summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/adminhandler.h4
-rw-r--r--src/net/cashshophandler.h4
-rw-r--r--src/net/ea/adminhandler.cpp5
-rw-r--r--src/net/ea/adminhandler.h3
-rw-r--r--src/net/ea/beinghandler.cpp2
-rw-r--r--src/net/ea/beinghandler.h2
-rw-r--r--src/net/ea/inventoryitem.h5
-rw-r--r--src/net/ea/itemhandler.cpp10
-rw-r--r--src/net/eathena/beinghandler.cpp50
-rw-r--r--src/net/eathena/buyingstorehandler.cpp4
-rw-r--r--src/net/eathena/buysellhandler.cpp2
-rw-r--r--src/net/eathena/cashshophandler.cpp4
-rw-r--r--src/net/eathena/cashshophandler.h2
-rw-r--r--src/net/eathena/charserverhandler.cpp6
-rw-r--r--src/net/eathena/inventoryhandler.cpp91
-rw-r--r--src/net/eathena/itemhandler.cpp10
-rw-r--r--src/net/eathena/markethandler.cpp4
-rw-r--r--src/net/eathena/markethandler.h2
-rw-r--r--src/net/eathena/npchandler.cpp2
-rw-r--r--src/net/eathena/npchandler.h2
-rw-r--r--src/net/eathena/tradehandler.cpp12
-rw-r--r--src/net/eathena/vendinghandler.cpp2
-rw-r--r--src/net/markethandler.h4
-rw-r--r--src/net/npchandler.h3
-rw-r--r--src/net/tmwa/beinghandler.cpp50
-rw-r--r--src/net/tmwa/buysellhandler.cpp2
-rw-r--r--src/net/tmwa/cashshophandler.cpp2
-rw-r--r--src/net/tmwa/cashshophandler.h2
-rw-r--r--src/net/tmwa/charserverhandler.cpp7
-rw-r--r--src/net/tmwa/inventoryhandler.cpp65
-rw-r--r--src/net/tmwa/itemhandler.cpp2
-rw-r--r--src/net/tmwa/markethandler.cpp2
-rw-r--r--src/net/tmwa/markethandler.h2
-rw-r--r--src/net/tmwa/npchandler.cpp2
-rw-r--r--src/net/tmwa/npchandler.h2
-rw-r--r--src/net/tmwa/tradehandler.cpp12
36 files changed, 251 insertions, 134 deletions
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 77f0508a8..328290ea8 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -24,6 +24,7 @@
#define NET_ADMINHANDLER_H
#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/itemcolor.h"
#include <string>
@@ -69,7 +70,8 @@ class AdminHandler notfinal
virtual void warp(const std::string &map,
const int x, const int y) const = 0;
- virtual void createItems(const int id, const int color,
+ virtual void createItems(const int id,
+ const ItemColor color,
const int amount) const = 0;
virtual void gotoName(const std::string &name) const = 0;
diff --git a/src/net/cashshophandler.h b/src/net/cashshophandler.h
index 64a04d8ed..1577aa543 100644
--- a/src/net/cashshophandler.h
+++ b/src/net/cashshophandler.h
@@ -23,6 +23,8 @@
#ifdef EATHENA_SUPPORT
+#include "enums/simpletypes/itemcolor.h"
+
#include <string>
#include "localconsts.h"
@@ -38,7 +40,7 @@ class CashShopHandler notfinal
virtual void buyItem(const int points,
const int itemId,
- const unsigned char color,
+ const ItemColor color,
const int amount) const = 0;
virtual void close() const = 0;
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index bf4bd590c..2cc98acb0 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -74,7 +74,8 @@ void AdminHandler::ipcheckName(const std::string &name) const
chatHandler->talk("@ipcheck " + name, GENERAL_CHANNEL);
}
-void AdminHandler::createItems(const int id, const int color,
+void AdminHandler::createItems(const int id,
+ const ItemColor color,
const int amount) const
{
if (!serverFeatures->haveItemColors())
@@ -85,7 +86,7 @@ void AdminHandler::createItems(const int id, const int color,
else
{
chatHandler->talk(strprintf("@item %d %d %d",
- id, color, amount), GENERAL_CHANNEL);
+ id, toInt(color, int), amount), GENERAL_CHANNEL);
}
}
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index acabd288a..ab7b8c557 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -60,7 +60,8 @@ class AdminHandler notfinal : public Net::AdminHandler
void ipcheckName(const std::string &name) const override final;
- void createItems(const int id, const int color,
+ void createItems(const int id,
+ const ItemColor color,
const int amount) const override final;
protected:
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 76fe061ed..2c2c65652 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -76,7 +76,7 @@ Being *BeingHandler::createBeing(const BeingId id,
void BeingHandler::setSprite(Being *const being, const unsigned int slot,
const int id, const std::string &color,
- const unsigned char colorId,
+ const ItemColor colorId,
const bool isWeapon,
const bool isTempSprite)
{
diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h
index 20622e514..6c372ce1f 100644
--- a/src/net/ea/beinghandler.h
+++ b/src/net/ea/beinghandler.h
@@ -42,7 +42,7 @@ class BeingHandler notfinal : public Net::BeingHandler
static void setSprite(Being *const being, const unsigned int slot,
const int id,
const std::string &color = "",
- const unsigned char colorId = 1,
+ const ItemColor colorId = ItemColor_one,
const bool isWeapon = false,
const bool isTempSprite = false);
diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h
index b318b2f23..d4d9c3637 100644
--- a/src/net/ea/inventoryitem.h
+++ b/src/net/ea/inventoryitem.h
@@ -27,6 +27,7 @@
#include "enums/simpletypes/equipm.h"
#include "enums/simpletypes/favorite.h"
#include "enums/simpletypes/identified.h"
+#include "enums/simpletypes/itemcolor.h"
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#include <cstdint>
@@ -51,7 +52,7 @@ class InventoryItem final
int cards[4];
int quantity;
uint8_t refine;
- unsigned char color;
+ ItemColor color;
Identified identified;
Damaged damaged;
Favorite favorite;
@@ -63,7 +64,7 @@ class InventoryItem final
const int *const cards0,
const int quantity0,
const uint8_t refine0,
- const unsigned char color0,
+ const ItemColor color0,
const Identified identified0,
const Damaged damaged0,
const Favorite favorite0,
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index 2c297f69f..478c17990 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -43,7 +43,7 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("item object id");
const int itemId = msg.readInt16("item id");
- const uint8_t identify = msg.readUInt8("identify");
+ const ItemColor identify = fromInt(msg.readUInt8("identify"), ItemColor);
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const int amount = msg.readInt16("amount");
@@ -52,8 +52,12 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg)
if (actorManager)
{
- actorManager->createItem(id, itemId,
- x, y, amount, identify, subX, subY);
+ actorManager->createItem(id,
+ itemId,
+ x, y,
+ amount,
+ identify,
+ subX, subY);
}
}
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 35d549149..5c748915b 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -585,100 +585,101 @@ void BeingHandler::processBeingChangeLookContinue(Net::MessageIn &msg,
dstBeing->getLook());
break;
case 1: // eAthena LOOK_HAIR
- dstBeing->setHairColor(id);
+ dstBeing->setHairColor(fromInt(id, ItemColor));
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, "", 1, true);
+ dstBeing->setSprite(SPRITE_BODY, id, "", ItemColor_one, true);
dstBeing->setSprite(SPRITE_FLOOR, id2);
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
break;
case 3: // LOOK_HEAD_BOTTOM
dstBeing->setSprite(SPRITE_WEAPON, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_WEAPON);
break;
case 4: // LOOK_HEAD_TOP Change upper headgear for eAthena, hat for us
dstBeing->setSprite(SPRITE_CLOTHES_COLOR, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_CLOTHES_COLOR);
break;
case 5: // LOOK_HEAD_MID Change middle headgear for eathena,
// armor for us
dstBeing->setSprite(SPRITE_HEAD_BOTTOM, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_HEAD_BOTTOM);
break;
case 6: // eAthena LOOK_HAIR_COLOR
- dstBeing->setHairColor(id);
+ dstBeing->setHairColor(fromInt(id, ItemColor));
dstBeing->setSpriteColor(SPRITE_HAIR_COLOR,
ItemDB::get(dstBeing->getSpriteID(
- SPRITE_HAIR_COLOR)).getDyeColorsString(id));
+ SPRITE_HAIR_COLOR)).getDyeColorsString(
+ fromInt(id, ItemColor)));
break;
case 7: // Clothes color. Now used as look
dstBeing->setLook(static_cast<uint8_t>(id));
break;
case 8: // eAthena LOOK_SHIELD
dstBeing->setSprite(SPRITE_FLOOR, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
break;
case 9: // eAthena LOOK_SHOES
dstBeing->setSprite(SPRITE_HAIR, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_HAIR);
break;
case 10: // LOOK_GLOVES
dstBeing->setSprite(SPRITE_SHOES, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_SHOES);
break;
case 11: // LOOK_FLOOR
dstBeing->setSprite(SPRITE_SHIELD, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_SHIELD);
break;
case 12: // LOOK_ROBE
dstBeing->setSprite(SPRITE_HEAD_TOP, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_HEAD_TOP);
break;
case 13: // COSTUME_HEAD_TOP
dstBeing->setSprite(SPRITE_HEAD_MID, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_HEAD_MID);
break;
case 14: // COSTUME_HEAD_MID
dstBeing->setSprite(SPRITE_ROBE, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_ROBE);
break;
case 15: // COSTUME_HEAD_LOW
dstBeing->setSprite(SPRITE_EVOL2, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_EVOL2);
break;
case 16: // COSTUME_GARMENT
dstBeing->setSprite(SPRITE_EVOL3, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_EVOL3);
break;
case 17: // ARMOR
dstBeing->setSprite(SPRITE_EVOL4, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_EVOL4);
break;
@@ -769,7 +770,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const int hairColor = msg.readInt16("hair color");
+ const ItemColor hairColor = fromInt(msg.readInt16("hair color"), ItemColor);
const uint16_t shoes = msg.readInt16("shoes or clothes color?");
const uint16_t gloves = msg.readInt16("head dir / gloves");
@@ -795,7 +796,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
setSprite(dstBeing, SPRITE_HAIR, shoes);
setSprite(dstBeing, SPRITE_SHOES, gloves);
- setSprite(dstBeing, SPRITE_BODY, weapon, "", 1, true);
+ setSprite(dstBeing, SPRITE_BODY, weapon, "", ItemColor_one, true);
// setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
@@ -930,7 +931,8 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const int hairColor = msg.readInt16("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readInt16("hair color"), ItemColor);
const uint16_t shoes = msg.readInt16("shoes or clothes color?");
const uint16_t gloves = msg.readInt16("head dir / gloves");
@@ -958,7 +960,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
setSprite(dstBeing, SPRITE_HAIR, shoes);
setSprite(dstBeing, SPRITE_SHOES, gloves);
- setSprite(dstBeing, SPRITE_BODY, weapon, "", 1, true);
+ setSprite(dstBeing, SPRITE_BODY, weapon, "", ItemColor_one, true);
}
// setSprite(dstBeing, SPRITE_FLOOR, shield);
}
@@ -1097,9 +1099,9 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const int hairColor = msg.readInt16("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readInt16("hair color"), ItemColor);
const uint16_t shoes = msg.readInt16("shoes or clothes color?");
-
const uint16_t gloves = msg.readInt16("head dir / gloves");
// may be use robe as gloves?
msg.readInt16("robe");
@@ -1123,7 +1125,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
setSprite(dstBeing, SPRITE_HAIR, shoes);
setSprite(dstBeing, SPRITE_SHOES, gloves);
- setSprite(dstBeing, SPRITE_BODY, weapon, "", 1, true);
+ setSprite(dstBeing, SPRITE_BODY, weapon, "", ItemColor_one, true);
// setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp
index d42d66b07..4fcad8637 100644
--- a/src/net/eathena/buyingstorehandler.cpp
+++ b/src/net/eathena/buyingstorehandler.cpp
@@ -210,11 +210,11 @@ void BuyingStoreHandler::processBuyingStoreItemsList(Net::MessageIn &msg)
if (!inv)
continue;
- const Item *const item = inv->findItem(itemId, 1);
+ const Item *const item = inv->findItem(itemId, ItemColor_one);
if (!item)
continue;
// +++ need add colors support
- dialog->addItem(itemId, itemType, 1, amount, price);
+ dialog->addItem(itemId, itemType, ItemColor_one, amount, price);
}
}
diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp
index da64491ed..6e145a171 100644
--- a/src/net/eathena/buysellhandler.cpp
+++ b/src/net/eathena/buysellhandler.cpp
@@ -103,7 +103,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
msg.readInt32("dc value?");
const int type = msg.readUInt8("type");
const int itemId = msg.readInt16("item id");
- const unsigned char color = 1;
+ const ItemColor color = ItemColor_one;
mBuyDialog->addItem(itemId, type, color, 0, value);
}
mBuyDialog->sort();
diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp
index 23d6ab66d..012923424 100644
--- a/src/net/eathena/cashshophandler.cpp
+++ b/src/net/eathena/cashshophandler.cpp
@@ -104,7 +104,7 @@ void CashShopHandler::processCashShopOpen(Net::MessageIn &msg)
const int value = msg.readInt32("discount price");
const int type = msg.readUInt8("item type");
const int itemId = msg.readInt16("item id");
- const int color = 1;
+ const ItemColor color = ItemColor_one;
mBuyDialog->addItem(itemId, type, color, 0, value);
}
mBuyDialog->sort();
@@ -168,7 +168,7 @@ void CashShopHandler::processCashShopSchedule(Net::MessageIn &msg)
void CashShopHandler::buyItem(const int points,
const int itemId,
- const unsigned char color A_UNUSED,
+ const ItemColor color A_UNUSED,
const int amount) const
{
createOutPacket(CMSG_NPC_CASH_SHOP_BUY);
diff --git a/src/net/eathena/cashshophandler.h b/src/net/eathena/cashshophandler.h
index cc8859a89..851b62527 100644
--- a/src/net/eathena/cashshophandler.h
+++ b/src/net/eathena/cashshophandler.h
@@ -43,7 +43,7 @@ class CashShopHandler final : public MessageHandler,
void buyItem(const int points,
const int itemId,
- const unsigned char color,
+ const ItemColor color,
const int amount) const override final;
void close() const override final;
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index b2310b029..960acf44d 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -235,7 +235,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int option A_UNUSED = (msg.readInt16("weapon") | 1) ^ 1;
const int weapon = 0;
- tempPlayer->setSprite(SPRITE_BODY, weapon, "", 1, true);
+ tempPlayer->setSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
data.mAttributes[Attributes::LEVEL] = msg.readInt16("level");
@@ -245,8 +245,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int hat = msg.readInt16("head top");
const int topClothes = msg.readInt16("head mid");
- const uint16_t color = msg.readInt16("hair color");
- tempPlayer->setHairColor(static_cast<unsigned char>(color));
+ const ItemColor color = fromInt(msg.readInt16("hair color"), ItemColor);
+ tempPlayer->setHairColor(color);
tempPlayer->setSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
ItemDB::get(-hairStyle).getDyeColorsString(
color));
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 86faea2e7..c2b01be22 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -458,8 +458,12 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
flags.byte = msg.readUInt8("flags");
if (inventory)
{
- inventory->setItem(index, itemId, itemType, 1, refine,
+ inventory->setItem(index,
+ itemId,
+ itemType,
1,
+ refine,
+ ItemColor_one,
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -542,14 +546,23 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
break;
}
if (localPlayer)
- localPlayer->pickedUp(itemInfo, 0, 1, floorId, pickup);
+ {
+ localPlayer->pickedUp(itemInfo,
+ 0,
+ ItemColor_one,
+ floorId,
+ pickup);
+ }
}
else
{
if (localPlayer)
{
- localPlayer->pickedUp(itemInfo, amount,
- 1, floorId, Pickup::OKAY);
+ localPlayer->pickedUp(itemInfo,
+ amount,
+ ItemColor_one,
+ floorId,
+ Pickup::OKAY);
}
if (inventory)
@@ -559,8 +572,12 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += item->getQuantity();
- inventory->setItem(index, itemId, itemType, amount, refine,
- 1,
+ inventory->setItem(index,
+ itemId,
+ itemType,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
fromBool(damaged, Damaged),
Favorite_false,
@@ -608,8 +625,12 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (inventory)
{
- inventory->setItem(index, itemId, itemType, amount,
- 0, 1,
+ inventory->setItem(index,
+ itemId,
+ itemType,
+ amount,
+ 0,
+ ItemColor_one,
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -645,8 +666,13 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
- mInventoryItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, 0, 1,
+ mInventoryItems.push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ amount,
+ 0,
+ ItemColor_one,
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -746,8 +772,13 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
- mInventoryItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, refine, 1,
+ mInventoryItems.push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -773,15 +804,19 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
if (Item *const item = mStorage->getItem(index))
{
- item->setId(itemId, 1);
+ item->setId(itemId, ItemColor_one);
item->increaseQuantity(amount);
}
else
{
if (mStorage)
{
- mStorage->setItem(index, itemId, itemType, amount,
- refine, 1,
+ mStorage->setItem(index,
+ itemId,
+ itemType,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -960,8 +995,12 @@ void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += item->getQuantity();
- inventory->setItem(index, itemId, itemType, amount, refine,
- 1,
+ inventory->setItem(index,
+ itemId,
+ itemType,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -995,8 +1034,13 @@ void InventoryHandler::processPlayerCartEquip(Net::MessageIn &msg)
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
- mCartItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, refine, 1,
+ mCartItems.push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
@@ -1027,8 +1071,13 @@ void InventoryHandler::processPlayerCartItems(Net::MessageIn &msg)
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
- mCartItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, 0, 1,
+ mCartItems.push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ amount,
+ 0,
+ ItemColor_one,
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 ce5dfadfb..4fa4a7e3e 100644
--- a/src/net/eathena/itemhandler.cpp
+++ b/src/net/eathena/itemhandler.cpp
@@ -82,7 +82,7 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
const BeingId id = msg.readBeingId("id");
const int itemId = msg.readInt16("item id");
msg.readInt16("type");
- const uint8_t identify = msg.readUInt8("identify");
+ msg.readUInt8("identify");
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const int subX = static_cast<int>(msg.readInt8("subx"));
@@ -91,8 +91,12 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
if (actorManager)
{
- actorManager->createItem(id, itemId,
- x, y, amount, identify, subX, subY);
+ actorManager->createItem(id,
+ itemId,
+ x, y,
+ amount,
+ ItemColor_one,
+ subX, subY);
}
}
diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp
index 265fc7ca5..d0e8ff6ce 100644
--- a/src/net/eathena/markethandler.cpp
+++ b/src/net/eathena/markethandler.cpp
@@ -87,7 +87,7 @@ void MarketHandler::processMarketOpen(Net::MessageIn &msg)
const int value = msg.readInt32("price");
const int amount = msg.readInt32("amount");
msg.readInt16("view");
- const unsigned char color = 1;
+ const ItemColor color = ItemColor_one;
mBuyDialog->addItem(itemId, type, color, amount, value);
}
mBuyDialog->sort();
@@ -116,7 +116,7 @@ void MarketHandler::close()
void MarketHandler::buyItem(const int itemId,
const int type,
- const unsigned char color A_UNUSED,
+ const ItemColor color A_UNUSED,
const int amount) const
{
const bool nonStack = type == 4 || type == 5 || type == 7 || type == 8;
diff --git a/src/net/eathena/markethandler.h b/src/net/eathena/markethandler.h
index 42a4bcac0..e58ac1e68 100644
--- a/src/net/eathena/markethandler.h
+++ b/src/net/eathena/markethandler.h
@@ -43,7 +43,7 @@ class MarketHandler final : public MessageHandler,
void buyItem(const int itemId,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount) const override final;
protected:
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp
index e8a7daf8b..7b376fbeb 100644
--- a/src/net/eathena/npchandler.cpp
+++ b/src/net/eathena/npchandler.cpp
@@ -212,7 +212,7 @@ void NpcHandler::sell(const BeingId beingId) const
void NpcHandler::buyItem(const BeingId beingId A_UNUSED,
const int itemId,
- const unsigned char color A_UNUSED,
+ const ItemColor color A_UNUSED,
const int amount) const
{
createOutPacket(CMSG_NPC_BUY_REQUEST);
diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h
index 75d9a245d..3b35cadc5 100644
--- a/src/net/eathena/npchandler.h
+++ b/src/net/eathena/npchandler.h
@@ -60,7 +60,7 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler
void buyItem(const BeingId beingId,
const int itemId,
- const unsigned char color,
+ const ItemColor color,
const int amount) const override final;
void sellItem(const BeingId beingId,
diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index 749d9343e..a76a08130 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -199,10 +199,14 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
}
else
{
- tradeWindow->addItem2(type, itemType,
- cards, 4,
- false, amount,
- refine, 1,
+ tradeWindow->addItem2(type,
+ itemType,
+ cards,
+ 4,
+ false,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identify, Identified),
Damaged_false,
Favorite_false,
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp
index 48b301a77..584aa1f23 100644
--- a/src/net/eathena/vendinghandler.cpp
+++ b/src/net/eathena/vendinghandler.cpp
@@ -158,7 +158,7 @@ void VendingHandler::processItemsList(Net::MessageIn &msg)
for (int d = 0; d < 4; d ++)
msg.readInt16("card");
- const unsigned char color = 1;
+ const ItemColor color = ItemColor_one;
ShopItem *const item = mBuyDialog->addItem(itemId, type,
color, amount, value);
if (item)
diff --git a/src/net/markethandler.h b/src/net/markethandler.h
index f98b1b18d..13027024e 100644
--- a/src/net/markethandler.h
+++ b/src/net/markethandler.h
@@ -23,6 +23,8 @@
#ifdef EATHENA_SUPPORT
+#include "enums/simpletypes/itemcolor.h"
+
#include <string>
#include "localconsts.h"
@@ -40,7 +42,7 @@ class MarketHandler notfinal
virtual void buyItem(const int itemId,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount) const = 0;
};
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index 1f4642b4d..29ecc5632 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -28,6 +28,7 @@
#include "enums/being/cookingtype.h"
#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/itemcolor.h"
#include "localconsts.h"
@@ -65,7 +66,7 @@ class NpcHandler notfinal
virtual void buyItem(const BeingId beingId,
const int itemId,
- const unsigned char color,
+ const ItemColor color,
const int amount) const = 0;
virtual void sellItem(const BeingId beingId,
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 8092a519f..d336bdf47 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -339,70 +339,70 @@ void BeingHandler::processBeingChangeLookContinue(Net::MessageIn &msg,
break;
}
case 2: // Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(SPRITE_BODY, id, "", 1, true);
+ dstBeing->setSprite(SPRITE_BODY, id, "", ItemColor_one, true);
dstBeing->setSprite(SPRITE_FLOOR, id2);
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
break;
case 3: // Change lower headgear for eAthena, pants for us
dstBeing->setSprite(SPRITE_WEAPON, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_WEAPON);
break;
case 4: // Change upper headgear for eAthena, hat for us
dstBeing->setSprite(SPRITE_CLOTHES_COLOR, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_CLOTHES_COLOR);
break;
case 5: // Change middle headgear for eathena, armor for us
dstBeing->setSprite(SPRITE_HEAD_BOTTOM, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_HEAD_BOTTOM);
break;
case 6: // eAthena LOOK_HAIR_COLOR
dstBeing->setHairColor(SPRITE_HAIR_COLOR,
- static_cast<uint8_t>(id));
+ fromInt(id, ItemColor));
break;
case 7: // Clothes color
// ignoring it
break;
case 8: // eAthena LOOK_SHIELD
dstBeing->setSprite(SPRITE_FLOOR, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
break;
case 9: // eAthena LOOK_SHOES
dstBeing->setSprite(SPRITE_HAIR, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_HAIR);
break;
case 10: // LOOK_GLOVES
dstBeing->setSprite(SPRITE_SHOES, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_SHOES);
break;
case 11: // LOOK_CAPE
dstBeing->setSprite(SPRITE_SHIELD, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_SHIELD);
break;
case 12:
dstBeing->setSprite(SPRITE_HEAD_TOP, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_HEAD_TOP);
break;
case 13:
dstBeing->setSprite(SPRITE_HEAD_MID, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_HEAD_MID);
break;
case 14:
dstBeing->setSprite(SPRITE_ROBE, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_ROBE);
break;
case 15:
dstBeing->setSprite(SPRITE_EVOL2, id, color,
- static_cast<unsigned char>(id2));
+ fromInt(id2, ItemColor));
localPlayer->imitateOutfit(dstBeing, SPRITE_EVOL2);
break;
case 16:
@@ -483,7 +483,8 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg)
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const uint8_t hairColor = msg.readUInt8("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
msg.readInt32("unused");
@@ -508,7 +509,7 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg)
if (!disguiseId)
{
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->updateSprite(SPRITE_BODY, weapon, "", 1, true);
+ dstBeing->updateSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -617,7 +618,8 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg)
const uint16_t headBottom = msg.readInt16("head bottom");
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const uint8_t hairColor = msg.readUInt8("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
msg.readInt32("unused");
@@ -642,7 +644,7 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg)
if (!disguiseId)
{
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->updateSprite(SPRITE_BODY, weapon, "", 1, true);
+ dstBeing->updateSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -751,7 +753,8 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg)
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const uint8_t hairColor = msg.readUInt8("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
msg.readInt32("unused");
@@ -776,7 +779,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg)
if (!disguiseId)
{
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->updateSprite(SPRITE_BODY, weapon, "", 1, true);
+ dstBeing->updateSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -942,7 +945,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
const uint16_t shield = msg.readInt16("shield");
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const uint8_t hairColor = msg.readUInt8("hair color");
+ const ItemColor hairColor = fromInt(msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
const uint16_t shoes = msg.readInt16("shoes / clothes color");
@@ -1004,7 +1007,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
setSprite(dstBeing, SPRITE_HAIR, shoes);
setSprite(dstBeing, SPRITE_SHOES, gloves);
- setSprite(dstBeing, SPRITE_BODY, weapon, "", 1, true);
+ setSprite(dstBeing, SPRITE_BODY, weapon, "", ItemColor_one, true);
setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
@@ -1143,7 +1146,8 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
const uint16_t shield = msg.readInt16("shield");
const uint16_t headTop = msg.readInt16("head top");
const uint16_t headMid = msg.readInt16("head mid");
- const uint8_t hairColor = msg.readUInt8("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
const uint16_t shoes = msg.readInt16("shoes / clothes color");
@@ -1205,7 +1209,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
setSprite(dstBeing, SPRITE_HAIR, shoes);
setSprite(dstBeing, SPRITE_SHOES, gloves);
- setSprite(dstBeing, SPRITE_BODY, weapon, "", 1, true);
+ setSprite(dstBeing, SPRITE_BODY, weapon, "", ItemColor_one, true);
setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index e09fd2ae8..e41b1580e 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -110,7 +110,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
msg.readInt32("dc value?");
const int type = msg.readUInt8("type");
const int itemId = msg.readInt16("item id");
- uint8_t color = 1;
+ const ItemColor color = ItemColor_one;
mBuyDialog->addItem(itemId, type, color, 0, value);
}
mBuyDialog->sort();
diff --git a/src/net/tmwa/cashshophandler.cpp b/src/net/tmwa/cashshophandler.cpp
index c9fecd9fb..45a4aaacb 100644
--- a/src/net/tmwa/cashshophandler.cpp
+++ b/src/net/tmwa/cashshophandler.cpp
@@ -44,7 +44,7 @@ void CashShopHandler::handleMessage(Net::MessageIn &msg A_UNUSED)
void CashShopHandler::buyItem(const int points A_UNUSED,
const int itemId A_UNUSED,
- const unsigned char color A_UNUSED,
+ const ItemColor color A_UNUSED,
const int amount A_UNUSED) const
{
}
diff --git a/src/net/tmwa/cashshophandler.h b/src/net/tmwa/cashshophandler.h
index 588aba087..3b4c668ec 100644
--- a/src/net/tmwa/cashshophandler.h
+++ b/src/net/tmwa/cashshophandler.h
@@ -42,7 +42,7 @@ class CashShopHandler final : public MessageHandler,
void buyItem(const int points,
const int itemId,
- const unsigned char color,
+ const ItemColor color,
const int amount) const override final;
void close() const override final;
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 12d698186..229339ef4 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -168,7 +168,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const uint16_t look = msg.readUInt8("look");
tempPlayer->setSubtype(fromInt(race, BeingTypeId), look);
const uint16_t weapon = msg.readInt16("weapon");
- tempPlayer->setSprite(SPRITE_BODY, weapon, "", 1, true);
+ tempPlayer->setSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
data.mAttributes[Attributes::LEVEL] = msg.readInt16("level");
@@ -179,11 +179,12 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int hat = msg.readInt16("hat");
const int topClothes = msg.readInt16("top clothes");
- const uint8_t hairColor = msg.readUInt8("hair color");
+ const ItemColor hairColor = fromInt(
+ msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
tempPlayer->setSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
- tempPlayer->setHairColor(static_cast<unsigned char>(hairColor));
+ tempPlayer->setHairColor(hairColor);
const int misc2 = msg.readInt16("misc2");
tempPlayer->setName(msg.readString(24, "name"));
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 5ff9325ae..05ed6e40d 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -292,8 +292,12 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
if (inventory)
{
- inventory->setItem(index, itemId, itemType, 1, refine,
+ inventory->setItem(index,
+ itemId,
+ itemType,
1,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -374,14 +378,23 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
break;
}
if (localPlayer)
- localPlayer->pickedUp(itemInfo, 0, identified, floorId, pickup);
+ {
+ localPlayer->pickedUp(itemInfo,
+ 0,
+ fromInt(identified, ItemColor),
+ floorId,
+ pickup);
+ }
}
else
{
if (localPlayer)
{
- localPlayer->pickedUp(itemInfo, amount,
- identified, floorId, Pickup::OKAY);
+ localPlayer->pickedUp(itemInfo,
+ amount,
+ fromInt(identified, ItemColor),
+ floorId,
+ Pickup::OKAY);
}
if (inventory)
@@ -391,8 +404,12 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += item->getQuantity();
- inventory->setItem(index, itemId, type, amount, refine,
- 1,
+ inventory->setItem(index,
+ itemId,
+ type,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -449,8 +466,12 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (inventory)
{
- inventory->setItem(index, itemId, itemType, amount,
- 0, 1,
+ inventory->setItem(index,
+ itemId,
+ itemType,
+ amount,
+ 0,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -490,8 +511,13 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
cards[0], cards[1], cards[2], cards[3]);
}
- mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
- itemType, cards, amount, 0, 1,
+ mInventoryItems.push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ amount,
+ 0,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -559,8 +585,13 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
static_cast<unsigned int>(refine));
}
- mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
- itemType, cards, amount, refine, 1,
+ mInventoryItems.push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
@@ -585,15 +616,19 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
if (Item *const item = mStorage->getItem(index))
{
- item->setId(itemId, identified);
+ item->setId(itemId, ItemColor_one);
item->increaseQuantity(amount);
}
else
{
if (mStorage)
{
- mStorage->setItem(index, itemId, 0, amount,
- refine, 1,
+ mStorage->setItem(index,
+ itemId,
+ 0,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identified, Identified),
Damaged_false,
Favorite_false,
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index 7ad3f733a..745c79865 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -72,7 +72,7 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("item object id");
const int itemId = msg.readInt16("item id");
- const uint8_t identify = msg.readUInt8("identify");
+ const ItemColor identify = fromInt(msg.readUInt8("identify"), ItemColor);
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const int subX = static_cast<int>(msg.readInt8("sub x"));
diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp
index 6fff692c8..4e322b1cf 100644
--- a/src/net/tmwa/markethandler.cpp
+++ b/src/net/tmwa/markethandler.cpp
@@ -53,7 +53,7 @@ void MarketHandler::close()
void MarketHandler::buyItem(const int itemId A_UNUSED,
const int type A_UNUSED,
- const unsigned char color A_UNUSED,
+ const ItemColor color A_UNUSED,
const int amount A_UNUSED) const
{
}
diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h
index bf817ac04..65d299251 100644
--- a/src/net/tmwa/markethandler.h
+++ b/src/net/tmwa/markethandler.h
@@ -43,7 +43,7 @@ class MarketHandler final : public MessageHandler,
void buyItem(const int itemId,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount) const override final;
};
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 60d41a7ef..b01c3277f 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -178,7 +178,7 @@ void NpcHandler::sell(const BeingId beingId) const
void NpcHandler::buyItem(const BeingId beingId A_UNUSED,
const int itemId,
- const unsigned char color A_UNUSED,
+ const ItemColor color A_UNUSED,
const int amount) const
{
createOutPacket(CMSG_NPC_BUY_REQUEST);
diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h
index c8da3fd42..35a6f9459 100644
--- a/src/net/tmwa/npchandler.h
+++ b/src/net/tmwa/npchandler.h
@@ -60,7 +60,7 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler
void buyItem(const BeingId beingId,
const int itemId,
- const unsigned char color,
+ const ItemColor color,
const int amount) const override final;
void sellItem(const BeingId beingId,
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index c445f8d06..845a7af6b 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -184,10 +184,14 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
}
else
{
- tradeWindow->addItem2(type, 0,
- cards, 4,
- false, amount,
- refine, 1,
+ tradeWindow->addItem2(type,
+ 0,
+ cards,
+ 4,
+ false,
+ amount,
+ refine,
+ ItemColor_one,
fromBool(identify, Identified),
Damaged_false,
Favorite_false,