diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-22 21:59:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-22 21:59:47 +0300 |
commit | 8bc005b59bd27533a19354318e17a5cb5cfa09c5 (patch) | |
tree | f2c7357610554a414b3ce61bd151f1e9976290f2 | |
parent | 4545b34b1533657d58788285a38b5128f49070a8 (diff) | |
download | manaverse-8bc005b59bd27533a19354318e17a5cb5cfa09c5.tar.gz manaverse-8bc005b59bd27533a19354318e17a5cb5cfa09c5.tar.bz2 manaverse-8bc005b59bd27533a19354318e17a5cb5cfa09c5.tar.xz manaverse-8bc005b59bd27533a19354318e17a5cb5cfa09c5.zip |
Add pet actor type. For now it works almost same like monsters.
-rw-r--r-- | src/actormanager.cpp | 5 | ||||
-rw-r--r-- | src/being/actortype.h | 1 | ||||
-rw-r--r-- | src/being/being.cpp | 15 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 4 |
4 files changed, 20 insertions, 5 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 0f30fa215..18f9ff211 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -245,7 +245,10 @@ Being *ActorManager::createBeing(const int id, Being *const being = new Being(id, type, subtype, mMap); mActors.insert(being); - if (type == ActorType::Player || type == ActorType::Npc) + if (type == ActorType::Player + || type == ActorType::Npc + || type == ActorType::Mercenary + || type == ActorType::Pet) { being->updateFromCache(); beingHandler->requestNameById(id); diff --git a/src/being/actortype.h b/src/being/actortype.h index f92ce9e82..f39216d32 100644 --- a/src/being/actortype.h +++ b/src/being/actortype.h @@ -33,6 +33,7 @@ namespace ActorType FloorItem, Portal, LocalPet, + Pet, Avatar, Mercenary }; diff --git a/src/being/being.cpp b/src/being/being.cpp index 79b976049..102a5b440 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -222,10 +222,16 @@ Being::Being(const int id, setMap(map); setSubtype(subtype, 0); - if (mType == ActorType::Player || mType == ActorType::Mercenary) + if (mType == ActorType::Player + || mType == ActorType::Mercenary + || mType == ActorType::Pet) + { mShowName = config.getBoolValue("visiblenames"); + } else if (mType != ActorType::Npc) + { mGotComment = true; + } config.addListener("visiblenames", this); @@ -297,7 +303,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mSubType = subtype; mLook = look; - if (mType == ActorType::Monster) + if (mType == ActorType::Monster || mType == ActorType::Pet) { mInfo = MonsterDB::get(mSubType); if (mInfo) @@ -560,7 +566,9 @@ void Being::takeDamage(Being *const attacker, const int amount, color = &userPalette->getColor(UserPalette::MISS); } } - else if (mType == ActorType::Monster || mType == ActorType::Mercenary) + else if (mType == ActorType::Monster + || mType == ActorType::Mercenary + || mType == ActorType::Pet) { if (attacker == localPlayer) { @@ -2926,6 +2934,7 @@ std::string Being::loadComment(const std::string &name, case ActorType::LocalPet: case ActorType::Avatar: case ActorType::Mercenary: + case ActorType::Pet: default: return ""; } diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 0f924d5f4..23e7d1149 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -310,6 +310,9 @@ Being *BeingHandler::createBeing2(const int id, case BeingType::MERSOL: type = ActorType::Mercenary; break; + case BeingType::PET: + type = ActorType::Pet; + break; case BeingType::ITEM: case BeingType::SKILL: case BeingType::ELEMENTAL: @@ -317,7 +320,6 @@ Being *BeingHandler::createBeing2(const int id, static_cast<int>(beingType), static_cast<int>(job)); break; case BeingType::CHAT: - case BeingType::PET: case BeingType::HOMUN: default: type = ActorType::Monster; |