Plugins Fixup / Conversion(#511)

* Server: Ripped PluginService From Astreaus-V2

This Removes The Need For Plugin MetaData

* Plugins: Handle Emote Tab Run Buttons

* Add Some Settings Button Plugins

Brightness Buttons
Music Volume Buttons
Walk/Run Buttons
Toggle SplitPrivate-Chat

* Fix Player Still Running With 0 Energy

Fixes Players Continuing To Run For The Rest Of Their Current Movement Task Even If They Run Out Of Energy
This commit is contained in:
Josh Shippam
2021-10-26 04:47:33 +01:00
committed by GitHub
parent 7d64e2298f
commit c2f325b4e7
14 changed files with 163 additions and 333 deletions
@@ -0,0 +1,25 @@
package plugin.buttons.gameframe
import com.rs2.event.SubscribesTo
import com.rs2.event.impl.ButtonActionEvent
import com.rs2.game.items.impl.LightSources
import com.rs2.game.players.Player
import plugin.buttons.ButtonClick
@SubscribesTo(ButtonActionEvent::class)
class BrightnessButtons : ButtonClick() {
override fun execute(player: Player, event: ButtonActionEvent) {
when (event.button) {
3138 -> LightSources.brightness1(player)
3140 -> LightSources.brightness2(player)
3142 -> LightSources.brightness3(player)
3144 -> LightSources.brightness4(player)
}
}
override fun test(event: ButtonActionEvent): Boolean {
return event.button == 3138 || event.button == 3140 || event.button == 3142 || event.button == 912
}
}
@@ -14,7 +14,7 @@ class LogoutButton : ButtonClick() {
}
override fun test(event: ButtonActionEvent): Boolean {
return event.button == 9154;
return event.button == 9154
}
}
@@ -0,0 +1,32 @@
package plugin.buttons.gameframe
import com.rs2.event.SubscribesTo
import com.rs2.event.impl.ButtonActionEvent
import com.rs2.game.content.music.Music
import com.rs2.game.players.Player
import plugin.buttons.ButtonClick
@SubscribesTo(ButtonActionEvent::class)
class MusicVolumeButtons : ButtonClick() {
override fun execute(player: Player, event: ButtonActionEvent) {
when (event.button) {
3162 -> {
if (player.musicOn) {
player.musicOn = false
} else {
player.packetSender.sendMessage("Your music is already turned off.")
}
}
3163,3164,3165,3166 -> {
Music.playMusic(player)
player.musicOn = true
}
}
}
override fun test(event: ButtonActionEvent): Boolean {
return event.button == 3162 || event.button == 3163 || event.button == 3164 || event.button == 3165 || event.button == 3166
}
}
@@ -0,0 +1,34 @@
package plugin.buttons.gameframe
import com.rs2.event.SubscribesTo
import com.rs2.event.impl.ButtonActionEvent
import com.rs2.game.players.Player
import plugin.buttons.ButtonClick
@SubscribesTo(ButtonActionEvent::class)
class ToggleRunButtons : ButtonClick() {
override fun execute(player: Player, event: ButtonActionEvent) {
when (event.button) {
152 -> {
player.packetSender.sendConfig(173, 0)
player.isRunning = false
player.isRunning2 = false
}
153 -> {
if (player.tutorialProgress == 11) {
player.dialogueHandler.sendDialogues(3041, 0)
}
player.packetSender.sendConfig(173, 1)
player.isRunning = true
player.isRunning2 = true
}
}
}
override fun test(event: ButtonActionEvent): Boolean {
return event.button == 152 || event.button == 153
}
}
@@ -0,0 +1,32 @@
package plugin.buttons.gameframe
import com.rs2.event.SubscribesTo
import com.rs2.event.impl.ButtonActionEvent
import com.rs2.game.players.Player
import plugin.buttons.ButtonClick
@SubscribesTo(ButtonActionEvent::class)
class ToggleSplitChatButtons : ButtonClick() {
override fun execute(player: Player, event: ButtonActionEvent) {
when (event.button) {
3189 -> {
player.packetSender.sendConfig(502, 1)
player.packetSender.sendConfig(287, 1)
player.splitChat = true
}
3190 -> {
player.packetSender.sendConfig(502, 0)
player.packetSender.sendConfig(287, 0)
player.splitChat = false
}
}
}
override fun test(event: ButtonActionEvent): Boolean {
return event.button == 3189 || event.button == 3190
}
}
@@ -1,12 +0,0 @@
[
{
"name": "Logout Button",
"description": "The button for logging a player out.",
"group": "button",
"base": "plugin.buttons.gameframe.LogoutButton",
"authors": [
"Vult-R"
],
"version": 1.0
}
]
@@ -1,62 +0,0 @@
[
{
"name": "Item First Click",
"description": "The plugin for handling the first option of an item.",
"group": "click",
"base": "plugin.click.item.ItemFirstClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Item Second Click",
"description": "The plugin for handling the second option of an item.",
"group": "click",
"base": "plugin.click.item.ItemSecondClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Item Third Click",
"description": "The plugin for handling the third option of an item.",
"group": "click",
"base": "plugin.click.item.ItemThirdClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Item On Item",
"description": "The plugin for handling using an item on another item.",
"group": "item",
"base": "plugin.click.item.ItemOnItem",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Item On Npc",
"description": "The plugin for handling using an item on an npc.",
"group": "item",
"base": "plugin.click.item.ItemOnNpc",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Item On Object",
"description": "The plugin for handling using an item on a game object.",
"group": "item",
"base": "plugin.click.item.ItemOnObject",
"authors": [
"Vult-R"
],
"version": 1.0
}
]
@@ -1,12 +0,0 @@
[
{
"name": "Magic On Item",
"description": "The plugin for handling using spells on items.",
"group": "magic",
"base": "plugin.click.magic.MagicOnItem",
"authors": [
"Vult-R"
],
"version": 1.0
}
]
@@ -1,32 +0,0 @@
[
{
"name": "Npc First Click",
"description": "The plugin for handling the first option of an npc.",
"group": "click",
"base": "plugin.click.npc.NpcFirstClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Npc Second Click",
"description": "The plugin for handling the second option of an npc.",
"group": "click",
"base": "plugin.click.npc.NpcSecondClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Npc Third Click",
"description": "The plugin for handling the third option of an npc.",
"group": "click",
"base": "plugin.click.npc.NpcThirdClick",
"authors": [
"Vult-R"
],
"version": 1.0
}
]
@@ -1,42 +0,0 @@
[
{
"name": "Object First Click",
"description": "The plugin for handling the first option of an object.",
"group": "click",
"base": "plugin.click.obj.ObjectFirstClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Object Second Click",
"description": "The plugin for handling the second option of an object.",
"group": "click",
"base": "plugin.click.obj.ObjectSecondClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Object Third Click",
"description": "The plugin for handling the third option of an object.",
"group": "click",
"base": "plugin.click.obj.ObjectThirdClick",
"authors": [
"Vult-R"
],
"version": 1.0
},
{
"name": "Object Fourth Click",
"description": "The plugin for handling the fourth option of an object.",
"group": "click",
"base": "plugin.click.obj.ObjectFourthClick",
"authors": [
"Vult-R"
],
"version": 1.0
}
]