From 0f74f6264081680017702e7e6769eb554a26f349 Mon Sep 17 00:00:00 2001 From: Nuno Date: Fri, 23 Apr 2021 22:40:09 +0200 Subject: [PATCH] Merge branch 'ark' --- .../game_item_manager/game_item.cpp | 2 ++ .../game_item_manager/game_item.h | 6 +++++ .../mission_manager/mission_item.cpp | 18 +++++++++++---- .../mission_manager/mission_item.h | 4 +++- .../mission_manager/missions_commands.cpp | 16 +++++++++----- .../player_manager/character.cpp | 22 +++++++++++++++++-- .../player_manager/character.h | 12 ++++++++-- .../player_manager/persistent_player_data.cpp | 1 + 8 files changed, 66 insertions(+), 15 deletions(-) diff --git a/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp b/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp index 72c872496..9eb09a2be 100644 --- a/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp +++ b/ryzom/server/src/entities_game_service/game_item_manager/game_item.cpp @@ -1253,6 +1253,7 @@ CGameItemPtr CGameItem::getItemCopy() item->_LostHPremains = 0.0f; item->_PhraseId = _PhraseId; item->_RequiredFaction = _RequiredFaction; + item->_RequiredPowo = _RequiredPowo; item->computeItemWornState(); log_Item_Create(item->getItemId(), item->getSheetId(), item->getStackSize(), item->quality()); @@ -1428,6 +1429,7 @@ void CGameItem::clear() _TypeSkillMods.clear(); _PhraseId.clear(); _RequiredFaction.clear(); + _RequiredPowo.clear(); _CustomText.clear(); } diff --git a/ryzom/server/src/entities_game_service/game_item_manager/game_item.h b/ryzom/server/src/entities_game_service/game_item_manager/game_item.h index 41bce3793..f9c12f5e6 100644 --- a/ryzom/server/src/entities_game_service/game_item_manager/game_item.h +++ b/ryzom/server/src/entities_game_service/game_item_manager/game_item.h @@ -691,6 +691,11 @@ public : /// set Required Faction inline void setRequiredFaction(const std::string & str){ _RequiredFaction = str;} + /// get Required Powo + inline const std::string & getRequiredPowo() const { return _RequiredPowo;} + /// set Required Pow + inline void setRequiredPowo(const std::string & str){ _RequiredPowo = str;} + inline bool getLockedByOwner() const { return _LockedByOwner; } void setLockedByOwner(bool value); @@ -964,6 +969,7 @@ private: // required skill bool _UseNewSystemRequirement; std::string _RequiredFaction; + std::string _RequiredPowo; SKILLS::ESkills _RequiredSkill; uint16 _RequiredSkillLevel; SKILLS::ESkills _RequiredSkill2; diff --git a/ryzom/server/src/entities_game_service/mission_manager/mission_item.cpp b/ryzom/server/src/entities_game_service/mission_manager/mission_item.cpp index 9bfd77075..8ce4d1c9e 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/mission_item.cpp +++ b/ryzom/server/src/entities_game_service/mission_manager/mission_item.cpp @@ -59,7 +59,7 @@ bool CMissionItem::buildFromScript(const std::vector & script) { MISLOG("Invalid sitem sheet '%s'", (script[0]+".sitem").c_str()); return false; } - + NLMISC::fromString(script[1], _Quality); _NoDrop = script[2] == "0"; @@ -67,7 +67,7 @@ bool CMissionItem::buildFromScript(const std::vector & script) { if (script.size() > 3) { vector vars; NLMISC::splitString(script[3], ",", vars); - + for (uint i = 0; i < vars.size(); i++) { vector args; @@ -79,6 +79,10 @@ bool CMissionItem::buildFromScript(const std::vector & script) { _CustomName.fromUtf8(hex_decode(args[1])); else if(!nlstricmp(args[0], "CustomText")) _CustomText.fromUtf8(hex_decode(args[1])); + else if(!nlstricmp(args[0], "RequiredFaction")) + _RequiredFaction = args[1]; + else if(!nlstricmp(args[0], "RequiredPowo")) + _RequiredPowo = args[1]; else { float value; @@ -189,7 +193,7 @@ bool CMissionItem::buildFromScript(const std::vector & script) { } } } - + return true; }// CMissionItem::buildFromScript @@ -223,7 +227,7 @@ CGameItemPtr CMissionItem::createItem(uint16 quantity) nlwarning(" could not create mission item"); return NULL; } - + setItemParam(item); return item; }// CMissionItem::createItem @@ -274,6 +278,12 @@ void CMissionItem::setItemParam(CGameItemPtr item) if (!_CustomName.empty()) item->setCustomName(_CustomName); + + if (!_RequiredFaction.empty()) + item->setRequiredFaction(_RequiredFaction); + + if (!_RequiredPowo.empty()) + item->setRequiredPowo(_RequiredPowo); } }// CMissionItem::setItemParam diff --git a/ryzom/server/src/entities_game_service/mission_manager/mission_item.h b/ryzom/server/src/entities_game_service/mission_manager/mission_item.h index e1d711d3c..ff8ac76f0 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/mission_item.h +++ b/ryzom/server/src/entities_game_service/mission_manager/mission_item.h @@ -48,7 +48,7 @@ private: // set a created item parameter void setItemParam(CGameItemPtr item); - + /// sheet describing the item type NLMISC::CSheetId _SheetId; /// parameters of the item @@ -63,6 +63,8 @@ private: NLMISC::CSheetId _SPhraseId; ucstring _CustomText; ucstring _CustomName; + std::string _RequiredFaction; + std::string _RequiredPowo; }; diff --git a/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp b/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp index 9bd005208..31ea533cf 100644 --- a/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp +++ b/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp @@ -825,7 +825,6 @@ NLMISC_COMMAND(getItemList, "get list of items of character by filter", " [ CInventoryPtr childSrc = c->getInventory(inventories[i]); if (childSrc != NULL) { - uint32 k = 0; log.displayNL("#%s", INVENTORIES::toString(inventories[i]).c_str()); for (uint j = 0; j < childSrc->getSlotCount(); j++) @@ -1657,7 +1656,7 @@ NLMISC_COMMAND(setFaction, "set the faction of player", " [] } //---------------------------------------------------------------------------- -NLMISC_COMMAND(accessPowo, "give access to the powo", " [playername] [instance] [exit_pos] [can_xp,cant_dead,can_teleport,can_speedup] [access_room_inv,access_guild_room] [scope]") +NLMISC_COMMAND(accessPowo, "give access to the powo", " [playername] [instance] [exit_pos] [can_xp,cant_dead,can_teleport,can_speedup,can_dp,onetry] [access_room_inv,access_guild_room] [scope]") { if (args.size() < 2) return false; @@ -1670,12 +1669,12 @@ NLMISC_COMMAND(accessPowo, "give access to the powo", " [playername] [insta else building = CBuildingManager::getInstance()->getBuildingPhysicalsByName("building_instance_ZO_player_111"); - string powoFlags = "0000"; - if (args.size() > 4) + string powoFlags = "000000"; + if (args.size() > 4 && args[4].length() == 6) powoFlags = args[4]; string invFlags = "00"; - if (args.size() > 5) + if (args.size() > 5 && args[5].length() == 2) invFlags = args[5]; if (building) @@ -1701,9 +1700,12 @@ NLMISC_COMMAND(accessPowo, "give access to the powo", " [playername] [insta c->setPowoScope(args[6]); c->setPowoFlag("xp", powoFlags[0] == '1'); - c->setPowoFlag("dead", powoFlags[1] == '1'); + c->setPowoFlag("nodead", powoFlags[1] == '1'); c->setPowoFlag("teleport", powoFlags[2] == '1'); c->setPowoFlag("speed", powoFlags[3] == '1'); + c->setPowoFlag("dp", powoFlags[4] == '1'); + c->setPowoFlag("retry", powoFlags[5] == '1'); + c->setPowoFlag("room_inv", invFlags[0] == '1'); c->setPowoFlag("guild_inv", invFlags[1] == '1'); @@ -3357,6 +3359,8 @@ NLMISC_COMMAND(spawnPlayerPet, "spawn player pet", " ") uint32 index; fromString(args[1], index); + c->setPetStatus(index, CPetAnimal::waiting_spawn); + c->updateOnePetDatabase(index, false); c->removeAnimalIndex(index, CPetCommandMsg::DESPAWN); c->setAnimalPosition(index, c->getState().X, c->getState().Y); if (!c->spawnCharacterAnimal(index)) diff --git a/ryzom/server/src/entities_game_service/player_manager/character.cpp b/ryzom/server/src/entities_game_service/player_manager/character.cpp index 83f505937..f914c54f8 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -573,7 +573,7 @@ CCharacter::CCharacter() _DeathPenaltyTimer.setRemaining(1, new CDeathPenaltiesTimerEvent(this), 1); _BarUpdateTimer.setRemaining(1, new CCharacterBarUpdateTimerEvent(this), 1); _BuildingExitZone = 0xffff; - _BuildingExitPos = CVector(); + _BuildingExitPos = CVector(0, 0, 0); _BuildingExitPos.x = 0; _BuildingExitPos.y = 0; _RespawnMainLandInTown = false; @@ -5694,6 +5694,25 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi _PowoCell = 0; CBuildingManager::getInstance()->removePlayerFromRoom(this, false); getRespawnPoints().setArkRespawnpoint(0, 0, 0); + + CInventoryPtr childSrc = getInventory(INVENTORIES::bag); + if (childSrc != NULL) + { + for (uint j = 0; j < childSrc->getSlotCount(); j++) + { + CGameItemPtr itemPtr = childSrc->getItem(j); + if (itemPtr != NULL) + { + if (!itemPtr->getRequiredPowo().empty()) + { + if (itemPtr->getRequiredPowo() != _PowoScope) + GameItemManager.destroyItem(itemPtr); + else + unequipCharacter(childSrc->getInventoryId(), itemPtr->getRefInventorySlot()); + } + } + } + } } else if (_PowoCell == 0) CBuildingManager::getInstance()->removePlayerFromRoom(this); @@ -21313,7 +21332,6 @@ uint32 CPetAnimal::getAnimalMaxBulk() if (formBag) { - // zig inventories have bulk proportionnal to size (size is 1->250) if (creatureBagSheet == CSheetId("zig_inventory.sitem")) return formBag->BulkMax*1.5; return formBag->BulkMax; diff --git a/ryzom/server/src/entities_game_service/player_manager/character.h b/ryzom/server/src/entities_game_service/player_manager/character.h index 04d78dd98..f5453b77f 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.h +++ b/ryzom/server/src/entities_game_service/player_manager/character.h @@ -4099,6 +4099,7 @@ private: bool _PowoCanTeleport; bool _PowoCanSpeedUp; bool _PowoCanDP; + bool _PowoCanRetry; bool _PowoCanAccesRoomInv; bool _PowoCanAccessGuildInv; @@ -4160,7 +4161,7 @@ public: if (flag == "xp") return _PowoCanXP; - if (flag == "dead") + if (flag == "nodead") return _PowoCantDead; if (flag == "teleport") @@ -4172,6 +4173,9 @@ public: if (flag == "dp") return _PowoCanDP; + if (flag == "retry") + return _PowoCanRetry; + if (flag == "guild_inv") return _PowoCanAccessGuildInv; @@ -4186,7 +4190,7 @@ public: if (flag == "xp") _PowoCanXP = value; - else if (flag == "dead") + else if (flag == "nodead") _PowoCantDead = value; else if (flag == "teleport") @@ -4198,6 +4202,9 @@ public: else if (flag == "dp") _PowoCanDP = value; + else if (flag == "retry") + _PowoCanRetry = value; + else if (flag == "guild_inv") _PowoCanAccessGuildInv = value; @@ -4214,6 +4221,7 @@ public: _PowoCanTeleport = false; _PowoCanSpeedUp = false; _PowoCanDP = false; + _PowoCanRetry = true; } void resetTodayGuildPoints() diff --git a/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp b/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp index 0a0e68d43..46bbf874d 100644 --- a/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp +++ b/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp @@ -1388,6 +1388,7 @@ private: PROP2(_CreatorId, CEntityId, _CreatorId, _CreatorId=val)\ PROP2(_PhraseId, string, _PhraseId, _PhraseId=val)\ PROP2(_RequiredFaction, string, _RequiredFaction, _RequiredFaction=val)\ + PROP2(_RequiredPowo, string, _RequiredPowo, _RequiredPowo=val)\ LSTRUCT2(_CraftParameters, if (_CraftParameters != NULL), _CraftParameters->store(pdr), _CraftParameters = new CItemCraftParameters; _CraftParameters->apply(pdr))\ LPROP2(_SlotImage, uint16, if (0), 0xffff, slotImage=val)\ LPROP2(_SapLoad, uint32, if (_SapLoad!=0), _SapLoad, _SapLoad=val)\