Browse Source

Class renaming for clarity

combat-2
MagicBot 8 months ago
parent
commit
ded3e16d48
  1. 2
      src/engine/net/client/ClientConnection.java
  2. 4
      src/engine/net/client/Protocol.java
  3. 20
      src/engine/net/client/handlers/VendorBuyMsgHandler.java
  4. 26
      src/engine/net/client/handlers/VendorSellMsgHandler.java
  5. 6
      src/engine/net/client/msg/VendorBuyMsg.java
  6. 10
      src/engine/net/client/msg/VendorSellMsg.java

2
src/engine/net/client/ClientConnection.java

@ -278,7 +278,7 @@ public class ClientConnection extends AbstractConnection {
// case ClientOpcodes.ToggleSitStand: // case ClientOpcodes.ToggleSitStand:
// case ClientOpcodes.SocialChannel: // case ClientOpcodes.SocialChannel:
// case ClientOpcodes.OpenFriendsCondemnList: // case ClientOpcodes.OpenFriendsCondemnList:
case SELLOBJECT: case SELLTONPC:
this.setLastMsgTime(); this.setLastMsgTime();
break; break;
case MOVETOPOINT: case MOVETOPOINT:

4
src/engine/net/client/Protocol.java

@ -54,7 +54,7 @@ public enum Protocol {
BANISHMEMBER(0x31AA3368, BanishUnbanishMsg.class, BanishUnbanishHandler.class), // Banish/Unbanish BANISHMEMBER(0x31AA3368, BanishUnbanishMsg.class, BanishUnbanishHandler.class), // Banish/Unbanish
BANKINVENTORY(0x32F3F503, ShowBankInventoryMsg.class, null), // ShowCombatInfo Bank Inventory BANKINVENTORY(0x32F3F503, ShowBankInventoryMsg.class, null), // ShowCombatInfo Bank Inventory
BREAKFEALTY(0x479A4C19, BreakFealtyMsg.class, BreakFealtyHandler.class), BREAKFEALTY(0x479A4C19, BreakFealtyMsg.class, BreakFealtyHandler.class),
BUYFROMNPC(0xA2B8DFA5, BuyFromNPCMsg.class, BuyFromNPCMsgHandler.class), // Buy Item From NPC BUYFROMNPC(0xA2B8DFA5, VendorBuyMsg.class, VendorBuyMsgHandler.class), // Buy Item From NPC
CANCELGUILDCREATION(0x385EA922, GuildCreationCloseMsg.class, GuildCreationCloseHandler.class), //Close the window CANCELGUILDCREATION(0x385EA922, GuildCreationCloseMsg.class, GuildCreationCloseHandler.class), //Close the window
CHANGEALTITUDE(0x624F08BA, ChangeAltitudeMsg.class, ChangeAltitudeHandler.class), //Change Altitude CHANGEALTITUDE(0x624F08BA, ChangeAltitudeMsg.class, ChangeAltitudeHandler.class), //Change Altitude
CHANGEGUILDLEADER(0xE40BC95D, ChangeGuildLeaderMsg.class, ChangeGuildLeaderHandler.class), CHANGEGUILDLEADER(0xE40BC95D, ChangeGuildLeaderMsg.class, ChangeGuildLeaderHandler.class),
@ -187,7 +187,7 @@ public enum Protocol {
SELECTCHAR(0x7E6A9338, GameServerIPRequestMsg.class, null), // Game Server IP Request SELECTCHAR(0x7E6A9338, GameServerIPRequestMsg.class, null), // Game Server IP Request
SELECTCITY(0x7E6BE630, null, null), SELECTCITY(0x7E6BE630, null, null),
SELECTSERVER(0x440D28B7, ServerInfoMsg.class, null), // Server Info Request/Response SELECTSERVER(0x440D28B7, ServerInfoMsg.class, null), // Server Info Request/Response
SELLOBJECT(0x57111C67, SellToNPCMsg.class, SellToNPCMsgHandler.class), //Sell to NPC SELLTONPC(0x57111C67, VendorSellMsg.class, VendorSellMsgHandler.class), //Sell to NPC
SENDCITYENTRY(0xBC3B5E72, null, null), //Send Teleport/Repledge List SENDCITYENTRY(0xBC3B5E72, null, null), //Send Teleport/Repledge List
SENDGUILDENTRY(0x6D5EF164, null, null), SENDGUILDENTRY(0x6D5EF164, null, null),
SENDMEMBERENTRY(0x6949C720, GuildListMsg.class, GuildListHandler.class), // ShowCombatInfo guild members list, I think SENDMEMBERENTRY(0x6949C720, GuildListMsg.class, GuildListHandler.class), // ShowCombatInfo guild members list, I think

20
src/engine/net/client/handlers/BuyFromNPCMsgHandler.java → src/engine/net/client/handlers/VendorBuyMsgHandler.java

@ -13,18 +13,18 @@ import engine.exception.MsgSendException;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.BuyFromNPCMsg;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.VendorBuyMsg;
import engine.objects.*; import engine.objects.*;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler { public class VendorBuyMsgHandler extends AbstractClientMsgHandler {
public BuyFromNPCMsgHandler() { public VendorBuyMsgHandler() {
super(BuyFromNPCMsg.class); super(VendorBuyMsg.class);
} }
public static Item createItemForPlayer(PlayerCharacter pc, int templateID) { public static Item createItemForPlayer(PlayerCharacter pc, int templateID) {
@ -47,11 +47,11 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
// Member variable declaration // Member variable declaration
BuyFromNPCMsg buyFromNPCMsg; VendorBuyMsg vendorBuyMsg;
// Member variable assignment // Member variable assignment
buyFromNPCMsg = (BuyFromNPCMsg) baseMsg; vendorBuyMsg = (VendorBuyMsg) baseMsg;
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin); PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
Item vendorItem; Item vendorItem;
@ -66,7 +66,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
if (itemMan == null) if (itemMan == null)
return true; return true;
NPC npc = NPC.getFromCache(buyFromNPCMsg.getNPCID()); NPC npc = NPC.getFromCache(vendorBuyMsg.getNPCID());
if (npc == null) if (npc == null)
return true; return true;
@ -81,10 +81,10 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
if (sellInventory == null) if (sellInventory == null)
return true; return true;
if (buyFromNPCMsg.getItemID() < 0) { if (vendorBuyMsg.getItemID() < 0) {
for (Item me : sellInventory) { for (Item me : sellInventory) {
if (me.objectUUID == buyFromNPCMsg.getItemID()) { if (me.objectUUID == vendorBuyMsg.getItemID()) {
//test room available for item //test room available for item
if (!itemMan.hasRoomInventory(me.template.item_wt)) if (!itemMan.hasRoomInventory(me.template.item_wt))
@ -142,7 +142,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
if (npcCim == null) if (npcCim == null)
return true; return true;
vendorItem = Item.getFromCache(buyFromNPCMsg.getItemID()); vendorItem = Item.getFromCache(vendorBuyMsg.getItemID());
if (vendorItem == null) if (vendorItem == null)
return true; return true;

26
src/engine/net/client/handlers/SellToNPCMsgHandler.java → src/engine/net/client/handlers/VendorSellMsgHandler.java

@ -17,16 +17,16 @@ import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.SellToNPCMsg;
import engine.net.client.msg.UpdateGoldMsg; import engine.net.client.msg.UpdateGoldMsg;
import engine.net.client.msg.VendorSellMsg;
import engine.objects.*; import engine.objects.*;
import java.util.ArrayList; import java.util.ArrayList;
public class SellToNPCMsgHandler extends AbstractClientMsgHandler { public class VendorSellMsgHandler extends AbstractClientMsgHandler {
public SellToNPCMsgHandler() { public VendorSellMsgHandler() {
super(SellToNPCMsg.class); super(VendorSellMsg.class);
} }
@Override @Override
@ -44,9 +44,9 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
if (itemMan == null) if (itemMan == null)
return true; return true;
SellToNPCMsg sellToNPCMsg = (SellToNPCMsg) baseMsg; VendorSellMsg vendorSellMsg = (VendorSellMsg) baseMsg;
NPC npc = NPC.getFromCache(sellToNPCMsg.getNPCID()); NPC npc = NPC.getFromCache(vendorSellMsg.getNPCID());
if (npc == null) if (npc == null)
return true; return true;
@ -81,10 +81,10 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
// Early exit sanity check // Early exit sanity check
if (sellToNPCMsg.getItemType() == Enum.GameObjectType.Item.ordinal() == false) if (vendorSellMsg.getItemType() == Enum.GameObjectType.Item.ordinal() == false)
return true; return true;
sell = Item.getFromCache(sellToNPCMsg.getItemID()); sell = Item.getFromCache(vendorSellMsg.getItemID());
if (sell == null) if (sell == null)
return true; return true;
@ -183,11 +183,11 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
//send the sell message back to update player //send the sell message back to update player
sellToNPCMsg.setItemType(sell.getObjectType().ordinal()); vendorSellMsg.setItemType(sell.getObjectType().ordinal());
sellToNPCMsg.setItemID(sell.getObjectUUID()); vendorSellMsg.setItemID(sell.getObjectUUID());
sellToNPCMsg.setUnknown01(cost); //not sure if this is correct vendorSellMsg.setUnknown01(cost); //not sure if this is correct
dispatch = Dispatch.borrow(player, sellToNPCMsg); dispatch = Dispatch.borrow(player, vendorSellMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
} finally { } finally {
@ -199,7 +199,7 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
// Send ping to client // Send ping to client
dispatch = Dispatch.borrow(pc, sellToNPCMsg); dispatch = Dispatch.borrow(pc, vendorSellMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
return true; return true;

6
src/engine/net/client/msg/BuyFromNPCMsg.java → src/engine/net/client/msg/VendorBuyMsg.java

@ -17,7 +17,7 @@ import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.Item; import engine.objects.Item;
public class BuyFromNPCMsg extends ClientNetMsg { public class VendorBuyMsg extends ClientNetMsg {
private int npcType; private int npcType;
private int npcID; private int npcID;
@ -29,7 +29,7 @@ public class BuyFromNPCMsg extends ClientNetMsg {
/** /**
* This is the general purpose constructor * This is the general purpose constructor
*/ */
public BuyFromNPCMsg() { public VendorBuyMsg() {
super(Protocol.BUYFROMNPC); super(Protocol.BUYFROMNPC);
} }
@ -39,7 +39,7 @@ public class BuyFromNPCMsg extends ClientNetMsg {
* past the limit) then this constructor Throws that Exception to the * past the limit) then this constructor Throws that Exception to the
* caller. * caller.
*/ */
public BuyFromNPCMsg(AbstractConnection origin, ByteBufferReader reader) { public VendorBuyMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.BUYFROMNPC, origin, reader); super(Protocol.BUYFROMNPC, origin, reader);
} }

10
src/engine/net/client/msg/SellToNPCMsg.java → src/engine/net/client/msg/VendorSellMsg.java

@ -21,7 +21,7 @@ import engine.net.client.Protocol;
* *
* @author Eighty * @author Eighty
*/ */
public class SellToNPCMsg extends ClientNetMsg { public class VendorSellMsg extends ClientNetMsg {
int npcType; int npcType;
int npcID; int npcID;
@ -32,8 +32,8 @@ public class SellToNPCMsg extends ClientNetMsg {
/** /**
* This is the general purpose constructor * This is the general purpose constructor
*/ */
public SellToNPCMsg() { public VendorSellMsg() {
super(Protocol.SELLOBJECT); super(Protocol.SELLTONPC);
} }
/** /**
@ -42,8 +42,8 @@ public class SellToNPCMsg extends ClientNetMsg {
* past the limit) then this constructor Throws that Exception to the * past the limit) then this constructor Throws that Exception to the
* caller. * caller.
*/ */
public SellToNPCMsg(AbstractConnection origin, ByteBufferReader reader) { public VendorSellMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.SELLOBJECT, origin, reader); super(Protocol.SELLTONPC, origin, reader);
} }
/** /**
Loading…
Cancel
Save