summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-05 03:41:13 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-05 03:41:13 +0300
commitd0571ca16bb4ef11a718cfa78dc29b57080fcc72 (patch)
treeadd362fa6b01bb83c608a78b3a56bf8b52136767 /src/being.cpp
parent0202b0b4cdac57a04a3765f6bca893bd3b5c9812 (diff)
downloadManaVerse-d0571ca16bb4ef11a718cfa78dc29b57080fcc72.tar.gz
ManaVerse-d0571ca16bb4ef11a718cfa78dc29b57080fcc72.tar.bz2
ManaVerse-d0571ca16bb4ef11a718cfa78dc29b57080fcc72.tar.xz
ManaVerse-d0571ca16bb4ef11a718cfa78dc29b57080fcc72.zip
Add ability to send client states to other clients.
Using for this emotes.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/being.cpp b/src/being.cpp
index f26b2c245..acfe9e445 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -153,6 +153,12 @@ class BeingCacheEntry
void setIp(std::string ip)
{ mIp = ip; }
+ bool isAdvanced() const
+ { return mIsAdvanced; }
+
+ void setAdvanced(bool a)
+ { mIsAdvanced = a; }
+
protected:
int mId; /**< Unique sprite id */
std::string mName; /**< Name of character */
@@ -161,6 +167,7 @@ class BeingCacheEntry
unsigned int mPvpRank;
int mTime;
std::string mIp;
+ bool mIsAdvanced;
};
@@ -218,7 +225,11 @@ Being::Being(int id, Type type, Uint16 subtype, Map *map):
mCriticalHit(0),
mPvpRank(0),
mComment(""),
- mGotComment(false)
+ mGotComment(false),
+ mAdvanced(false),
+ mShop(false),
+ mAway(false),
+ mInactive(false)
{
mSpriteRemap = new int[20];
mSpriteHide = new int[20];
@@ -1718,14 +1729,17 @@ void Being::reReadConfig()
bool Being::updateFromCache()
{
BeingCacheEntry *entry = Being::getCacheEntry(getId());
- if (entry && !entry->getName().empty()
- && entry->getTime() + 120 < cur_time)
+
+ if (entry && entry->getTime() + 120 >= cur_time)
{
- setName(entry->getName());
+ if (!entry->getName().empty())
+ setName(entry->getName());
setPartyName(entry->getPartyName());
setLevel(entry->getLevel());
setPvpRank(entry->getPvpRank());
setIp(entry->getIp());
+
+ setAdvanced(entry->isAdvanced());
if (mType == PLAYER)
updateColors();
return true;
@@ -1747,12 +1761,16 @@ void Being::addToCache()
beingInfoCache.pop_back();
}
}
+ if (!mLowTraffic)
+ return;
+
entry->setName(getName());
entry->setLevel(getLevel());
entry->setPartyName(getPartyName());
entry->setTime(cur_time);
entry->setPvpRank(getPvpRank());
entry->setIp(getIp());
+ entry->setAdvanced(isAdvanced());
}
BeingCacheEntry* Being::getCacheEntry(int id)
@@ -2292,6 +2310,23 @@ void Being::saveComment(const std::string &name,
resman->saveTextFile(dir, "comment.txt", name + "\n" + comment);
}
+void Being::setEmote(Uint8 emotion, int emote_time)
+{
+ if (emotion & FLAG_SPECIAL)
+ {
+ mAdvanced = true;
+ mShop = (emotion & FLAG_SHOP);
+ mAway = (emotion & FLAG_AWAY);
+ mInactive = (emotion & FLAG_INACTIVE);
+// logger->log("flags: %d", emotion - FLAG_SPECIAL);
+ }
+ else
+ {
+ mEmotion = emotion;
+ mEmotionTime = emote_time;
+ }
+}
+
BeingEquipBackend::BeingEquipBackend(Being *being):
mBeing(being)
{