summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-16 23:35:37 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-16 23:35:37 +0300
commitead2b06e3496b0cbe3a4a4c33a55c8262f02b73f (patch)
tree1017b9434f0bf905423f22b39fc683075040ac83 /src/net
parent37eb9896130e6606c93166d29c595480e02a785b (diff)
downloadplus-ead2b06e3496b0cbe3a4a4c33a55c8262f02b73f.tar.gz
plus-ead2b06e3496b0cbe3a4a4c33a55c8262f02b73f.tar.bz2
plus-ead2b06e3496b0cbe3a4a4c33a55c8262f02b73f.tar.xz
plus-ead2b06e3496b0cbe3a4a4c33a55c8262f02b73f.zip
In all places try get item color from ItemColorManager.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/auctionhandler.cpp1
-rw-r--r--src/net/eathena/beinghandler.cpp8
-rw-r--r--src/net/eathena/beinghandler.h2
-rw-r--r--src/net/eathena/inventoryhandler.cpp27
-rw-r--r--src/net/eathena/itemhandler.cpp5
-rw-r--r--src/net/eathena/partyhandler.cpp1
-rw-r--r--src/net/eathena/searchstorehandler.cpp2
-rw-r--r--src/net/eathena/tradehandler.cpp3
-rw-r--r--src/net/eathena/vendinghandler.cpp6
9 files changed, 34 insertions, 21 deletions
diff --git a/src/net/eathena/auctionhandler.cpp b/src/net/eathena/auctionhandler.cpp
index 7522ec491..f75efd2ea 100644
--- a/src/net/eathena/auctionhandler.cpp
+++ b/src/net/eathena/auctionhandler.cpp
@@ -108,6 +108,7 @@ void AuctionHandler::processAuctionResults(Net::MessageIn &msg)
msg.readInt32("buy now");
msg.readString(24, "buyer name");
msg.readInt32("timestamp");
+ // +++ need use ItemColorManager for color
}
}
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 5c748915b..5c531e16a 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -25,6 +25,7 @@
#include "actormanager.h"
#include "effectmanager.h"
#include "game.h"
+#include "itemcolormanager.h"
#include "notifymanager.h"
#include "party.h"
@@ -525,7 +526,7 @@ void BeingHandler::processBeingChangeLook2(Net::MessageIn &msg)
void BeingHandler::processBeingChangeLookCards(Net::MessageIn &msg)
{
Being *dstBeing = nullptr;
- uint16_t cards[4];
+ int cards[4];
if (!actorManager)
{ // here can be look from char server
@@ -571,12 +572,13 @@ void BeingHandler::processBeingChangeLookContinue(Net::MessageIn &msg,
const uint8_t type,
const int id,
const int id2,
- const uint16_t *cards
+ const int *cards
A_UNUSED)
{
if (dstBeing->getType() == ActorType::Player)
dstBeing->setOtherTime();
+ const ItemColor itemColor = ItemColorManager::getColorFromCards(cards);
const std::string color;
switch (type)
{
@@ -589,7 +591,7 @@ void BeingHandler::processBeingChangeLookContinue(Net::MessageIn &msg,
dstBeing->setSpriteID(SPRITE_HAIR_COLOR, id * -1);
break;
case 2: // LOOK_WEAPON Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(SPRITE_BODY, id, "", ItemColor_one, true);
+ dstBeing->setSprite(SPRITE_BODY, id, "", itemColor, true);
dstBeing->setSprite(SPRITE_FLOOR, id2);
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h
index bc77924b9..7dda4f2cb 100644
--- a/src/net/eathena/beinghandler.h
+++ b/src/net/eathena/beinghandler.h
@@ -89,7 +89,7 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
const uint8_t type,
const int id,
const int id2,
- const uint16_t *cards)
+ const int *cards)
A_NONNULL(2);
static void processBeingSpecialEffect(Net::MessageIn &msg);
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index c2b01be22..30ec030cc 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -23,6 +23,7 @@
#include "net/eathena/inventoryhandler.h"
#include "notifymanager.h"
+#include "itemcolormanager.h"
#include "being/localplayer.h"
@@ -463,7 +464,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
itemType,
1,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -505,6 +506,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
msg.readInt32("hire expire date");
msg.readInt16("bind on equip");
+ const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
const ItemInfo &itemInfo = ItemDB::get(itemId);
BeingId floorId;
if (mSentPickups.empty())
@@ -549,7 +551,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
{
localPlayer->pickedUp(itemInfo,
0,
- ItemColor_one,
+ color,
floorId,
pickup);
}
@@ -560,7 +562,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
{
localPlayer->pickedUp(itemInfo,
amount,
- ItemColor_one,
+ color,
floorId,
Pickup::OKAY);
}
@@ -577,7 +579,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
itemType,
amount,
refine,
- ItemColor_one,
+ color,
fromBool(identified, Identified),
fromBool(damaged, Damaged),
Favorite_false,
@@ -630,7 +632,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
itemType,
amount,
0,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -672,7 +674,7 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
cards,
amount,
0,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -778,7 +780,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
cards,
amount,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -802,9 +804,10 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
+ const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
if (Item *const item = mStorage->getItem(index))
{
- item->setId(itemId, ItemColor_one);
+ item->setId(itemId, color);
item->increaseQuantity(amount);
}
else
@@ -816,7 +819,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
itemType,
amount,
refine,
- ItemColor_one,
+ color,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -1000,7 +1003,7 @@ void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg)
itemType,
amount,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -1040,7 +1043,7 @@ void InventoryHandler::processPlayerCartEquip(Net::MessageIn &msg)
cards,
amount,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -1077,7 +1080,7 @@ void InventoryHandler::processPlayerCartItems(Net::MessageIn &msg)
cards,
amount,
0,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
diff --git a/src/net/eathena/itemhandler.cpp b/src/net/eathena/itemhandler.cpp
index 909d6d312..6bb541649 100644
--- a/src/net/eathena/itemhandler.cpp
+++ b/src/net/eathena/itemhandler.cpp
@@ -23,6 +23,7 @@
#include "net/eathena/itemhandler.h"
#include "actormanager.h"
+#include "itemcolormanager.h"
#include "logger.h"
#include "net/eathena/protocol.h"
@@ -141,7 +142,7 @@ void ItemHandler::processItemDropped2(Net::MessageIn &msg)
itemType,
amount,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
identified,
subX, subY,
&cards[0]);
@@ -226,7 +227,7 @@ void ItemHandler::processItemVisible2(Net::MessageIn &msg)
itemType,
amount,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
identified,
subX, subY,
&cards[0]);
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index bbc2d0b48..15c1c4940 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -479,6 +479,7 @@ void PartyHandler::processPartyItemPickup(Net::MessageIn &msg)
msg.readInt16("card");
msg.readInt16("equip location");
msg.readUInt8("item type");
+ // for color can be used ItemColorManager
}
void PartyHandler::processPartyLeader(Net::MessageIn &msg)
diff --git a/src/net/eathena/searchstorehandler.cpp b/src/net/eathena/searchstorehandler.cpp
index c133ed184..6151a161c 100644
--- a/src/net/eathena/searchstorehandler.cpp
+++ b/src/net/eathena/searchstorehandler.cpp
@@ -129,6 +129,8 @@ void SearchStoreHandler::processSearchAck(Net::MessageIn &msg)
msg.readUInt8("refine");
for (int d = 0; d < 4; d++)
msg.readInt16("card");
+
+ // +++ need use ItemColorManager for colors
}
}
diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index a76a08130..bc416cff6 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -24,6 +24,7 @@
#include "inventory.h"
#include "item.h"
+#include "itemcolormanager.h"
#include "notifymanager.h"
#include "being/playerinfo.h"
@@ -206,7 +207,7 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
false,
amount,
refine,
- ItemColor_one,
+ ItemColorManager::getColorFromCards(&cards[0]),
fromBool(identify, Identified),
Damaged_false,
Favorite_false,
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp
index 584aa1f23..1db5cd5fc 100644
--- a/src/net/eathena/vendinghandler.cpp
+++ b/src/net/eathena/vendinghandler.cpp
@@ -21,6 +21,7 @@
#include "net/eathena/vendinghandler.h"
#include "actormanager.h"
+#include "itemcolormanager.h"
#include "shopitem.h"
#include "being/localplayer.h"
@@ -142,6 +143,7 @@ void VendingHandler::processItemsList(Net::MessageIn &msg)
Being *const being = actorManager->findBeing(id);
if (!being)
return;
+ int cards[4];
CREATEWIDGETV(mBuyDialog, BuyDialog, being->getName());
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
msg.readInt32("vender id");
@@ -156,9 +158,9 @@ void VendingHandler::processItemsList(Net::MessageIn &msg)
msg.readUInt8("attribute");
msg.readUInt8("refine");
for (int d = 0; d < 4; d ++)
- msg.readInt16("card");
+ cards[d] = msg.readInt16("card");
- const ItemColor color = ItemColor_one;
+ const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
ShopItem *const item = mBuyDialog->addItem(itemId, type,
color, amount, value);
if (item)