diff --git a/ryzom/server/src/ai_service/ai_mgr_pet.cpp b/ryzom/server/src/ai_service/ai_mgr_pet.cpp index f272d6069..f35647e5f 100644 --- a/ryzom/server/src/ai_service/ai_mgr_pet.cpp +++ b/ryzom/server/src/ai_service/ai_mgr_pet.cpp @@ -327,7 +327,7 @@ void CPetSpawnMsgImp::callback(std::string const& name, NLNET::TServiceId id) CEntityId id = botPet->getSpawn()->getEntityId(); float t = 0; uint8 cont = 0; - uint8 one = 1; + uint8 one = 0; sint32 x = position.x(); sint32 y = position.y(); sint32 z = position.h(); diff --git a/ryzom/server/src/entities_game_service/admin.cpp b/ryzom/server/src/entities_game_service/admin.cpp index 4272d6807..8375b4f91 100644 --- a/ryzom/server/src/entities_game_service/admin.cpp +++ b/ryzom/server/src/entities_game_service/admin.cpp @@ -4255,8 +4255,9 @@ ENTITY_VARIABLE(Invisible, "Invisibility of a player") CCharacter *c = dynamic_cast(e); uint64 val; + bool isVisible = R2_VISION::isEntityVisibleToPlayers(e->getWhoSeesMe()); - if (value=="1" || value=="on" || strlwr(value)=="true" ) + if (value=="1" || value=="on" || strlwr(value)=="true" || (strlwr(value)=="toggle" && isVisible)) { if (c != NULL) c->setInvisibility(true); @@ -4283,7 +4284,7 @@ ENTITY_VARIABLE(Invisible, "Invisibility of a player") val=0; } } - else if (value=="0" || value=="off" || strlwr(value)=="false" ) + else if (value=="0" || value=="off" || strlwr(value)=="false" || strlwr(value)=="toggle") { if (c != NULL) c->setInvisibility(false); @@ -4443,15 +4444,17 @@ ENTITY_VARIABLE (God, "God mode, invulnerability") } else { - if (value=="1" || value=="on" || strlwr(value)=="god" || strlwr(value)=="true" ) + if (value=="1" || value=="on" || strlwr(value)=="god" || strlwr(value)=="true" || (strlwr(value)=="toggle" && !c->godMode())) { c->setGodModeSave(true); c->setGodMode(true); + c->setBonusMalusName("god", c->addEffectInDB(CSheetId("berserk.sbrick"), true)); } - else if (value=="0" || value=="off" || strlwr(value)=="false" ) + else if (value=="0" || value=="off" || strlwr(value)=="false" || strlwr(value)=="toggle") { c->setGodModeSave(false); c->setGodMode(false); + c->removeEffectInDB(c->getBonusMalusName("god"), true); } nlinfo ("%s %s now in god mode", entity.toString().c_str(), c->godMode()?"is":"isn't"); } @@ -4468,13 +4471,15 @@ ENTITY_VARIABLE (Invulnerable, "Invulnerable mode, invulnerability too all") } else { - if (value=="1" || value=="on" || strlwr(value)=="invulnerable" || strlwr(value)=="true" ) + if (value=="1" || value=="on" || strlwr(value)=="invulnerable" || strlwr(value)=="true" || (strlwr(value)=="toggle" && !c->invulnerableMode())) { c->setInvulnerableMode(true); + c->setBonusMalusName("invulnerability", c->addEffectInDB(CSheetId("invulnerability.sbrick"), true)); } - else if (value=="0" || value=="off" || strlwr(value)=="false" ) + else if (value=="0" || value=="off" || strlwr(value)=="false" || strlwr(value)=="toggle") { c->setInvulnerableMode(false); + c->removeEffectInDB(c->getBonusMalusName("invulnerability"), true); } nlinfo ("%s %s now in invulnerable mode", entity.toString().c_str(), c->invulnerableMode()?"is":"isn't"); } diff --git a/ryzom/server/src/entities_game_service/entity_manager/entity_base.h b/ryzom/server/src/entities_game_service/entity_manager/entity_base.h index 71885694f..c2eb25dda 100644 --- a/ryzom/server/src/entities_game_service/entity_manager/entity_base.h +++ b/ryzom/server/src/entities_game_service/entity_manager/entity_base.h @@ -919,6 +919,21 @@ public: void setEventSpeedVariationModifier(float value) { _EventSpeedVariationModifier = value; } float getEventSpeedVariationModifier() { return _EventSpeedVariationModifier; } + void setBonusMalusName(const std::string& name, sint8 id) + { + if (id == -1) + _BonusMalusNames.erase(name); + else + _BonusMalusNames[name] = id; + } + + sint8 getBonusMalusName(const std::string& name) + { + if (_BonusMalusNames.find(name) != _BonusMalusNames.end()) + return _BonusMalusNames[name]; + return -1; + } + /// change the outpost alias virtual void setOutpostAlias( uint32 id ); /// get the outpost alias @@ -1072,6 +1087,8 @@ protected: } IdAndSide; }; CMirrorPropValueAlice< uint16, CPropLocationPacked<2> > _OutpostInfos; + + std::map _BonusMalusNames; }; diff --git a/ryzom/server/src/entities_game_service/entity_manager/entity_callbacks.cpp b/ryzom/server/src/entities_game_service/entity_manager/entity_callbacks.cpp index 5c20c35cd..eccc881e7 100644 --- a/ryzom/server/src/entities_game_service/entity_manager/entity_callbacks.cpp +++ b/ryzom/server/src/entities_game_service/entity_manager/entity_callbacks.cpp @@ -704,6 +704,14 @@ void finalizeClientReady( uint32 userId, uint32 index ) delete CmdDisplayer; delete CmdLogger; } + + if (c->godMode()) + c->setBonusMalusName("god", c->addEffectInDB(CSheetId("berserk.sbrick"), true)); + + if (c->invulnerableMode()) + c->setBonusMalusName("invulnerability", c->addEffectInDB(CSheetId("invulnerability.sbrick"), true)); + + c->setFinalized(true); } // finalizeClientReady // 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 12080d645..057f3fef0 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -7590,6 +7590,7 @@ void CCharacter::sendAnimalCommand(uint8 petIndexCode, uint8 command) { case ANIMALS_ORDERS::ENTER_BAG: + _PlayerPets[petIndex].PetStatus = CPetAnimal::in_bag; if (_PlayerPets[petIndex].IsInBag) continue; 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 df65f9922..735a6ceb1 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.h +++ b/ryzom/server/src/entities_game_service/player_manager/character.h @@ -313,7 +313,7 @@ struct CPetAnimal DECLARE_PERSISTENCE_METHODS - enum TStatus { db_unknown = -1, not_present = 0, waiting_spawn, landscape, stable, death, tp_continent }; + enum TStatus { db_unknown = -1, not_present = 0, waiting_spawn, landscape, stable, death, tp_continent, in_bag }; TStatus PetStatus; NLMISC::CSheetId TicketPetSheetId; 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 88cdb5ceb..254966cf3 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 @@ -727,6 +727,7 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons LPROP(bool,IsFollowing,if(IsFollowing))\ LPROP(bool,IsMounted,if(IsMounted))\ PROP(bool,IsTpAllowed)\ + PROP(bool,IsInBag)\ PROP(TSatiety,Satiety)\ PROP2(CustomName, ucstring, CustomName, CustomName = val)\