summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-08 19:35:18 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-08 19:35:18 +0300
commit93e5a6fbfba642e4e3ff85dcf7bc3c02bada5649 (patch)
tree3561909ed91fb58b03a7d5bd815fcff91bfe5e30 /src
parent8685a2564a96c6819fc0854891293747232fe02a (diff)
downloadplus-93e5a6fbfba642e4e3ff85dcf7bc3c02bada5649.tar.gz
plus-93e5a6fbfba642e4e3ff85dcf7bc3c02bada5649.tar.bz2
plus-93e5a6fbfba642e4e3ff85dcf7bc3c02bada5649.tar.xz
plus-93e5a6fbfba642e4e3ff85dcf7bc3c02bada5649.zip
Add setWeaponId into Being class.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp8
-rw-r--r--src/being/being.h2
-rw-r--r--src/net/eathena/beingrecv.cpp4
-rw-r--r--src/net/eathena/charserverrecv.cpp1
-rw-r--r--src/net/tmwa/beingrecv.cpp6
-rw-r--r--src/net/tmwa/charserverrecv.cpp1
6 files changed, 22 insertions, 0 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 18535ab9e..7cd645b17 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2604,6 +2604,14 @@ void Being::setSprite(const unsigned int slot,
beingEquipmentWindow->updateBeing(this);
}
+void Being::setWeaponId(const int id) restrict2
+{
+ if (id == 0)
+ mEquippedWeapon = nullptr;
+ else
+ mEquippedWeapon = &ItemDB::get(id);
+}
+
void Being::setTempSprite(const unsigned int slot,
const int id,
std::string color,
diff --git a/src/being/being.h b/src/being/being.h
index bb9951f56..7e3ec2b55 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -326,6 +326,8 @@ class Being notfinal : public ActorSprite,
const IsWeapon isWeapon,
const int *const cards) restrict2;
+ void setWeaponId(const int id) restrict2;
+
void setTempSprite(const unsigned int slot,
const int id,
std::string color,
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 1664cd77a..bcfaa06eb 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -166,6 +166,7 @@ void BeingRecv::processBeingChangeLookContinue(const Net::MessageIn &msg,
itemColor,
IsWeapon_true,
cards);
+ dstBeing->setWeaponId(id);
dstBeing->setSprite(SPRITE_FLOOR,
id2,
std::string(),
@@ -490,6 +491,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
// Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
@@ -696,6 +698,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
}
// Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
@@ -900,6 +903,7 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
// Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index 7c8a2d99f..796be90ca 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -135,6 +135,7 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
ItemColor_one,
IsWeapon_true,
nullptr);
+ tempPlayer->setWeaponId(weapon);
data.mAttributes[Attributes::LEVEL] = msg.readInt16("level");
diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp
index 98f030f12..a219203cc 100644
--- a/src/net/tmwa/beingrecv.cpp
+++ b/src/net/tmwa/beingrecv.cpp
@@ -149,6 +149,7 @@ void BeingRecv::processBeingChangeLookContinue(const Net::MessageIn &msg,
ItemColor_one,
IsWeapon_true,
nullptr);
+ dstBeing->setWeaponId(id);
dstBeing->setSprite(SPRITE_FLOOR,
id2,
std::string(),
@@ -370,6 +371,7 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -516,6 +518,7 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -662,6 +665,7 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -916,6 +920,7 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
@@ -1133,6 +1138,7 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
"",
ItemColor_one,
IsWeapon_true);
+ dstBeing->setWeaponId(weapon);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp
index a940799ba..fdc24cf7a 100644
--- a/src/net/tmwa/charserverrecv.cpp
+++ b/src/net/tmwa/charserverrecv.cpp
@@ -110,6 +110,7 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
ItemColor_one,
IsWeapon_true,
nullptr);
+ tempPlayer->setWeaponId(weapon);
data.mAttributes[Attributes::LEVEL] = msg.readInt16("level");