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 f502b354a..3edfaf0e2 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 @@ -711,8 +711,6 @@ void finalizeClientReady( uint32 userId, uint32 index ) if (c->invulnerableMode()) c->setBonusMalusName("invulnerability", c->addEffectInDB(CSheetId("invulnerability.sbrick"), true)); - c->updateJewelsTags(false); - c->setFinalized(true); } // finalizeClientReady // 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 c4d5dccd1..d6085fddb 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 @@ -37,6 +37,7 @@ #include "team_manager/team_manager.h" #include "weather_everywhere.h" #include "death_penalties.h" +#include "harvest_source.h" #include "mission_manager/mission_team.h" #include "mission_manager/mission_step_ai.h" #include "mission_manager/mission_guild.h" @@ -1039,6 +1040,7 @@ NLMISC_COMMAND(enchantEquipedItem, "enchantEquipedItem", " applyEnchantment(sheets); + c->updateJewelsTags(false); log.displayNL("OK"); return true; } @@ -4268,3 +4270,26 @@ NLMISC_COMMAND(manageBuilding, "Manage a building", " ") log.displayNL("OK"); return true; } + + +NLMISC_COMMAND(despawnTargetSource, "Despawn the target source", "") +{ + if (args.size() < 1) return false; + + GET_ACTIVE_CHARACTER + const CEntityId &target = c->getTarget(); + if (target.getType() == RYZOMID::forageSource) + { + TDataSetRow sourceRowId = c->getTargetDataSetRow(); + CHarvestSource *source = CHarvestSourceManager::getInstance()->getEntity( sourceRowId ); + if (!source->wasProspected()) + { + source->spawnEnd(false); + log.displayNL("OK"); + return true; + } + } + + log.displayNL("ERR"); + return true; +} 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 bb94e2772..fc6e5f63f 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -89,6 +89,7 @@ #include "entities_game_service/egs_variables.h" #include "entity_matrix.h" #include "forage_progress.h" +#include "harvest_source.h" #include "game_event_manager.h" #include "game_item_manager/player_inv_pet.h" #include "game_item_manager/player_inv_temp.h" @@ -14895,6 +14896,8 @@ string CCharacter::getTargetInfos() msg += "n|"; else if (target.getType() == RYZOMID::player) msg += "p|"; + else if (target.getType() == RYZOMID::forageSource) + msg += "s|"; else msg += "0"; @@ -14932,6 +14935,21 @@ string CCharacter::getTargetInfos() msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d|", dist, x, y, z, h, cell)+cTarget->getType().toString()+"|"+EGSPD::CPeople::toString(cTarget->getRace())+"|"+toString("%d", cTarget->getGender()); } } + else if (target.getType() == RYZOMID::forageSource) + { + TDataSetRow sourceRowId = getTargetDataSetRow(); + CHarvestSource *source = CHarvestSourceManager::getInstance()->getEntity( sourceRowId ); + + float x = source->pos().x; + float y = source->pos().y; + double dist = sqrt((p_x-x)*(p_x-x)+(p_y-y)*(p_y-y)); + + msg += toString("%.2f|%.2f|%.2f|", dist, x, y)+source->materialSheet().toString()+"|"+toString("%.2f|%.2f|%.2f|%u|", source->quantity(), source->quality(), source->maxQuality(), source->timeToLive()); + if (source->wasProspected()) + msg += "1"; + else + msg += "0"; + } else { string name; @@ -17998,6 +18016,8 @@ void CCharacter::clearIgnoreList() //-------------------------------------------------------------- void CCharacter::online(bool onlineStatus) { + _AreOnline = onlineStatus; + // send contact list init if goind online if (onlineStatus) sendContactListInit(); @@ -21196,9 +21216,9 @@ void CCharacter::updateParry(ITEMFAMILY::EItemFamily family, SKILLS::ESkills ski } //---------------------------------------------------------------------------- -void CCharacter::updateJewelsTags(bool remove) +void CCharacter::updateJewelsTags(bool remove, bool update) { - if (!getEnterFlag()) + if (!getEnterFlag() || !getOnLineStatus()) return; string tagA = getTagA(); @@ -21222,9 +21242,13 @@ void CCharacter::updateJewelsTags(bool remove) setTagB(sbrickParam->Value); } - if (getTagA() != tagA || getTagB() != tagB) + if (!update) + return; + + if (getTagA() != tagA || getTagB() != tagB) { registerName(); } +} //---------------------------------------------------------------------------- void CCharacter::updateMagicProtectionAndResistance() 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 d93383dfb..62b8ed34e 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character.h +++ b/ryzom/server/src/entities_game_service/player_manager/character.h @@ -706,6 +706,12 @@ public: */ bool getEnterFlag() const; + /** + * Get the online status + * \return true if the player are in the game, false if he left + */ + bool getOnLineStatus() const; + /** * wrapper to CEntityBase */ @@ -2423,7 +2429,7 @@ public: void updateParry(ITEMFAMILY::EItemFamily family, SKILLS::ESkills skill); // Jewel enchants used for Tags - void updateJewelsTags(bool remove); + void updateJewelsTags(bool remove, bool update=true); // Jewel equipment or skill or region are changed, recompute protection and resistances void updateMagicProtectionAndResistance(); @@ -3588,6 +3594,8 @@ private: std::vector _CheckPos; + bool _AreOnline; + // for a power/combat event, stores start and end ticks struct CFlagTickRange { diff --git a/ryzom/server/src/entities_game_service/player_manager/character_inlines.h b/ryzom/server/src/entities_game_service/player_manager/character_inlines.h index 43e7a8f0e..8354017f6 100644 --- a/ryzom/server/src/entities_game_service/player_manager/character_inlines.h +++ b/ryzom/server/src/entities_game_service/player_manager/character_inlines.h @@ -82,6 +82,11 @@ inline bool CCharacter::getEnterFlag() const return _Enter; } +inline bool CCharacter::getOnLineStatus() const +{ + return _AreOnline; +} + //------------------------------------------------------------------------------ //inline CEntityState& CCharacter::getState()