summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-30 22:37:01 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-30 22:37:01 +0300
commitb78cc1c9f70f7add1c66c6a40b55b9add71de6df (patch)
tree7c3bb0aa2c2737ba478814c79e466f707f7e35b7
parentd82994bca93b4278c4751a2a4c1313ba2f41bd4b (diff)
downloadplus-b78cc1c9f70f7add1c66c6a40b55b9add71de6df.tar.gz
plus-b78cc1c9f70f7add1c66c6a40b55b9add71de6df.tar.bz2
plus-b78cc1c9f70f7add1c66c6a40b55b9add71de6df.tar.xz
plus-b78cc1c9f70f7add1c66c6a40b55b9add71de6df.zip
Add karma field to beings.
-rw-r--r--src/being/being.cpp1
-rw-r--r--src/being/being.h7
-rw-r--r--src/net/eathena/beinghandler.cpp17
-rw-r--r--src/net/eathena/charserverhandler.cpp2
-rw-r--r--src/net/tmwa/beinghandler.cpp10
-rw-r--r--src/net/tmwa/charserverhandler.cpp2
6 files changed, 22 insertions, 17 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 3cc51ef9d..7d054fc97 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -200,6 +200,7 @@ Being::Being(const int id,
mPvpRank(0),
mNumber(100),
mUsageCounter(1),
+ mKarma(0),
mLook(0U),
mHairColor(0),
mErased(false),
diff --git a/src/being/being.h b/src/being/being.h
index a65fb1af0..5f95fbfed 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -899,6 +899,12 @@ class Being notfinal : public ActorSprite,
const ChatObject *getChat() const
{ return mChat; }
+ void setKarma(const int karma)
+ { mKarma = karma; }
+
+ int getKarma() const
+ { return mKarma; }
+
protected:
/**
* Updates name's location.
@@ -1065,6 +1071,7 @@ class Being notfinal : public ActorSprite,
unsigned int mPvpRank;
unsigned int mNumber;
int mUsageCounter;
+ int mKarma;
uint8_t mLook;
unsigned char mHairColor;
bool mErased;
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 56f894097..1bd20c0e3 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -616,8 +616,7 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg) const
msg.readInt16("emblem");
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- msg.readUInt8("karma");
- // reserving bit for future usage
+ dstBeing->setKarma(msg.readUInt8("karma"));
dstBeing->setGender(Being::intToGender(msg.readUInt8("gender")));
if (!disguiseId)
@@ -742,8 +741,7 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg) const
msg.readInt16("emblem");
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- msg.readUInt8("karma");
- // reserving bit for future usage
+ dstBeing->setKarma(msg.readUInt8("karma"));
dstBeing->setGender(Being::intToGender(msg.readUInt8("gender")));
if (!disguiseId)
@@ -868,8 +866,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const
msg.readInt16("emblem");
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- msg.readUInt8("karma");
- // reserving bit for future usage
+ dstBeing->setKarma(msg.readUInt8("karma"));
dstBeing->setGender(Being::intToGender(msg.readUInt8("gender")));
if (!disguiseId)
@@ -1037,7 +1034,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, static_cast<uint16_t>(
msg.readInt32("opt3")));
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
uint8_t gender = msg.readUInt8("gender");
if (dstBeing->getType() == ActorType::Player)
@@ -1202,7 +1199,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, static_cast<uint16_t>(
msg.readInt32("opt3")));
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
uint8_t gender = msg.readUInt8("gender");
if (dstBeing->getType() == ActorType::Player)
@@ -1369,7 +1366,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, static_cast<uint16_t>(
msg.readInt32("opt3")));
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
uint8_t gender = msg.readUInt8("gender");
if (dstBeing->getType() == ActorType::Player)
@@ -1784,7 +1781,7 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const
const uint16_t stunMode = msg.readInt16("stun mode");
uint32_t statusEffects = msg.readInt16("status effect");
statusEffects |= (static_cast<uint32_t>(msg.readInt32("opt?"))) << 16;
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
dstBeing->setStunMode(stunMode);
dstBeing->setStatusEffectBlock(0, static_cast<uint16_t>(
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 35d64e70f..b2ba2da08 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -161,7 +161,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int misc1 = msg.readInt16(); // look like unused
msg.readInt32("option");
- msg.readInt32("karma");
+ tempPlayer->setKarma(msg.readInt32("karma"));
msg.readInt32("manner");
msg.readInt16("left points");
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 863c4420f..6d19dbe72 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -556,7 +556,7 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg) const
msg.readInt16("emblem");
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
// reserving bit for future usage
dstBeing->setGender(Being::intToGender(
static_cast<uint8_t>(msg.readUInt8("gender") & 3)));
@@ -707,7 +707,7 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg) const
msg.readInt16("emblem");
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
// reserving bit for future usage
dstBeing->setGender(Being::intToGender(
static_cast<uint8_t>(msg.readUInt8("gender") & 3)));
@@ -858,7 +858,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const
msg.readInt16("emblem");
msg.readInt16("manner");
dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3"));
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
// reserving bit for future usage
dstBeing->setGender(Being::intToGender(
static_cast<uint8_t>(msg.readUInt8("gender") & 3)));
@@ -1138,7 +1138,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg)
}
else
{
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
}
uint8_t gender = msg.readUInt8("gender");
@@ -1342,7 +1342,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg)
}
else
{
- msg.readUInt8("karma");
+ dstBeing->setKarma(msg.readUInt8("karma"));
}
uint8_t gender = msg.readUInt8("gender");
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index c687739e2..8c98c56e2 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -159,7 +159,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int misc1 = msg.readInt16("misc1");
msg.readInt32("option");
- msg.readInt32("karma");
+ tempPlayer->setKarma(msg.readInt32("karma"));
msg.readInt32("manner");
msg.readInt16("character points left");