Class renaming for clarity
This commit is contained in:
+10
-10
@@ -13,18 +13,18 @@ import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.BuyFromNPCMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.VendorBuyMsg;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
public class VendorBuyMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public BuyFromNPCMsgHandler() {
|
||||
super(BuyFromNPCMsg.class);
|
||||
public VendorBuyMsgHandler() {
|
||||
super(VendorBuyMsg.class);
|
||||
}
|
||||
|
||||
public static Item createItemForPlayer(PlayerCharacter pc, int templateID) {
|
||||
@@ -47,11 +47,11 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
BuyFromNPCMsg buyFromNPCMsg;
|
||||
VendorBuyMsg vendorBuyMsg;
|
||||
|
||||
// Member variable assignment
|
||||
|
||||
buyFromNPCMsg = (BuyFromNPCMsg) baseMsg;
|
||||
vendorBuyMsg = (VendorBuyMsg) baseMsg;
|
||||
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
||||
Item vendorItem;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (itemMan == null)
|
||||
return true;
|
||||
|
||||
NPC npc = NPC.getFromCache(buyFromNPCMsg.getNPCID());
|
||||
NPC npc = NPC.getFromCache(vendorBuyMsg.getNPCID());
|
||||
|
||||
if (npc == null)
|
||||
return true;
|
||||
@@ -81,10 +81,10 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (sellInventory == null)
|
||||
return true;
|
||||
|
||||
if (buyFromNPCMsg.getItemID() < 0) {
|
||||
if (vendorBuyMsg.getItemID() < 0) {
|
||||
for (Item me : sellInventory) {
|
||||
|
||||
if (me.objectUUID == buyFromNPCMsg.getItemID()) {
|
||||
if (me.objectUUID == vendorBuyMsg.getItemID()) {
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(me.template.item_wt))
|
||||
@@ -142,7 +142,7 @@ public class BuyFromNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (npcCim == null)
|
||||
return true;
|
||||
|
||||
vendorItem = Item.getFromCache(buyFromNPCMsg.getItemID());
|
||||
vendorItem = Item.getFromCache(vendorBuyMsg.getItemID());
|
||||
|
||||
if (vendorItem == null)
|
||||
return true;
|
||||
+13
-13
@@ -17,16 +17,16 @@ import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.SellToNPCMsg;
|
||||
import engine.net.client.msg.UpdateGoldMsg;
|
||||
import engine.net.client.msg.VendorSellMsg;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
public class VendorSellMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public SellToNPCMsgHandler() {
|
||||
super(SellToNPCMsg.class);
|
||||
public VendorSellMsgHandler() {
|
||||
super(VendorSellMsg.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,9 +44,9 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (itemMan == null)
|
||||
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)
|
||||
return true;
|
||||
@@ -81,10 +81,10 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Early exit sanity check
|
||||
|
||||
if (sellToNPCMsg.getItemType() == Enum.GameObjectType.Item.ordinal() == false)
|
||||
if (vendorSellMsg.getItemType() == Enum.GameObjectType.Item.ordinal() == false)
|
||||
return true;
|
||||
|
||||
sell = Item.getFromCache(sellToNPCMsg.getItemID());
|
||||
sell = Item.getFromCache(vendorSellMsg.getItemID());
|
||||
|
||||
if (sell == null)
|
||||
return true;
|
||||
@@ -183,11 +183,11 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
//send the sell message back to update player
|
||||
sellToNPCMsg.setItemType(sell.getObjectType().ordinal());
|
||||
sellToNPCMsg.setItemID(sell.getObjectUUID());
|
||||
sellToNPCMsg.setUnknown01(cost); //not sure if this is correct
|
||||
vendorSellMsg.setItemType(sell.getObjectType().ordinal());
|
||||
vendorSellMsg.setItemID(sell.getObjectUUID());
|
||||
vendorSellMsg.setUnknown01(cost); //not sure if this is correct
|
||||
|
||||
dispatch = Dispatch.borrow(player, sellToNPCMsg);
|
||||
dispatch = Dispatch.borrow(player, vendorSellMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
} finally {
|
||||
@@ -199,7 +199,7 @@ public class SellToNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Send ping to client
|
||||
|
||||
dispatch = Dispatch.borrow(pc, sellToNPCMsg);
|
||||
dispatch = Dispatch.borrow(pc, vendorSellMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
return true;
|
||||
Reference in New Issue
Block a user