From 8bc005b59bd27533a19354318e17a5cb5cfa09c5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 22 Sep 2014 21:59:47 +0300 Subject: Add pet actor type. For now it works almost same like monsters. --- src/actormanager.cpp | 5 ++++- src/being/actortype.h | 1 + src/being/being.cpp | 15 ++++++++++++--- src/net/eathena/beinghandler.cpp | 4 +++- 4 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src') 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(beingType), static_cast(job)); break; case BeingType::CHAT: - case BeingType::PET: case BeingType::HOMUN: default: type = ActorType::Monster; -- cgit v1.2.3-60-g2f50