diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-11-08 23:40:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-11-08 23:40:50 +0300 |
commit | 80792e881942a1cdbc10050177df888bbad44a9e (patch) | |
tree | 2477945c0a6d3bc50c46fd9aeb9d52d87d5b52d1 /src | |
parent | 7ca06be4b1a8dab21d21ddbab078ef7fed8cd1f8 (diff) | |
download | mv-80792e881942a1cdbc10050177df888bbad44a9e.tar.gz mv-80792e881942a1cdbc10050177df888bbad44a9e.tar.bz2 mv-80792e881942a1cdbc10050177df888bbad44a9e.tar.xz mv-80792e881942a1cdbc10050177df888bbad44a9e.zip |
Add npc option for allow equipment.
New option: allowEquipment
Default value: false
Diffstat (limited to 'src')
-rw-r--r-- | src/being/being.cpp | 4 | ||||
-rw-r--r-- | src/being/being.h | 4 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 25 | ||||
-rw-r--r-- | src/resources/beinginfo.cpp | 3 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 7 | ||||
-rw-r--r-- | src/resources/db/npcdb.cpp | 3 |
6 files changed, 33 insertions, 13 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 4f115a6d3..429201cf2 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -272,7 +272,8 @@ Being::Being(const BeingId id, mAway(false), mInactive(false), mNeedPosUpdate(true), - mBotAi(true) + mBotAi(true), + mAllowNpcEquipment(false) { for (int f = 0; f < 20; f ++) { @@ -462,6 +463,7 @@ void Being::setSubtype(const BeingTypeId subtype, DisplayType::Item, std::string()); mYDiff = mInfo->getSortOffsetY(); + mAllowNpcEquipment = mInfo->getAllowEquipment(); } break; case ActorType::Avatar: diff --git a/src/being/being.h b/src/being/being.h index 775c875f9..feb686740 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1097,6 +1097,9 @@ class Being notfinal : public ActorSprite, void fixDirectionOffsets(int &offsetX, int &offsetY) const; + bool getAllowNpcEquipment() const noexcept2 A_WARN_UNUSED + { return mAllowNpcEquipment; } + static Being *createBeing(const BeingId id, const ActorTypeT type, const BeingTypeId subtype, @@ -1377,6 +1380,7 @@ class Being notfinal : public ActorSprite, bool mInactive; bool mNeedPosUpdate; bool mBotAi; + bool mAllowNpcEquipment; }; extern std::list<BeingCacheEntry*> beingInfoCache; diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 7a91b413b..b1daece88 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -131,17 +131,20 @@ static void setBasicFields(Being *restrict const dstBeing, { dstBeing->setGender(Being::intToGender(gender)); } - dstBeing->setHairColor(hairColor); - dstBeing->setHairStyle(SPRITE_HAIR_COLOR, -hairStyle); - // for npc not checking updateSlots flag, - // probably because npc missing visible packet if moving - dstBeing->updateSprite(SPRITE_WEAPON, headBottom); - dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid); - dstBeing->updateSprite(SPRITE_CLOTHES_COLOR, headTop); - dstBeing->updateSprite(SPRITE_HAIR, shoes); - dstBeing->updateSprite(SPRITE_SHOES, gloves); - dstBeing->updateSprite(SPRITE_BODY, weapon); - dstBeing->setWeaponId(weapon); + if (dstBeing->getAllowNpcEquipment()) + { + dstBeing->setHairColor(hairColor); + dstBeing->setHairStyle(SPRITE_HAIR_COLOR, -hairStyle); + // for npc not checking updateSlots flag, + // probably because npc missing visible packet if moving + dstBeing->updateSprite(SPRITE_WEAPON, headBottom); + dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid); + dstBeing->updateSprite(SPRITE_CLOTHES_COLOR, headTop); + dstBeing->updateSprite(SPRITE_HAIR, shoes); + dstBeing->updateSprite(SPRITE_SHOES, gloves); + dstBeing->updateSprite(SPRITE_BODY, weapon); + dstBeing->setWeaponId(weapon); + } break; default: case ActorType::Monster: diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 6c082d85f..6e28e37be 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -106,7 +106,8 @@ BeingInfo::BeingInfo() : mQuickActionEffectId(-1), mStaticMaxHP(false), mTargetSelection(true), - mAllowDelete(true) + mAllowDelete(true), + mAllowEquipment(false) { SpriteDisplay display; display.sprites.push_back(SpriteReference::Empty); diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index bd60131c8..b4139d0b4 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -320,6 +320,12 @@ class BeingInfo final int getAllowDelete() const noexcept2 A_WARN_UNUSED { return static_cast<int>(mAllowDelete); } + void setAllowEquipment(const bool b) + { mAllowEquipment = b; } + + bool getAllowEquipment() const noexcept2 A_WARN_UNUSED + { return mAllowEquipment; } + void setQuickActionEffectId(const int n) { mQuickActionEffectId = n; } @@ -396,6 +402,7 @@ class BeingInfo final bool mStaticMaxHP; bool mTargetSelection; bool mAllowDelete; + bool mAllowEquipment; }; typedef std::map<BeingTypeId, BeingInfo*> BeingInfos; diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index 26034de12..3432ed4b5 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -118,6 +118,9 @@ void NPCDB::loadXmlFile(const std::string &fileName, currentInfo->setAllowDelete(XML::getBoolProperty(npcNode, "allowDelete", true)); + currentInfo->setAllowEquipment(XML::getBoolProperty(npcNode, + "allowEquipment", false)); + const std::string currency = XML::getProperty(npcNode, "currency", "default"); if (UnitsDb::existsCurrency(currency) == false) |