mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-04 08:39:05 +00:00
Plugins System (#510)
* Started Ripping Plugin System From Astraeus
*Currently only ClickingButtons Support
*Also Started Using The Logout Button Plugin From Astraeus
* NpcFirstClickEvent setup for plugins
also made Man & Women chat work through this
* Server: Add Google Collect Lib
* Server: NpcSecondClickEvent setup for plugins
also handle pickpocketing npc clicking through plugin
* Server: NpcThirdClickEvent setup for plugins
* Server: Remove conflicting action for Secondclicking npc id 3
* Server: ItemFirstClickEvent setup for plugins
Also Handle Yo-Yo First Click Through This
* Server: ItemOnItemEvent setup for plugins
Also Handle Black Candle Lighting With Tinderbox Through this
* Server: ItemOnNpcEvent setup for plugins
* Server: ItemOnObjectEvent setup for plugins
Also Handle Fillable Items Through This
* Server: ItemSecondClickEvent & ItemThirdClickEvent setup for plugins
Also Handle Yo-Yo Actions Through This
* Server: ObjectFirstClickEvent setup for plugins
Also Handle FirstClick Mining Actions Through This
* Server: ObjectSecondClickEvent setup for plugins
Also Handle Stall Thieving Actions Through This
* Server: ObjectThirdClickEvent setup for plugins
* Server: ObjectFourthClickEvent setup for plugins
Also Handle Fourth Click Farming Object Actions Through This
* Server: MagicOnItemEvent setup for plugins
Also Handle SuperHeat Through This
* More mage training arena (#509)
* Fixup points display
* Only allow players to deposit up to 12k at one time
* Apple damage and play animation
* Update order or prices
* Update Telekinetic.java
(cherry picked from commit ab3b1e9731)
Co-authored-by: RedSparr0w <RedSparr0w@users.noreply.github.com>
Co-authored-by: Danial <admin@redsparr0w.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.rs2.game.items;
|
||||
|
||||
import com.rs2.event.impl.ItemOnItemEvent;
|
||||
import com.rs2.GameConstants;
|
||||
import com.rs2.game.content.skills.cooking.Cooking;
|
||||
import com.rs2.game.content.skills.crafting.BattleStaffs;
|
||||
@@ -121,6 +122,8 @@ public class UseItem {
|
||||
}
|
||||
|
||||
public static void itemOnItem(Player player, int itemUsed, int useWith) {
|
||||
player.post(new ItemOnItemEvent(itemUsed, useWith));
|
||||
player.post(new ItemOnItemEvent(useWith, itemUsed));
|
||||
LogCuttingInterface.handleItemOnItem(player, itemUsed, useWith);
|
||||
ArrowMaking.makeArrow(player, itemUsed, useWith);
|
||||
Stringing.StringBow(player, itemUsed, useWith);
|
||||
@@ -218,11 +221,11 @@ public class UseItem {
|
||||
player.getItemAssistant().deleteItem(327, 1);
|
||||
player.getItemAssistant().addItem(1552, 1);
|
||||
}
|
||||
if (itemUsed == 38 && useWith == 590 || useWith == 38
|
||||
/*f (itemUsed == 38 && useWith == 590 || useWith == 38
|
||||
&& itemUsed == 590) {//
|
||||
player.getItemAssistant().addItem(32, 1);
|
||||
player.getItemAssistant().deleteItem(38, 1);
|
||||
}
|
||||
}*/
|
||||
if (itemUsed == 36 && useWith == 590 || useWith == 36
|
||||
&& itemUsed == 590) {
|
||||
player.getItemAssistant().addItem(33, 1);
|
||||
|
||||
@@ -40,20 +40,6 @@ public class NpcActions {
|
||||
}
|
||||
}
|
||||
switch (npcType) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6: //1-3 Man, 4-6 Woman - We are playing random dialogues here
|
||||
if (Misc.random(10) <= 5)
|
||||
{
|
||||
player.getDialogueHandler().sendDialogues(3869, npcType);
|
||||
}
|
||||
else {
|
||||
player.getDialogueHandler().sendDialogues(3872, npcType);
|
||||
}
|
||||
break;
|
||||
case 389 : //thormac
|
||||
player.getDialogueHandler().sendDialogues(3574, npcType);
|
||||
break;
|
||||
@@ -1064,10 +1050,6 @@ public class NpcActions {
|
||||
player.rememberNpcIndex = player.npcClickIndex;
|
||||
player.npcClickIndex = 0;
|
||||
Shops.openShop(player, npcType);
|
||||
if (Pickpocket.isNPC(player, npcType)) {
|
||||
Pickpocket.attemptPickpocket(player, npcType);
|
||||
return;
|
||||
}
|
||||
if (Fishing.fishingNPC(player, npcType)) {
|
||||
Fishing.fishingNPC(player, 2, npcType);
|
||||
}
|
||||
@@ -1083,13 +1065,9 @@ public class NpcActions {
|
||||
player.getFarmingTools().loadInterfaces();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
player.getDialogueHandler().sendDialogues(5, npcType);
|
||||
break;
|
||||
|
||||
case 209:
|
||||
/*case 209:
|
||||
player.getShopAssistant().openShop(144);
|
||||
break;
|
||||
break;*/
|
||||
|
||||
|
||||
case 2437:
|
||||
|
||||
@@ -115,10 +115,7 @@ public class ObjectsActions {
|
||||
PassDoor.processDoor(player, objectType);
|
||||
AbyssalHandler.handleAbyssalTeleport(player, objectType);
|
||||
OpenObject.interactObject(player, objectType);
|
||||
// if its a rock we can mine, mine it
|
||||
if (Mining.rockExists(objectType))
|
||||
player.getMining().startMining(player, objectType, player.objectX, player.objectY, player.clickObjectType);
|
||||
if (Stalls.isObject(objectType)) {
|
||||
if (Stalls.isObject(objectType)) {
|
||||
Stalls.attemptStall(player, objectType, objectX, objectY);
|
||||
return;
|
||||
}
|
||||
@@ -2775,10 +2772,6 @@ public class ObjectsActions {
|
||||
if (!Region.objectExists(objectType, obX, obY, player.heightLevel)) {
|
||||
return;
|
||||
}
|
||||
if (Stalls.isObject(objectType)) {
|
||||
Stalls.attemptStall(player, objectType, obX, obY);
|
||||
return;
|
||||
}
|
||||
if (Farming.inspectObject(player, obX, obY)) {
|
||||
return;
|
||||
}
|
||||
@@ -3052,10 +3045,6 @@ public class ObjectsActions {
|
||||
if (!Region.objectExists(objectType, obX, obY, player.heightLevel)) {
|
||||
return;
|
||||
}
|
||||
if (Stalls.isObject(objectType)) {
|
||||
Stalls.attemptStall(player, objectType, obX, obY);
|
||||
return;
|
||||
}
|
||||
OpenObject.interactObject(player, objectType);
|
||||
switch (objectType) {
|
||||
case 6:
|
||||
@@ -3073,9 +3062,6 @@ public class ObjectsActions {
|
||||
Climbing.climbDown(player);
|
||||
}
|
||||
break;
|
||||
case 10177:
|
||||
player.getPlayerAssistant().movePlayer(1798, 4407, 3);
|
||||
break;
|
||||
case 11890:
|
||||
Climbing.handleClimbing(player);
|
||||
break;
|
||||
@@ -3098,6 +3084,5 @@ public class ObjectsActions {
|
||||
if (!Region.objectExists(objectType, obX, obY, player.heightLevel)) {
|
||||
return;
|
||||
}
|
||||
Farming.guide(player, obX, obY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,11 @@ import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
import com.everythingrs.hiscores.Hiscores;
|
||||
import com.rs2.event.*;
|
||||
import com.rs2.plugin.PluginService;
|
||||
import org.apache.mina.common.IoSession;
|
||||
import com.rs2.GameConstants;
|
||||
import com.rs2.GameEngine;
|
||||
import com.rs2.event.CycleEvent;
|
||||
import com.rs2.event.CycleEventContainer;
|
||||
import com.rs2.event.CycleEventHandler;
|
||||
import com.rs2.game.content.BankPin;
|
||||
import com.rs2.game.content.EmoteHandler;
|
||||
import com.rs2.game.content.combat.CombatAssistant;
|
||||
@@ -166,7 +165,7 @@ public abstract class Player {
|
||||
private SingleGates singleGates = new SingleGates();
|
||||
private DoubleGates doubleGates = new DoubleGates();
|
||||
public int lastMainFrameInterface = -1; //Possibly used in future to prevent packet exploits
|
||||
|
||||
|
||||
public boolean isPreaching() {
|
||||
return preaching;
|
||||
}
|
||||
@@ -742,6 +741,68 @@ public abstract class Player {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This worlds event provider.
|
||||
*/
|
||||
private static final UniversalEventProvider eventProvider = new UniversalEventProvider();
|
||||
|
||||
/**
|
||||
* The service for plugins.
|
||||
*/
|
||||
private static final PluginService pluginService = new PluginService();
|
||||
|
||||
/**
|
||||
* Posts an event to this worlds event provider.
|
||||
*
|
||||
* @param player
|
||||
* The player to post the event for.
|
||||
* @param event
|
||||
* The event to post.
|
||||
*/
|
||||
public <E extends Event> void post(Player player, E event) {
|
||||
eventProvider.post(player, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts an event to this world's event provider.
|
||||
*
|
||||
* @param event
|
||||
* The event to post.
|
||||
*/
|
||||
public <E extends Event> void post(E event) {
|
||||
post(this, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an event subscriber to this worlds event provider.
|
||||
*
|
||||
* @param subscriber
|
||||
* The event subscriber.
|
||||
*/
|
||||
public static <E extends Event> void provideSubscriber(EventSubscriber<E> subscriber) {
|
||||
eventProvider.provideSubscriber(subscriber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprives an event subscriber to this worlds event provider.
|
||||
*
|
||||
* @param subscriber
|
||||
* The event subscriber.
|
||||
*/
|
||||
public <E extends Event> void depriveSubscriber(EventSubscriber<E> subscriber) {
|
||||
eventProvider.depriveSubscriber(subscriber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service for plugins.
|
||||
*/
|
||||
public static PluginService getPluginService() {
|
||||
return pluginService;
|
||||
}
|
||||
|
||||
public UniversalEventProvider getSubscribers() {
|
||||
return eventProvider;
|
||||
}
|
||||
|
||||
public int packetSize = 0, packetType = -1;
|
||||
public boolean wildernessWarning;
|
||||
|
||||
@@ -1227,12 +1227,6 @@ public class PlayerAssistant {
|
||||
}
|
||||
break;
|
||||
|
||||
case 1173:
|
||||
if (!Superheat.superHeatItem(player, itemId)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1155: // Lvl-1 enchant sapphire
|
||||
case 1165: // Lvl-2 enchant emerald
|
||||
case 1176: // Lvl-3 enchant ruby
|
||||
|
||||
Reference in New Issue
Block a user