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 c92903129..b045e3ece 100644
--- a/ryzom/server/src/entities_game_service/player_manager/character.cpp
+++ b/ryzom/server/src/entities_game_service/player_manager/character.cpp
@@ -18,135 +18,138 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+
+
#include "stdpch.h"
/////////////
// INCLUDE //
/////////////
-// Misc
-#include "nel/misc/i_xml.h"
-#include "nel/misc/md5.h"
+//Misc
#include "nel/misc/o_xml.h"
+#include "nel/misc/i_xml.h"
#include "nel/misc/path.h"
+#include "nel/misc/md5.h"
#include "nel/misc/sha1.h"
-#include "nel/misc/sstring.h"
-#include "nel/misc/vector_2d.h"
#include "nel/misc/vectord.h"
+#include "nel/misc/vector_2d.h"
+#include "nel/misc/sstring.h"
-// Nel georges
+//Nel georges
#include "nel/georges/u_form.h"
#include "limits.h"
+
+#include "server_share/used_continent.h"
+#include "server_share/msg_brick_service.h"
#include "game_share/msg_client_server.h"
#include "game_share/slot_equipment.h"
-#include "server_share/msg_brick_service.h"
-#include "server_share/used_continent.h"
//#include "game_share/chat_static_database.h"
+#include "game_share/inventories.h"
+#include "server_share/stats_status.h"
+#include "game_share/gender.h"
+#include "game_share/chat_group.h"
+#include "server_share/npc_description_messages.h"
+#include "game_share/roles.h"
+#include "game_share/guild_grade.h"
+#include "game_share/fame.h"
+#include "game_share/send_chat.h"
+#include "game_share/animals_orders.h"
#include "game_share/animal_status.h"
#include "game_share/animal_type.h"
-#include "game_share/animals_orders.h"
-#include "game_share/character_sync_itf.h"
+#include "game_share/rolemaster_flags.h"
+#include "game_share/time_weather_season/time_and_season.h"
+#include "game_share/visual_fx.h"
+#include "game_share/interface_flags.h"
#include "game_share/chat_group.h"
#include "game_share/entity_types.h"
-#include "game_share/fame.h"
-#include "game_share/gender.h"
-#include "game_share/guild_grade.h"
-#include "game_share/interface_flags.h"
-#include "game_share/inventories.h"
-#include "game_share/mainland_summary.h"
#include "game_share/mount_people.h"
#include "game_share/pvp_mode.h"
-#include "game_share/rolemaster_flags.h"
-#include "game_share/roles.h"
-#include "game_share/send_chat.h"
-#include "game_share/shard_names.h"
-#include "game_share/time_weather_season/time_and_season.h"
#include "game_share/utils.h"
-#include "game_share/visual_fx.h"
-#include "server_share/npc_description_messages.h"
-#include "server_share/stats_status.h"
+#include "game_share/shard_names.h"
+#include "game_share/character_sync_itf.h"
+#include "game_share/mainland_summary.h"
#include "game_share/r2_share_itf.h"
#include "server_share/r2_vision.h"
-#include "admin.h"
-#include "admin_log.h"
-#include "backward_compatibility/places_back_compat.h"
-#include "building_manager/building_manager.h"
-#include "building_manager/room_instance.h"
+#include "egs_sheets/egs_sheets.h"
+#include "player_manager/character.h"
+#include "player_manager/player_manager.h"
+#include "player_manager/player.h"
+#include "creature_manager/creature_manager.h"
+#include "team_manager/team_manager.h"
+#include "phrase_manager/phrase_manager.h"
+#include "egs_progress_callback.h"
#include "cdb_check_sum.h"
+#include "player_manager/cdb_branch.h"
#include "cdb_struct_banks.h"
-#include "character_tick_update_timer_event.h"
-#include "creature_manager/creature_manager.h"
-#include "death_penalties.h"
-#include "dyn_chat_egs.h"
#include "egs_mirror.h"
-#include "egs_progress_callback.h"
-#include "egs_sheets/egs_sheets.h"
-#include "entities_game_service.h"
-#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"
-#include "game_item_manager/player_inv_xchg.h"
+#include "mission_manager/mission_manager.h"
+#include "shop_type/shop_type_manager.h"
+#include "zone_manager.h"
+#include "player_manager/action_distance_checker.h"
+#include "phrase_manager/s_phrase.h"
+#include "phrase_manager/phrase_utilities_functions.h"
+#include "phrase_manager/available_phrases.h"
+#include "phrase_manager/s_effect.h"
+#include "phrase_manager/mod_magic_protection_effet.h"
#include "guild_manager/fame_manager.h"
+#include "forage_progress.h"
+#include "progression/progression_pve.h"
+#include "progression/progression_pvp.h"
+#include "player_manager/character_respawn_points.h"
+#include "mission_manager/mission_log.h"
+#include "entity_matrix.h"
+#include "stables/stable.h"
+#include "building_manager/building_manager.h"
+#include "world_instances.h"
+#include "pvp_manager/pvp_manager_2.h"
+#include "pvp_manager/pvp_manager.h"
+#include "pvp_manager/pvp.h"
#include "guild_manager/guild_manager.h"
#include "guild_manager/guild_member_module.h"
-#include "inter_shard_exchange_validator.h"
-#include "item_service_manager.h"
-#include "mission_manager/mission_guild.h"
-#include "mission_manager/mission_log.h"
-#include "mission_manager/mission_manager.h"
+#include "building_manager/room_instance.h"
#include "mission_manager/mission_solo.h"
#include "mission_manager/mission_team.h"
+#include "mission_manager/mission_guild.h"
+#include "character_tick_update_timer_event.h"
+#include "mission_manager/mission_team.h"
#include "mission_pd.h"
-#include "modules/char_name_mapper_client.h"
-#include "modules/client_command_forwarder.h"
-#include "modules/r2_give_item.h"
-#include "modules/shard_unifier_client.h"
-#include "phrase_manager/available_phrases.h"
-#include "phrase_manager/mod_magic_protection_effet.h"
-#include "phrase_manager/phrase_manager.h"
-#include "phrase_manager/phrase_utilities_functions.h"
-#include "phrase_manager/s_effect.h"
-#include "phrase_manager/s_link_effect.h"
-#include "phrase_manager/s_phrase.h"
-#include "player_manager/action_distance_checker.h"
-#include "player_manager/admin_properties.h"
-#include "player_manager/cdb_branch.h"
-#include "player_manager/character.h"
+#include "shop_type/offline_character_command.h"
+#include "player_manager/character_version_adapter.h"
+#include "backward_compatibility/places_back_compat.h"
+#include "dyn_chat_egs.h"
#include "player_manager/character_encyclopedia.h"
#include "player_manager/character_game_event.h"
-#include "player_manager/character_respawn_points.h"
-#include "player_manager/character_version_adapter.h"
-#include "player_manager/gear_latency.h"
-#include "player_manager/player.h"
-#include "player_manager/player_manager.h"
+#include "shop_type/character_shopping_list.h"
#include "player_manager/player_room.h"
+#include "entities_game_service.h"
+#include "shop_type/items_for_sale.h"
+#include "player_manager/admin_properties.h"
+#include "admin.h"
+#include "death_penalties.h"
+#include "player_manager/gear_latency.h"
#include "primitives_parser.h"
-#include "progression/progression_pve.h"
-#include "progression/progression_pvp.h"
-#include "pvp_manager/pvp.h"
+#include "phrase_manager/s_link_effect.h"
+#include "item_service_manager.h"
+#include "game_item_manager/player_inv_temp.h"
+#include "game_item_manager/player_inv_pet.h"
+#include "game_item_manager/player_inv_xchg.h"
+#include "outpost_manager/outpost_manager.h"
+#include "game_event_manager.h"
+#include "stat_db.h"
#include "pvp_manager/pvp_faction_reward_manager/pvp_faction_reward_manager.h"
-#include "pvp_manager/pvp_manager.h"
-#include "pvp_manager/pvp_manager_2.h"
+#include "entities_game_service/egs_variables.h"
+#include "modules/shard_unifier_client.h"
+#include "modules/r2_give_item.h"
+#include "modules/char_name_mapper_client.h"
+#include "inter_shard_exchange_validator.h"
+#include "modules/client_command_forwarder.h"
#include "server_share/log_character_gen.h"
#include "server_share/log_item_gen.h"
-#include "server_share/mongo_wrapper.h"
-#include "shop_type/character_shopping_list.h"
-#include "shop_type/items_for_sale.h"
-#include "shop_type/offline_character_command.h"
-#include "shop_type/shop_type_manager.h"
-#include "stables/stable.h"
-#include "stat_db.h"
-#include "team_manager/team_manager.h"
-#include "world_instances.h"
-#include "zone_manager.h"
///////////
// USING //
@@ -159,14 +162,13 @@ using namespace EGSPD;
NL_INSTANCE_COUNTER_IMPL(CCharacter);
NLMISC::TInstanceCounterData CCharacter::CBotGift::CBotGiftInstanceCounter::_InstanceCounterData("CBotGift");
-// NLMISC::TInstanceCounterData
-// CCharacter::CCharacterDbReminder::CCharacterDbReminderInstanceCounter::_InstanceCounterData("CCharacterDbReminder");
+//NLMISC::TInstanceCounterData CCharacter::CCharacterDbReminder::CCharacterDbReminderInstanceCounter::_InstanceCounterData("CCharacterDbReminder");
/////////////
// DEFINES //
/////////////
-#define MAX_PICKED_MISSIONS 8
-#define MAX_STEPS_PER_MISSION 16
+#define MAX_PICKED_MISSIONS 8
+#define MAX_STEPS_PER_MISSION 16
//#define _DEBUG_SKILL_PROGRESSION
@@ -177,28 +179,28 @@ NLMISC::TInstanceCounterData CCharacter::CBotGift::CBotGiftInstanceCounter::_Ins
// utility function to convert a guild id into a human readable string
extern std::string guildIdToString(uint32 guildId);
-extern CPlayerManager PlayerManager;
-extern CGenericXmlMsgHeaderManager GenericMsgManager;
-extern sint32 BitPosAfterDatabaseMsgHeader;
-extern CTeamManager TeamManager;
-// extern CChatStaticDatabase ChatDatabase;
-extern bool TTSIsUp;
-extern bool UnlimitedDeathPact;
-extern float CarriedItemsDecayRatio;
-extern float CarriedItemsDecayRate;
-extern uint8 TeamMembersStatusMaxValue;
-extern CCharacterBotChatBeginEnd CharacterBotChatBeginEnd;
+extern CPlayerManager PlayerManager;
+extern CGenericXmlMsgHeaderManager GenericMsgManager;
+extern sint32 BitPosAfterDatabaseMsgHeader;
+extern CTeamManager TeamManager;
+//extern CChatStaticDatabase ChatDatabase;
+extern bool TTSIsUp;
+extern bool UnlimitedDeathPact;
+extern float CarriedItemsDecayRatio;
+extern float CarriedItemsDecayRate;
+extern uint8 TeamMembersStatusMaxValue;
+extern CCharacterBotChatBeginEnd CharacterBotChatBeginEnd;
//*** Removed by Sadge ***
-// extern CCreatureAskInformationMsg CreatureNpcInformation;
+//extern CCreatureAskInformationMsg CreatureNpcInformation;
//*** ***
-extern float MaxHarvestDistance;
-extern float MaxMountDistance;
-extern CRandom RandomGenerator;
-extern CVariable NeverAggroPriv;
-extern SKILLS::ESkills BarehandCombatSkill;
+extern float MaxHarvestDistance;
+extern float MaxMountDistance;
+extern CRandom RandomGenerator;
+extern CVariable NeverAggroPriv;
+extern SKILLS::ESkills BarehandCombatSkill;
// Variable to alter the progression factor.
-extern float SkillProgressionFactor;
+extern float SkillProgressionFactor;
extern CVariable ArkSalt;
extern CVariable TeleportWithMektoubPriv;
@@ -209,47 +211,32 @@ extern CVariable DefaultWeightHands;
extern vector Mainlands;
-CVariable SpawnedDeadMektoubDelay(
- "egs", "SpawnedDeadMektoubDelay", "nb tick before a dead mektoub despawn)", 2592000, 0, true);
-CVariable ForceQuarteringRight(
- "egs", "ForceQuarteringRight", "Allow anyone to quarter a dead creature", false, 0, true);
-CVariable AllowAnimalInventoryAccessFromAnyStable("egs", "AllowAnimalInventoryAccessFromAnyStable",
- "If true a player can access to his animal inventory (if the animal is inside a stable) from any stable over the "
- "world",
- true, 0, true);
-CVariable FreeTrialSkillLimit(
- "egs", "FreeTrialSkillLimit", "Level limit for characters belonging to free trial accounts", 125, 0, true);
-CVariable CraftFailureProbaMpLost(
- "egs", "CraftFailureProbaMpLost", "Probability de destruction de chaque MP en cas d'echec du craft", 50, 0, true);
+CVariable SpawnedDeadMektoubDelay("egs", "SpawnedDeadMektoubDelay", "nb tick before a dead mektoub despawn)", 2592000, 0, true);
+CVariable ForceQuarteringRight("egs", "ForceQuarteringRight", "Allow anyone to quarter a dead creature", false, 0, true);
+CVariable AllowAnimalInventoryAccessFromAnyStable("egs", "AllowAnimalInventoryAccessFromAnyStable", "If true a player can access to his animal inventory (if the animal is inside a stable) from any stable over the world", true, 0, true);
+CVariable FreeTrialSkillLimit("egs", "FreeTrialSkillLimit", "Level limit for characters belonging to free trial accounts", 125, 0, true);
+CVariable CraftFailureProbaMpLost("egs", "CraftFailureProbaMpLost", "Probability de destruction de chaque MP en cas d'echec du craft", 50, 0, true);
// Number of login stats kept for a character
-CVariable NBLoginStats(
- "egs", "NBLoginStats", "Nb logins stats kept (logon time, logoff time", 50, 0, true);
-
-CVariable EnableGuildPoints(
- "egs", "EnableGuildPoints", "Enable guild points", false, 0, true);
-
-CVariable NBPointsForGuild(
- "egs", "NbrPointsForGuild", "Nb points need to add one guild point", 100, 0, true);
+CVariable NBLoginStats("egs","NBLoginStats", "Nb logins stats kept (logon time, logoff time", 50, 0, true );
-CVariable ArkSalt(
- "egs", "ArkSalt", "Salt used to hmac callbacks", string("BAE"), 0, true);
+CVariable EnableGuildPoints("egs", "EnableGuildPoints", "Enable guild points", false, 0, true);
+CVariable NBPointsForGuild("egs", "NbrPointsForGuild", "Nb points need to add one guild point", 100, 0, true);
+CVariable ArkSalt("egs", "ArkSalt", "Salt used to hmac callbacks", string("BAE"), 0, true);
-
-// Max Bonus/malus/consumable effects displayed by client (database corresponding array must have the same size, and
-// client must process the same size)
+// Max Bonus/malus/consumable effects displayed by client (database corresponding array must have the same size, and client must process the same size)
const uint32 MaxBonusMalusDisplayed = 12;
const string randomStrings = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#";
-// We use this constant instead of the _StartingCharacteristicValues because _StartingCharacteristicValues is not
-// working
-// TODO
-// const uint32 StartCharacteristicsValue = 10;
+// We use this constant instead of the _StartingCharacteristicValues because _StartingCharacteristicValues is not working
+//TODO
+//const uint32 StartCharacteristicsValue = 10;
-// CCharacter::CCharacterDbReminder* CCharacter::_DataIndexReminder = NULL;
-#include "cdb_group.h"
+//CCharacter::CCharacterDbReminder* CCharacter::_DataIndexReminder = NULL;
+
#include "cdb_struct_banks.h"
+#include "cdb_group.h"
/// get the Right Trail value
uint8 getRightTrailValue(uint16 refValue)
@@ -262,7 +249,8 @@ uint8 getLeftTrailValue(uint16 refValue)
return uint8(7 * refValue / 250.0f);
}
-ICharacter* ICharacter::getInterface(CCharacter* character, bool onlyOnline)
+
+ICharacter *ICharacter::getInterface(CCharacter *character, bool onlyOnline)
{
if (character != NULL && onlyOnline && !character->getEnterFlag())
return NULL;
@@ -270,56 +258,57 @@ ICharacter* ICharacter::getInterface(CCharacter* character, bool onlyOnline)
return static_cast(character);
}
-ICharacter* ICharacter::getInterface(uint32 charId, bool onlyOnline)
+ICharacter *ICharacter::getInterface(uint32 charId, bool onlyOnline)
{
- CCharacter* character = CPlayerManager::getInstance().getChar(charId >> 4, charId & 0xf);
+ CCharacter *character = CPlayerManager::getInstance().getChar(charId >> 4, charId & 0xf);
- if (character != NULL && onlyOnline && !character->getEnterFlag())
+ if (character != NULL && onlyOnline && !character->getEnterFlag() )
return NULL;
return character;
}
-ICharacter* ICharacter::getInterface(NLMISC::CEntityId charEId, bool onlyOnline)
+ICharacter *ICharacter::getInterface(NLMISC::CEntityId charEId, bool onlyOnline)
{
uint32 charId = uint32(charEId.getShortId());
- CCharacter* character = CPlayerManager::getInstance().getChar(charId >> 4, charId & 0xf);
+ CCharacter *character = CPlayerManager::getInstance().getChar(charId >> 4, charId & 0xf);
- if (character != NULL && onlyOnline && !character->getEnterFlag())
+ if (character != NULL && onlyOnline && !character->getEnterFlag() )
return NULL;
return character;
}
-ICharacter* ICharacter::getInterfaceFromUser(uint32 userId, bool onlyOnline)
+ICharacter *ICharacter::getInterfaceFromUser(uint32 userId, bool onlyOnline)
{
- CCharacter* character = CPlayerManager::getInstance().getActiveChar(userId);
+ CCharacter *character = CPlayerManager::getInstance().getActiveChar(userId);
- if (character != NULL && onlyOnline && !character->getEnterFlag())
+ if (character != NULL && onlyOnline && !character->getEnterFlag() )
return NULL;
return character;
}
-CCharacter* ICharacter::getCharacter()
+CCharacter *ICharacter::getCharacter()
{
return static_cast(this);
}
-CModuleParent &ICharacter::getModuleParentWrap()
+CModuleParent & ICharacter::getModuleParentWrap()
{
return getCharacter()->getModuleParent();
}
-CEntityState &ICharacter::getStateWrap()
+CEntityState& ICharacter::getStateWrap()
{
return getCharacter()->getState();
}
-void ICharacter::setStateWrap(const COfflineEntityState &es)
+void ICharacter::setStateWrap( const COfflineEntityState& es )
{
getCharacter()->setState(es);
}
+
//-----------------------------------------------
// Constructor
//
@@ -346,55 +335,64 @@ void ICharacter::setStateWrap(const COfflineEntityState &es)
// CCharacter :
// Default constructor.
//-----------------------------------------------
-CCharacter::CCharacter()
- : CEntityBase(false)
- , _StartupInstance(INVALID_AI_INSTANCE)
- , _InventoryUpdater(&_PropertyDatabase)
- , _PVPInterface(NULL)
- , _EncycloChar(NULL)
- , _GameEvent(NULL)
- , _RespawnPoints(NULL)
- , _PlayerRoom(NULL)
- , _ItemsInShopStore(NULL)
- , _AdminProperties(NULL)
- , _DeathPenalties(NULL)
- , _GearLatency(NULL)
- , _Missions(NULL)
- , _Fames(NULL)
- , RingRewardPoints(this)
- , _PersistentEffects(this)
- , _Invisibility(false)
- , _AggroableSave(true)
- , _GodModeSave(false)
- , _UseWig(false)
+CCharacter::CCharacter(): CEntityBase(false),
+ _StartupInstance(INVALID_AI_INSTANCE),
+ _InventoryUpdater(&_PropertyDatabase),
+ _PVPInterface(NULL),
+ _EncycloChar(NULL),
+ _GameEvent(NULL),
+ _RespawnPoints(NULL),
+ _PlayerRoom(NULL),
+ _ItemsInShopStore(NULL),
+ _AdminProperties(NULL),
+ _DeathPenalties(NULL),
+ _GearLatency(NULL),
+ _Missions(NULL),
+ _Fames(NULL),
+ RingRewardPoints(this),
+ _PersistentEffects(this),
+ _Invisibility(false),
+ _AggroableSave(true),
+ _GodModeSave(false),
+ _UseWig(false)
{
// todo : uncomment that when sadge item api is plugged
_AggroCount = 0;
- // _Bulk = 0;
- // _CarriedWeight = 0;
+// _Bulk = 0;
+// _CarriedWeight = 0;
_GuildId = 0;
_UseFactionSymbol = false;
+
_SavedVersion = 0;
_Enter = false;
- _OldPosX = 0;
- _OldPosY = 0;
+
+ _OldPosX = 0;
+ _OldPosY = 0;
+
_LastPosXInDB = 0;
_LastPosYInDB = 0;
- _NbStaticActiveEffects = 0;
+
+ _NbStaticActiveEffects = 0;
_StaticActionInProgress = false;
+
_NbUserChannels = 0;
+
_LoadingFinish = false;
+
_PVPFlagAlly = 0;
_PVPFlagEnemy = 0;
+
// init faber plans
- // _KnownFaberPlans.resize(64,(uint64)0); //64*64 bits
+// _KnownFaberPlans.resize(64,(uint64)0); //64*64 bits
+
// init of inventories
initInventories();
+
_LootContainer = 0;
_EntityLoot = NLMISC::CEntityId::Unknown;
- // _NextDecayTickTime = CTickEventHandler::getGameCycle() + uint32(CarriedItemsDecayRate /
- // CTickEventHandler::getGameTimeStep());
- _LastTickSufferGooDamage = CTickEventHandler::getGameCycle();
+
+// _NextDecayTickTime = CTickEventHandler::getGameCycle() + uint32(CarriedItemsDecayRate / CTickEventHandler::getGameTimeStep());
+ _LastTickSufferGooDamage= CTickEventHandler::getGameCycle();
_LastTickSaved = CTickEventHandler::getGameCycle();
_LastTickCompassUpdated = CTickEventHandler::getGameCycle();
_LastTickNpcStopped = 0;
@@ -404,18 +402,22 @@ CCharacter::CCharacter()
_MpSourceSheetId = CSheetId();
_HarvestDeposit = false;
_DepositSearchSkill = SKILLS::unknown;
+
// forage
_ForageProgress = NULL;
_ProspectionLocateDepositEffect = NULL;
_ForageBonusExtractionTime = 0;
+
// bot chat
_CurrentBotChatListPage = 0;
_BotGift = NULL;
- // no exchange proposition
+
+ //no exchange proposition
_ExchangeAsker = CEntityId::Unknown;
_ExchangeId = 0;
_ExchangeAccepted = false;
_ExchangeMoney = (uint64)0;
+
// pvp for player with privilege inactive
_PriviledgePvp = false;
// full pvp
@@ -423,84 +425,102 @@ CCharacter::CCharacter()
// aggroable undefined
_Aggroable = true;
_AggroableOverride = -1;
+
// init money to zero
_Money = 0;
- for (uint i = 0; i < (PVP_CLAN::EndClans - PVP_CLAN::BeginClans + 1); ++i)
+ for (uint i = 0 ; i < (PVP_CLAN::EndClans-PVP_CLAN::BeginClans+1); ++i)
_FactionPoint[i] = 0;
_PvpPoint = 0;
_GuildPoints = 0;
_TodayGuildPoints = 0;
_NextTodayGuildPointsReset = 0;
+
_PVPFlagLastTimeChange = 0;
_PVPFlagTimeSettedOn = 0;
_PvPDatabaseCounter = 0;
_PVPFlag = false;
_PVPRecentActionTime = 0;
+
_Organization = 0;
_OrganizationStatus = 0;
_OrganizationPoints = 0;
// refill pact automatically
_doPact = false;
+
// do not start berserk
_IsBerserk = false;
+
// Contextual properties init
CProperties contprop;
- contprop.selectable(true);
- contprop.talkableTo(false);
- contprop.usable(false);
- contprop.liftable(false);
- contprop.lookableAt(false);
- contprop.givable(false);
- contprop.attackable(false);
- contprop.invitable(true);
- contprop.lootable(false);
- contprop.harvestable(false);
- contprop.canExchangeItem(true);
- contprop.mountable(false);
- _ContextualProperty = contprop;
+ contprop.selectable( true );
+ contprop.talkableTo( false );
+ contprop.usable( false );
+ contprop.liftable( false );
+ contprop.lookableAt( false );
+ contprop.givable( false );
+ contprop.attackable( false );
+ contprop.invitable( true );
+ contprop.lootable( false );
+ contprop.harvestable( false );
+ contprop.canExchangeItem( true );
+ contprop.mountable( false );
+ _ContextualProperty= contprop;
_StaticContextualProperty = contprop;
+
// init vector size of owned Pets
- _PlayerPets.resize(MAX_INVENTORY_ANIMAL);
+ _PlayerPets.resize( MAX_INVENTORY_ANIMAL );
NearPetTpAllowed = false;
- // ensureDbReminderReady();
+
+// ensureDbReminderReady();
+
TestProgression = false;
+
_ActionCounter = 0;
_InterfaceCounter = 0;
_CycleCounter = 0;
_NextCounter = 0;
+
_CurrentContinent = CONTINENT::UNKNOWN;
_CurrentRegion = 0xFFFF;
_RegionKilledInPvp = 0xFFFF;
_CurrentStable = 0xFFFF;
+
_MeleeCombatIsValid = false;
+
_CurrentBotChatType = BOTCHATTYPE::UnknownFlag;
- /*
+
+/*
_HaveMweaTool = false;
_HaveRweaTool = false;
_HaveAmmoTool = false;
_HaveArmorTool = false;
_HaveJewelTool = false;
_HaveForageTool = false;
- */
+*/
_DateOfNextAllowedAction = 0;
+
_OldHpBarSentToTeam = 0;
_OldSapBarSentToTeam = 0;
_OldStaBarSentToTeam = 0;
+
_OldHpBarSentToPlayer = 0;
_OldSapBarSentToPlayer = 0;
_OldStaBarSentToPlayer = 0;
_OldFocusBarSentToPlayer = 0;
_BarSentToPlayerMsgNumber = 0;
- /// init teamId
- _TeamId = CTEAM::InvalidTeamId;
- /// init LeagueId
+
+
+ ///init teamId
+ _TeamId= CTEAM::InvalidTeamId;
+
+ ///init LeagueId
_LeagueId = DYN_CHAT_INVALID_CHAN;
+
// init combat flags
_CombatEventFlagTicks.resize(32);
-
- for (uint i = 0; i < 32; ++i)
+ for( uint i=0; i<32; ++i )
{
_CombatEventFlagTicks[i].StartTick = 0;
_CombatEventFlagTicks[i].EndTick = 0;
@@ -512,8 +532,7 @@ CCharacter::CCharacter()
_ForbidAuraUseStartDate = 0;
_ForbidAuraUseEndDate = 0;
_PowerFlagTicks.resize(32);
-
- for (uint i = 0; i < 32; ++i)
+ for( uint i=0; i<32; ++i )
{
_PowerFlagTicks[i].StartTick = 0;
_PowerFlagTicks[i].EndTick = 0;
@@ -523,71 +542,88 @@ CCharacter::CCharacter()
// resize charac vector
_StartingCharacteristicValues.resize(CHARACTERISTICS::NUM_CHARACTERISTICS);
+
_NbAuras = 0;
+
_WearEquipmentMalus = 0.0f;
- _DodgeModifier = 0;
- _ParryModifier = 0;
- _AdversaryDodgeModifier = 0;
- _AdversaryParryModifier = 0;
- _IsInAComa = false;
- _IntangibleEndDate = 0;
- uint64 NOT_TELEPORTING_FLAG = (((uint64)0x12345678) << 32) | (uint64)0x87654321;
- _WhoSeesMeBeforeTP = NOT_TELEPORTING_FLAG;
- _PlayerIsInWater = false;
- _BestSkill = SKILLS::unknown;
- _ConsumedItemSlot = -1;
- _ConsumedItemInventory = INVENTORIES::UNDEFINED;
- _XpCatalyserSlot = INVENTORIES::INVALID_INVENTORY_SLOT;
- _RingXpCatalyserSlot = INVENTORIES::INVALID_INVENTORY_SLOT;
+
+ _DodgeModifier = 0;
+ _ParryModifier = 0;
+ _AdversaryDodgeModifier = 0;
+ _AdversaryParryModifier = 0;
+
+ _IsInAComa = false;
+ _IntangibleEndDate = 0;
+ uint64 NOT_TELEPORTING_FLAG= (((uint64)0x12345678)<<32)| (uint64)0x87654321;
+ _WhoSeesMeBeforeTP = NOT_TELEPORTING_FLAG;
+
+ _PlayerIsInWater = false;
+
+ _BestSkill = SKILLS::unknown;
+
+ _ConsumedItemSlot = -1;
+ _ConsumedItemInventory = INVENTORIES::UNDEFINED;
+
+ _XpCatalyserSlot = INVENTORIES::INVALID_INVENTORY_SLOT;
+ _RingXpCatalyserSlot = INVENTORIES::INVALID_INVENTORY_SLOT;
// init _Sp
- for (uint i = 0; i < EGSPD::CSPType::EndSPType; ++i)
+ for (uint i = 0 ; i < EGSPD::CSPType::EndSPType ; ++i)
{
_SpType[i] = 0.0f;
_SpentSpType[i] = 0;
}
// init permanent modifiers on scores
- for (uint i = 0; i < SCORES::NUM_SCORES; ++i)
+ for (uint i = 0 ; i < SCORES::NUM_SCORES ; ++i)
_ScorePermanentModifiers[i] = 0;
// init jewel enchantement
for (uint i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i)
_JewelEnchants[i] = CSBrickParamJewelAttrs();
-
// init owner character for CItemsForSale class member
_ItemsInShopStore = new CItemsForSale;
- _ItemsInShopStore->setOwnerCharacter(this);
+ _ItemsInShopStore->setOwnerCharacter( this );
+
_ShoppingList = 0;
_RawMaterialItemPartFilter = RM_FABER_TYPE::Unknown;
_MinQualityFilter = 0;
_MaxQualityFilter = ~0u;
_MinPriceFilter = 0;
_MaxPriceFilter = ~0u;
+
_LastAppliedWeightMalus = 0;
_TpTicketSlot = INVENTORIES::INVALID_INVENTORY_SLOT;
+
// setup timer for tickUpdate() calling
- _TickUpdateTimer.setRemaining(1, new CCharacterTickUpdateTimerEvent(this), CharacterTickUpdatePeriodGc);
- _DbUpdateTimer.setRemaining(1, new CCharacterTickUpdateTimerEvent(this), 1);
- _DeathPenaltyTimer.setRemaining(1, new CDeathPenaltiesTimerEvent(this), 1);
- _BarUpdateTimer.setRemaining(1, new CCharacterBarUpdateTimerEvent(this), 1);
+ _TickUpdateTimer.setRemaining( 1, new CCharacterTickUpdateTimerEvent( this ), CharacterTickUpdatePeriodGc );
+ _DbUpdateTimer.setRemaining( 1, new CCharacterTickUpdateTimerEvent( this ),1 );
+ _DeathPenaltyTimer.setRemaining( 1, new CDeathPenaltiesTimerEvent( this ),1 );
+ _BarUpdateTimer.setRemaining( 1, new CCharacterBarUpdateTimerEvent( this ),1 );
+
_BuildingExitZone = 0xffff;
_BuildingExitPos = CVector(0, 0, 0);
_BuildingExitPos.x = 0;
_BuildingExitPos.y = 0;
+
_RespawnMainLandInTown = false;
+
_CurrentPVPZone = CAIAliasTranslator::Invalid;
_CurrentOutpostZone = CAIAliasTranslator::Invalid;
_CurrentOutpostState = OUTPOSTENUMS::Peace;
resetNextDeathPenaltyFactor();
+
_CurrentDodgeLevel = 1;
_BaseDodgeLevel = 1;
_CurrentParryLevel = 1;
_BaseParryLevel = 1;
+
_BaseResistance = 1;
+
_SkillUsedForDodge = SKILLS::SF;
_CurrentParrySkill = BarehandCombatSkill;
+
_EncycloChar = new CCharacterEncyclopedia(*this);
_GameEvent = new CCharacterGameEvent(*this);
_RespawnPoints = new CCharacterRespawnPoints(*this);
@@ -596,58 +632,78 @@ CCharacter::CCharacter()
_AdminProperties = new CAdminProperties;
_DeathPenalties = new CDeathPenalties;
_GearLatency = new CGearLatency;
+
/** \todo Handle PDS code a MUCH BETTER WAY */
//_Missions = new EGSPD::CMissionContainerPD;
//_Fames = new EGSPD::CFameContainerPD;
_Missions = NULL;
_Fames = NULL;
+
_HairCuteDiscount = false;
+
_DPLossDuration = 0.f;
+
_EnterCriticalZoneProposalQueueId = 0;
- _NbNonNullClassificationTypesSkillMod = 0;
- for (uint i = 0; i < (uint)EGSPD::CClassificationType::EndClassificationType; ++i)
+ _NbNonNullClassificationTypesSkillMod = 0;
+ for (uint i = 0 ; i < (uint)EGSPD::CClassificationType::EndClassificationType ; ++i)
_ClassificationTypesSkillModifiers[i] = 0;
// log stats init
_FirstConnectedTime = 0;
_LastConnectedTime = 0;
_PlayedTime = 0;
+
_HaveToUpdateItemsPrerequisit = false;
+
_OutpostLeavingTime = 0;
_OutpostIdBeforeUserValidation = 0;
+
_SelectedOutpost = 0;
+
_ChannelAdded = false;
+
_DuelOpponent = NULL;
+
_LastTpTick = 0;
_LastOverSpeedTick = 0;
_LastMountTick = 0;
_LastUnMountTick = 0;
_LastFreeMount = 0;
_LastExchangeMount = 0;
+
_LastCivPointWriteDB = ~0;
_LastCultPointWriteDB = ~0;
+
_DeclaredCult = PVP_CLAN::Unknown;
_DeclaredCiv = PVP_CLAN::Unknown;
+
_HaveToUpdatePVPMode = false;
_SessionId = TSessionId(0);
_CurrentSessionId = _SessionId;
_PvPSafeZoneActive = false;
+
_PVPSafeLastTimeChange = CTickEventHandler::getGameCycle();
_PVPSafeLastTime = false;
_PVPInSafeZoneLastTime = false;
+
// For client/server contact list communication
- _ContactIdPool = 0;
+ _ContactIdPool= 0;
+
_inRoomOfPlayer = CEntityId::Unknown;
- for (uint i = 0; i < BRICK_FAMILIES::NbFamilies; ++i)
+ for(uint i = 0; i < BRICK_FAMILIES::NbFamilies; ++i )
_BrickFamilyBitField[i] = 0;
_InterfacesFlagsBitField = 0;
_RingSeason = 0;
+
_LastTickNpcControlUpdated = CTickEventHandler::getGameCycle();
+
_LastWebCommandIndex = 0;
_LastUrlIndex = 0;
+
+
_CustomMissionsParams.clear();
_FriendVisibility = VisibleToAll;
_LangChannel = "rf";
@@ -658,6 +714,7 @@ CCharacter::CCharacter()
resetPowoFlags();
} // CCharacter //
+
//-----------------------------------------------
// clear :
//
@@ -680,35 +737,38 @@ void CCharacter::clear()
_Title = CHARACTER_TITLE::Refugee;
_NewTitle = "Refugee";
_UseWig = false;
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatModel, 0);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.CharacterHeight, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.TorsoWidth, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.ArmsWidth, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.LegsWidth, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.BreastSize, 0);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.JacketColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.TrouserColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.ArmColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.HandsColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.FeetColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget1, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget2, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget3, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget4, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget5, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget6, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget7, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.MorphTarget8, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.EyesColor, 0);
- SET_STRUCT_MEMBER(_VisualPropertyC, PropertySubData.Tattoo, 0);
+
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,0);
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.CharacterHeight,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.TorsoWidth,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.ArmsWidth,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.LegsWidth,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.BreastSize,0);
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.JacketColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.TrouserColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.ArmColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyB,PropertySubData.HandsColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyB,PropertySubData.FeetColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget1,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget2,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget3,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget4,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget5,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget6,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget7,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.MorphTarget8,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.EyesColor,0);
+ SET_STRUCT_MEMBER(_VisualPropertyC,PropertySubData.Tattoo,0);
+
_BoughtPhrases.clear();
_KnownBricks.clear();
_FriendsList.clear();
_IgnoreList.clear();
_IsFriendOf.clear();
_IsIgnoredBy.clear();
+
_MemorizedPhrases.clear();
_ForbidPowerDates.clear();
_IneffectiveAuras.clear();
@@ -719,38 +779,35 @@ void CCharacter::clear()
_PlayerRoom->clear();
CEntityBase::clear();
getRespawnPoints().clearRespawnPoints();
-
- while (_Fames->getEntriesBegin() != _Fames->getEntriesEnd())
- _Fames->deleteFromEntries((*_Fames->getEntriesBegin()).first);
+ while(_Fames->getEntriesBegin()!=_Fames->getEntriesEnd()) _Fames->deleteFromEntries((*_Fames->getEntriesBegin()).first);
_Pact.clear();
_KnownPhrases.clear();
_MissionHistories.clear();
- uint32 petCount = (uint32)_PlayerPets.size();
- _PlayerPets.clear();
- _PlayerPets.resize(petCount);
+ uint32 petCount= (uint32)_PlayerPets.size(); _PlayerPets.clear(); _PlayerPets.resize(petCount);
- for (uint32 i = 0; i < EGSPD::CSPType::EndSPType; ++i)
- _SpType[i] = 0.0;
+ for(uint32 i=0;iclearInventory();
_SDBPvPPath.clear();
}
+
/*
* Init PD Struct
*/
-void CCharacter::initPDStructs()
+void CCharacter::initPDStructs()
{
/**
*
@@ -759,15 +816,16 @@ void CCharacter::initPDStructs()
*
*/
{
- H_AUTO(InitMissioPD);
- _Missions = EGSPD::CMissionContainerPD::create(_Id);
+ H_AUTO(InitMissioPD);
+ _Missions = EGSPD::CMissionContainerPD::create(_Id);
}
{
- H_AUTO(InitFamePD);
- _Fames = EGSPD::CFameContainerPD::create(_Id);
+ H_AUTO(InitFamePD);
+ _Fames = EGSPD::CFameContainerPD::create(_Id);
}
}
+
//-----------------------------------------------
// updatePVPClanVP
//
@@ -775,14 +833,13 @@ void CCharacter::initPDStructs()
void CCharacter::updatePVPClanVP() const
{
TYPE_PVP_CLAN propPvpClanTemp = 0;
-
+
if (_LeagueId != DYN_CHAT_INVALID_CHAN)
- propPvpClanTemp = 1 + (uint32)(_LeagueId.getShortId());
+ propPvpClanTemp = 1+(uint32)(_LeagueId.getShortId());
else
propPvpClanTemp = 0;
- CMirrorPropValue propPvpClan(TheDataset, TheDataset.getDataSetRow(_Id), DSPropertyPVP_CLAN);
-
+ CMirrorPropValue propPvpClan( TheDataset, TheDataset.getDataSetRow(_Id), DSPropertyPVP_CLAN );
if (propPvpClan.getValue() != propPvpClanTemp)
{
propPvpClan = propPvpClanTemp;
@@ -817,49 +874,58 @@ TYPE_PVP_CLAN CCharacter::getPVPFamesEnemies()
// addPropertiesToMirror :
//
//-----------------------------------------------
-void CCharacter::addPropertiesToMirror(const TDataSetRow &entityIndex, bool keepSheetId)
+void CCharacter::addPropertiesToMirror( const TDataSetRow& entityIndex, bool keepSheetId )
{
- nlassert(_Id != CEntityId::Unknown);
+ nlassert( _Id != CEntityId::Unknown );
+
// Add properties of CEntityBase
- CEntityBase::addPropertiesToMirror(entityIndex, keepSheetId);
+ CEntityBase::addPropertiesToMirror( entityIndex, keepSheetId );
+
// Visual properties for player character
- _VisualPropertyA.tempMirrorize(TheDataset, entityIndex, DSPropertyVPA);
- _VisualPropertyB.tempMirrorize(TheDataset, entityIndex, DSPropertyVPB);
- _VisualPropertyC.tempMirrorize(TheDataset, entityIndex, DSPropertyVPC);
- _ContextualProperty.tempMirrorize(TheDataset, entityIndex, DSPropertyCONTEXTUAL);
+ _VisualPropertyA.tempMirrorize( TheDataset, entityIndex, DSPropertyVPA );
+ _VisualPropertyB.tempMirrorize( TheDataset, entityIndex, DSPropertyVPB );
+ _VisualPropertyC.tempMirrorize( TheDataset, entityIndex, DSPropertyVPC );
+
+ _ContextualProperty.tempMirrorize( TheDataset, entityIndex, DSPropertyCONTEXTUAL );
+
// Size of database impulsion window (TEMP: only 1 FS)
- _AvailImpulseBitsize.init(TheDataset, entityIndex, DSFirstPropertyAvailableImpulseBitSize);
+ _AvailImpulseBitsize.init( TheDataset, entityIndex, DSFirstPropertyAvailableImpulseBitSize );
+
// current team id
- _TeamId.tempMirrorize(TheDataset, entityIndex, DSPropertyTEAM_ID);
- // _Fames->addPropertiesToMirror( entityIndex );
+ _TeamId.tempMirrorize( TheDataset, entityIndex, DSPropertyTEAM_ID );
+
+// _Fames->addPropertiesToMirror( entityIndex );
+
+
updatePVPClanVP();
+
updateGuildFlag();
- _OutpostInfos.init(TheDataset, entityIndex, DSPropertyOUTPOST_INFOS);
+
+ _OutpostInfos.init( TheDataset, entityIndex, DSPropertyOUTPOST_INFOS );
_OutpostInfos = 0;
- if (!_OutpostAlias.isReadable())
+ if( !_OutpostAlias.isReadable() )
{
- _OutpostAlias.init(TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_ALIAS);
- _OutpostAlias = 0;
+ _OutpostAlias.init( TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_ALIAS );
+ _OutpostAlias = 0;
}
else
{
- _OutpostAlias.tempMirrorize(TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_ALIAS);
+ _OutpostAlias.tempMirrorize( TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_ALIAS );
}
-
- if (!_OutpostSide.isReadable())
+ if( !_OutpostSide.isReadable() )
{
- _OutpostSide.init(TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_SIDE);
+ _OutpostSide.init( TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_SIDE );
_OutpostSide = OUTPOSTENUMS::UnknownPVPSide;
}
else
{
- _OutpostSide.tempMirrorize(TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_SIDE);
+ _OutpostSide.tempMirrorize( TheDataset, entityIndex, DSPropertyIN_OUTPOST_ZONE_SIDE );
}
- if (_OutpostAlias != 0)
+ if( _OutpostAlias != 0 )
{
- if (_OutpostLeavingTime < CTickEventHandler::getGameCycle())
+ if( _OutpostLeavingTime < CTickEventHandler::getGameCycle() )
{
_OutpostAlias = 0;
_OutpostSide = OUTPOSTENUMS::UnknownPVPSide;
@@ -871,26 +937,27 @@ void CCharacter::addPropertiesToMirror(const TDataSetRow &entityIndex, bool keep
}
CPVPManager2::getInstance()->setPVPModeInMirror(this);
+
} // addPropertiesToMirror //
+
//---------------------------------------------------
// setValue :
//
//---------------------------------------------------
-bool CCharacter::setValue(string var, string value)
+bool CCharacter::setValue( string var, string value )
{
- // if( _Behaviour.getValue().Behaviour < MBEHAV::RESURECTED || _Behaviour.getValue().Behaviour >
- // MBEHAV::PERMANENT_DEATH )
- // if (!isDead())
+// if( _Behaviour.getValue().Behaviour < MBEHAV::RESURECTED || _Behaviour.getValue().Behaviour > MBEHAV::PERMANENT_DEATH )
+ //if (!isDead())
{
try
{
sint32 &temp = lookupStat(var);
NLMISC::fromString(value, temp);
}
- catch (const CCharacter::EInvalidStat &e)
+ catch(const CCharacter::EInvalidStat &e)
{
- nlwarning(" Exception : %s", e.what(var));
+ nlwarning(" Exception : %s",e.what( var ) );
return false;
}
}
@@ -901,10 +968,9 @@ bool CCharacter::setValue(string var, string value)
// modifyValue :
//
//---------------------------------------------------
-bool CCharacter::modifyValue(string var, string value)
+bool CCharacter::modifyValue( string var, string value )
{
- // if( _Behaviour.getValue().Behaviour < MBEHAV::RESURECTED || _Behaviour.getValue().Behaviour >
- // MBEHAV::PERMANENT_DEATH )
+// if( _Behaviour.getValue().Behaviour < MBEHAV::RESURECTED || _Behaviour.getValue().Behaviour > MBEHAV::PERMANENT_DEATH )
if (!isDead())
{
try
@@ -914,13 +980,12 @@ bool CCharacter::modifyValue(string var, string value)
NLMISC::fromString(value, valueInt);
temp = temp + valueInt;
}
- catch (const CCharacter::EInvalidStat &e)
+ catch(const CCharacter::EInvalidStat &e)
{
- nlwarning(" Exception : %s", e.what(var));
+ nlwarning(" Exception : %s",e.what( var ) );
return false;
}
}
-
return true;
} // setValue //
@@ -928,18 +993,17 @@ bool CCharacter::modifyValue(string var, string value)
// getValue :
//
//---------------------------------------------------
-bool CCharacter::getValue(string var, string &value)
+bool CCharacter::getValue( string var, string& value )
{
try
{
- CEntityBase::getValue(var, value);
+ CEntityBase::getValue( var, value );
}
- catch (const CCharacter::EInvalidStat &e)
+ catch(const CCharacter::EInvalidStat &e)
{
- nlwarning(" Exception : %s", e.what(var));
+ nlwarning(" Exception : %s",e.what( var ) );
return false;
}
-
return true;
} // getValue //
@@ -953,8 +1017,7 @@ bool CCharacter::getValue(string var, string &value)
uint32 CCharacter::tickUpdate()
{
H_AUTO(CharacterUpdate);
-
- if (!getEnterFlag()) // wait for the properties to be in the mirror
+ if ( ! getEnterFlag() ) // wait for the properties to be in the mirror
return 16;
// update connexion stats.
@@ -962,20 +1025,20 @@ uint32 CCharacter::tickUpdate()
_PlayedTime += time - _LastConnectedTime;
_LastConnectedTime = time;
- if (!checkCharacterStillValide(" Character corrupted : start tickUpdate !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : start tickUpdate !!!") )
+ return (uint32)-1;
// save character if save delay is elapsed
saveCharacter();
+
{
H_AUTO(CharacterLinkToMatrix);
EntityMatrix.linkToMatrix(getState().X, getState().Y, _ListLink);
- if (!checkCharacterStillValide(
- " Character corrupted : after EntityMatrix.linkToMatrix !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after EntityMatrix.linkToMatrix !!!") )
+ return (uint32)-1;
}
- /*
+/*
{
H_AUTO(CharacterAntiBugCheckContinent);
//ANTIBUG : CHARACTERS MUST BE IN A CONTINENT IF THEY ARE NOT BEING TELEPORTED
@@ -984,23 +1047,19 @@ uint32 CCharacter::tickUpdate()
// if the instance is invalid and char on valid coords, we have a problem. We ignore invalid coords because of teleports
if ( in == ~0 && _EntityState.X > 0 && _EntityState.Y < 0)
{
- nlwarning("%s IS ON AN INVALID CONTINENT. x= %d, y = %d ",_Id.toString().c_str(),_EntityState.X(),
- _EntityState.Y() );
+ nlwarning("%s IS ON AN INVALID CONTINENT. x= %d, y = %d ",_Id.toString().c_str(),_EntityState.X(), _EntityState.Y() );
CContinent * cont = CZoneManager::getInstance().getContinent(_EntityState.X,_EntityState.Y);
if ( cont )
{
in = CUsedContinent::instance().getInstanceForContinent( CONTINENT::TContinent(cont->getId()) );
if ( in == INVALID_AI_INSTANCE )
{
- nlwarning("%s will arrive in an invalid continent (WE NAME : '%s') (REAL NAME : '%s')
- ",_Id.toString().c_str(), NLMISC::strlwr( cont->getName() ).c_str(),
- CONTINENT::toString(CONTINENT::TContinent(cont->getId())).c_str() );
+ nlwarning("%s will arrive in an invalid continent (WE NAME : '%s') (REAL NAME : '%s') ",_Id.toString().c_str(), NLMISC::strlwr( cont->getName() ).c_str(), CONTINENT::toString(CONTINENT::TContinent(cont->getId())).c_str() );
}
}
else
{
- nlwarning("%s AT x= %d, y = %d NO VALID CONTINENT
- FOUND",_Id.toString().c_str(),_EntityState.X() , _EntityState.Y() );
+ nlwarning("%s AT x= %d, y = %d NO VALID CONTINENT FOUND",_Id.toString().c_str(),_EntityState.X() , _EntityState.Y() );
}
setInstanceNumber( in );
@@ -1009,80 +1068,72 @@ uint32 CCharacter::tickUpdate()
}
// end of ANTIBUG
}
- */
+*/
{
H_AUTO(CharacterCheckEnterLeaveZone);
// check if the player enter/ leaves a zone
- CZoneManager::getInstance().updateCharacterPosition(this);
+ CZoneManager::getInstance().updateCharacterPosition( this );
- if (!checkCharacterStillValide(
- " Character corrupted : after CZoneManager::updateCharacterPosition !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after CZoneManager::updateCharacterPosition !!!") )
+ return (uint32)-1;
}
+
// test progression
static TGameCycle lastTickTestProgressionCalled = 0;
-
- if (TestProgression && CTickEventHandler::getGameCycle() > (XpGainRate + lastTickTestProgressionCalled))
+ if( TestProgression && CTickEventHandler::getGameCycle() > ( XpGainRate + lastTickTestProgressionCalled ) )
{
lastTickTestProgressionCalled = CTickEventHandler::getGameCycle();
TReportAction ra;
ra.ActorRowId = _EntityRowId;
ra.ActionNature = ACTNATURE::CRAFT;
ra.DeltaLvl = 0;
- ra.Skill = SKILLS::toSkill(TestProgressSkill);
- PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->actionReport(ra);
+ ra.Skill = SKILLS::toSkill( TestProgressSkill );
+ PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->actionReport( ra );
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->reportAction(ra);
}
{
H_AUTO(CharacterProcessStaticAction);
processStaticAction();
-
- if (!checkCharacterStillValide(
- " Character corrupted : after processStaticAction() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after processStaticAction() !!!") )
+ return (uint32)-1;
}
// update game event
_GameEvent->tickUpdate();
+
// keep old score values for reference
- sint32 oldHp = _PhysScores._PhysicalScores[SCORES::hit_points].Current;
- sint32 oldSta = _PhysScores._PhysicalScores[SCORES::stamina].Current;
- sint32 oldSap = _PhysScores._PhysicalScores[SCORES::sap].Current;
- sint32 oldFocus = _PhysScores._PhysicalScores[SCORES::focus].Current;
+ sint32 oldHp = _PhysScores._PhysicalScores[ SCORES::hit_points ].Current;
+ sint32 oldSta = _PhysScores._PhysicalScores[ SCORES::stamina].Current;
+ sint32 oldSap = _PhysScores._PhysicalScores[ SCORES::sap ].Current;
+ sint32 oldFocus = _PhysScores._PhysicalScores[ SCORES::focus].Current;
- if (_GodMode || _Invulnerable)
+ if( _GodMode || _Invulnerable )
{
- if (_PhysScores._PhysicalScores[SCORES::hit_points].Current <= 0)
+ if( _PhysScores._PhysicalScores[ SCORES::hit_points ].Current <= 0 )
{
- _PhysScores._PhysicalScores[SCORES::hit_points].Current
- = _PhysScores._PhysicalScores[SCORES::hit_points].Base;
+ _PhysScores._PhysicalScores[ SCORES::hit_points ].Current = _PhysScores._PhysicalScores[ SCORES::hit_points ].Base;
}
-
- if (_PhysScores._PhysicalScores[SCORES::stamina].Current
- < _PhysScores._PhysicalScores[SCORES::stamina].Base / 3)
+ if( _PhysScores._PhysicalScores[ SCORES::stamina ].Current < _PhysScores._PhysicalScores[ SCORES::stamina ].Base / 3 )
{
- _PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base;
+ _PhysScores._PhysicalScores[ SCORES::stamina ].Current = _PhysScores._PhysicalScores[ SCORES::stamina ].Base;
}
-
- if (_PhysScores._PhysicalScores[SCORES::sap].Current < _PhysScores._PhysicalScores[SCORES::sap].Base / 3)
+ if( _PhysScores._PhysicalScores[ SCORES::sap ].Current < _PhysScores._PhysicalScores[ SCORES::sap ].Base / 3 )
{
- _PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base;
+ _PhysScores._PhysicalScores[ SCORES::sap ].Current = _PhysScores._PhysicalScores[ SCORES::sap ].Base;
}
-
- if (_PhysScores._PhysicalScores[SCORES::focus].Current < _PhysScores._PhysicalScores[SCORES::focus].Base / 3)
+ if( _PhysScores._PhysicalScores[ SCORES::focus ].Current < _PhysScores._PhysicalScores[ SCORES::focus ].Base / 3 )
{
- _PhysScores._PhysicalScores[SCORES::focus].Current = _PhysScores._PhysicalScores[SCORES::focus].Base;
+ _PhysScores._PhysicalScores[ SCORES::focus ].Current = _PhysScores._PhysicalScores[ SCORES::focus ].Base;
}
}
// Check Death of player and manage pact if death occurs
- if (currentHp() <= 0 && !_IsDead && !teleportInProgress())
+ if( currentHp() <= 0 && !_IsDead && !teleportInProgress() )
{
kill();
-
- if (!checkCharacterStillValide(" Character corrupted : after kill() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after kill() !!!") )
+ return (uint32)-1;
}
// test again as effects can kill the entity (dots...)
@@ -1092,37 +1143,29 @@ uint32 CCharacter::tickUpdate()
H_AUTO(CharacterComputeMaxValue);
// Compute max values after apply modifier
computeMaxValue();
-
- if (!checkCharacterStillValide(
- " Character corrupted : after computeMaxValue() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after computeMaxValue() !!!") )
+ return (uint32)-1;
}
{
H_AUTO(CharacterRegenScores);
// now we ready apply regen and clip currents value
applyRegenAndClipCurrentValue();
-
- if (!checkCharacterStillValide(
- " Character corrupted : after applyRegenAndClipCurrentValue() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after applyRegenAndClipCurrentValue() !!!") )
+ return (uint32)-1;
}
{
H_AUTO(CharacterGearLatency);
// update gear latency
_GearLatency->update(this);
-
- if (!checkCharacterStillValide(
- " Character corrupted : after _GearLatency->update() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after _GearLatency->update() !!!") )
+ return (uint32)-1;
}
}
else
{
deathOccurs();
-
- if (!checkCharacterStillValide(" Character corrupted : after death !!!"))
- return (uint32) - 1;
-
+ if( !checkCharacterStillValide(" Character corrupted : after death !!!") )
+ return (uint32)-1;
_PhysScores.CurrentWalkSpeed = 0;
_PhysScores.CurrentRunSpeed = 0;
}
@@ -1130,142 +1173,123 @@ uint32 CCharacter::tickUpdate()
// reset modifiers now (after comptuing max value and regen, effects are applied by the TimerManager)
{
H_AUTO(CharacterModifierReset);
-
- if (!isDead())
+ if ( !isDead() )
{
// Set all character stats modifiers to initial state (depend on item etc..)
resetCharacterModifier();
-
- if (!checkCharacterStillValide(
- " Character corrupted : after resetCharacterModifier() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after resetCharacterModifier() !!!") )
+ return (uint32)-1;
}
}
+
{
H_AUTO(CharacterClearDeadTargetInfo);
// set TARGET HP, SAP and STAMINA in the database
- CEntityBase* target;
-
- if (_Target.isReadable())
+ CEntityBase * target;
+ if ( _Target.isReadable() )
{
- target = CEntityBaseManager::getEntityBasePtr(getTarget());
-
- if (target)
+ target = CEntityBaseManager::getEntityBasePtr( getTarget() );
+ if( target )
{
if (target->isDead())
{
// target is a player then do nothing, as dead players (in fact in a coma) can be targeted
if (target->getId().getType() != RYZOMID::player)
{
- if (_Id.getType() == RYZOMID::player)
+ if (_Id.getType()==RYZOMID::player)
{
- setTarget(CEntityId::Unknown);
+ setTarget( CEntityId::Unknown );
}
-
// clear DB Bars
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, 0 );
}
}
}
}
-
- if (!checkCharacterStillValide(
- " Character corrupted : after update dead target (clear HP/STA/SAP) !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after update dead target (clear HP/STA/SAP) !!!") )
+ return (uint32)-1;
}
+
{
H_AUTO(CharacterWriteTargetSelectInfos);
- CEntityBase* target = CEntityBaseManager::getEntityBasePtr(_Target());
-
- if (target)
+ CEntityBase * target = CEntityBaseManager::getEntityBasePtr( _Target() );
+ if( target )
{
sint8 percent;
// UID
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID,
- // target->getEntityRowId().getCompressedIndex() );
- CBankAccessor_PLR::getTARGET().getBARS().setUID(
- _PropertyDatabase, target->getEntityRowId().getCompressedIndex());
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, target->getEntityRowId().getCompressedIndex() );
+ CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, target->getEntityRowId().getCompressedIndex() );
// Hp
- if (target->getPhysScores()._PhysicalScores[SCORES::hit_points].Max <= 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Max <= 0 )
{
percent = 0;
}
else
{
- percent = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::hit_points].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::hit_points].Max));
+ percent = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Max ) );
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, percent );
// Sap
- if (target->getPhysScores()._PhysicalScores[SCORES::sap].Max <= 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::sap ].Max <= 0 )
{
percent = 0;
}
else
{
- percent = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::sap].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::sap].Max));
+ percent = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::sap ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::sap ].Max ) );
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, percent );
// Stamina
- if (target->getPhysScores()._PhysicalScores[SCORES::stamina].Max <= 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::stamina ].Max <= 0 )
{
percent = 0;
}
else
{
- percent = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::stamina].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::stamina].Max));
+ percent = sint8((127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::stamina ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::stamina ].Max ) );
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, percent );
// Focus
- if (target->getPhysScores()._PhysicalScores[SCORES::focus].Max <= 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::focus ].Max <= 0 )
{
percent = 0;
}
else
{
- sint8 percentTmp = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::focus].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::focus].Max));
-
- if (percentTmp < 0)
+ sint8 percentTmp = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::focus ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::focus ].Max ) );
+ if( percentTmp < 0 )
percent = 0;
else
percent = percentTmp;
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, percent );
// Set the level of the target (if player character) in database for ForceRegion/ForceLevel deduction
- if (target->getId().getType() == RYZOMID::player)
+ if ( target->getId().getType() == RYZOMID::player )
{
- CCharacter* targetChar = safe_cast(target);
- sint32 skillBaseValue = targetChar->getSkillBaseValue(targetChar->getBestSkill());
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.PLAYER_LEVEL, skillBaseValue );
- CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(
- _PropertyDatabase, checkedCast(skillBaseValue));
+ CCharacter *targetChar = safe_cast(target);
+ sint32 skillBaseValue = targetChar->getSkillBaseValue( targetChar->getBestSkill() );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.PLAYER_LEVEL, skillBaseValue );
+ CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, checkedCast(skillBaseValue) );
}
else
{
- CCreature * creature = dynamic_cast< CCreature *>(target);
+ CCreature *creature = dynamic_cast(target);
if (creature)
{
if (creature->getLockLoot() != CTEAM::InvalidTeamId)
@@ -1280,87 +1304,78 @@ uint32 CCharacter::tickUpdate()
}
}
if (!checkCharacterStillValide(" Character corrupted : after update target HP/STA/SAP !!!"))
- return (uint32) - 1;
+ return (uint32)-1;
}
}
+
// set life bar
{
H_AUTO(CharacterSetBars);
setBars();
-
- if (!checkCharacterStillValide(" Character corrupted : after setBars() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after setBars() !!!") )
+ return (uint32)-1;
}
+
{
H_AUTO(CharacterWriteTeamInfos);
-
// update team bars if needed
if (_TeamId.getValue() != CTEAM::InvalidTeamId)
{
- CTeam* team = TeamManager.getRealTeam(_TeamId.getValue());
-
+ CTeam *team = TeamManager.getRealTeam(_TeamId.getValue());
if (team)
{
uint8 bar = uint8((_StatusBars & (0x000007ff)) >> 3);
-
if (_OldHpBarSentToTeam != bar)
{
team->updateCharacterScore(this, SCORES::hit_points, bar);
_OldHpBarSentToTeam = bar;
}
-
- bar = uint8((_StatusBars & (0x0003f800)) >> 11);
-
+ bar = uint8( (_StatusBars & (0x0003f800)) >> 11);
if (_OldStaBarSentToTeam != bar)
{
team->updateCharacterScore(this, SCORES::stamina, bar);
_OldStaBarSentToTeam = bar;
}
-
- bar = uint8((_StatusBars & (0x1fc0000)) >> 18);
-
+ bar = uint8( (_StatusBars & (0x1fc0000)) >> 18);
if (_OldSapBarSentToTeam != bar)
{
team->updateCharacterScore(this, SCORES::sap, bar);
_OldSapBarSentToTeam = bar;
}
-
- if (!checkCharacterStillValide(
- " Character corrupted : after update team bars !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after update team bars !!!") )
+ return (uint32)-1;
}
}
}
+
{
H_AUTO(CharacterWritePetCoordinateAndDb);
// Update coordinate of player's pet
updatePetCoordinateAndDatabase();
-
- if (!checkCharacterStillValide("Character corrupted : after updatePetCoordinateAndDatabase() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide("Character corrupted : after updatePetCoordinateAndDatabase() !!!") )
+ return (uint32)-1;
}
+
{
- if (_LastTickCompassUpdated + TickFrequencyCompassUpdate.get() <= CTickEventHandler::getGameCycle())
+ if ( _LastTickCompassUpdated + TickFrequencyCompassUpdate.get() <= CTickEventHandler::getGameCycle() )
{
_LastTickCompassUpdated = CTickEventHandler::getGameCycle();
{
H_AUTO(CharacterUpdateMissionCompass);
-
- for (map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it)
+ for ( map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it )
{
nlassert((*it).second);
(*it).second->updateCompass(*this, string());
}
}
+
{
H_AUTO(CharacterUpdateTeamCompass);
- CTeam* team = TeamManager.getRealTeam(_TeamId);
-
- if (team)
+ CTeam * team = TeamManager.getRealTeam( _TeamId );
+ if ( team )
{
const uint size = (uint)team->getMissions().size();
-
- for (uint i = 0; i < size; i++)
+ for ( uint i = 0; i < size; i++ )
{
nlassert(team->getMissions()[i]);
team->getMissions()[i]->updateCompass(*this, string(""));
@@ -1368,16 +1383,15 @@ uint32 CCharacter::tickUpdate()
}
}
}
+
// Adding UpdateCompass for guild missions
{
H_AUTO(CharacterUpdateGuildCompass);
- CGuild* guild = CGuildManager::getInstance()->getGuildFromId(_GuildId);
-
- if (guild)
+ CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId );
+ if ( guild )
{
const uint size = (uint)guild->getMissions().size();
-
- for (uint i = 0; i < size; i++)
+ for ( uint i = 0; i < size; i++ )
{
nlassert(guild->getMissions()[i]);
guild->getMissions()[i]->updateCompass(*this, string(""));
@@ -1385,23 +1399,21 @@ uint32 CCharacter::tickUpdate()
}
}
}
+
{
H_AUTO(CharacterUpdateTargetCoordinatesCompass);
// update compass coordinates information
compassDatabaseUpdate();
}
-
- if (!checkCharacterStillValide(
- " Character corrupted : after compassDatabaseUpdate() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after compassDatabaseUpdate() !!!") )
+ return (uint32)-1;
}
}
if (IsRingShard && _NpcControlEid != CEntityId::Unknown)
{
H_AUTO(CharacterUpdateNpcControl);
-
- if (_LastTickNpcControlUpdated + TickFrequencyNpcControlUpdate.get() <= CTickEventHandler::getGameCycle())
+ if ( _LastTickNpcControlUpdated + TickFrequencyNpcControlUpdate.get() <= CTickEventHandler::getGameCycle() )
{
// _LastTickNpcControlUpdated = CTickEventHandler::getGameCycle(); is done in setNpcControl
{
@@ -1411,57 +1423,49 @@ uint32 CCharacter::tickUpdate()
}
}
+
{
H_AUTO(CharacterUpdateCombatEventFlags);
// update combat flags
updateCombatEventFlags();
-
- if (!checkCharacterStillValide(
- " Character corrupted : after updateCombatEventFlags() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after updateCombatEventFlags() !!!") )
+ return (uint32)-1;
}
-
{
H_AUTO(CharacterUpdatePowerAndAuraFlags);
// update power flags
updatePowerAndAuraFlags();
-
- if (!checkCharacterStillValide(
- " Character corrupted : after updatePowerAndAuraFlags() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after updatePowerAndAuraFlags() !!!") )
+ return (uint32)-1;
}
{
H_AUTO(CharacterUpdateDisableModifier);
// update disabled modifiers
_ModifiersInDB.update(_PropertyDatabase);
-
- if (!checkCharacterStillValide(
- " Character corrupted : after _ModifiersInDB.update() !!!"))
- return (uint32) - 1;
+ if( !checkCharacterStillValide(" Character corrupted : after _ModifiersInDB.update() !!!") )
+ return (uint32)-1;
}
{
// update items prerequisits
- if (_HaveToUpdateItemsPrerequisit)
+ if( _HaveToUpdateItemsPrerequisit )
{
H_AUTO(CharacterUpdateItemsPrerequisit);
- CInventoryPtr bagInv = getInventory(INVENTORIES::bag);
- if (bagInv != NULL)
+ CInventoryPtr bagInv = getInventory( INVENTORIES::bag );
+ if( bagInv != NULL )
bagInv->updateAllItemPrerequisit();
- for (uint i = INVENTORIES::pet_animal; i < INVENTORIES::max_pet_animal; ++i)
+ for( uint i=INVENTORIES::pet_animal; iupdateAllItemPrerequisit();
}
- CInventoryPtr roomInv = getInventory(INVENTORIES::player_room);
-
- if (roomInv != NULL)
+ CInventoryPtr roomInv = getInventory( INVENTORIES::player_room );
+ if( roomInv != NULL )
roomInv->updateAllItemPrerequisit();
_HaveToUpdateItemsPrerequisit = false;
@@ -1471,24 +1475,23 @@ uint32 CCharacter::tickUpdate()
bool updatePVP = false;
{
H_AUTO(CharacterUpdateOutpost);
- TAIAlias outpostAlias = getOutpostAlias();
- if (outpostAlias != 0)
+ TAIAlias outpostAlias = getOutpostAlias();
+ if( outpostAlias != 0 )
{
// if timer over : reset flag
- if (outpostLeavingDurationElapsed())
+ if( outpostLeavingDurationElapsed() )
{
stopOutpostLeavingTimer();
setOutpostAlias(0);
updatePVP = true;
}
- CSmartPtr outpost = COutpostManager::getInstance().getOutpostFromAlias(outpostAlias);
-
- if (outpost)
+ CSmartPtr outpost = COutpostManager::getInstance().getOutpostFromAlias( outpostAlias );
+ if( outpost )
{
// if peace : reset flag
- if (outpost->getState() == OUTPOSTENUMS::Peace)
+ if( outpost->getState() == OUTPOSTENUMS::Peace )
{
stopOutpostLeavingTimer();
setOutpostAlias(0);
@@ -1502,6 +1505,7 @@ uint32 CCharacter::tickUpdate()
}
}
}
+
{
H_AUTO(CharacterUpdatePVPMode);
@@ -1520,7 +1524,7 @@ uint32 CCharacter::tickUpdate()
_PVPInSafeZoneLastTime = !_PVPInSafeZoneLastTime;
updatePVP = true;
}
-
+
if (updatePVP)
{
CPVPManager2::getInstance()->setPVPModeInMirror(this);
@@ -1529,10 +1533,9 @@ uint32 CCharacter::tickUpdate()
}
}
- if (_HaveToUpdatePVPMode)
+ if( _HaveToUpdatePVPMode )
{
const TGameCycle waitTime = _PVPFlag ? TimeForSetPVPFlag.get() : TimeForPVPFlagOff.get();
-
if (_PVPFlagLastTimeChange + waitTime < CTickEventHandler::getGameCycle())
{
CPVPManager2::getInstance()->setPVPModeInMirror(this);
@@ -1542,12 +1545,10 @@ uint32 CCharacter::tickUpdate()
}
}
- if (getPvPRecentActionFlag() == false)
+ if( getPvPRecentActionFlag() == false )
{
- CMirrorPropValue propPvpMode(
- TheDataset, TheDataset.getDataSetRow(_Id), DSPropertyEVENT_FACTION_ID);
-
- if (propPvpMode.getValue() & PVP_MODE::PvpFactionFlagged)
+ CMirrorPropValue propPvpMode( TheDataset, TheDataset.getDataSetRow(_Id), DSPropertyEVENT_FACTION_ID );
+ if( propPvpMode.getValue()&PVP_MODE::PvpFactionFlagged )
{
CPVPManager2::getInstance()->setPVPModeInMirror(this);
updatePVPClanVP();
@@ -1556,32 +1557,28 @@ uint32 CCharacter::tickUpdate()
}
// write faction points in database if needed
- if (CPVPFactionRewardManager::getInstance().getFactionPointPool(_DeclaredCult) != _LastCultPointWriteDB)
+ if( CPVPFactionRewardManager::getInstance().getFactionPointPool( _DeclaredCult ) != _LastCultPointWriteDB )
{
- _LastCultPointWriteDB = CPVPFactionRewardManager::getInstance().getFactionPointPool(_DeclaredCult);
- // _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CULT", _DeclaredCult );
- CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCULT(_PropertyDatabase, _DeclaredCult);
- // _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CULT_POINTS", _LastCultPointWriteDB );
- CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCULT_POINTS(
- _PropertyDatabase, _LastCultPointWriteDB);
+ _LastCultPointWriteDB = CPVPFactionRewardManager::getInstance().getFactionPointPool( _DeclaredCult );
+// _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CULT", _DeclaredCult );
+ CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCULT(_PropertyDatabase, _DeclaredCult );
+// _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CULT_POINTS", _LastCultPointWriteDB );
+ CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCULT_POINTS(_PropertyDatabase, _LastCultPointWriteDB );
}
-
- if (CPVPFactionRewardManager::getInstance().getFactionPointPool(_DeclaredCiv) != _LastCivPointWriteDB)
+ if( CPVPFactionRewardManager::getInstance().getFactionPointPool( _DeclaredCiv ) != _LastCivPointWriteDB )
{
- _LastCivPointWriteDB = CPVPFactionRewardManager::getInstance().getFactionPointPool(_DeclaredCiv);
- // _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CIV", _DeclaredCiv );
- CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCIV(_PropertyDatabase, _DeclaredCiv);
- // _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CIV_POINTS", _LastCivPointWriteDB );
- CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCIV_POINTS(
- _PropertyDatabase, _LastCivPointWriteDB);
+ _LastCivPointWriteDB = CPVPFactionRewardManager::getInstance().getFactionPointPool( _DeclaredCiv );
+// _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CIV", _DeclaredCiv );
+ CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCIV(_PropertyDatabase, _DeclaredCiv );
+// _PropertyDatabase.setProp( "PVP_EFFECTS:PVP_FACTION_POINTS:CIV_POINTS", _LastCivPointWriteDB );
+ CBankAccessor_PLR::getPVP_EFFECTS().getPVP_FACTION_POINTS().setCIV_POINTS(_PropertyDatabase, _LastCivPointWriteDB );
}
uint32 nextUpdate = 16;
-
if (oldHp != _PhysScores._PhysicalScores[SCORES::hit_points].Current
- || oldSta != _PhysScores._PhysicalScores[SCORES::stamina].Current
- || oldSap != _PhysScores._PhysicalScores[SCORES::sap].Current
- || oldFocus != _PhysScores._PhysicalScores[SCORES::focus].Current)
+ || oldSta != _PhysScores._PhysicalScores[SCORES::stamina].Current
+ || oldSap != _PhysScores._PhysicalScores[SCORES::sap].Current
+ || oldFocus != _PhysScores._PhysicalScores[SCORES::focus].Current)
{
nextUpdate = 8;
}
@@ -1600,7 +1597,7 @@ uint32 CCharacter::tickUpdate()
if ((double)(A * A) + (double)(B * B) <= (double)(R * R))
{
TAIAlias missionAlias = CAIAliasTranslator::getInstance()->getMissionUniqueIdFromName((*it).Name);
- CMission* mission = _Missions->getMissions(missionAlias);
+ CMission *mission = _Missions->getMissions(missionAlias);
if (mission != NULL)
{
@@ -1641,14 +1638,14 @@ uint32 CCharacter::tickUpdate()
} // tickUpdate //
//----------------------------------------------------------------------------
-void CCharacter::setEnterFlag(bool b)
+void CCharacter::setEnterFlag( bool b )
{
- if (b)
+ if ( b )
{
// setup timer for tickUpdate() calling
- _TickUpdateTimer.setRemaining(1, new CCharacterTickUpdateTimerEvent(this), 16);
- _DeathPenaltyTimer.setRemaining(1, new CDeathPenaltiesTimerEvent(this), 16);
- _BarUpdateTimer.setRemaining(1, new CCharacterBarUpdateTimerEvent(this), 1);
+ _TickUpdateTimer.setRemaining( 1, new CCharacterTickUpdateTimerEvent( this ),16 );
+ _DeathPenaltyTimer.setRemaining(1, new CDeathPenaltiesTimerEvent( this ),16);
+ _BarUpdateTimer.setRemaining(1, new CCharacterBarUpdateTimerEvent( this ),1);
}
else
{
@@ -1666,13 +1663,14 @@ void CCharacter::setEnterFlag(bool b)
//-----------------------------------------------
void CCharacter::saveCharacter()
{
- if ((_LastTickSaved + TickFrequencyPCSave) <= CTickEventHandler::getGameCycle())
+ if( ( _LastTickSaved + TickFrequencyPCSave ) <= CTickEventHandler::getGameCycle() )
{
_LastTickSaved = CTickEventHandler::getGameCycle();
- PlayerManager.savePlayerActiveChar(PlayerManager.getPlayerId(_Id));
+ PlayerManager.savePlayerActiveChar( PlayerManager.getPlayerId( _Id ) );
}
}
+
//-----------------------------------------------
// CCharacter::kill
//-----------------------------------------------
@@ -1682,39 +1680,44 @@ void CCharacter::kill(TDataSetRow killerRowId)
return;
// force player to unmount
- if (TheDataset.isAccessible(_EntityMounted()))
+ if( TheDataset.isAccessible(_EntityMounted()) )
{
unmount();
}
- std::vector usableRespawnPoints;
+ std::vector< uint16 > usableRespawnPoints;
getRespawnPoints().getUsableRespawnPoints(getCurrentContinent(), usableRespawnPoints);
-
- if (usableRespawnPoints.empty())
+ if ( usableRespawnPoints.empty() )
{
getRespawnPoints().addDefaultRespawnPoint(getCurrentContinent());
}
_IsDead = true;
_Mode = MBEHAV::DEATH;
+
removeAllSpells();
_ForbidPowerDates.clearConsumable();
+
_PhysScores._PhysicalScores[SCORES::hit_points].Current = -_PhysScores._PhysicalScores[SCORES::hit_points].Max / 2;
setBars();
+
_TimeDeath = CTickEventHandler::getGameTime() + 5.0;
+
// stop all temp inventory actions
sendCloseTempInventoryImpulsion();
+
// end quartering if in progress
endHarvest();
+
// stop all temp inventory actions
clearTempInventory();
// Testing tools report
- if (TTSIsUp)
+ if( TTSIsUp )
{
CMessage msgout("TTS_REPORT_ACTOR_DEAD");
- msgout.serial(_Id);
- CUnifiedNetwork::getInstance()->send("TTS", msgout);
+ msgout.serial( _Id );
+ CUnifiedNetwork::getInstance()->send( "TTS", msgout );
}
CMessage msgout("SET_DEAD_STATUS");
@@ -1724,36 +1727,34 @@ void CCharacter::kill(TDataSetRow killerRowId)
_ContextualProperty.directAccessForStructMembers().talkableTo(false);
_ContextualProperty.setChanged();
+
CPhraseManager::getInstance().removeEntity(_EntityRowId, false);
if (_TpTicketSlot != INVENTORIES::INVALID_INVENTORY_SLOT)
{
- unLockItem(INVENTORIES::bag, _TpTicketSlot, 1);
+ unLockItem(INVENTORIES::bag, _TpTicketSlot,1);
resetTpTicketSlot();
}
// Output Stats
string placeName = string("None");
string regionName = string("None");
-
- if (!_Places.empty())
+ if ( !_Places.empty() )
{
- CPlace* p = CZoneManager::getInstance().getPlaceFromId(_Places[0]);
-
- if (p)
+ CPlace * p = CZoneManager::getInstance().getPlaceFromId( _Places[0] );
+ if( p )
placeName = p->getName();
}
- const CRegion* r = NULL;
- CZoneManager::getInstance().getRegion(this, &r);
-
- if (r)
+ const CRegion * r=NULL;
+ CZoneManager::getInstance().getRegion( this, &r);
+ if( r )
{
regionName = r->getName();
}
// if best skill of player is too low then he doesn't get death penalty
- if (getBestChildSkillValue(SKILLS::any) < DeathPenaltyMinLevel)
+ if( getBestChildSkillValue(SKILLS::any) < DeathPenaltyMinLevel )
{
setNextDeathPenaltyFactor(0.0f);
}
@@ -1761,14 +1762,12 @@ void CCharacter::kill(TDataSetRow killerRowId)
// check killer and do things accordingly
CEntityId killerId;
CSheetId killerSheet;
- CEntityBase* e = CEntityBaseManager::getEntityBasePtr(killerRowId);
-
- if (e)
+ CEntityBase * e = CEntityBaseManager::getEntityBasePtr(killerRowId);
+ if( e )
{
// clear XP gain for this player
PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->clearAllXpForPlayer(_EntityRowId, _TeamId, false);
-
- if (e->getId().getType() == RYZOMID::player)
+ if( e->getId().getType() == RYZOMID::player )
{
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->playerDeath(this, (CCharacter*)e);
}
@@ -1776,16 +1775,16 @@ void CCharacter::kill(TDataSetRow killerRowId)
killerId = e->getId();
killerSheet = e->getType();
- if (!(getPVPInterface().isValid() && getPVPInterface().killedBy(e)))
+ if ( ! (getPVPInterface().isValid() &&
+ getPVPInterface().killedBy( e )) )
{
// if killed by a creature, check if death penalty should be applied or not
- if (killerId.getType() == RYZOMID::creature || killerId.getType() == RYZOMID::npc)
+ if ( killerId.getType() == RYZOMID::creature || killerId.getType() == RYZOMID::npc )
{
- CCreature* creature = dynamic_cast(e);
-
+ CCreature *creature = dynamic_cast (e);
if (creature && creature->getForm())
{
- if (creature->getForm()->getXPGainOnCreature() == 0)
+ if ( creature->getForm()->getXPGainOnCreature() == 0 )
{
setNextDeathPenaltyFactor(0.0f);
}
@@ -1793,11 +1792,11 @@ void CCharacter::kill(TDataSetRow killerRowId)
}
}
- if (killerId.getType() == RYZOMID::player)
+ if( killerId.getType() == RYZOMID::player )
{
- if (getDuelOpponent())
+ if( getDuelOpponent() )
{
- if (getDuelOpponent()->getId() != killerId)
+ if( getDuelOpponent()->getId() != killerId )
{
setNextDeathPenaltyFactor(0.0f);
}
@@ -1808,35 +1807,31 @@ void CCharacter::kill(TDataSetRow killerRowId)
}
}
}
-
- // Bsi.append( StatPath, NLMISC::toString("[PJM] %s %s %s %s %s %s", _Id.toString().c_str(),
- // CONTINENT::toString(_CurrentContinent).c_str(), regionName.c_str(), placeName.c_str(),
- // KillerId.toString().c_str(), KillerSheet.toString().c_str()) );
- // EgsStat.displayNL("[PJM] %s %s %s %s %s %s", _Id.toString().c_str(),
- // CONTINENT::toString(_CurrentContinent).c_str(), regionName.c_str(), placeName.c_str(),
- // KillerId.toString().c_str(), KillerSheet.toString().c_str());
- // EGSPD::pCDead(_Id, CONTINENT::toString(_CurrentContinent), regionName, placeName, killerId,
- // killerSheet.toString());
+ //Bsi.append( StatPath, NLMISC::toString("[PJM] %s %s %s %s %s %s", _Id.toString().c_str(), CONTINENT::toString(_CurrentContinent).c_str(), regionName.c_str(), placeName.c_str(), KillerId.toString().c_str(), KillerSheet.toString().c_str()) );
+ //EgsStat.displayNL("[PJM] %s %s %s %s %s %s", _Id.toString().c_str(), CONTINENT::toString(_CurrentContinent).c_str(), regionName.c_str(), placeName.c_str(), KillerId.toString().c_str(), KillerSheet.toString().c_str());
+// EGSPD::pCDead(_Id, CONTINENT::toString(_CurrentContinent), regionName, placeName, killerId, killerSheet.toString());
} // kill //
+
//---------------------------------------------------
// character is dead
//
//---------------------------------------------------
-void CCharacter::deathOccurs(void)
+void CCharacter::deathOccurs( void )
{
H_AUTO(DeathOccursCharacter);
- if (currentHp() > 0)
+ if( currentHp() > 0 )
{
resurrected();
return;
}
- if (getPVPInterface().isValid())
+ if ( getPVPInterface().isValid() )
{
// ignore PVP death
const bool cancelRespawn = getPVPInterface().doCancelRespawn();
+
getPVPInterface().leavePVP(IPVP::Death);
if (cancelRespawn)
@@ -1844,104 +1839,93 @@ void CCharacter::deathOccurs(void)
}
CPVPManager2::getInstance()->playerDies(this);
+
CBuildingManager::getInstance()->removeTriggerRequest(getEntityRowId());
- if (_TimeDeath < CTickEventHandler::getGameTime())
+ if( _TimeDeath < CTickEventHandler::getGameTime() )
{
if (_Mode.getValue().Mode == MBEHAV::DEATH)
{
// Cancel all action during death
cancelStaticActionInProgress();
- if (_Mode.getValue().Mode == MBEHAV::DEATH && _IsDead == true)
+ if( _Mode.getValue().Mode == MBEHAV::DEATH && _IsDead == true )
{
_TimeDeath = CTickEventHandler::getGameTime() + CommaDelayBeforeDeath;
CPhraseManager::getInstance().removeEntity(TheDataset.getDataSetRow(_Id), false);
}
else
{
- // todo make necessary for stop vision of character
+ //todo make necessary for stop vision of character
}
}
}
// update regen
- if (!_IsInAComa)
+ if( !_IsInAComa )
{
resetCharacterModifier();
computeMaxValue();
// negative regen giving healing times for resurrect character
- for (uint32 i = 0; i < SCORES::NUM_SCORES; ++i)
+ for( uint32 i = 0; i < SCORES::NUM_SCORES; ++i )
{
- if (i == SCORES::hit_points)
+ if( i == SCORES::hit_points )
{
- float currentRegen = -_PhysScores._PhysicalScores[i].Max / (CommaDelayBeforeDeath * 0.2f);
- _PhysScores._PhysicalScores[i].CurrentRegenerate = currentRegen;
- _PhysScores._PhysicalScores[i].Current = -_PhysScores._PhysicalScores[i].Max / 2;
+ float currentRegen = - _PhysScores._PhysicalScores[ i ].Max / (CommaDelayBeforeDeath * 0.2f );
+ _PhysScores._PhysicalScores[ i ].CurrentRegenerate = currentRegen;
+ _PhysScores._PhysicalScores[ i ].Current = - _PhysScores._PhysicalScores[ i ].Max / 2;
}
else
{
- float currentRegen = -_PhysScores._PhysicalScores[i].Current / (CommaDelayBeforeDeath * 0.1f);
- _PhysScores._PhysicalScores[i].CurrentRegenerate = currentRegen;
+ float currentRegen = - _PhysScores._PhysicalScores[ i ].Current / ( CommaDelayBeforeDeath * 0.1f );
+ _PhysScores._PhysicalScores[ i ].CurrentRegenerate = currentRegen;
}
}
-
_IsInAComa = true;
}
- for (uint32 i = 0; i < SCORES::NUM_SCORES; ++i)
+ for( uint32 i = 0; i < SCORES::NUM_SCORES; ++i )
{
- sint32 oldCurrent = _PhysScores._PhysicalScores[i].Current;
-
- if (i == SCORES::hit_points)
+ sint32 oldCurrent = _PhysScores._PhysicalScores[ i ].Current;
+ if( i == SCORES::hit_points )
{
- if (_PhysScores._PhysicalScores[i].Current > -_PhysScores._PhysicalScores[i].Max)
+ if( _PhysScores._PhysicalScores[ i ].Current > - _PhysScores._PhysicalScores[ i ].Max )
{
- _PhysScores._PhysicalScores[i].KeepRegenerateDecimal += _PhysScores._PhysicalScores[i].CurrentRegenerate
- * (CTickEventHandler::getGameCycle() - _PhysScores._PhysicalScores[i].RegenerateTickUpdate) / 10.0f;
- _PhysScores._PhysicalScores[i].Current = (sint32)(_PhysScores._PhysicalScores[i].Current
- + (sint32)_PhysScores._PhysicalScores[i].KeepRegenerateDecimal);
- _PhysScores._PhysicalScores[i].KeepRegenerateDecimal
- -= (sint32)_PhysScores._PhysicalScores[i].KeepRegenerateDecimal;
+ _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal += _PhysScores._PhysicalScores[ i ].CurrentRegenerate * ( CTickEventHandler::getGameCycle() - _PhysScores._PhysicalScores[ i ].RegenerateTickUpdate ) / 10.0f;
+ _PhysScores._PhysicalScores[ i ].Current = (sint32) ( _PhysScores._PhysicalScores[ i ].Current + (sint32) _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal );
+ _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal -= (sint32) _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal;
}
-
- if (_PhysScores._PhysicalScores[i].Current < -_PhysScores._PhysicalScores[i].Max)
+ if( _PhysScores._PhysicalScores[ i ].Current < -_PhysScores._PhysicalScores[ i ].Max )
{
- _PhysScores._PhysicalScores[i].Current = -_PhysScores._PhysicalScores[i].Max;
+ _PhysScores._PhysicalScores[ i ].Current = - _PhysScores._PhysicalScores[ i ].Max;
}
-
- _PhysScores._PhysicalScores[i].RegenerateTickUpdate = CTickEventHandler::getGameCycle();
+ _PhysScores._PhysicalScores[ i ].RegenerateTickUpdate = CTickEventHandler::getGameCycle();
}
else
{
- if (_PhysScores._PhysicalScores[i].Current > 0)
+ if( _PhysScores._PhysicalScores[ i ].Current > 0 )
{
- _PhysScores._PhysicalScores[i].KeepRegenerateDecimal += _PhysScores._PhysicalScores[i].CurrentRegenerate
- * (CTickEventHandler::getGameCycle() - _PhysScores._PhysicalScores[i].RegenerateTickUpdate) / 10.0f;
- _PhysScores._PhysicalScores[i].Current = (sint32)(_PhysScores._PhysicalScores[i].Current
- + (sint32)_PhysScores._PhysicalScores[i].KeepRegenerateDecimal);
- _PhysScores._PhysicalScores[i].KeepRegenerateDecimal
- -= (sint32)_PhysScores._PhysicalScores[i].KeepRegenerateDecimal;
+ _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal += _PhysScores._PhysicalScores[ i ].CurrentRegenerate * ( CTickEventHandler::getGameCycle() - _PhysScores._PhysicalScores[ i ].RegenerateTickUpdate ) / 10.0f;
+ _PhysScores._PhysicalScores[ i ].Current = (sint32) ( _PhysScores._PhysicalScores[ i ].Current + (sint32) _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal );
+ _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal -= (sint32) _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal;
}
-
- if (_PhysScores._PhysicalScores[i].Current < 0)
+ if( _PhysScores._PhysicalScores[ i ].Current < 0 )
{
- _PhysScores._PhysicalScores[i].Current = 0;
+ _PhysScores._PhysicalScores[ i ].Current = 0;
}
-
- _PhysScores._PhysicalScores[i].RegenerateTickUpdate = CTickEventHandler::getGameCycle();
+ _PhysScores._PhysicalScores[ i ].RegenerateTickUpdate = CTickEventHandler::getGameCycle();
}
}
-
setBars();
}
+
//---------------------------------------------------
// player choose a re-spawn for his death character
//
//---------------------------------------------------
-void CCharacter::respawn(uint16 index)
+void CCharacter::respawn( uint16 index )
{
// ignore message if player isn't dead
if (!_IsDead)
@@ -1950,10 +1934,11 @@ void CCharacter::respawn(uint16 index)
}
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->playerRespawn(this);
- sint32 x, y, z;
+
+ sint32 x,y,z;
float heading;
- if (getRespawnPoints().getRingAdventuresRespawnPoint(x, y))
+ if( getRespawnPoints().getRingAdventuresRespawnPoint( x, y ) )
{
z = 0;
heading = 0.0f;
@@ -1962,34 +1947,28 @@ void CCharacter::respawn(uint16 index)
{
vector points;
getRespawnPoints().getUsableRespawnPoints(getCurrentContinent(), points);
-
- if (index >= points.size())
+ if ( index >= points.size() )
{
- nlwarning(" invalid point %u for user %s ( count = %u)", index, _Id.toString().c_str(),
- points.size());
+ nlwarning(" invalid point %u for user %s ( count = %u)",index,_Id.toString().c_str(),points.size());
index = 0;
getRespawnPoints().addDefaultRespawnPoint(getCurrentContinent());
getRespawnPoints().getUsableRespawnPoints(getCurrentContinent(), points);
- if (index >= points.size())
+ if ( index >= points.size() )
{
- nlwarning(" invalid default point %u for user %s. CurrentContinent %d x = %d, y = %d",
- index, _Id.toString().c_str(), getCurrentContinent(), getState().X(), getState().Y());
+ nlwarning(" invalid default point %u for user %s. CurrentContinent %d x = %d, y = %d",index,_Id.toString().c_str(), getCurrentContinent(), getState().X(),getState().Y() );
return;
}
}
// get the tp coords
- const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone(points[index]);
-
- if (!zone)
+ const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( points[index] );
+ if ( !zone )
{
- nlwarning(" invalid point %u for user %s ( count = %u) ( NULL zone returned )", index,
- _Id.toString().c_str(), points.size());
+ nlwarning(" invalid point %u for user %s ( count = %u) ( NULL zone returned )",index,_Id.toString().c_str(),points.size());
return;
}
-
- zone->getRandomPoint(x, y, z, heading);
+ zone->getRandomPoint(x,y,z,heading);
}
respawn(x, y, z, heading);
@@ -1999,25 +1978,29 @@ void CCharacter::respawn(sint32 x, sint32 y, sint32 z, float heading, bool apply
{
// remove character of vision of other PC
CMessage msgout("ENTITY_TELEPORTATION");
- msgout.serial(_Id);
-
+ msgout.serial( _Id );
if (IsRingShard)
{
- nlinfo("Asking GPMS to TP character %s to (0,0) for respawn", _Id.toString().c_str());
+ nlinfo("Asking GPMS to TP character %s to (0,0) for respawn",_Id.toString().c_str());
}
-
sendMessageViaMirror("GPMS", msgout);
+
forbidNearPetTp();
+
// set player to intangible state
_IntangibleEndDate = ~0;
+
applyRespawnEffects(applyDP);
+
TDataSetRow dsr = getEntityRowId();
CMirrorPropValueRO srcCell(TheDataset, dsr, DSPropertyCELL);
sint32 cell = srcCell;
// tpWanted() sends message CAIPlayerRespawnMsg to AIS
tpWanted(x, y, z, true, heading, 0xFF, cell);
+
// give spire effect if needed
- CPVPFactionRewardManager::getInstance().giveTotemsEffects(this);
+ CPVPFactionRewardManager::getInstance().giveTotemsEffects( this );
+
_RegionKilledInPvp = 0xffff;
}
@@ -2103,9 +2086,12 @@ void CCharacter::resurrected()
_IsDead = false;
_IsInAComa = false;
resetNextDeathPenaltyFactor();
+
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->playerResurrected(this);
+
// give spire effect if needed
- CPVPFactionRewardManager::getInstance().giveTotemsEffects(this);
+ CPVPFactionRewardManager::getInstance().giveTotemsEffects( this );
+
_RegionKilledInPvp = 0xffff;
CMessage msgout("SET_DEAD_STATUS");
@@ -2114,6 +2100,7 @@ void CCharacter::resurrected()
sendMessageViaMirror("GPMS", msgout);
}
+
//---------------------------------------------------
// revive
// player revives at full health at his location without death penalty
@@ -2125,6 +2112,7 @@ void CCharacter::revive()
_IsDead = false;
_IsInAComa = false;
_RegionKilledInPvp = 0xffff;
+
_PhysScores._PhysicalScores[SCORES::hit_points].Current = _PhysScores._PhysicalScores[SCORES::hit_points].Base;
_PhysScores._PhysicalScores[SCORES::stamina].Current = _PhysScores._PhysicalScores[SCORES::stamina].Base;
_PhysScores._PhysicalScores[SCORES::sap].Current = _PhysScores._PhysicalScores[SCORES::sap].Base;
@@ -2140,9 +2128,9 @@ void CCharacter::revive()
// Buy kami or karavan pact for a respawn point
//
//---------------------------------------------------
-void CCharacter::buyPact(const std::string &PactName)
+void CCharacter::buyPact( const std::string& PactName )
{
- /// TODO RESPAWN
+ ///TODO RESPAWN
}
//---------------------------------------------------
@@ -2151,10 +2139,9 @@ void CCharacter::buyPact(const std::string &PactName)
void CCharacter::incNbAura()
{
++_NbAuras;
-
if (_NbAuras == 1)
{
- CMirrorPropValue visualFx(TheDataset, _EntityRowId, DSPropertyVISUAL_FX);
+ CMirrorPropValue visualFx( TheDataset, _EntityRowId, DSPropertyVISUAL_FX );
CVisualFX fx;
fx.unpack(visualFx.getValue());
fx.AuraReceipt = true;
@@ -2169,13 +2156,13 @@ void CCharacter::incNbAura()
//---------------------------------------------------
void CCharacter::decNbAura()
{
- if (_NbAuras)
+ if(_NbAuras)
--_NbAuras;
if (_NbAuras == 0)
{
// set visual fx on the entity
- CMirrorPropValue visualFx(TheDataset, _EntityRowId, DSPropertyVISUAL_FX);
+ CMirrorPropValue visualFx( TheDataset, _EntityRowId, DSPropertyVISUAL_FX );
CVisualFX fx;
fx.unpack(visualFx.getValue());
fx.AuraReceipt = false;
@@ -2190,115 +2177,107 @@ void CCharacter::decNbAura()
//---------------------------------------------------
void CCharacter::displayPowerFlags()
{
- for (uint i = 0; i < 32; ++i)
+ for (uint i = 0 ; i < 32 ; ++i)
{
- BRICK_FLAGS::TBrickFlag flag = (BRICK_FLAGS::TBrickFlag)(BRICK_FLAGS::BeginPowerFlags + i);
- nldebug("Power %s, flag = %u startTick = %u endTick = %u", BRICK_FLAGS::toString(flag).c_str(), i,
- _PowerFlagTicks[i].StartTick, _PowerFlagTicks[i].EndTick);
+ BRICK_FLAGS::TBrickFlag flag = (BRICK_FLAGS::TBrickFlag) (BRICK_FLAGS::BeginPowerFlags + i);
+ nldebug("Power %s, flag = %u startTick = %u endTick = %u", BRICK_FLAGS::toString(flag).c_str(), i, _PowerFlagTicks[i].StartTick, _PowerFlagTicks[i].EndTick);
}
}
//---------------------------------------------------
// Entity want mount another
//---------------------------------------------------
-void CCharacter::mount(TDataSetRow PetRowId)
+void CCharacter::mount( TDataSetRow PetRowId )
{
- if (!R2_VISION::isEntityVisibleToPlayers(getWhoSeesMe()))
+ if ( !R2_VISION::isEntityVisibleToPlayers(getWhoSeesMe()) )
{
- PHRASE_UTILITIES::sendDynamicSystemMessage(
- _EntityRowId, "CANT_MOUNT_WHILE_INVISIBLE"); // not translated (only for GM)
+ PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "CANT_MOUNT_WHILE_INVISIBLE" ); // not translated (only for GM)
return;
}
- CEntityBase* e = CEntityBaseManager::getEntityBasePtr(PetRowId);
-
- if (e)
+ CEntityBase * e = CEntityBaseManager::getEntityBasePtr( PetRowId );
+ if( e )
{
- const CStaticCreatures* form = e->getForm();
-
- if (form)
+ const CStaticCreatures * form = e->getForm();
+ if( form )
{
- if (form->getProperties().mountable())
+ if( form->getProperties().mountable() )
{
- if (e->getRiderEntity().isNull())
+ if( e->getRiderEntity().isNull() )
{
setAfkState(false);
- sint32 petIndex = getPlayerPet(PetRowId);
-
- if ((petIndex != -1) /*&& (staticActionInProgress() != true)*/)
+ sint32 petIndex = getPlayerPet( PetRowId );
+ if( (petIndex!=-1) /*&& (staticActionInProgress() != true)*/ )
{
- COfflineEntityState state = e->getState();
- CVector2d destination(state.X, state.Y);
- CVector2d start(_EntityState.X, _EntityState.Y);
+ COfflineEntityState state = e->getState();
+ CVector2d destination( state.X, state.Y );
+ CVector2d start( _EntityState.X, _EntityState.Y );
float distance = (float)(start - destination).sqrnorm();
-
- if (distance <= MaxTalkingDistSquare * 1000 * 1000)
+ if( distance <= MaxTalkingDistSquare * 1000 * 1000 )
{
// prevent from giving the mount which the player mounts
abortExchange();
- setEntityMounted(e->getEntityRowId());
+
+ setEntityMounted( e->getEntityRowId() );
+
// set the rider for entity
- e->setRiderEntity(_EntityRowId);
+ e->setRiderEntity( _EntityRowId );
+
// remember the mount state
_PlayerPets[petIndex].IsMounted = true;
- // _PropertyDatabase.setProp( "USER:MOUNT_WALK_SPEED",
- //(sint64)(sint)(e->getPhysScores().CurrentWalkSpeed() * 1000.0f) );
- CBankAccessor_PLR::getUSER().setMOUNT_WALK_SPEED(_PropertyDatabase,
- checkedCast(e->getPhysScores().CurrentWalkSpeed() * 1000.0f));
- // _PropertyDatabase.setProp( "USER:MOUNT_RUN_SPEED",
- //(sint64)(sint)(e->getPhysScores().CurrentRunSpeed() * 1000.0f) );
- CBankAccessor_PLR::getUSER().setMOUNT_RUN_SPEED(
- _PropertyDatabase, checkedCast(e->getPhysScores().CurrentRunSpeed() * 1000.0f));
-
- if (e->getContextualProperty().directAccessForStructMembers().mountable())
+
+// _PropertyDatabase.setProp( "USER:MOUNT_WALK_SPEED", (sint64)(sint)(e->getPhysScores().CurrentWalkSpeed() * 1000.0f) );
+ CBankAccessor_PLR::getUSER().setMOUNT_WALK_SPEED(_PropertyDatabase, checkedCast(e->getPhysScores().CurrentWalkSpeed() * 1000.0f) );
+// _PropertyDatabase.setProp( "USER:MOUNT_RUN_SPEED", (sint64)(sint)(e->getPhysScores().CurrentRunSpeed() * 1000.0f) );
+ CBankAccessor_PLR::getUSER().setMOUNT_RUN_SPEED(_PropertyDatabase, checkedCast(e->getPhysScores().CurrentRunSpeed() * 1000.0f) );
+
+ if( e->getContextualProperty().directAccessForStructMembers().mountable() )
{
- setMode(MBEHAV::MOUNT_NORMAL, true);
+ setMode( MBEHAV::MOUNT_NORMAL, true );
_LastMountTick = CTickEventHandler::getGameCycle();
- // egs_chinfo(" %d Set Mode to %d for entity %s",
- // CTickEventHandler::getGameCycle(), MBEHAV::EMode(_Mode.getValue().Mode),
- // _Id.toString().c_str() );
+
+ // egs_chinfo(" %d Set Mode to %d for entity %s", CTickEventHandler::getGameCycle(), MBEHAV::EMode(_Mode.getValue().Mode), _Id.toString().c_str() );
CMessage msgout("ACQUIRE_CONTROL");
- CEntityId mountedEntityId = TheDataset.getEntityId(getEntityMounted());
- msgout.serial(mountedEntityId);
- msgout.serial(_Id);
+ CEntityId mountedEntityId = TheDataset.getEntityId( getEntityMounted() );
+ msgout.serial( mountedEntityId );
+ msgout.serial( _Id );
sint32 local = 0;
- msgout.serial(local);
- msgout.serial(local);
- msgout.serial(local);
- sendMessageViaMirror("GPMS", msgout);
- e->setMode(MBEHAV::MOUNT_NORMAL, true);
+ msgout.serial( local );
+ msgout.serial( local );
+ msgout.serial( local );
+ sendMessageViaMirror( "GPMS", msgout );
+
+ e->setMode( MBEHAV::MOUNT_NORMAL, true );
+
_PhysScores.BaseWalkSpeed = _PhysScores.CurrentWalkSpeed = form->getWalkSpeed();
_PhysScores.BaseRunSpeed = _PhysScores.CurrentRunSpeed = form->getRunSpeed();
- e->getContextualProperty().directAccessForStructMembers().mountable(false);
+
+ e->getContextualProperty().directAccessForStructMembers().mountable( false );
e->getContextualProperty().setChanged();
- setTarget(CEntityId::Unknown);
+ setTarget( CEntityId::Unknown );
}
else
{
- CMessage msgout("IMPULSION_ID");
- msgout.serial(_Id);
+ CMessage msgout( "IMPULSION_ID" );
+ msgout.serial( _Id );
CBitMemStream bms;
-
- if (!GenericMsgManager.pushNameToStream("ANIMALS:MOUNT_ABORT", bms))
+ if ( ! GenericMsgManager.pushNameToStream( "ANIMALS:MOUNT_ABORT", bms) )
{
nlwarning(" Msg name ANIMALS:MOUNT_ABORT not found");
return;
}
-
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
- CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(_Id.getDynamicId()), msgout);
+ CUnifiedNetwork::getInstance()->send( NLNET::TServiceId(_Id.getDynamicId()), msgout );
// reset vars
if (e)
{
- e->setRiderEntity(TDataSetRow());
+ e->setRiderEntity( TDataSetRow() );
}
-
_EntityMounted = TDataSetRow();
-
- for (uint i = 0; i != _PlayerPets.size(); ++i)
+ for ( uint i=0; i!=_PlayerPets.size(); ++i )
{
- if (_PlayerPets[i].IsMounted)
+ if ( _PlayerPets[i].IsMounted )
{
_PlayerPets[i].IsMounted = false;
break;
@@ -2309,58 +2288,54 @@ void CCharacter::mount(TDataSetRow PetRowId)
return;
}
}
-
return;
}
}
else
{
- nlwarning(" %d Entity %s %s is not moutable !! sheeter or client bug ?",
- CTickEventHandler::getGameCycle(), e->getId().toString().c_str(), e->getType().toString().c_str());
+ nlwarning(" %d Entity %s %s is not moutable !! sheeter or client bug ?", CTickEventHandler::getGameCycle(), e->getId().toString().c_str(), e->getType().toString().c_str() );
}
}
else
{
- nlwarning(" %d Can't found static form sheet for entity %s %s !!",
- CTickEventHandler::getGameCycle(), e->getId().toString().c_str(), e->getType().toString().c_str());
+ nlwarning(" %d Can't found static form sheet for entity %s %s !!", CTickEventHandler::getGameCycle(), e->getId().toString().c_str(), e->getType().toString().c_str() );
}
}
- CMessage msgout("IMPULSION_ID");
- msgout.serial(_Id);
+ CMessage msgout( "IMPULSION_ID" );
+ msgout.serial( _Id );
CBitMemStream bms;
-
- if (!GenericMsgManager.pushNameToStream("ANIMALS:MOUNT_ABORT", bms))
+ if ( ! GenericMsgManager.pushNameToStream( "ANIMALS:MOUNT_ABORT", bms) )
{
nlwarning(" Msg name ANIMALS:MOUNT_ABORT not found");
return;
}
-
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
- CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(_Id.getDynamicId()), msgout);
+ CUnifiedNetwork::getInstance()->send( NLNET::TServiceId(_Id.getDynamicId()), msgout );
}
+
//---------------------------------------------------
// Unmount
// If changeMountedState is false, IsMounted is not changed (useful to remember the state when teleporting).
// If petIndex is ~0, auto-finds the index of the first mount for which IsMounted is true.
//---------------------------------------------------
-void CCharacter::unmount(bool changeMountedState, uint petIndex)
+void CCharacter::unmount( bool changeMountedState, uint petIndex )
{
- setMode(MBEHAV::NORMAL, true);
- // egs_chinfo(" %d Set Mode to %d for entity %s", CTickEventHandler::getGameCycle(),
- // MBEHAV::EMode(_Mode.getValue().Mode) , _Id.toString().c_str() );
+ setMode( MBEHAV::NORMAL, true );
+ // egs_chinfo(" %d Set Mode to %d for entity %s", CTickEventHandler::getGameCycle(), MBEHAV::EMode(_Mode.getValue().Mode) , _Id.toString().c_str() );
_LastUnMountTick = CTickEventHandler::getGameCycle();
+
CMessage msgout("LEAVE_CONTROL");
- msgout.serial(_Id);
- sendMessageViaMirror("GPMS", msgout);
- CEntityBase* e = CEntityBaseManager::getEntityBasePtr(getEntityMounted());
+ msgout.serial( _Id );
+ sendMessageViaMirror( "GPMS", msgout );
- if (e)
+ CEntityBase * e = CEntityBaseManager::getEntityBasePtr( getEntityMounted() );
+ if( e )
{
- e->setMode(MBEHAV::NORMAL, true);
- e->setRiderEntity(TDataSetRow());
- e->getContextualProperty().directAccessForStructMembers().mountable(true);
+ e->setMode( MBEHAV::NORMAL, true );
+ e->setRiderEntity( TDataSetRow() );
+ e->getContextualProperty().directAccessForStructMembers().mountable( true );
e->getContextualProperty().setChanged();
}
@@ -2372,43 +2347,44 @@ void CCharacter::unmount(bool changeMountedState, uint petIndex)
_EntityMounted = TDataSetRow();
// Set state
- if (changeMountedState)
+ if ( changeMountedState )
{
- if (petIndex == ~0)
+ if ( petIndex == ~0 )
{
- for (uint i = 0; i != _PlayerPets.size(); ++i)
+ for ( uint i=0; i!=_PlayerPets.size(); ++i )
{
- if (_PlayerPets[i].IsMounted)
+ if ( _PlayerPets[i].IsMounted )
{
petIndex = i;
break;
}
}
-
- if (petIndex == ~0)
+ if ( petIndex == ~0 )
{
- nlwarning("Mounted pet not found for %s", getId().toString().c_str());
+ nlwarning( "Mounted pet not found for %s", getId().toString().c_str() );
return;
}
}
else
{
- BOMB_IF(petIndex >= _PlayerPets.size(),
- toString("Pet index out of range for %s", getId().toString().c_str()), return);
+ BOMB_IF( petIndex >= _PlayerPets.size(),
+ toString( "Pet index out of range for %s", getId().toString().c_str() ),
+ return );
}
-
_PlayerPets[petIndex].IsMounted = false;
}
}
+
/*
* Return the mount if the player is mounted, otherwise NULL
*/
-CEntityBase* CCharacter::getMountEntity()
+CEntityBase *CCharacter::getMountEntity()
{
- return CEntityBaseManager::getEntityBasePtr(getEntityMounted());
+ return CEntityBaseManager::getEntityBasePtr( getEntityMounted() );
}
+
//---------------------------------------------------
// Set all character stats modifiers to initale states
//---------------------------------------------------
@@ -2417,6 +2393,7 @@ void CCharacter::resetCharacterModifier()
// NEVER RESET MODIFIERS they must be managed by effect themselves
} // resetCharacterModifier //
+
//---------------------------------------------------
// recompute all Max value
//
@@ -2424,147 +2401,99 @@ void CCharacter::resetCharacterModifier()
void CCharacter::computeMaxValue()
{
int i;
-
// Characteristics
- for (i = 0; i < CHARACTERISTICS::NUM_CHARACTERISTICS; ++i)
+ for( i = 0; i < CHARACTERISTICS::NUM_CHARACTERISTICS; ++i )
{
- _PhysCharacs._PhysicalCharacteristics[i].Max
- = _PhysCharacs._PhysicalCharacteristics[i].Modifier + _PhysCharacs._PhysicalCharacteristics[i].Base;
-
- if (_PhysCharacs._PhysicalCharacteristics[i].OldMax != _PhysCharacs._PhysicalCharacteristics[i].Max)
+ _PhysCharacs._PhysicalCharacteristics[ i ].Max = _PhysCharacs._PhysicalCharacteristics[ i ].Modifier + _PhysCharacs._PhysicalCharacteristics[ i ].Base;
+ if( _PhysCharacs._PhysicalCharacteristics[ i ].OldMax != _PhysCharacs._PhysicalCharacteristics[ i ].Max )
{
// antibug becaus in mirror == 133 and is a bool...
- if (_PhysCharacs._PhysicalCharacteristics[i].Current.testFlagInMirror() > 1)
+ if ( _PhysCharacs._PhysicalCharacteristics[ i ].Current.testFlagInMirror() > 1 )
{
- nlwarning("%s NASTY MEMORY BUG in computeMaxValue. current carac %d ", _Id.toString().c_str(), i);
+ nlwarning("%s NASTY MEMORY BUG in computeMaxValue. current carac %d ",_Id.toString().c_str(), i );
continue;
}
-
- if (_PhysCharacs._PhysicalCharacteristics[i].Max.testFlagInMirror() > 1)
+ if ( _PhysCharacs._PhysicalCharacteristics[ i ].Max.testFlagInMirror() > 1 )
{
- nlwarning("%s NASTY MEMORY BUG in computeMaxValue. max carac %d ", _Id.toString().c_str(), i);
+ nlwarning("%s NASTY MEMORY BUG in computeMaxValue. max carac %d ",_Id.toString().c_str(), i );
continue;
}
// Characteristics should not be negative
- _PhysCharacs._PhysicalCharacteristics[i].Current
- = std::max(sint32(_PhysCharacs._PhysicalCharacteristics[i].Max.getValue()), sint32(1));
-
- if (_PhysCharacs._PhysicalCharacteristics[i].OldCurrent
- != _PhysCharacs._PhysicalCharacteristics[i].Current)
+ _PhysCharacs._PhysicalCharacteristics[ i ].Current = std::max(sint32(_PhysCharacs._PhysicalCharacteristics[ i ].Max.getValue()), sint32(1));
+ if( _PhysCharacs._PhysicalCharacteristics[ i ].OldCurrent != _PhysCharacs._PhysicalCharacteristics[ i ].Current )
{
- // _PropertyDatabase.setProp( string("CHARACTER_INFO:CHARACTERISTICS:") +
- // CHARACTERISTICS::toString( (CHARACTERISTICS::TCharacteristics)i ) ,
- //_PhysCharacs._PhysicalCharacteristics[ i ].Current );
- CBankAccessor_PLR::getCHARACTER_INFO().getCHARACTERISTICS(i).setVALUE(
- _PropertyDatabase, checkedCast(_PhysCharacs._PhysicalCharacteristics[i].Current()));
- _PhysCharacs._PhysicalCharacteristics[i].OldCurrent = _PhysCharacs._PhysicalCharacteristics[i].Current;
+// _PropertyDatabase.setProp( string("CHARACTER_INFO:CHARACTERISTICS:") + CHARACTERISTICS::toString( (CHARACTERISTICS::TCharacteristics)i ) , _PhysCharacs._PhysicalCharacteristics[ i ].Current );
+ CBankAccessor_PLR::getCHARACTER_INFO().getCHARACTERISTICS(i).setVALUE(_PropertyDatabase, checkedCast(_PhysCharacs._PhysicalCharacteristics[ i ].Current()) );
+ _PhysCharacs._PhysicalCharacteristics[ i ].OldCurrent = _PhysCharacs._PhysicalCharacteristics[ i ].Current;
}
}
}
// Scores
- for (i = 0; i < SCORES::NUM_SCORES; ++i)
+ for( i = 0; i < SCORES::NUM_SCORES; ++i )
{
// antibug because in mirror == 133 and is a bool...
- if (_PhysScores._PhysicalScores[i].Current.testFlagInMirror() > 1)
+ if ( _PhysScores._PhysicalScores[ i ].Current.testFlagInMirror() > 1 )
{
- nlwarning("%s NASTY MEMORY BUG in computeMaxValue. current score %d ", _Id.toString().c_str(), i);
+ nlwarning("%s NASTY MEMORY BUG in computeMaxValue. current score %d ",_Id.toString().c_str(), i );
continue;
}
-
- if (_PhysScores._PhysicalScores[i].Max.testFlagInMirror() > 1)
+ if ( _PhysScores._PhysicalScores[ i ].Max.testFlagInMirror() > 1 )
{
- nlwarning("%s NASTY MEMORY BUG in computeMaxValue. max score %d ", _Id.toString().c_str(), i);
+ nlwarning("%s NASTY MEMORY BUG in computeMaxValue. max score %d ",_Id.toString().c_str(), i );
continue;
}
-
- switch (i)
+ switch( i )
{
- case SCORES::hit_points:
- _PhysScores._PhysicalScores[i].Base
- = (_PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::constitution].Current
- + PhysicalCharacteristicsBaseValue)
- * PhysicalCharacteristicsFactor
- + _ScorePermanentModifiers[i];
- _PhysScores._PhysicalScores[i].BaseRegenerateRepos
- = _PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::metabolism].Current
- / RegenDivisor; // + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
- _PhysScores._PhysicalScores[i].BaseRegenerateAction
- = _PhysScores._PhysicalScores[i].BaseRegenerateRepos / RegenReposFactor;
- break;
-
- case SCORES::sap:
- _PhysScores._PhysicalScores[i].Base
- = (_PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::intelligence].Current
- + PhysicalCharacteristicsBaseValue)
- * PhysicalCharacteristicsFactor
- + _ScorePermanentModifiers[i];
- _PhysScores._PhysicalScores[i].BaseRegenerateRepos
- = _PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::wisdom].Current
- / RegenDivisor; // + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
- _PhysScores._PhysicalScores[i].BaseRegenerateAction
- = _PhysScores._PhysicalScores[i].BaseRegenerateRepos / RegenReposFactor;
- break;
-
- case SCORES::stamina:
- _PhysScores._PhysicalScores[i].Base
- = (_PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::strength].Current
- + PhysicalCharacteristicsBaseValue)
- * PhysicalCharacteristicsFactor
- + _ScorePermanentModifiers[i];
- _PhysScores._PhysicalScores[i].BaseRegenerateRepos
- = _PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::well_balanced].Current
- / RegenDivisor; // + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
- _PhysScores._PhysicalScores[i].BaseRegenerateAction
- = _PhysScores._PhysicalScores[i].BaseRegenerateRepos / RegenReposFactor;
- break;
-
- case SCORES::focus:
- _PhysScores._PhysicalScores[i].Base
- = (_PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::dexterity].Current
- + PhysicalCharacteristicsBaseValue)
- * PhysicalCharacteristicsFactor
- + _ScorePermanentModifiers[i];
- _PhysScores._PhysicalScores[i].BaseRegenerateRepos
- = _PhysCharacs._PhysicalCharacteristics[CHARACTERISTICS::will].Current
- / RegenDivisor; // - _PhysScores._PhysicalScores[ i ].RegenerateModifier;
- _PhysScores._PhysicalScores[i].BaseRegenerateAction
- = _PhysScores._PhysicalScores[i].BaseRegenerateRepos / RegenReposFactor;
- break;
-
- default:
- ;
+ case SCORES::hit_points:
+ _PhysScores._PhysicalScores[ i ].Base = (_PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::constitution ].Current + PhysicalCharacteristicsBaseValue) * PhysicalCharacteristicsFactor + _ScorePermanentModifiers[i];
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos = _PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::metabolism ].Current / RegenDivisor;// + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateAction = _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos / RegenReposFactor;
+ break;
+ case SCORES::sap:
+ _PhysScores._PhysicalScores[ i ].Base = (_PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::intelligence ].Current + PhysicalCharacteristicsBaseValue) * PhysicalCharacteristicsFactor + _ScorePermanentModifiers[i];
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos = _PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::wisdom ].Current / RegenDivisor;// + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateAction = _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos / RegenReposFactor;
+ break;
+ case SCORES::stamina:
+ _PhysScores._PhysicalScores[ i ].Base = (_PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::strength ].Current + PhysicalCharacteristicsBaseValue) * PhysicalCharacteristicsFactor + _ScorePermanentModifiers[i];
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos = _PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::well_balanced ].Current / RegenDivisor;// + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateAction = _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos / RegenReposFactor;
+ break;
+ case SCORES::focus:
+ _PhysScores._PhysicalScores[ i ].Base = (_PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::dexterity ].Current + PhysicalCharacteristicsBaseValue) * PhysicalCharacteristicsFactor + _ScorePermanentModifiers[i];
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos = _PhysCharacs._PhysicalCharacteristics[ CHARACTERISTICS::will ].Current / RegenDivisor;// - _PhysScores._PhysicalScores[ i ].RegenerateModifier;
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateAction = _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos / RegenReposFactor;
+ break;
+ default:;
}
// add regen offset
- _PhysScores._PhysicalScores[i].BaseRegenerateRepos += RegenOffset;
- _PhysScores._PhysicalScores[i].BaseRegenerateAction += RegenOffset;
- // Malkav : done in applyRegenAndClipCurrentValue(), so removed it
- // _PhysScores._PhysicalScores[ i ].CurrentRegenerate = _PhysScores._PhysicalScores[ i
- //].BaseRegenerateAction;
- _PhysScores._PhysicalScores[i].Max
- = _PhysScores._PhysicalScores[i].Base + _PhysScores._PhysicalScores[i].Modifier;
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos += RegenOffset;
+ _PhysScores._PhysicalScores[ i ].BaseRegenerateAction += RegenOffset;
- if (_PhysScores._PhysicalScores[i].Max < 1)
+ //Malkav : done in applyRegenAndClipCurrentValue(), so removed it
+// _PhysScores._PhysicalScores[ i ].CurrentRegenerate = _PhysScores._PhysicalScores[ i ].BaseRegenerateAction;
+
+ _PhysScores._PhysicalScores[ i ].Max = _PhysScores._PhysicalScores[ i ].Base + _PhysScores._PhysicalScores[ i ].Modifier;
+ if( _PhysScores._PhysicalScores[ i ].Max < 1 )
{
- _PhysScores._PhysicalScores[i].Max = 1;
+ _PhysScores._PhysicalScores[ i ].Max = 1;
}
- if (_PhysScores._PhysicalScores[i].OldMax != _PhysScores._PhysicalScores[i].Max)
+ if( _PhysScores._PhysicalScores[ i ].OldMax != _PhysScores._PhysicalScores[ i ].Max )
{
- // _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SCORES.MaxScore[i],
- //_PhysScores._PhysicalScores[ i ].Max );
- CBankAccessor_PLR::getCHARACTER_INFO().getSCORES(i).setMax(
- _PropertyDatabase, _PhysScores._PhysicalScores[i].Max);
- _PhysScores._PhysicalScores[i].OldMax = _PhysScores._PhysicalScores[i].Max;
+// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SCORES.MaxScore[i], _PhysScores._PhysicalScores[ i ].Max );
+ CBankAccessor_PLR::getCHARACTER_INFO().getSCORES(i).setMax(_PropertyDatabase, _PhysScores._PhysicalScores[ i ].Max );
+ _PhysScores._PhysicalScores[ i ].OldMax = _PhysScores._PhysicalScores[ i ].Max;
}
}
// Skills
- for (i = 0; i < SKILLS::NUM_SKILLS; ++i)
+ for( i = 0; i < SKILLS::NUM_SKILLS; ++i )
{
- _Skills._Skills[i].Current = _Skills._Skills[i].Modifier + _Skills._Skills[i].Base;
+ _Skills._Skills[ i ].Current = _Skills._Skills[ i ].Modifier + _Skills._Skills[ i ].Base;
}
} // computeMaxValue //
@@ -2576,102 +2505,84 @@ void CCharacter::applyRegenAndClipCurrentValue()
{
// First compute all current regen
int i;
+
float currentRegen;
float baseRegen;
-
- for (i = 0; i < SCORES::NUM_SCORES; ++i)
+ for( i = 0; i < SCORES::NUM_SCORES; ++i )
{
- if (_Mode().Mode == MBEHAV::SIT)
+ if( _Mode().Mode == MBEHAV::SIT )
{
- baseRegen = _PhysScores._PhysicalScores[i].BaseRegenerateRepos;
+ baseRegen = _PhysScores._PhysicalScores[ i ].BaseRegenerateRepos;
}
else
{
- baseRegen = _PhysScores._PhysicalScores[i].BaseRegenerateAction;
+ baseRegen = _PhysScores._PhysicalScores[ i ].BaseRegenerateAction;
}
- currentRegen = baseRegen + _PhysScores._PhysicalScores[i].RegenerateModifier;
+ currentRegen = baseRegen + _PhysScores._PhysicalScores[ i ].RegenerateModifier;
- if (currentRegen < 0)
+ if ( currentRegen < 0 )
{
currentRegen = 0;
}
-
- if (currentRegen != _PhysScores._PhysicalScores[i].CurrentRegenerate)
+ if( currentRegen != _PhysScores._PhysicalScores[ i ].CurrentRegenerate )
{
- // _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SCORES.BaseRegen[i],
- //(uint32)(baseRegen * 10.0f), true );
- CBankAccessor_PLR::getCHARACTER_INFO().getSCORES(i).setBaseRegen(
- _PropertyDatabase, (uint32)(baseRegen * 10.0f), true);
- // _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SCORES.Regen[i],
- //(uint32)(currentRegen
- //* 10.0f) , true );
- CBankAccessor_PLR::getCHARACTER_INFO().getSCORES(i).setRegen(
- _PropertyDatabase, (uint32)(currentRegen * 10.0f), true);
- _PhysScores._PhysicalScores[i].CurrentRegenerate = currentRegen;
+// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SCORES.BaseRegen[i], (uint32)(baseRegen * 10.0f), true );
+ CBankAccessor_PLR::getCHARACTER_INFO().getSCORES(i).setBaseRegen(_PropertyDatabase, (uint32)(baseRegen * 10.0f), true );
+// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SCORES.Regen[i], (uint32)(currentRegen * 10.0f) , true );
+ CBankAccessor_PLR::getCHARACTER_INFO().getSCORES(i).setRegen(_PropertyDatabase, (uint32)(currentRegen * 10.0f) , true );
+ _PhysScores._PhysicalScores[ i ].CurrentRegenerate = currentRegen;
}
}
sint32 weightMalus = getWeightMalus();
// Compute current Skills
- for (i = 0; i < SKILLS::NUM_SKILLS; ++i)
+ for( i = 0; i < SKILLS::NUM_SKILLS; ++i )
{
- _Skills._Skills[i].Current = _Skills._Skills[i].Modifier + _Skills._Skills[i].Base;
-
- if (_Skills._Skills[i].Current < 0)
- _Skills._Skills[i].Current = 0;
-
- if (_Skills._Skills[i].OldCurrent != _Skills._Skills[i].Current)
+ _Skills._Skills[ i ].Current = _Skills._Skills[ i ].Modifier + _Skills._Skills[ i ].Base;
+ if ( _Skills._Skills[ i ].Current < 0 )
+ _Skills._Skills[ i ].Current = 0;
+ if( _Skills._Skills[ i ].OldCurrent != _Skills._Skills[ i ].Current )
{
- // _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.Skill[i], _Skills._Skills[
- // i
- //].Current );
- CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(
- _PropertyDatabase, checkedCast(_Skills._Skills[i].Current));
- _Skills._Skills[i].OldCurrent = _Skills._Skills[i].Current;
+// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.Skill[i], _Skills._Skills[ i ].Current );
+ CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(_PropertyDatabase, checkedCast(_Skills._Skills[ i ].Current) );
+ _Skills._Skills[ i ].OldCurrent = _Skills._Skills[ i ].Current;
}
}
sint32 oldCurrent;
-
- for (i = 0; i < SCORES::NUM_SCORES; ++i)
+ for( i = 0; i < SCORES::NUM_SCORES; ++i )
{
- oldCurrent = _PhysScores._PhysicalScores[i].Current;
-
- if (_PhysScores._PhysicalScores[i].Current < _PhysScores._PhysicalScores[i].Max)
+ oldCurrent = _PhysScores._PhysicalScores[ i ].Current;
+ if( _PhysScores._PhysicalScores[ i ].Current < _PhysScores._PhysicalScores[ i ].Max )
{
- _PhysScores._PhysicalScores[i].KeepRegenerateDecimal += _PhysScores._PhysicalScores[i].CurrentRegenerate
- * (CTickEventHandler::getGameCycle() - _PhysScores._PhysicalScores[i].RegenerateTickUpdate) / 10.0f;
- const sint32 regenWholePart = sint32(_PhysScores._PhysicalScores[i].KeepRegenerateDecimal);
- _PhysScores._PhysicalScores[i].Current = sint32(_PhysScores._PhysicalScores[i].Current + regenWholePart);
- _PhysScores._PhysicalScores[i].KeepRegenerateDecimal -= regenWholePart;
+ _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal += _PhysScores._PhysicalScores[ i ].CurrentRegenerate * ( CTickEventHandler::getGameCycle() - _PhysScores._PhysicalScores[ i ].RegenerateTickUpdate ) / 10.0f;
+ const sint32 regenWholePart = sint32(_PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal);
+ _PhysScores._PhysicalScores[ i ].Current = sint32(_PhysScores._PhysicalScores[ i ].Current + regenWholePart);
+ _PhysScores._PhysicalScores[ i ].KeepRegenerateDecimal -= regenWholePart;
if (i == SCORES::hit_points)
{
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->playerRegenHP(this, regenWholePart);
}
}
-
- if (_PhysScores._PhysicalScores[i].Current > _PhysScores._PhysicalScores[i].Max)
+ if( _PhysScores._PhysicalScores[ i ].Current > _PhysScores._PhysicalScores[ i ].Max )
{
- _PhysScores._PhysicalScores[i].Current = _PhysScores._PhysicalScores[i].Max;
+ _PhysScores._PhysicalScores[ i ].Current = _PhysScores._PhysicalScores[ i ].Max;
}
- else if (_PhysScores._PhysicalScores[i].Current < 0)
- _PhysScores._PhysicalScores[i].Current = 0;
-
- _PhysScores._PhysicalScores[i].RegenerateTickUpdate = CTickEventHandler::getGameCycle();
+ else if( _PhysScores._PhysicalScores[ i ].Current < 0 ) _PhysScores._PhysicalScores[ i ].Current = 0;
+ _PhysScores._PhysicalScores[ i ].RegenerateTickUpdate = CTickEventHandler::getGameCycle();
}
// restore value without weight malus
_PhysScores.SpeedVariationModifier -= _LastAppliedWeightMalus;
// adapt speed of mount without weight malus
- if (TheDataset.isAccessible(_EntityMounted()))
+ if( TheDataset.isAccessible(_EntityMounted()) )
{
TDataSetRow creatureId = _EntityMounted;
- CCreature* creature = CreatureManager.getCreature(creatureId);
-
+ CCreature *creature = CreatureManager.getCreature(creatureId);
if (creature)
{
creature->setSpeedVariationModifier(_PhysScores.SpeedVariationModifier);
@@ -2681,29 +2592,30 @@ void CCharacter::applyRegenAndClipCurrentValue()
// compute new value
_LastAppliedWeightMalus = getWeightMalus();
_PhysScores.SpeedVariationModifier += _LastAppliedWeightMalus;
- sint16 speedVariationModifier = std::max((sint)_PhysScores.SpeedVariationModifier, (sint) - 100);
+
+ sint16 speedVariationModifier = std::max( (sint)_PhysScores.SpeedVariationModifier, (sint)-100 );
+
// Speed
// while stunned/root/mezzed etc speed is forced to 0
float oldCurrentSpeed;
-
- if (_Mode().Mode != MBEHAV::SIT && canEntityMove() && !PlayerManager.isRootedByGM(_Id))
+ if( _Mode().Mode != MBEHAV::SIT && canEntityMove() && !PlayerManager.isRootedByGM( _Id ) )
{
float pcSpeed = 1.0f + speedVariationModifier / 100.0f;
oldCurrentSpeed = _PhysScores.CurrentWalkSpeed;
_PhysScores.CurrentWalkSpeed = pcSpeed * _PhysScores.BaseWalkSpeed;
- // if( oldCurrentSpeed != _PhysScores.CurrentWalkSpeed )
+ //if( oldCurrentSpeed != _PhysScores.CurrentWalkSpeed )
//{
// _PropertyDatabase.setProp( "USER:WALK_SPEED", (uint32)(_PhysScores.CurrentWalkSpeed * 1000) );
//}
oldCurrentSpeed = _PhysScores.CurrentRunSpeed;
_PhysScores.CurrentRunSpeed = pcSpeed * _PhysScores.BaseRunSpeed;
- // if( oldCurrentSpeed != _PhysScores.CurrentRunSpeed )
+ //if( oldCurrentSpeed != _PhysScores.CurrentRunSpeed )
//{
// _PropertyDatabase.setProp( "USER:RUN_SPEED", (uint32)(_PhysScores.CurrentRunSpeed * 1000) );
//}
- // _PropertyDatabase.setProp( "USER:SPEED_FACTOR", sint64( speedVariationModifier + 100.0f ) );
- CBankAccessor_PLR::getUSER().setSPEED_FACTOR(
- _PropertyDatabase, checkedCast(speedVariationModifier + 100.0f));
+
+// _PropertyDatabase.setProp( "USER:SPEED_FACTOR", sint64( speedVariationModifier + 100.0f ) );
+ CBankAccessor_PLR::getUSER().setSPEED_FACTOR(_PropertyDatabase, checkedCast( speedVariationModifier + 100.0f ) );
if (speedVariationModifier > 0)
{
@@ -2714,21 +2626,24 @@ void CCharacter::applyRegenAndClipCurrentValue()
{
oldCurrentSpeed = _PhysScores.CurrentWalkSpeed;
_PhysScores.CurrentWalkSpeed = 0;
- // if( oldCurrentSpeed != _PhysScores.CurrentWalkSpeed )
+ //if( oldCurrentSpeed != _PhysScores.CurrentWalkSpeed )
//{
// _PropertyDatabase.setProp( "USER:WALK_SPEED", (uint32)(_PhysScores.CurrentWalkSpeed * 1000) );
//}
oldCurrentSpeed = _PhysScores.CurrentRunSpeed;
_PhysScores.CurrentRunSpeed = 0;
- // if( oldCurrentSpeed != _PhysScores.CurrentRunSpeed )
+ //if( oldCurrentSpeed != _PhysScores.CurrentRunSpeed )
//{
// _PropertyDatabase.setProp( "USER:RUN_SPEED", (uint32)(_PhysScores.CurrentRunSpeed * 1000) );
//}
- // _PropertyDatabase.setProp( "USER:SPEED_FACTOR", sint64(0) );
- CBankAccessor_PLR::getUSER().setSPEED_FACTOR(_PropertyDatabase, 0);
+
+// _PropertyDatabase.setProp( "USER:SPEED_FACTOR", sint64(0) );
+ CBankAccessor_PLR::getUSER().setSPEED_FACTOR(_PropertyDatabase, 0 );
}
+
} // applyRegenAndClipCurrentValue //
+
//---------------------------------------------------
// Process static actions (like harvest, faber...)
//
@@ -2739,82 +2654,72 @@ void CCharacter::processStaticAction()
if (_NbStaticActiveEffects > 0)
{
- if (hasMovedDuringStaticAction())
+ if ( hasMovedDuringStaticAction() )
{
cancelStaticEffects();
}
}
// test if the character has moved since last update (if character is in action mode)
- if (_StaticActionInProgress || _HarvestOpened)
+ if ( _StaticActionInProgress || _HarvestOpened )
{
bool stopAction = false;
// Casting is canceled by event the smallest move
- switch (_StaticActionType)
+ switch ( _StaticActionType )
{
case STATIC_ACT_TYPES::Casting:
case STATIC_ACT_TYPES::Teleport:
stopAction = hasMovedDuringStaticAction();
break;
-
case STATIC_ACT_TYPES::Mount:
- {
- double sqrDistance = CVector2d(_EntityState.X() - _OldPosX, _EntityState.Y() - _OldPosY).sqrnorm();
- stopAction = (sqrDistance > (MaxMountDistance * MaxMountDistance * 1000.0 * 1000.0));
- }
- break;
-
+ {
+ double sqrDistance = CVector2d( _EntityState.X() - _OldPosX, _EntityState.Y() - _OldPosY ).sqrnorm();
+ stopAction = ( sqrDistance > ( MaxMountDistance * MaxMountDistance * 1000.0 * 1000.0 ) );
+ }
+ break;
case STATIC_ACT_TYPES::BotChat:
- {
- CEntityBase* entity = CEntityBaseManager::getEntityBasePtr(_CurrentInterlocutor);
-
- if (entity)
{
- double sqrDistance
- = CVector2d(_EntityState.X() - entity->getX(), _EntityState.Y() - entity->getY()).sqrnorm();
- // Special case if it is an outpost building
- CCreature* c = dynamic_cast(entity);
+ CEntityBase* entity = CEntityBaseManager::getEntityBasePtr( _CurrentInterlocutor );
+ if (entity)
+ {
+ double sqrDistance = CVector2d( _EntityState.X() - entity->getX(), _EntityState.Y() - entity->getY() ).sqrnorm();
- if ((c != NULL) && (c->getOutpostBuilding() != NULL))
- stopAction = (sqrDistance > (MaxTalkingOutpostBuildingDistSquare * 1000.0 * 1000.0));
- else
- stopAction = (sqrDistance > (MaxTalkingDistSquare * 1000.0 * 1000.0));
+ // Special case if it is an outpost building
+ CCreature *c = dynamic_cast(entity);
+ if ((c != NULL) && (c->getOutpostBuilding() != NULL))
+ stopAction = ( sqrDistance > (MaxTalkingOutpostBuildingDistSquare * 1000.0 * 1000.0 ) );
+ else
+ stopAction = ( sqrDistance > (MaxTalkingDistSquare * 1000.0 * 1000.0 ) );
- break;
+ break;
+ }
}
- }
-
- // else go to default (no break)
+ // else go to default (no break)
default:
- {
- // other static actions (quartering, botchat etc...) have a spatial tolerance (TEMP : use MaxHarvestDistance
- // as tolerance)
- double sqrDistance = CVector2d(_EntityState.X() - _OldPosX, _EntityState.Y() - _OldPosY).sqrnorm();
-
- // get current position
- if (_StaticActionType == STATIC_ACT_TYPES::Forage)
{
- stopAction = (sqrDistance > 200 * 200); // 0.2 m for extraction and prospection (currently hardcoded)
-
- if (stopAction)
+ // other static actions (quartering, botchat etc...) have a spatial tolerance (TEMP : use MaxHarvestDistance as tolerance)
+ double sqrDistance = CVector2d( _EntityState.X() - _OldPosX, _EntityState.Y() - _OldPosY ).sqrnorm();
+ // get current position
+ if ( _StaticActionType == STATIC_ACT_TYPES::Forage )
{
- // If first run of extraction cycle, do not stop to prevent a bug after auto-move by the client
- const CEntityPhrases* entityPhrases = CPhraseManager::getInstance().getEntityPhrases(_EntityRowId);
-
- if (entityPhrases)
+ stopAction = ( sqrDistance > 200*200 ); // 0.2 m for extraction and prospection (currently hardcoded)
+ if ( stopAction )
{
- const CSPhrasePtr currentAction = entityPhrases->getCurrentActionConst();
-
- if ((currentAction != NULL) && (currentAction->mustOverrideCancelStaticAction()))
- stopAction = false;
+ // If first run of extraction cycle, do not stop to prevent a bug after auto-move by the client
+ const CEntityPhrases *entityPhrases = CPhraseManager::getInstance().getEntityPhrases( _EntityRowId );
+ if ( entityPhrases )
+ {
+ const CSPhrasePtr currentAction = entityPhrases->getCurrentActionConst();
+ if ( (currentAction != NULL) && (currentAction->mustOverrideCancelStaticAction()) )
+ stopAction = false;
+ }
}
}
+ else
+ stopAction = ( sqrDistance > ( MaxHarvestDistance * MaxHarvestDistance * 1000.0 * 1000.0 ) );
}
- else
- stopAction = (sqrDistance > (MaxHarvestDistance * MaxHarvestDistance * 1000.0 * 1000.0));
- }
- break;
+ break;
}
if (stopAction)
@@ -2824,14 +2729,13 @@ void CCharacter::processStaticAction()
}
else
{
- if (_HarvestDeposit)
+ if( _HarvestDeposit )
{
- // processDepositHarvestResult();
+ //processDepositHarvestResult();
}
else
{
- CEntityBase* entity = CEntityBaseManager::getEntityBasePtr(_CurrentInterlocutor);
-
+ CEntityBase* entity = CEntityBaseManager::getEntityBasePtr( _CurrentInterlocutor );
if (entity != NULL)
{
if (isDead())
@@ -2850,6 +2754,7 @@ void CCharacter::processStaticAction()
}
} // processStaticAction //
+
//---------------------------------------------------
// update compass coordinates information
//---------------------------------------------------
@@ -2858,31 +2763,29 @@ void CCharacter::compassDatabaseUpdate()
static const TDataSetRow invalidRow;
static sint32 targetX = 0;
static sint32 targetY = 0;
-
- if (TheDataset.isAccessible(_CompassTarget))
+ if (TheDataset.isAccessible( _CompassTarget ) )
{
- CEntityBase* e = CEntityBaseManager::getEntityBasePtr(_CompassTarget);
-
- if (e == NULL)
+ CEntityBase * e = CEntityBaseManager::getEntityBasePtr( _CompassTarget );
+ if( e == NULL )
{
_CompassTarget = invalidRow;
- e = CEntityBaseManager::getEntityBasePtr(_Target);
+ e = CEntityBaseManager::getEntityBasePtr( _Target );
}
-
- if (e)
+ if( e )
{
- if (targetX != e->getState().X || targetY != e->getState().Y)
+ if( targetX != e->getState().X || targetY != e->getState().Y )
{
targetX = e->getState().X;
targetY = e->getState().Y;
- uint64 pos = (((uint64)targetX) << 32) + targetY;
- // _PropertyDatabase.setProp( "COMPASS:TARGET", pos );
- CBankAccessor_PLR::getCOMPASS().setTARGET(_PropertyDatabase, pos);
+ uint64 pos = ( ( (uint64)targetX ) << 32 ) + targetY;
+// _PropertyDatabase.setProp( "COMPASS:TARGET", pos );
+ CBankAccessor_PLR::getCOMPASS().setTARGET(_PropertyDatabase, pos );
}
}
}
}
+
//---------------------------------------------------
// serial: reading off-mirror, writing from mirror
//
@@ -2890,100 +2793,83 @@ void CCharacter::compassDatabaseUpdate()
void CCharacter::serial(NLMISC::IStream &f)
{
nlerror("Serial method no longer exists!");
+
} // serial //
+
//---------------------------------------------------
// set player position to default respawn point of continent
//
//---------------------------------------------------
void CCharacter::setPositionToDefaultRespawnPoint()
{
- CContinent* continent = CZoneManager::getInstance().getContinent(getX(), getY());
+ CContinent * continent = CZoneManager::getInstance().getContinent( getX(), getY() );
uint16 zoneId = std::numeric_limits::max();
-
- if (continent == 0)
+ if( continent == 0 )
{
- nlwarning(
- "getId())
+ switch( (CONTINENT::TContinent)continent->getId() )
{
case CONTINENT::FYROS:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_kami_place_pyr");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_kami_place_pyr" );
break;
-
case CONTINENT::MATIS:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_karavan_place_yrkanis");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_karavan_place_yrkanis" );
break;
-
case CONTINENT::TRYKER:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_karavan_place_fairhaven");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_karavan_place_fairhaven" );
break;
-
case CONTINENT::ZORAI:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_kami_place_zora");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_kami_place_zora" );
break;
-
case CONTINENT::FYROS_NEWBIE:
case CONTINENT::MATIS_NEWBIE:
case CONTINENT::TRYKER_NEWBIE:
case CONTINENT::ZORAI_NEWBIE:
- egs_chinfo(" Character %s pos from %d %d is newbieland, do nothing", getId().toString().c_str(),
- getX(), getY());
+ egs_chinfo(" Character %s pos from %d %d is newbieland, do nothing", getId().toString().c_str(), getX(), getY());
return;
-
default:
- switch (getRace())
+ switch( getRace() )
{
case EGSPD::CPeople::Fyros:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_kami_place_pyr");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_kami_place_pyr" );
break;
-
case EGSPD::CPeople::Matis:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_karavan_place_yrkanis");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_karavan_place_yrkanis" );
break;
-
case EGSPD::CPeople::Tryker:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_karavan_place_fairhaven");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_karavan_place_fairhaven" );
break;
-
case EGSPD::CPeople::Zorai:
- zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName("spawn_kami_place_zora");
+ zoneId = CZoneManager::getInstance().getTpSpawnZoneIdByName( "spawn_kami_place_zora" );
break;
-
default:
- nlwarning(" Character %s %u have no known race %s", getId().toString().c_str(),
- continent->getId(), EGSPD::CPeople::toString(getRace()).c_str());
+ nlwarning(" Character %s %u have no known race %s", getId().toString().c_str(), continent->getId(), EGSPD::CPeople::toString( getRace() ).c_str() );
return;
}
-
break;
}
- if (zoneId != std::numeric_limits::max())
+ if( zoneId != std::numeric_limits::max() )
{
// get the tp coords
- const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone(zoneId);
-
- if (!zone)
+ const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( zoneId );
+ if ( !zone )
{
- nlwarning("getId(), EGSPD::CPeople::toString(getRace()).c_str());
+ nlwarning("getId(), EGSPD::CPeople::toString( getRace() ).c_str() );
return;
}
-
COfflineEntityState position;
- zone->getRandomPoint(position.X, position.Y, position.Z, position.Heading);
- egs_chinfo(" Character %s pos from %d %d go to %d %d", getId().toString().c_str(), getX(), getY(),
- position.X, position.Y);
- setState(position);
+ zone->getRandomPoint( position.X, position.Y, position.Z, position.Heading );
+ egs_chinfo(" Character %s pos from %d %d go to %d %d", getId().toString().c_str(), getX(), getY(), position.X, position.Y);
+ setState( position );
}
else
{
- nlwarning("getId(), EGSPD::CPeople::toString(getRace()).c_str());
+ nlwarning("getId(), EGSPD::CPeople::toString( getRace() ).c_str() );
}
}
@@ -2994,106 +2880,100 @@ void CCharacter::setPositionToDefaultRespawnPoint()
CCharacter::~CCharacter()
{
TLogNoContext_Item noLog;
-
// remove CSR special properties
- if (getEnterFlag())
+ if ( getEnterFlag() )
{
- CCharacter* user = PlayerManager.getChar(_MonitoringCSR);
-
- if (user)
- user->setMonitoringCSR(TDataSetRow::createFromRawIndex(INVALID_DATASET_ROW));
-
- user = PlayerManager.getChar(_AdminProperties->getMissionMonitoredUser());
-
- if (user)
- user->getAdminProperties().setMissionMonitoredUser(TDataSetRow::createFromRawIndex(INVALID_DATASET_ROW));
-
- for (map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it)
+ CCharacter * user = PlayerManager.getChar( _MonitoringCSR );
+ if ( user )
+ user->setMonitoringCSR( TDataSetRow::createFromRawIndex( INVALID_DATASET_ROW ) );
+ user = PlayerManager.getChar( _AdminProperties->getMissionMonitoredUser() );
+ if ( user )
+ user->getAdminProperties().setMissionMonitoredUser( TDataSetRow::createFromRawIndex( INVALID_DATASET_ROW ) );
+ for ( map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it )
{
- CMissionManager::getInstance()->deInstanciateMission((*it).second);
+ CMissionManager::getInstance()->deInstanciateMission( (*it).second );
/// do not delete the mission : it is pd managed
}
-
- PlayerManager.removeSummonedUser(_EntityRowId);
-
- if (_BotGift)
+ PlayerManager.removeSummonedUser( _EntityRowId );
+ if ( _BotGift )
delete _BotGift;
// egs_chinfo(" destructing char %s", _Id.toString().c_str() );
// Cancel all static action still occurs
cancelStaticActionInProgress();
- if (_ExchangeAsker != CEntityId::Unknown)
+
+ if ( _ExchangeAsker != CEntityId::Unknown )
{
- CActionDistanceChecker::getInstance()->removePlayer(getEntityRowId());
+ CActionDistanceChecker::getInstance()->removePlayer( getEntityRowId() );
}
if (_TeamId != CTEAM::InvalidTeamId)
{
- TeamManager.removeCharacter(_Id);
+ TeamManager.removeCharacter( _Id );
}
- if (_LootContainer != NULL)
+ if( _LootContainer!=NULL )
{
pickUpItemClose();
}
// Erase potential forage progress
- if (_ForageProgress)
+ if ( _ForageProgress )
delete _ForageProgress;
// Do this before we clear the _PlayerPets vector
- for (uint i = 0; i < MAX_INVENTORY_ANIMAL; ++i)
+ for( uint i = 0; i < MAX_INVENTORY_ANIMAL; ++i )
{
- if (i < _PlayerPets.size())
+ if( i < _PlayerPets.size() )
{
- if (TheDataset.isAccessible(_PlayerPets[i].SpawnedPets))
+ if( TheDataset.isAccessible(_PlayerPets[ i ].SpawnedPets) )
{
- sendPetCommand(CPetCommandMsg::DESPAWN, i, true);
- _PlayerPets[i].SpawnedPets = TDataSetRow();
+ sendPetCommand( CPetCommandMsg::DESPAWN, i, true );
+ _PlayerPets[ i ].SpawnedPets = TDataSetRow();
}
}
}
// remove recipient for character
- DbGroupGlobal.removeRecipient(_Id);
+ DbGroupGlobal.removeRecipient( _Id );
}
// Clear _PlayersPets before releasing inventory because CPetAnimal owns an item reference (ItemPtr)
_PlayerPets.clear();
+
// Release inventories
releaseInventories();
// if player was harvesting, cancel it
- if (_MpSourceId != CEntityId::Unknown)
+ if ( _MpSourceId != CEntityId::Unknown )
{
- CCreature* creature = CreatureManager.getCreature(_MpSourceId);
-
+ CCreature *creature = CreatureManager.getCreature( _MpSourceId );
if (creature != NULL)
{
- // creature->harvester( NULL );
+ //creature->harvester( NULL );
creature->resetHarvesterRowId();
}
}
// if character mount a creature
- if (TheDataset.isAccessible(_EntityMounted()))
+ if( TheDataset.isAccessible(_EntityMounted()) )
{
- unmount(false);
+ unmount( false );
}
- if (getEnterFlag()) // avoid players not entered yet
+ if ( getEnterFlag() ) // avoid players not entered yet
{
// remove entity from PhraseManager
CPhraseManager::getInstance().removeEntity(_EntityRowId, true);
}
// free structure eventualy allocated for progression
- PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->clearAllXpForPlayer(_EntityRowId, _TeamId, false);
+ PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->clearAllXpForPlayer( _EntityRowId, _TeamId, false );
PROGRESSIONPVP::CCharacterProgressionPVP::getInstance()->removePlayer(this);
- CRegion* region = dynamic_cast(CZoneManager::getInstance().getPlaceFromId(_CurrentRegion));
- if (region)
+ CRegion * region = dynamic_cast( CZoneManager::getInstance().getPlaceFromId( _CurrentRegion ) );
+ if ( region )
{
region->removePlayer(_Id);
}
@@ -3103,6 +2983,7 @@ CCharacter::~CCharacter()
_DbUpdateTimer.reset();
_DeathPenaltyTimer.reset();
_BarUpdateTimer.reset();
+
delete _EncycloChar;
delete _GameEvent;
delete _RespawnPoints;
@@ -3112,11 +2993,15 @@ CCharacter::~CCharacter()
delete _AdminProperties;
delete _DeathPenalties;
delete _GearLatency;
+
EGSPD::CMissionContainerPD::unload(_Id);
+
EGSPD::CFameContainerPD::unload(_Id);
- // NLMEMORY::StatisticsReport( "egs_memory_report.csv", false );
+
+// NLMEMORY::StatisticsReport( "egs_memory_report.csv", false );
} // destructor //
+
//---------------------------------------------------
// prepareToLoad: method called before applying a pdr save record
//
@@ -3126,6 +3011,7 @@ void CCharacter::prepareToLoad()
initPDStructs();
}
+
//---------------------------------------------------
// postLoadTreatment: method called after applying a pdr save record for all generic processing work
//
@@ -3133,19 +3019,17 @@ void CCharacter::prepareToLoad()
void CCharacter::postLoadTreatment()
{
H_AUTO(CCharacterPostLoadTreatment);
+
// Check if the name is correct, otherwise set name to default (in case of corrupted name)
- uint8 charIndex = PlayerManager.getCharIndex(getId());
- uint32 userId = PlayerManager.getPlayerId(getId());
- // enter the name in the eid translator
- BOMB_IF(PlayerManager.getPlayer(userId) == NULL,
- "postLoadTreatment : can't find CPlayer instance for user " << userId, return);
+ uint8 charIndex = PlayerManager.getCharIndex( getId() );
+ uint32 userId = PlayerManager.getPlayerId( getId() );
+ // enter the name in the eid translator
+ BOMB_IF(PlayerManager.getPlayer(userId) == NULL, "postLoadTreatment : can't find CPlayer instance for user "<isEntityRegistered(getId()))
{
- std::string fullName
- = CShardNames::getInstance().makeFullNameFromRelative(getHomeMainlandSessionId(), getName().toUtf8());
- CEntityIdTranslator::getInstance()->registerEntity(getId(), capitalize(fullName), charIndex, userId,
- PlayerManager.getPlayer(userId)->getUserName(), IService::getInstance()->getShardId());
+ std::string fullName = CShardNames::getInstance().makeFullNameFromRelative(getHomeMainlandSessionId(), getName().toUtf8());
+ CEntityIdTranslator::getInstance()->registerEntity( getId(), capitalize( fullName ), charIndex, userId, PlayerManager.getPlayer(userId)->getUserName(), IService::getInstance()->getShardId() );
ICharNameMapperClient::getInstance()->mapCharacterName(getId(), fullName);
}
@@ -3154,163 +3038,172 @@ void CCharacter::postLoadTreatment()
if (gid != _GuildId)
{
- nlwarning("Player %s think he is in guild %u, he really is in guild %u, changing", _Id.toString().c_str(),
- _GuildId, guildIdToString(gid).c_str());
+ nlwarning("Player %s think he is in guild %u, he really is in guild %u, changing",
+ _Id.toString().c_str(),
+ _GuildId,
+ guildIdToString(gid).c_str());
+
_GuildId = gid;
}
+
/* make sure the player is in the guild that he thinks he's in */
- if (_GuildId && !CGuildManager::getInstance()->checkGuildMemberShip(_Id, _GuildId))
+ if ( _GuildId && !CGuildManager::getInstance()->checkGuildMemberShip( _Id,_GuildId ) )
{
- nlwarning("%s is not in its guild %u!!!", _Id.toString().c_str(), _GuildId);
+ nlwarning("%s is not in its guild %u!!!", _Id.toString().c_str(), _GuildId );
_GuildId = 0;
}
_NbSurvivePact = (uint8)_Pact.size();
- {
- H_AUTO(FixPetTicket);
- /* fix the pets to their tickets */
- vector tickets;
- tickets.resize(INVENTORIES::NbPackerSlots, false);
- for (uint i = 0; i < _PlayerPets.size(); ++i)
+ {
+ H_AUTO(FixPetTicket);
+ /* fix the pets to their tickets */
+ vector< bool > tickets;
+ tickets.resize( INVENTORIES::NbPackerSlots, false );
+ for( uint i = 0; i < _PlayerPets.size(); ++i )
+ {
+ if( _PlayerPets[ i ].PetStatus != CPetAnimal::not_present )
{
- if (_PlayerPets[i].PetStatus != CPetAnimal::not_present)
+ if( _PlayerPets[ i ].Slot >= 0 && _PlayerPets[ i ].Slot < INVENTORIES::NbPackerSlots )
{
- if (_PlayerPets[i].Slot >= 0 && _PlayerPets[i].Slot < INVENTORIES::NbPackerSlots)
+ if( tickets[ _PlayerPets[ i ].Slot ] )
{
- if (tickets[_PlayerPets[i].Slot])
- {
- _PlayerPets[i].Slot = INVENTORIES::INVALID_INVENTORY_SLOT;
- }
- else
- {
- tickets[_PlayerPets[i].Slot] = true;
- }
+ _PlayerPets[ i ].Slot = INVENTORIES::INVALID_INVENTORY_SLOT;
}
else
{
- _PlayerPets[i].Slot = INVENTORIES::INVALID_INVENTORY_SLOT;
+ tickets[ _PlayerPets[ i ].Slot ] = true;
}
+ }
+ else
+ {
+ _PlayerPets[ i ].Slot = INVENTORIES::INVALID_INVENTORY_SLOT;
+ }
sendPetCustomNameToClient(i);
uint32 slot = _PlayerPets[i].initLinkAnimalToTicket(this, i);
-
if (slot < INVENTORIES::NbPackerSlots)
{
tickets[slot] = true;
- initPetInventory(i);
- }
+
+ initPetInventory(i);
}
}
}
- {
- H_AUTO(PetPostLoadTrait);
- /* pet following will be done when receiving Pet Spawn acknowledge (AnimalSpawned) */
- CVector2f playerPos((float)_EntityState.X, (float)_EntityState.Y);
+ }
- for (uint i = 0; i < _PlayerPets.size(); ++i)
+ {
+ H_AUTO(PetPostLoadTrait);
+ /* pet following will be done when receiving Pet Spawn acknowledge (AnimalSpawned) */
+ CVector2f playerPos( (float)_EntityState.X, (float)_EntityState.Y );
+ for( uint i = 0; i < _PlayerPets.size(); ++i )
+ {
+ CPetAnimal& animal = _PlayerPets[i];
+ if( animal.PetStatus != CPetAnimal::not_present )
{
- CPetAnimal &animal = _PlayerPets[i];
-
- if (animal.PetStatus != CPetAnimal::not_present)
+ // Disable following if the distance is too far (e.g. AIS shutdown before EGS received the actual pos and EGS saved an old pos)
+ CVector2f petPos( (float)animal.Landscape_X, (float)animal.Landscape_Y );
+ float sqDistance = (float)(playerPos - petPos).sqrnorm();
+ if ( sqDistance > (float)MaxAnimalCommandDistSquare * (4.0f * 1000.0f * 1000.0f) ) // allow twice the MaxAnimalCommandDistSquare
{
- // Disable following if the distance is too far (e.g. AIS shutdown before EGS received the actual pos
- // and EGS saved an old pos)
- CVector2f petPos((float)animal.Landscape_X, (float)animal.Landscape_Y);
- float sqDistance = (float)(playerPos - petPos).sqrnorm();
-
- if (sqDistance > (float)MaxAnimalCommandDistSquare
- * (4.0f * 1000.0f * 1000.0f)) // allow twice the MaxAnimalCommandDistSquare
- {
- animal.IsFollowing = false;
- animal.IsMounted = false;
- }
+ animal.IsFollowing = false;
+ animal.IsMounted = false;
+ }
- // Init satiety if value not in the saved file
- if (animal.Satiety == SatietyNotInit)
- {
- const CStaticItem* ticketPetForm = CSheets::getForm(animal.TicketPetSheetId);
- animal.MaxSatiety = ticketPetForm ? ticketPetForm->PetHungerCount : 0;
- animal.Satiety = animal.MaxSatiety;
- }
+ // Init satiety if value not in the saved file
+ if ( animal.Satiety == SatietyNotInit )
+ {
+ const CStaticItem* ticketPetForm = CSheets::getForm( animal.TicketPetSheetId );
+ animal.MaxSatiety = ticketPetForm ? ticketPetForm->PetHungerCount : 0;
+ animal.Satiety = animal.MaxSatiety;
}
}
}
+ }
+
{
H_AUTO(LockTicketInInventory);
lockTicketInInventory();
}
+
// if EId translator has been initialized by SU, check contact list
{
H_AUTO(ValidateContactList);
validateContactList();
}
+
{
H_AUTO(UpdateFlagForActiveEffect);
-
/* update flags for active effects */
- if (_ForbidAuraUseEndDate > 0 && _ForbidAuraUseStartDate == 0)
+ if( _ForbidAuraUseEndDate>0 && _ForbidAuraUseStartDate==0 )
{
- // thus timer won't look like infinte on client(can happen due to old save file where startDate didn't
- // exist)
+ // thus timer won't look like infinte on client(can happen due to old save file where startDate didn't exist)
_ForbidAuraUseStartDate = CTickEventHandler::getGameCycle();
}
-
setPowerFlagDates();
setAuraFlagDates();
updateBrickFlagsDBEntry();
_ModifiersInDB.writeInDatabase(_PropertyDatabase);
}
+
{
H_AUTO(AddCreationBricks);
/* add starting bricks if any modification has been done */
addCreationBricks();
}
+
{
H_AUTO(CheckCharacterAndScoresValues);
/* check character and scores are as they are supposed to be according to bricks possessed */
checkCharacAndScoresValues();
}
+
{
H_AUTO(ComputeBestSkill);
/* compute player best skill */
computeBestSkill();
}
+
{
H_AUTO(ComputeSkillUsedForDodge);
/* compute player best skill to use for dodge */
computeSkillUsedForDodge();
}
+
{
H_AUTO(UpdateMagicProtectionAndResistance);
/* compute resists scores*/
updateMagicProtectionAndResistance();
}
+
{
H_AUTO(LoadedMissionPostLoad);
-
/* Call the postLoad methods for the loaded missions */
- for (map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it)
+ for ( map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it )
{
- BOMB_IF((*it).second == NULL, "Mission is NULL after load", continue);
+ BOMB_IF( (*it).second == NULL, "Mission is NULL after load", continue );
(*it).second->onLoad();
}
}
+
/* setup the implicit visual property fields */
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.Sex, getGender());
+ SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.Sex,getGender());
+
{
H_AUTO(ComputeForageBonus);
/* compute the forage bonuses */
computeForageBonus();
}
+
{
H_AUTO(ComputeMiscBonus);
/* compute misc bonuses */
computeMiscBonus();
}
- CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
+ // Always enable XP Catalyaer for non-trial accounts
+ CPlayer * p = PlayerManager.getPlayer(PlayerManager.getPlayerId( getId() ));
if (!p->isTrialPlayer())
{
CBankAccessor_PLR::getCHARACTER_INFO().getRING_XP_CATALYSER().setLevel(_PropertyDatabase, 250);
@@ -3324,8 +3217,10 @@ void CCharacter::postLoadTreatment()
{
H_AUTO(CheckPvPTagValidity);
+
_HaveToUpdatePVPMode = true;
}
+
}
//---------------------------------------------------
@@ -3334,21 +3229,19 @@ void CCharacter::postLoadTreatment()
//---------------------------------------------------
void CCharacter::lockTicketInInventory()
{
- if (IsRingShard)
+ if(IsRingShard)
{
CInventoryPtr inv = getInventory(INVENTORIES::bag);
-
- if (inv)
+ if(inv)
{
- for (uint i = 0; i < INVENTORIES::NbBagSlots; ++i)
+ for(uint i = 0; i < INVENTORIES::NbBagSlots; ++i)
{
// check if source slot is not empty
CGameItemPtr item = inv->getItem(i);
-
- if (item != NULL && item->getStaticForm() != NULL)
+ if (item != NULL && item->getStaticForm() != NULL )
{
- if (item->getStaticForm()->Family == ITEMFAMILY::PET_ANIMAL_TICKET
- || item->getStaticForm()->Family == ITEMFAMILY::TELEPORT)
+ if(item->getStaticForm()->Family == ITEMFAMILY::PET_ANIMAL_TICKET
+ || item->getStaticForm()->Family == ITEMFAMILY::TELEPORT)
{
item->setLockCount(item->getStackSize());
}
@@ -3366,42 +3259,39 @@ void CCharacter::validateContactList()
// if EId translator has been initialized by SU, check contact list
if (IShardUnifierEvent::getInstance()->isEidTranslatorInitilazed())
{
- CEntityIdTranslator* eidt = CEntityIdTranslator::getInstance();
-
+ CEntityIdTranslator *eidt = CEntityIdTranslator::getInstance();
// any friend must be in the Eid translator
- for (uint i = 0; i < _FriendsList.size(); ++i)
+ for (uint i=0; i<_FriendsList.size(); ++i)
{
if (!eidt->isEntityRegistered(_FriendsList[i].EntityId))
{
- _FriendsList.erase(_FriendsList.begin() + i);
+ _FriendsList.erase(_FriendsList.begin()+i);
--i;
}
}
-
- for (uint i = 0; i < _IgnoreList.size(); ++i)
+ for (uint i=0; i<_IgnoreList.size(); ++i)
{
if (!eidt->isEntityRegistered(_IgnoreList[i].EntityId))
{
- _IgnoreList.erase(_IgnoreList.begin() + i);
+ _IgnoreList.erase(_IgnoreList.begin()+i);
--i;
}
}
// any entity that referenced this must exist in EID translator
- for (uint i = 0; i < _IsFriendOf.size(); ++i)
+ for (uint i=0; i<_IsFriendOf.size(); ++i)
{
if (!eidt->isEntityRegistered(_IsFriendOf[i]))
{
- _IsFriendOf.erase(_IsFriendOf.begin() + i);
+ _IsFriendOf.erase(_IsFriendOf.begin()+i);
--i;
}
}
-
- for (uint i = 0; i < _IsIgnoredBy.size(); ++i)
+ for (uint i=0; i<_IsIgnoredBy.size(); ++i)
{
if (!eidt->isEntityRegistered(_IsIgnoredBy[i]))
{
- _IsIgnoredBy.erase(_IsIgnoredBy.begin() + i);
+ _IsIgnoredBy.erase(_IsIgnoredBy.begin()+i);
--i;
}
}
@@ -3415,15 +3305,13 @@ void CCharacter::validateContactList()
void CCharacter::computeBestSkill()
{
sint32 bestBase = 0;
-
for (int i = 0; i < SKILLS::NUM_SKILLS; i++)
{
const sint32 base = _Skills._Skills[i].Base;
-
if (base > bestBase)
{
bestBase = base;
- _BestSkill = (SKILLS::ESkills)i;
+ _BestSkill = (SKILLS::ESkills) i;
}
}
}
@@ -3437,26 +3325,23 @@ void CCharacter::computeSkillUsedForDodge()
for (int i = 0; i < SKILLS::NUM_SKILLS; i++)
{
sint32 val = getSkillEquivalentDodgeValue(SKILLS::ESkills(i));
-
- CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
- if (p->isTrialPlayer() && val > 125)
- val = 125;
-
+ CPlayer *p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
+ if (p->isTrialPlayer() && val > 125)
+ val = 125;
if (val > _BaseDodgeLevel)
{
- _SkillUsedForDodge = (SKILLS::ESkills)i;
+ _SkillUsedForDodge = (SKILLS::ESkills) i;
_BaseDodgeLevel = val;
_CurrentDodgeLevel = max(sint32(0), val + _DodgeModifier);
}
}
-
- // _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeBase, _BaseDodgeLevel);
+// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeBase, _BaseDodgeLevel);
CBankAccessor_PLR::getCHARACTER_INFO().getDODGE().setBase(_PropertyDatabase, checkedCast(_BaseDodgeLevel));
- // _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeCurrent, _CurrentDodgeLevel);
- CBankAccessor_PLR::getCHARACTER_INFO().getDODGE().setCurrent(
- _PropertyDatabase, checkedCast(_CurrentDodgeLevel));
+// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeCurrent, _CurrentDodgeLevel);
+ CBankAccessor_PLR::getCHARACTER_INFO().getDODGE().setCurrent(_PropertyDatabase, checkedCast(_CurrentDodgeLevel));
}
+
//---------------------------------------------------
// computeForageBonus
//---------------------------------------------------
@@ -3464,52 +3349,54 @@ void CCharacter::computeForageBonus()
{
// Browse the known bricks
CBrickProperties forageBonusBricks;
- getPropertiesFromKnownBricks(BRICK_FAMILIES::BPBHFEA, forageBonusBricks);
+ getPropertiesFromKnownBricks( BRICK_FAMILIES::BPBHFEA, forageBonusBricks );
+
// Calculate the sum of the bonuses for extraction, currently only extraction time bonus
float totalAdditionalTimeGC = 0;
- const CBrickPropertyValues &extractionTimeBonuses = forageBonusBricks[TBrickParam::BONUS_FG_EXTRACTION_TIME_GC];
-
- for (CBrickPropertyValues::const_iterator ibv = extractionTimeBonuses.begin(),
- endOfMap = extractionTimeBonuses.end();
- ibv != endOfMap; ++ibv)
+ const CBrickPropertyValues& extractionTimeBonuses = forageBonusBricks[TBrickParam::BONUS_FG_EXTRACTION_TIME_GC];
+ for ( CBrickPropertyValues::const_iterator ibv=extractionTimeBonuses.begin(), endOfMap=extractionTimeBonuses.end(); ibv!=endOfMap; ++ibv )
{
- CSBrickParamBonusFgExtractionTimeGC* param = (CSBrickParamBonusFgExtractionTimeGC*)(TBrickParam::IId*)(*ibv);
+ CSBrickParamBonusFgExtractionTimeGC *param = (CSBrickParamBonusFgExtractionTimeGC*)(TBrickParam::IId*)(*ibv);
totalAdditionalTimeGC += param->AdditionalTimeGC;
}
-
_ForageBonusExtractionTime = (NLMISC::TGameCycle)totalAdditionalTimeGC;
}
+
//---------------------------------------------------
// process a new received bonus brick
//---------------------------------------------------
-void CCharacter::processForageBonusBrick(const CStaticBrick* brick)
+void CCharacter::processForageBonusBrick( const CStaticBrick *brick )
{
- if (!brick)
+ if ( !brick )
return;
- for (std::vector::const_iterator ip = brick->Params.begin(); ip != brick->Params.end(); ++ip)
+ for ( std::vector::const_iterator ip=brick->Params.begin(); ip!=brick->Params.end(); ++ip )
{
- CSBrickParamBonusFgExtractionTimeGC* param = (CSBrickParamBonusFgExtractionTimeGC*)(TBrickParam::IId*)(*ip);
+ CSBrickParamBonusFgExtractionTimeGC *param = (CSBrickParamBonusFgExtractionTimeGC*)(TBrickParam::IId*)(*ip);
+
_ForageBonusExtractionTime += (NLMISC::TGameCycle)param->AdditionalTimeGC;
}
}
+
//---------------------------------------------------
// unprocess a new received bonus brick
//---------------------------------------------------
-void CCharacter::unprocessForageBonusBrick(const CStaticBrick* brick)
+void CCharacter::unprocessForageBonusBrick( const CStaticBrick *brick )
{
- if (!brick)
+ if ( !brick )
return;
- for (std::vector::const_iterator ip = brick->Params.begin(); ip != brick->Params.end(); ++ip)
+ for ( std::vector::const_iterator ip=brick->Params.begin(); ip!=brick->Params.end(); ++ip )
{
- CSBrickParamBonusFgExtractionTimeGC* param = (CSBrickParamBonusFgExtractionTimeGC*)(TBrickParam::IId*)(*ip);
+ CSBrickParamBonusFgExtractionTimeGC *param = (CSBrickParamBonusFgExtractionTimeGC*)(TBrickParam::IId*)(*ip);
+
_ForageBonusExtractionTime -= (NLMISC::TGameCycle)param->AdditionalTimeGC;
}
}
+
//---------------------------------------------------
// computeMiscBonus
//---------------------------------------------------
@@ -3517,108 +3404,104 @@ void CCharacter::computeMiscBonus()
{
// Browse the known bricks
CBrickProperties landmarkBonusBricks;
- getPropertiesFromKnownBricks(BRICK_FAMILIES::BPBGLA, landmarkBonusBricks);
+ getPropertiesFromKnownBricks( BRICK_FAMILIES::BPBGLA, landmarkBonusBricks );
+
// Calculate the sum of the bonuses for landmark number
float sumOfBonusLandmarkNumber = 0;
- const CBrickPropertyValues &landmarkBonuses = landmarkBonusBricks[TBrickParam::BONUS_LANDMARK_NUMBER];
-
- for (CBrickPropertyValues::const_iterator ibv = landmarkBonuses.begin(), endOfMap = landmarkBonuses.end();
- ibv != endOfMap; ++ibv)
+ const CBrickPropertyValues& landmarkBonuses = landmarkBonusBricks[TBrickParam::BONUS_LANDMARK_NUMBER];
+ for ( CBrickPropertyValues::const_iterator ibv=landmarkBonuses.begin(), endOfMap=landmarkBonuses.end(); ibv!=endOfMap; ++ibv )
{
- CSBrickParamBonusLandmarkNumber* param = (CSBrickParamBonusLandmarkNumber*)(TBrickParam::IId*)(*ibv);
+ CSBrickParamBonusLandmarkNumber *param = (CSBrickParamBonusLandmarkNumber*)(TBrickParam::IId*)(*ibv);
sumOfBonusLandmarkNumber += param->Nb;
}
// Set in db
- // _PropertyDatabase.setProp( "INTERFACES:NB_BONUS_LANDMARKS", (sint64)(sint)sumOfBonusLandmarkNumber );
- CBankAccessor_PLR::getINTERFACES().setNB_BONUS_LANDMARKS(
- _PropertyDatabase, checkedCast(sumOfBonusLandmarkNumber));
+// _PropertyDatabase.setProp( "INTERFACES:NB_BONUS_LANDMARKS", (sint64)(sint)sumOfBonusLandmarkNumber );
+ CBankAccessor_PLR::getINTERFACES().setNB_BONUS_LANDMARKS(_PropertyDatabase, checkedCast(sumOfBonusLandmarkNumber) );
}
+
//---------------------------------------------------
// process a new received bonus brick
//---------------------------------------------------
-void CCharacter::processMiscBonusBrick(const CStaticBrick* brick)
+void CCharacter::processMiscBonusBrick( const CStaticBrick *brick )
{
- if (!brick)
+ if ( !brick )
return;
- BOMB_IF((brick->Family != BRICK_FAMILIES::BPBGLA), "Invalid bonus brick",
- return); // currently, only 1 misc bonus brick
- float sumOfBonusLandmarkNumber = 0;
+ BOMB_IF( (brick->Family != BRICK_FAMILIES::BPBGLA), "Invalid bonus brick", return ); // currently, only 1 misc bonus brick
- for (std::vector::const_iterator ip = brick->Params.begin(); ip != brick->Params.end(); ++ip)
+ float sumOfBonusLandmarkNumber = 0;
+ for ( std::vector::const_iterator ip=brick->Params.begin(); ip!=brick->Params.end(); ++ip )
{
- CSBrickParamBonusLandmarkNumber* param = (CSBrickParamBonusLandmarkNumber*)(TBrickParam::IId*)(*ip);
+ CSBrickParamBonusLandmarkNumber *param = (CSBrickParamBonusLandmarkNumber*)(TBrickParam::IId*)(*ip);
+
sumOfBonusLandmarkNumber += (NLMISC::TGameCycle)param->Nb;
}
- // ICDBStructNode *node = _PropertyDatabase.getICDBStructNodeFromName( "INTERFACES:NB_BONUS_LANDMARKS" );
- // BOMB_IF( !node, "Node NB_BONUS_LANDMARKS not found", return );
- // _PropertyDatabase.setProp( node, _PropertyDatabase.getProp( node ) + (sint64)(sint)sumOfBonusLandmarkNumber );
- CBankAccessor_PLR::getINTERFACES().setNB_BONUS_LANDMARKS(_PropertyDatabase,
- checkedCast(
- CBankAccessor_PLR::getINTERFACES().getNB_BONUS_LANDMARKS(_PropertyDatabase) + sumOfBonusLandmarkNumber));
+// ICDBStructNode *node = _PropertyDatabase.getICDBStructNodeFromName( "INTERFACES:NB_BONUS_LANDMARKS" );
+// BOMB_IF( !node, "Node NB_BONUS_LANDMARKS not found", return );
+// _PropertyDatabase.setProp( node, _PropertyDatabase.getProp( node ) + (sint64)(sint)sumOfBonusLandmarkNumber );
+ CBankAccessor_PLR::getINTERFACES().setNB_BONUS_LANDMARKS(_PropertyDatabase, checkedCast(CBankAccessor_PLR::getINTERFACES().getNB_BONUS_LANDMARKS(_PropertyDatabase) + sumOfBonusLandmarkNumber) );
}
+
//---------------------------------------------------
// unprocess a new received bonus brick
//---------------------------------------------------
-void CCharacter::unprocessMiscBonusBrick(const CStaticBrick* brick)
+void CCharacter::unprocessMiscBonusBrick( const CStaticBrick *brick )
{
- if (!brick)
+ if ( !brick )
return;
- BOMB_IF((brick->Family != BRICK_FAMILIES::BPBGLA), "Invalid bonus brick",
- return); // currently, only 1 misc bonus brick
- float sumOfBonusLandmarkNumber = 0;
+ BOMB_IF( (brick->Family != BRICK_FAMILIES::BPBGLA), "Invalid bonus brick", return ); // currently, only 1 misc bonus brick
- for (std::vector::const_iterator ip = brick->Params.begin(); ip != brick->Params.end(); ++ip)
+ float sumOfBonusLandmarkNumber = 0;
+ for ( std::vector::const_iterator ip=brick->Params.begin(); ip!=brick->Params.end(); ++ip )
{
- CSBrickParamBonusLandmarkNumber* param = (CSBrickParamBonusLandmarkNumber*)(TBrickParam::IId*)(*ip);
+ CSBrickParamBonusLandmarkNumber *param = (CSBrickParamBonusLandmarkNumber*)(TBrickParam::IId*)(*ip);
+
sumOfBonusLandmarkNumber += (NLMISC::TGameCycle)param->Nb;
}
- // ICDBStructNode *node = _PropertyDatabase.getICDBStructNodeFromName( "INTERFACES:NB_BONUS_LANDMARKS" );
- // BOMB_IF( !node, "Node NB_BONUS_LANDMARKS not found", return );
- // _PropertyDatabase.setProp( node, _PropertyDatabase.getProp( node ) + (sint64)(sint)sumOfBonusLandmarkNumber );
- CBankAccessor_PLR::getINTERFACES().setNB_BONUS_LANDMARKS(_PropertyDatabase,
- checkedCast(
- CBankAccessor_PLR::getINTERFACES().getNB_BONUS_LANDMARKS(_PropertyDatabase) - sumOfBonusLandmarkNumber));
+// ICDBStructNode *node = _PropertyDatabase.getICDBStructNodeFromName( "INTERFACES:NB_BONUS_LANDMARKS" );
+// BOMB_IF( !node, "Node NB_BONUS_LANDMARKS not found", return );
+// _PropertyDatabase.setProp( node, _PropertyDatabase.getProp( node ) + (sint64)(sint)sumOfBonusLandmarkNumber );
+ CBankAccessor_PLR::getINTERFACES().setNB_BONUS_LANDMARKS(_PropertyDatabase, checkedCast(CBankAccessor_PLR::getINTERFACES().getNB_BONUS_LANDMARKS(_PropertyDatabase) - sumOfBonusLandmarkNumber) );
}
+
//---------------------------------------------------
// :
//---------------------------------------------------
-void CCharacter::setTarget(const CEntityId &targetId, bool sendMessage)
+void CCharacter::setTarget( const CEntityId &targetId, bool sendMessage )
{
// If target is the same, do not send message
- if (_Target() == TheDataset.getDataSetRow(targetId) && !IsRingShard)
+ if ( _Target() == TheDataset.getDataSetRow( targetId ) && !IsRingShard )
return;
- CR2GiveItem::getInstance().onUntarget(this, _Target());
- removeTargetingChar(_Target());
- CEntityBase* target = CEntityBaseManager::getEntityBasePtr(targetId);
+ CR2GiveItem::getInstance().onUntarget( this, _Target() );
+
+ removeTargetingChar( _Target() );
- if (target)
+ CEntityBase * target = CEntityBaseManager::getEntityBasePtr( targetId );
+ if( target )
{
- if (!R2_VISION::isEntityVisibleToPlayers(target->getWhoSeesMe()))
+ if( !R2_VISION::isEntityVisibleToPlayers(target->getWhoSeesMe()) )
return;
}
- // check entity exists and is targetable
+ //check entity exists and is targetable
if (targetId != CEntityId::Unknown)
{
// get data set row
TDataSetRow rowId = TheDataset.getDataSetRow(targetId);
-
- if (TheDataset.isAccessible(rowId))
+ if ( TheDataset.isAccessible( rowId ) )
{
addTargetingChar(rowId);
// get contextual properties and check targetable
- const CMirrorPropValue contextualProperties(TheDataset, rowId, DSPropertyCONTEXTUAL);
+ const CMirrorPropValue contextualProperties(TheDataset, rowId, DSPropertyCONTEXTUAL );
const CProperties prop(contextualProperties.getValue());
-
if (!prop.selectable())
{
return;
@@ -3626,54 +3509,54 @@ void CCharacter::setTarget(const CEntityId &targetId, bool sendMessage)
}
}
- // if targeting an entity which is already targeted, set the mirror value to "invalid" before, so that
+ //if targeting an entity which is already targeted, set the mirror value to "invalid" before, so that
// the onTarget callback is sent.
// On a RingShard,We want that a targeted entity can be targeted again without selecting another entity.
if (IsRingShard)
{
CEntityId invalidTarget = CEntityId::Unknown;
- CEntityBase::setTarget(invalidTarget);
+ CEntityBase::setTarget( invalidTarget );
}
- CEntityBase::setTarget(targetId);
+ CEntityBase::setTarget( targetId );
// Forage source are not handled by CEntityBaseManager
- if (targetId.getType() == RYZOMID::forageSource)
+ if ( targetId.getType() == RYZOMID::forageSource )
{
- CEntityBase::setTarget(targetId);
+ CEntityBase::setTarget( targetId );
// TODO: mission event?
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
- CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+ CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, 0 );
+
//_PropertyDatabase.setProp( "TARGET:AGGRESSIVE", 0 );
- // _PropertyDatabase.setProp( "TARGET:FORCE_RATIO", 0 );
- CBankAccessor_PLR::getTARGET().setFORCE_RATIO(_PropertyDatabase, 0);
+// _PropertyDatabase.setProp( "TARGET:FORCE_RATIO", 0 );
+ CBankAccessor_PLR::getTARGET().setFORCE_RATIO(_PropertyDatabase, 0 );
return;
}
- // uint agressiveness = 0;
+ //uint agressiveness = 0;
uint rangeLevel = 0;
+
// reset combat event flags
resetCombatEventFlags();
- // Get target, his Hp, and set TARGET HP in the database
- target = CEntityBaseManager::getEntityBasePtr(_Target());
- if (target)
+ // Get target, his Hp, and set TARGET HP in the database
+ target = CEntityBaseManager::getEntityBasePtr( _Target() );
+ if( target )
{
- CCreature* creature = dynamic_cast(target);
-
- if (creature)
+ CCreature * creature = dynamic_cast< CCreature *>(target);
+ if( creature )
{
- const CStaticCreatures* form = creature->getForm();
-
- if (form)
+ const CStaticCreatures * form = creature->getForm();
+ if( form )
{
if (form->getLevel() == 0)
rangeLevel = 0;
@@ -3696,422 +3579,336 @@ void CCharacter::setTarget(const CEntityId &targetId, bool sendMessage)
}
}
- if (sendMessage)
+ if ( sendMessage )
{
if (targetId == _Id)
{
- PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "TARGET_SELF");
+ PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "TARGET_SELF");
}
- else if (targetId != CEntityId::Unknown)
+ else if( targetId != CEntityId::Unknown )
{
SM_STATIC_PARAMS_1(params, STRING_MANAGER::entity);
- params[0].setEIdAIAlias(targetId, CAIAliasTranslator::getInstance()->getAIAlias(targetId));
- PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "TARGET_NEW", params);
+ params[0].setEIdAIAlias( targetId, CAIAliasTranslator::getInstance()->getAIAlias(targetId) );
+ PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "TARGET_NEW", params);
}
}
// Process mission event "target" until all steps "target" of all missions have been processed
- CMissionEventTarget event(target->getEntityRowId());
- processMissionMultipleEvent(event);
+ CMissionEventTarget event( target->getEntityRowId() );
+ processMissionMultipleEvent( event );
+
// set botchat programm and enable filter is needed
- setTargetBotchatProgramm(target, targetId);
+ setTargetBotchatProgramm( target, targetId );
+
// UID
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, target->getEntityRowId().getCompressedIndex()
- //);
- CBankAccessor_PLR::getTARGET().getBARS().setUID(
- _PropertyDatabase, target->getEntityRowId().getCompressedIndex());
- sint8 percent;
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, target->getEntityRowId().getCompressedIndex() );
+ CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, target->getEntityRowId().getCompressedIndex() );
+ sint8 percent;
// Hp
- if (target->getPhysScores()._PhysicalScores[SCORES::hit_points].Max == 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Max == 0 )
{
percent = 0;
}
else
{
- percent = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::hit_points].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::hit_points].Max));
+ percent = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Max ) );
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, percent );
// Sap
- if (target->getPhysScores()._PhysicalScores[SCORES::sap].Max == 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::sap ].Max == 0 )
{
percent = 0;
}
else
{
- sint8 percentTmp = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::sap].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::sap].Max));
-
- if (percentTmp < 0)
+ sint8 percentTmp = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::sap ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::sap ].Max ) );
+ if( percentTmp < 0 )
percent = 0;
else
percent = percentTmp;
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, percent );
// Stamina
- if (target->getPhysScores()._PhysicalScores[SCORES::stamina].Max == 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::stamina ].Max == 0 )
{
percent = 0;
}
else
{
- sint8 percentTmp = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::stamina].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::stamina].Max));
-
- if (percentTmp < 0)
+ sint8 percentTmp = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::stamina ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::stamina ].Max ) );
+ if( percentTmp < 0 )
percent = 0;
else
percent = percentTmp;
}
-
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, percent);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, percent );
// Focus
- if (target->getPhysScores()._PhysicalScores[SCORES::focus].Max == 0)
+ if( target->getPhysScores()._PhysicalScores[ SCORES::focus].Max == 0 )
{
percent = 0;
}
else
{
- sint8 percentTmp = sint8((127.0 * (target->getPhysScores()._PhysicalScores[SCORES::focus].Current))
- / (target->getPhysScores()._PhysicalScores[SCORES::focus].Max));
-
- if (percentTmp < 0)
+ sint8 percentTmp = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::focus ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::focus ].Max ) );
+ if( percentTmp < 0 )
percent = 0;
else
percent = percentTmp;
}
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, percent );
+ CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, percent );
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, percent );
- CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, percent);
// Validate properties of target
CProperties prop;
// set all flags to true as this bifield is used as a AND mask on the client side
prop.setAllFlags();
-
// set the mountable property
- if (target->getContextualProperty().directAccessForStructMembers().mountable())
+ if( target->getContextualProperty().directAccessForStructMembers().mountable() )
{
- if ((getPlayerPet(target->getEntityRowId()) == -1)
- || TheDataset.getEntityId(_EntityMounted()) == target->getId())
+ if( (getPlayerPet( target->getEntityRowId() ) == -1) || TheDataset.getEntityId( _EntityMounted() ) == target->getId() )
{
- prop.mountable(false);
+ prop.mountable( false );
}
}
-
- if (target->getId().getType() == RYZOMID::player)
+ if ( target->getId().getType() == RYZOMID::player )
{
- CCharacter* c = dynamic_cast(target);
-
+ CCharacter * c = dynamic_cast(target);
if (c)
{
// Set the invitable property
- if (!TeamManager.isInvitableBy(c, this))
- prop.invitable(false);
-
+ if ( ! TeamManager.isInvitableBy(c, this) )
+ prop.invitable( false );
// if any of the character is god, don't allow to team
if (c->godMode() || godMode())
- prop.invitable(false);
+ prop.invitable( false );
// Set the level in database for ForceRegion/ForceLevel deduction
- sint32 skillBaseValue = c->getSkillBaseValue(c->getBestSkill());
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.PLAYER_LEVEL, skillBaseValue );
- CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(
- _PropertyDatabase, checkedCast(skillBaseValue));
+ sint32 skillBaseValue = c->getSkillBaseValue( c->getBestSkill() );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.PLAYER_LEVEL, skillBaseValue );
+ CBankAccessor_PLR::getTARGET().getBARS().setPLAYER_LEVEL(_PropertyDatabase, checkedCast(skillBaseValue) );
}
else
{
- nlwarning("Entity %s type is player but dynamic_cast in CCharacter * returns NULL ?!",
- target->getId().toString().c_str());
+ nlwarning("Entity %s type is player but dynamic_cast in CCharacter * returns NULL ?!", target->getId().toString().c_str());
}
}
- if (CPVPFactionRewardManager::getInstance().isAttackable(this, target))
+ if ( CPVPFactionRewardManager::getInstance().isAttackable( this, target ) )
{
- prop.attackable(true);
+ prop.attackable( true );
}
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.CONTEXT_VAL, (uint16) prop );
- CBankAccessor_PLR::getTARGET().setCONTEXT_VAL(_PropertyDatabase, prop);
- //*** Removed by Sadge ***
- // // Ask information about target to AI service
- // CreatureNpcInformation.Character.push_back( _EntityRowId );
- // CreatureNpcInformation.Creature.push_back( target->getEntityRowId() );
- //*** ***
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.CONTEXT_VAL, (uint16) prop );
+ CBankAccessor_PLR::getTARGET().setCONTEXT_VAL(_PropertyDatabase, prop );
+
+//*** Removed by Sadge ***
+// // Ask information about target to AI service
+// CreatureNpcInformation.Character.push_back( _EntityRowId );
+// CreatureNpcInformation.Creature.push_back( target->getEntityRowId() );
+//*** ***
}
- else // target == NULL
+ else // target == NULL
{
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
- CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, 0 );
- CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, 0);
- // PHRASE_UTILITIES::sendDynamicSystemMessage( _Id, "TARGET_NONE");
- }
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+ CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.HP, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setHP(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.SAP, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setSAP(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.STA, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setSTA(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.FOCUS, 0 );
+ CBankAccessor_PLR::getTARGET().getBARS().setFOCUS(_PropertyDatabase, 0 );
+// PHRASE_UTILITIES::sendDynamicSystemMessage( _Id, "TARGET_NONE");
+ }
//_PropertyDatabase.setProp( "TARGET:AGGRESSIVE", agressiveness );
- // _PropertyDatabase.setProp( "TARGET:FORCE_RATIO", rangeLevel );
- CBankAccessor_PLR::getTARGET().setFORCE_RATIO(_PropertyDatabase, rangeLevel);
+// _PropertyDatabase.setProp( "TARGET:FORCE_RATIO", rangeLevel );
+ CBankAccessor_PLR::getTARGET().setFORCE_RATIO(_PropertyDatabase, rangeLevel );
} // setTarget //
+
//---------------------------------------------------
// setTargetBotchatProgramm:
//---------------------------------------------------
-void CCharacter::setTargetBotchatProgramm(CEntityBase* target, const CEntityId &targetId)
+void CCharacter::setTargetBotchatProgramm( CEntityBase * target, const CEntityId& targetId )
{
uint32 programm = 0;
// set bot chat programms and npcs special options
- CCreature* c = NULL;
-
+ CCreature * c = NULL;
if (targetId.getType() == RYZOMID::npc)
{
- c = dynamic_cast(target);
-
+ c = dynamic_cast(target);
if (c == NULL)
{
nlwarning("This dynamic_cast should not return NULL");
}
}
-
if (c)
{
programm = c->getBotChatProgram();
-
- if (programm & ((uint32)1 << uint32(BOTCHATTYPE::TradeItemFlag)))
+ if( programm & ( (uint32)1 << uint32(BOTCHATTYPE::TradeItemFlag) ) )
{
- enableAppropriateFiltersForSeller(c);
+ enableAppropriateFiltersForSeller( c );
}
// guild special features
if (_GuildId != 0)
{
- programm &= ~((uint32)1 << uint32(BOTCHATTYPE::CreateGuildFlag));
+ programm &= ~( (uint32)1 << uint32(BOTCHATTYPE::CreateGuildFlag) );
}
-
if (c->getOutpostBuilding() != NULL)
{
bool hasRightsToTradeOutpostBuilding = false;
// if the target is an outpost building check we have rights to build/construct
- CGuild* pGuild = CGuildManager::getInstance()->getGuildFromId(_GuildId);
-
+ CGuild *pGuild = CGuildManager::getInstance()->getGuildFromId(_GuildId);
if (pGuild != NULL)
{
- CGuildMember* pMember = pGuild->getMemberFromEId(_Id);
-
+ CGuildMember *pMember = pGuild->getMemberFromEId(_Id);
if (pMember != NULL)
{
- if ((pMember->getGrade() == EGSPD::CGuildGrade::Leader)
- || (pMember->getGrade() == EGSPD::CGuildGrade::HighOfficer))
+ if ((pMember->getGrade() == EGSPD::CGuildGrade::Leader) ||
+ (pMember->getGrade() == EGSPD::CGuildGrade::HighOfficer))
{
// Ok the user is a leader or a high officer
// check that the outpost belongs to its guild
- const COutpost* pO = c->getOutpostBuilding()->getParent();
-
+ const COutpost *pO = c->getOutpostBuilding()->getParent();
if (pO != NULL)
- if ((pO->isBelongingToAGuild()) && (pO->getOwnerGuild() == _GuildId))
+ if ((pO->isBelongingToAGuild()) &&
+ (pO->getOwnerGuild() == _GuildId))
hasRightsToTradeOutpostBuilding = true;
}
}
}
-
if (!hasRightsToTradeOutpostBuilding)
- programm &= ~((uint32)1 << uint32(BOTCHATTYPE::TradeOutpostBuilding));
+ programm &= ~( (uint32)1 << uint32(BOTCHATTYPE::TradeOutpostBuilding) );
}
-
// solo mission
- uint i = 0;
-
- for (map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it)
- {
- vector > texts;
- (*it).second->sendContextTexts(_EntityRowId, c->getEntityRowId(), texts);
-
- for (uint k = 0; k < texts.size(); k++)
- {
- if (i >= NB_CONTEXT_DYN_TEXTS)
- break; // no more room in the context menu, don't fill more or it'll assert
-
- // _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) ,
- // texts[k].second );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(
- _PropertyDatabase, texts[k].second);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i),texts[k].first );
- CBankAccessor_PLR::getTARGET()
- .getCONTEXT_MENU()
- .getMISSIONS_OPTIONS()
- .getArray(i)
- .setPLAYER_GIFT_NEEDED(_PropertyDatabase, texts[k].first);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i),
- // 3
- //);
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(
- _PropertyDatabase, 3);
+ uint i = 0;
+ for ( map::iterator it = getMissionsBegin(); it != getMissionsEnd(); ++it )
+ {
+ vector< pair< bool, uint32 > > texts;
+ (*it).second->sendContextTexts( _EntityRowId, c->getEntityRowId(),texts );
+ for ( uint k = 0; k < texts.size(); k++)
+ {
+ if(i >= NB_CONTEXT_DYN_TEXTS) break; // no more room in the context menu, don't fill more or it'll assert
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) , texts[k].second );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(_PropertyDatabase, texts[k].second );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i),texts[k].first );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPLAYER_GIFT_NEEDED(_PropertyDatabase, texts[k].first );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 3 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(_PropertyDatabase, 3 );
i++;
}
}
// group mission
- CTeam* team = TeamManager.getRealTeam(_TeamId);
-
- if (team)
+ CTeam * team = TeamManager.getRealTeam(_TeamId);
+ if ( team )
{
- for (uint j = 0; j < team->getMissions().size(); j++)
+ for (uint j = 0 ; j < team->getMissions().size(); j++ )
{
- vector > texts;
- team->getMissions()[j]->sendContextTexts(_EntityRowId, c->getEntityRowId(), texts);
-
- for (uint k = 0; k < texts.size(); k++)
+ vector< pair< bool, uint32 > > texts;
+ team->getMissions()[j]->sendContextTexts( _EntityRowId, c->getEntityRowId(),texts );
+ for ( uint k = 0; k < texts.size(); k++)
{
- if (i >= NB_CONTEXT_DYN_TEXTS)
- break; // no more room in the context menu, don't fill more or it'll assert
-
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i)
- //,
- // texts[k].second );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(
- _PropertyDatabase, texts[k].second);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i),texts[k].first );
- CBankAccessor_PLR::getTARGET()
- .getCONTEXT_MENU()
- .getMISSIONS_OPTIONS()
- .getArray(i)
- .setPLAYER_GIFT_NEEDED(_PropertyDatabase, texts[k].first);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 3 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(
- _PropertyDatabase, 3);
+ if(i >= NB_CONTEXT_DYN_TEXTS) break; // no more room in the context menu, don't fill more or it'll assert
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) , texts[k].second );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(_PropertyDatabase, texts[k].second );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i),texts[k].first );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPLAYER_GIFT_NEEDED(_PropertyDatabase, texts[k].first );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 3 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(_PropertyDatabase, 3 );
i++;
}
}
}
- // send special contextual texts
- if (!c->getContextTexts().empty())
+ //send special contextual texts
+ if ( !c->getContextTexts().empty() )
{
TVectorParamCheck vect;
STRING_MANAGER::TParam param;
+
param.Type = STRING_MANAGER::player;
- param.setEIdAIAlias(_Id, CAIAliasTranslator::getInstance()->getAIAlias(_Id));
- vect.push_back(param);
+ param.setEIdAIAlias( _Id, CAIAliasTranslator::getInstance()->getAIAlias( _Id) );
+ vect.push_back( param );
+
param.Type = STRING_MANAGER::bot;
- param.setEIdAIAlias(targetId, CAIAliasTranslator::getInstance()->getAIAlias(targetId));
- vect.push_back(param);
-
- for (uint j = 0; j < c->getContextTexts().size(); j++)
- {
- if (i >= NB_CONTEXT_DYN_TEXTS)
- break; // no more room in the context menu, don't fill more or it'll assert
-
- uint32 text
- = STRING_MANAGER::sendStringToClient(_EntityRowId, c->getContextTexts()[j].first.c_str(), vect);
- // _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) ,
- // text
- //);
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(
- _PropertyDatabase, text);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i) , 0 );
- CBankAccessor_PLR::getTARGET()
- .getCONTEXT_MENU()
- .getMISSIONS_OPTIONS()
- .getArray(i)
- .setPLAYER_GIFT_NEEDED(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i),
- // 0
- //);
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(
- _PropertyDatabase, 2);
+ param.setEIdAIAlias( targetId, CAIAliasTranslator::getInstance()->getAIAlias( targetId) );
+
+ vect.push_back( param );
+
+ for ( uint j = 0; j < c->getContextTexts().size(); j++ )
+ {
+ if(i >= NB_CONTEXT_DYN_TEXTS) break; // no more room in the context menu, don't fill more or it'll assert
+ uint32 text = STRING_MANAGER::sendStringToClient(_EntityRowId, c->getContextTexts()[j].first.c_str(),vect );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) , text );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(_PropertyDatabase, text);
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i) , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPLAYER_GIFT_NEEDED(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(_PropertyDatabase, 2 );
i++;
}
}
// send auto missions
- for (uint j = 0; j < c->getMissionVector().size(); j++)
+ for ( uint j = 0; j < c->getMissionVector().size(); j++ )
{
- const CMissionTemplate* templ = CMissionManager::getInstance()->getTemplate(c->getMissionVector()[j]);
-
- if ((templ != NULL) && !templ->AutoText.empty())
+ const CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( c->getMissionVector()[j] );
+ if ( (templ != NULL) && !templ->AutoText.empty() )
{
if (templ->testPrerequisits(this, false) == MISSION_DESC::PreReqSuccess)
{
- if (i >= NB_CONTEXT_DYN_TEXTS)
- break; // no more room in the context menu, don't fill more or it'll assert
-
- uint32 text = templ->sendAutoText(_EntityRowId, _CurrentInterlocutor);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i)
- //,
- // text );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(
- _PropertyDatabase, text);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i) , 0 );
- CBankAccessor_PLR::getTARGET()
- .getCONTEXT_MENU()
- .getMISSIONS_OPTIONS()
- .getArray(i)
- .setPLAYER_GIFT_NEEDED(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 3 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(
- _PropertyDatabase, 3);
+ if(i >= NB_CONTEXT_DYN_TEXTS) break; // no more room in the context menu, don't fill more or it'll assert
+ uint32 text = templ->sendAutoText(_EntityRowId,_CurrentInterlocutor);
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) , text );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(_PropertyDatabase, text );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i) , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPLAYER_GIFT_NEEDED(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 3 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(_PropertyDatabase, 3 );
i++;
}
}
}
- for (; i < NB_CONTEXT_DYN_TEXTS; i++)
+ for (; i < NB_CONTEXT_DYN_TEXTS; i++ )
{
- // _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) , 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(
- _PropertyDatabase, 0);
- // _PropertyDatabase.setProp(
- // toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i)
- //, 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPLAYER_GIFT_NEEDED(
- _PropertyDatabase, 0);
- // _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(
- _PropertyDatabase, 0);
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:TITLE",i) , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setTITLE(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PLAYER_GIFT_NEEDED",i) , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPLAYER_GIFT_NEEDED(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( toString("TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%u:PRIORITY",i), 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(i).setPRIORITY(_PropertyDatabase, 0 );
}
// WebPage Title
- if (programm & (1 << BOTCHATTYPE::WebPageFlag))
+ if( programm & (1<getWebPageName().find("MENU_") == 0)
+ if (NLMISC::startsWith(c->getWebPageName(), "MENU_")) // TODO: What is this?
{
- text = STRING_MANAGER::sendStringToClient(_EntityRowId, c->getWebPageName(), TVectorParamCheck());
+ text = STRING_MANAGER::sendStringToClient(_EntityRowId, c->getWebPageName(), TVectorParamCheck() );
}
else
{
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
- params[0].Literal = c->getWebPageName();
- text = STRING_MANAGER::sendStringToClient(_EntityRowId, "LITERAL", params);
+ params[0].Literal= c->getWebPageName();
+ text = STRING_MANAGER::sendStringToClient(_EntityRowId, "LITERAL", params );
}
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_TITLE" , text );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setWEB_PAGE_TITLE(_PropertyDatabase, text );
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_TITLE" , text );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setWEB_PAGE_TITLE(_PropertyDatabase, text);
// send the web page url
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = c->getWebPage();
@@ -4121,112 +3918,100 @@ void CCharacter::setTargetBotchatProgramm(CEntityBase* target, const CEntityId &
}
else
{
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_TITLE" , 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setWEB_PAGE_TITLE(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_URL" , 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setWEB_PAGE_URL(_PropertyDatabase, 0);
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_TITLE" , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setWEB_PAGE_TITLE(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:WEB_PAGE_URL" , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setWEB_PAGE_URL(_PropertyDatabase, 0 );
}
-
// Outpost
- if (programm & (1 << BOTCHATTYPE::OutpostFlag))
+ if( programm & (1<getBotChatOutpost().asInt() );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setOUTPOST(_PropertyDatabase, c->getBotChatOutpost());
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:OUTPOST" , c->getBotChatOutpost().asInt() );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setOUTPOST(_PropertyDatabase, c->getBotChatOutpost() );
}
else
{
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:OUTPOST" , 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setOUTPOST(_PropertyDatabase, CSheetId::Unknown);
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:OUTPOST" , 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setOUTPOST(_PropertyDatabase, CSheetId::Unknown );
}
}
else
{
- if (target->getId().getType() == RYZOMID::player)
+ if ( target->getId().getType() == RYZOMID::player )
{
- CCharacter* c = dynamic_cast(target);
-
+ CCharacter * c = dynamic_cast(target);
if (c)
{
- CGuildMemberModule* module;
-
- if (_ModulesCont->getModule(module))
+ CGuildMemberModule * module;
+ if ( _ModulesCont->getModule( module ) )
{
- if (c->getGuildId() == 0 && module->canInvite())
+ if ( c->getGuildId() == 0 && module->canInvite() )
programm |= 1 << BOTCHATTYPE::GuildInviteFlag;
}
}
else
{
- nlwarning("Entity %s type is player but dynamic_cast in CCharacter * returns NULL ?!",
- target->getId().toString().c_str());
+ nlwarning("Entity %s type is player but dynamic_cast in CCharacter * returns NULL ?!", target->getId().toString().c_str());
}
}
-
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:PROGRAMMES", programm );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setPROGRAMMES(_PropertyDatabase, programm);
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:0:TITLE", 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(0).setTITLE(
- _PropertyDatabase, 0);
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:0:PLAYER_GIFT_NEEDED", 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(0).setPLAYER_GIFT_NEEDED(
- _PropertyDatabase, 0);
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:0:PRIORITY", 0 );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(0).setPRIORITY(
- _PropertyDatabase, 0);
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:PROGRAMMES", programm );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setPROGRAMMES(_PropertyDatabase, programm );
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:0:TITLE", 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(0).setTITLE(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:0:PLAYER_GIFT_NEEDED", 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(0).setPLAYER_GIFT_NEEDED(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:0:PRIORITY", 0 );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().getMISSIONS_OPTIONS().getArray(0).setPRIORITY(_PropertyDatabase, 0 );
}
// Can attack another player or a npc/creature helping players?
bool invulnerable = target->getContextualProperty().directAccessForStructMembers().invulnerable();
-
- if (CPVPManager2::getInstance()->isOffensiveActionValid(this, target, true) && !invulnerable)
+ if( CPVPManager2::getInstance()->isOffensiveActionValid( this, target, true ) && !invulnerable )
{
programm |= 1 << BOTCHATTYPE::Attackable;
}
// otherwise if target is a creature/npc, check fame attackable
- else if (c && c->checkFactionAttackable(_Id))
+ else if( c && c->checkFactionAttackable(_Id) )
{
programm |= 1 << BOTCHATTYPE::Attackable;
}
- else if (isEntityAnOutpostEnemy(targetId) && !invulnerable)
+ else if( isEntityAnOutpostEnemy(targetId) && !invulnerable )
{
programm |= 1 << BOTCHATTYPE::Attackable;
}
- if (CPVPFactionRewardManager::getInstance().isAttackable(this, target))
+ if ( CPVPFactionRewardManager::getInstance().isAttackable( this, target ) )
programm |= 1 << BOTCHATTYPE::Attackable;
- // _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:PROGRAMMES", programm, true );
- CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setPROGRAMMES(_PropertyDatabase, programm, true);
+// _PropertyDatabase.setProp( "TARGET:CONTEXT_MENU:PROGRAMMES", programm, true );
+ CBankAccessor_PLR::getTARGET().getCONTEXT_MENU().setPROGRAMMES(_PropertyDatabase, programm, true );
}
//-----------------------------------------------------------------------------
-void CCharacter::enableAppropriateFiltersForSeller(CCreature* c)
+void CCharacter::enableAppropriateFiltersForSeller( CCreature * c )
{
- nlassert(c != 0);
- const std::vector &botChatCategory = c->getBotChatCategory();
+ nlassert( c != 0 );
+
+ const std::vector< uint32 >& botChatCategory = c->getBotChatCategory();
+
bool rawMaterialSeller = false;
uint64 itemTypeSelled64 = 0;
uint64 itemTypeSelled128 = 0;
-
- for (uint32 i = 0; i < botChatCategory.size(); ++i)
+ for( uint32 i = 0; i < botChatCategory.size(); ++i )
{
- if (botChatCategory[i] < CShopTypeManager::getCategoryName().size())
+ if( botChatCategory[ i ] < CShopTypeManager::getCategoryName().size() )
{
- if (botChatCategory[i] > CShopTypeManager::getRmStart()
- && botChatCategory[i] < CShopTypeManager::getRmEnd())
+ if( botChatCategory[ i ] > CShopTypeManager::getRmStart() && botChatCategory[ i ] < CShopTypeManager::getRmEnd() )
{
rawMaterialSeller = true;
}
- if (botChatCategory[i] > CShopTypeManager::getItemStart()
- && botChatCategory[i] < CShopTypeManager::getItemEnd())
+ if( botChatCategory[ i ] > CShopTypeManager::getItemStart() && botChatCategory[ i ] < CShopTypeManager::getItemEnd() )
{
- ITEM_TYPE::TItemType itemType
- = ITEM_TYPE::stringToItemType(CShopTypeManager::getCategoryName()[botChatCategory[i]]);
-
- if (itemType != ITEM_TYPE::UNDEFINED)
+ ITEM_TYPE::TItemType itemType = ITEM_TYPE::stringToItemType( CShopTypeManager::getCategoryName()[ botChatCategory[ i ] ] );
+ if( itemType != ITEM_TYPE::UNDEFINED )
{
- if (itemType < ITEM_TYPE::LIMIT_64)
+ if( itemType < ITEM_TYPE::LIMIT_64 )
{
itemTypeSelled64 |= ((uint64)1) << itemType;
}
@@ -4238,12 +4023,11 @@ void CCharacter::enableAppropriateFiltersForSeller(CCreature* c)
}
}
}
-
- // _PropertyDatabase.setProp( "TRADING:RAW_MATERIAL_SELLER", rawMaterialSeller );
- CBankAccessor_PLR::getTRADING().setRAW_MATERIAL_SELLER(_PropertyDatabase, rawMaterialSeller);
- // _PropertyDatabase.setProp( "TRADING:ITEM_TYPE_SELLER_BITFILED_0_63", itemTypeSelled64 );
+// _PropertyDatabase.setProp( "TRADING:RAW_MATERIAL_SELLER", rawMaterialSeller );
+ CBankAccessor_PLR::getTRADING().setRAW_MATERIAL_SELLER(_PropertyDatabase, rawMaterialSeller );
+// _PropertyDatabase.setProp( "TRADING:ITEM_TYPE_SELLER_BITFILED_0_63", itemTypeSelled64 );
CBankAccessor_PLR::getTRADING().setITEM_TYPE_SELLER_BITFILED_0_63(_PropertyDatabase, itemTypeSelled64);
- // _PropertyDatabase.setProp( "TRADING:ITEM_TYPE_SELLER_BITFILED_64_127", itemTypeSelled128 );
+// _PropertyDatabase.setProp( "TRADING:ITEM_TYPE_SELLER_BITFILED_64_127", itemTypeSelled128 );
CBankAccessor_PLR::getTRADING().setITEM_TYPE_SELLER_BITFILED_64_127(_PropertyDatabase, itemTypeSelled128);
}
@@ -4251,12 +4035,10 @@ void CCharacter::enableAppropriateFiltersForSeller(CCreature* c)
void CCharacter::updateTargetingChars()
{
const uint size = (uint)_TargetingChars.size();
-
- for (uint i = 0; i < size; i++)
+ for ( uint i = 0; i < size; i++ )
{
- CCharacter* user = PlayerManager.getChar(_TargetingChars[i]);
-
- if (user)
+ CCharacter* user = PlayerManager.getChar( _TargetingChars[i] );
+ if ( user )
{
user->updateTarget();
}
@@ -4268,17 +4050,17 @@ CRingRewardPoints &CCharacter::getRingRewardPoints()
return RingRewardPoints;
}
+
//---------------------------------------------------
// sendBetaTesterStatus :
//---------------------------------------------------
void CCharacter::sendBetaTesterStatus()
{
- CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
-
+ CPlayer * p = PlayerManager.getPlayer(PlayerManager.getPlayerId( getId() ));
if (p == NULL)
return;
- sendReservedTitleStatus(CHARACTER_TITLE::FBT, p->isBetaTester());
+ sendReservedTitleStatus( CHARACTER_TITLE::FBT, p->isBetaTester() );
/*if (!p->isBetaTester() && _Title == CHARACTER_TITLE::FBT)
{
@@ -4298,12 +4080,11 @@ void CCharacter::sendBetaTesterStatus()
//---------------------------------------------------
void CCharacter::sendWindermeerStatus()
{
- CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
-
+ CPlayer * p = PlayerManager.getPlayer(PlayerManager.getPlayerId( getId() ));
if (p == NULL)
return;
- sendReservedTitleStatus(CHARACTER_TITLE::WIND, p->isWindermeerCommunity());
+ sendReservedTitleStatus( CHARACTER_TITLE::WIND, p->isWindermeerCommunity() );
/*if ( !p->isWindermeerCommunity() && _Title == CHARACTER_TITLE::WIND)
{
@@ -4324,29 +4105,31 @@ void CCharacter::sendWindermeerStatus()
void CCharacter::sendReservedTitleStatus(CHARACTER_TITLE::ECharacterTitle title, bool available) const
{
// send message to client
- CMessage msgout("IMPULSION_ID");
+ CMessage msgout( "IMPULSION_ID" );
CEntityId id = _Id;
- msgout.serial(id);
- CBitMemStream bms;
+ msgout.serial( id );
- if (!GenericMsgManager.pushNameToStream("GUILD:UPDATE_PLAYER_TITLE", bms))
+ CBitMemStream bms;
+ if ( !GenericMsgManager.pushNameToStream("GUILD:UPDATE_PLAYER_TITLE", bms) )
{
nlwarning(" Msg name GUILD:UPDATE_PLAYER_TITLE not found");
return;
}
vector titles;
- titles.push_back((uint16)title);
- bms.serial(available);
- bms.serialCont(titles);
- msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
- CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(_Id.getDynamicId()), msgout);
+ titles.push_back( (uint16)title );
+
+ bms.serial( available );
+ bms.serialCont( titles );
+
+ msgout.serialBufferWithSize( (uint8*)bms.buffer(), bms.length() );
+ CUnifiedNetwork::getInstance()->send( NLNET::TServiceId(_Id.getDynamicId()), msgout );
}
/*
* Constructor
*/
-// CCharacter::CCharacterDbReminder::CCharacterDbReminder()
+//CCharacter::CCharacterDbReminder::CCharacterDbReminder()
//{
// CCDBStructNodeBranch *rootNode = CCDBStructBanks::instance()->getStructRoot( CDBPlayer );
// nlassert( rootNode );
@@ -4358,22 +4141,14 @@ void CCharacter::sendReservedTitleStatus(CHARACTER_TITLE::ECharacterTitle title,
// // BEAST[MAX_INVENTORY_ANIMAL]
// for (int i=0; i<4; ++i)
// {
-// nlverify( PACK_ANIMAL.BEAST[i].TYPE = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:TYPE", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].UID = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:UID", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].STATUS = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:STATUS", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].HP = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:HP", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].BULK_MAX = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:BULK_MAX", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].POS = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:POS", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].HUNGER = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:HUNGER", i ) ) );
-// nlverify( PACK_ANIMAL.BEAST[i].DESPAWN = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("PACK_ANIMAL:BEAST%d:DESPAWN", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].TYPE = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:TYPE", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].UID = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:UID", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].STATUS = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:STATUS", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].HP = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:HP", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].BULK_MAX = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:BULK_MAX", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].POS = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:POS", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].HUNGER = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:HUNGER", i ) ) );
+// nlverify( PACK_ANIMAL.BEAST[i].DESPAWN = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("PACK_ANIMAL:BEAST%d:DESPAWN", i ) ) );
// }
// }
// // CHARACTER_INFO
@@ -4382,33 +4157,24 @@ void CCharacter::sendReservedTitleStatus(CHARACTER_TITLE::ECharacterTitle title,
// {
// for (int i=0; igetICDBStructNodeFromNameFromRoot(
-// std::string("CHARACTER_INFO:SCORES")+toString(i)+":BaseRegen" );
-// nlverify( CHARACTER_INFO.SCORES.Regen[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// std::string("CHARACTER_INFO:SCORES")+toString(i)+":Regen"));
-// nlverify( CHARACTER_INFO.SCORES.BaseScore[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// std::string("CHARACTER_INFO:SCORES")+toString(i)+":Base" );
-// nlverify( CHARACTER_INFO.SCORES.MaxScore[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// std::string("CHARACTER_INFO:SCORES")+toString(i)+":Max"));
+// nlverify( CHARACTER_INFO.SCORES.BaseRegen[i] = rootNode->getICDBStructNodeFromNameFromRoot( std::string("CHARACTER_INFO:SCORES")+toString(i)+":BaseRegen" );
+// nlverify( CHARACTER_INFO.SCORES.Regen[i] = rootNode->getICDBStructNodeFromNameFromRoot( std::string("CHARACTER_INFO:SCORES")+toString(i)+":Regen"));
+// nlverify( CHARACTER_INFO.SCORES.BaseScore[i] = rootNode->getICDBStructNodeFromNameFromRoot( std::string("CHARACTER_INFO:SCORES")+toString(i)+":Base" );
+// nlverify( CHARACTER_INFO.SCORES.MaxScore[i] = rootNode->getICDBStructNodeFromNameFromRoot( std::string("CHARACTER_INFO:SCORES")+toString(i)+":Max"));
// }
//
// for (int i=0; igetICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("CHARACTER_INFO:SKILLS:%d:BaseSKILL", i) ) );
-// nlverify( CHARACTER_INFO.SKILLS.Skill[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("CHARACTER_INFO:SKILLS:%d:SKILL", i) ) );
-// nlverify( CHARACTER_INFO.SKILLS.ProgressBar[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("CHARACTER_INFO:SKILLS:%d:PROGRESS_BAR", i) ) );
+// nlverify( CHARACTER_INFO.SKILLS.BaseSkill[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("CHARACTER_INFO:SKILLS:%d:BaseSKILL", i) ) );
+// nlverify( CHARACTER_INFO.SKILLS.Skill[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("CHARACTER_INFO:SKILLS:%d:SKILL", i) ) );
+// nlverify( CHARACTER_INFO.SKILLS.ProgressBar[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("CHARACTER_INFO:SKILLS:%d:PROGRESS_BAR", i) ) );
// }
// }
// // Dodge / Parry modifier
// nlverify( CHARACTER_INFO.DodgeBase = rootNode->getICDBStructNodeFromNameFromRoot("CHARACTER_INFO:DODGE:Base") );
-// nlverify( CHARACTER_INFO.DodgeCurrent =
-// rootNode->getICDBStructNodeFromNameFromRoot("CHARACTER_INFO:DODGE:Current") );
+// nlverify( CHARACTER_INFO.DodgeCurrent = rootNode->getICDBStructNodeFromNameFromRoot("CHARACTER_INFO:DODGE:Current") );
// nlverify( CHARACTER_INFO.ParryBase = rootNode->getICDBStructNodeFromNameFromRoot("CHARACTER_INFO:PARRY:Base") );
-// nlverify( CHARACTER_INFO.ParryCurrent =
-// rootNode->getICDBStructNodeFromNameFromRoot("CHARACTER_INFO:PARRY:Current") );
+// nlverify( CHARACTER_INFO.ParryCurrent = rootNode->getICDBStructNodeFromNameFromRoot("CHARACTER_INFO:PARRY:Current") );
// }
// // TARGET
// {
@@ -4424,8 +4190,7 @@ void CCharacter::sendReservedTitleStatus(CHARACTER_TITLE::ECharacterTitle title,
// {
// for (int i=0; igetICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("BRICK_FAMILY:%d:BRICKS", i) ) );
+// nlverify( KnownBricksFamilies[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("BRICK_FAMILY:%d:BRICKS", i) ) );
// }
// }
//
@@ -4433,120 +4198,115 @@ void CCharacter::sendReservedTitleStatus(CHARACTER_TITLE::ECharacterTitle title,
// {
// for (int i=0; igetICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("MODIFIERS:BONUS:%d:SHEET", i) ) );
-// nlverify( Modifiers.Bonus.Disable[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("MODIFIERS:BONUS:%d:DISABLED", i) ) );
-// nlverify( Modifiers.Bonus.DisableTime[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("MODIFIERS:BONUS:%d:DISABLED_TIME", i) ) );
-// nlverify( Modifiers.Malus.Sheet[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("MODIFIERS:MALUS:%d:SHEET", i) ) );
-// nlverify( Modifiers.Malus.Disable[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("MODIFIERS:MALUS:%d:DISABLED", i) ) );
-// nlverify( Modifiers.Malus.DisableTime[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("MODIFIERS:MALUS:%d:DISABLED_TIME", i) ) );
+// nlverify( Modifiers.Bonus.Sheet[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("MODIFIERS:BONUS:%d:SHEET", i) ) );
+// nlverify( Modifiers.Bonus.Disable[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("MODIFIERS:BONUS:%d:DISABLED", i) ) );
+// nlverify( Modifiers.Bonus.DisableTime[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("MODIFIERS:BONUS:%d:DISABLED_TIME", i) ) );
+// nlverify( Modifiers.Malus.Sheet[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("MODIFIERS:MALUS:%d:SHEET", i) ) );
+// nlverify( Modifiers.Malus.Disable[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("MODIFIERS:MALUS:%d:DISABLED", i) ) );
+// nlverify( Modifiers.Malus.DisableTime[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("MODIFIERS:MALUS:%d:DISABLED_TIME", i) ) );
// }
-// nlverify( Modifiers.TotalMalusEquip = rootNode->getICDBStructNodeFromNameFromRoot( "MODIFIERS:TOTAL_MALUS_EQUIP"
-//)
-//);
+// nlverify( Modifiers.TotalMalusEquip = rootNode->getICDBStructNodeFromNameFromRoot( "MODIFIERS:TOTAL_MALUS_EQUIP" ) );
// }
//
// // Disable consumable family (overdose)
// {
// for(int i=0; igetICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("DISABLE_CONSUMABLE:%d:FAMILY", i) ) );
-// nlverify( DisableConsumable.DisableTime[i] = rootNode->getICDBStructNodeFromNameFromRoot(
-// NLMISC::toString("DISABLE_CONSUMABLE:%d:DISABLE_TIME", i) ) );
+// nlverify( DisableConsumable.Family[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("DISABLE_CONSUMABLE:%d:FAMILY", i) ) );
+// nlverify( DisableConsumable.DisableTime[i] = rootNode->getICDBStructNodeFromNameFromRoot( NLMISC::toString("DISABLE_CONSUMABLE:%d:DISABLE_TIME", i) ) );
// }
// }
//}
+
/*
* Fill version data for handshake. Please update checkHandshake() in client:net_manager.cpp accordingly.
*/
-void CCharacter::fillHandshake(CBitMemStream &bms)
+void CCharacter::fillHandshake( CBitMemStream& bms )
{
uint16 handshakeVersion = 0;
uint16 itemSlotVersion = INVENTORIES::CItemSlot::getVersion();
- bms.serial(handshakeVersion);
- bms.serial(itemSlotVersion);
+ bms.serial( handshakeVersion );
+ bms.serial( itemSlotVersion );
+
// Here we could fill with the SHA1 hash code of database.xml, msg.xml (but this one could bug because
// the handshake uses it already)...
}
+
//---------------------------------------------------
// initDatabase :
//---------------------------------------------------
void CCharacter::initDatabase()
{
// Load the database, and prepare database outbox
- // _PropertyDatabase.init( CDBPlayer );
- _PropertyDatabase.init();
+// _PropertyDatabase.init( CDBPlayer );
+ _PropertyDatabase.init( );
+
// Target
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
- CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX);
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.UID, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+ CBankAccessor_PLR::getTARGET().getBARS().setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+
+
// set player max bulk
- // _PropertyDatabase.setProp( "STATIC_DATA:BAG_BULK_MAX", MaxPlayerBulk / 1000 );
- CBankAccessor_PLR::getSTATIC_DATA().setBAG_BULK_MAX(_PropertyDatabase, MaxPlayerBulk / 1000);
+// _PropertyDatabase.setProp( "STATIC_DATA:BAG_BULK_MAX", MaxPlayerBulk / 1000 );
+ CBankAccessor_PLR::getSTATIC_DATA().setBAG_BULK_MAX(_PropertyDatabase, MaxPlayerBulk / 1000 );
+
// set player room max bulk
- // _PropertyDatabase.setProp( "INVENTORY:ROOM:BULK_MAX", BasePlayerRoomBulk / 1000 );
- CBankAccessor_PLR::getINVENTORY().getROOM().setBULK_MAX(_PropertyDatabase, BasePlayerRoomBulk / 1000);
+// _PropertyDatabase.setProp( "INVENTORY:ROOM:BULK_MAX", BasePlayerRoomBulk / 1000 );
+ CBankAccessor_PLR::getINVENTORY().getROOM().setBULK_MAX(_PropertyDatabase, BasePlayerRoomBulk / 1000 );
// GROUP is empty
- for (uint i = 0; i < 8; ++i)
+ for (uint i = 0 ; i < 8 ; ++i)
{
- // _PropertyDatabase.setProp( NLMISC::toString("GROUP:%d:PRESENT",i), 0 );
- CBankAccessor_PLR::getGROUP().getArray(i).setPRESENT(_PropertyDatabase, false);
- // _PropertyDatabase.setProp( NLMISC::toString("GROUP:%d:NAME",i), 0 );
- CBankAccessor_PLR::getGROUP().getArray(i).setNAME(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( NLMISC::toString("GROUP:%d:UID",i), CLFECOMMON::INVALID_CLIENT_DATASET_INDEX
- //);
- CBankAccessor_PLR::getGROUP().getArray(i).setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX);
+// _PropertyDatabase.setProp( NLMISC::toString("GROUP:%d:PRESENT",i), 0 );
+ CBankAccessor_PLR::getGROUP().getArray(i).setPRESENT(_PropertyDatabase, false );
+// _PropertyDatabase.setProp( NLMISC::toString("GROUP:%d:NAME",i), 0 );
+ CBankAccessor_PLR::getGROUP().getArray(i).setNAME(_PropertyDatabase, 0 );
+// _PropertyDatabase.setProp( NLMISC::toString("GROUP:%d:UID",i), CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+ CBankAccessor_PLR::getGROUP().getArray(i).setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
}
// PACK_ANIMAL is empty
- for (uint i = 0; i < MAX_INVENTORY_ANIMAL; ++i)
+ for (uint i = 0 ; i < MAX_INVENTORY_ANIMAL; ++i)
{
- // _PropertyDatabase.setProp( NLMISC::toString("PACK_ANIMAL:BEAST%d:UID",i),
- // CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
- CBankAccessor_PLR::getPACK_ANIMAL().getBEAST(i).setUID(
- _PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX);
+// _PropertyDatabase.setProp( NLMISC::toString("PACK_ANIMAL:BEAST%d:UID",i), CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
+ CBankAccessor_PLR::getPACK_ANIMAL().getBEAST(i).setUID(_PropertyDatabase, CLFECOMMON::INVALID_CLIENT_DATASET_INDEX );
}
- // _PropertyDatabase.setPropButDontSend( "BUILDING_SENTENCE:COUNTER", 0 );
+// _PropertyDatabase.setPropButDontSend( "BUILDING_SENTENCE:COUNTER", 0 );
// modifiers
- for (uint i = 0; i < MaxBonusMalusDisplayed; ++i)
+ for (uint i = 0 ; i < MaxBonusMalusDisplayed ; ++i)
{
- CBankAccessor_PLR::TMODIFIERS::TMALUS::TArray &malusElem
- = CBankAccessor_PLR::getMODIFIERS().getMALUS().getArray(i);
- CBankAccessor_PLR::TMODIFIERS::TBONUS::TArray &bonusElem
- = CBankAccessor_PLR::getMODIFIERS().getBONUS().getArray(i);
- // _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Malus.Sheet[i], 0);
+ CBankAccessor_PLR::TMODIFIERS::TMALUS::TArray &malusElem = CBankAccessor_PLR::getMODIFIERS().getMALUS().getArray(i);
+ CBankAccessor_PLR::TMODIFIERS::TBONUS::TArray &bonusElem = CBankAccessor_PLR::getMODIFIERS().getBONUS().getArray(i);
+// _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Malus.Sheet[i], 0);
malusElem.setSHEET(_PropertyDatabase, CSheetId::Unknown);
- // _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Malus.Disable[i], 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Malus.Disable[i], 0);
malusElem.setDISABLED(_PropertyDatabase, false);
- // _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Malus.DisableTime[i], 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Malus.DisableTime[i], 0);
malusElem.setDISABLED_TIME(_PropertyDatabase, 0);
- // _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Bonus.Sheet[i], 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Bonus.Sheet[i], 0);
bonusElem.setSHEET(_PropertyDatabase, CSheetId::Unknown);
- // _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Bonus.Disable[i], 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Bonus.Disable[i], 0);
bonusElem.setDISABLED(_PropertyDatabase, false);
- // _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Bonus.DisableTime[i], 0);
+// _PropertyDatabase.setProp( _DataIndexReminder->Modifiers.Bonus.DisableTime[i], 0);
bonusElem.setDISABLED_TIME(_PropertyDatabase, 0);
}
- // money
- // _PropertyDatabase.setProp( "INVENTORY:MONEY", _Money );
- CBankAccessor_PLR::getINVENTORY().setMONEY(_PropertyDatabase, _Money);
- // Temporary until managed by AI
- // _PropertyDatabase.setProp( _DataIndexReminder->TARGET.CONTEXT_VAL, 0xffff );
- CBankAccessor_PLR::getTARGET().setCONTEXT_VAL(_PropertyDatabase, 0xffff);
+ //money
+// _PropertyDatabase.setProp( "INVENTORY:MONEY", _Money );
+ CBankAccessor_PLR::getINVENTORY().setMONEY( _PropertyDatabase, _Money );
+
+ //Temporary until managed by AI
+// _PropertyDatabase.setProp( _DataIndexReminder->TARGET.CONTEXT_VAL, 0xffff );
+ CBankAccessor_PLR::getTARGET().setCONTEXT_VAL(_PropertyDatabase, 0xffff );
+
// interfaces flags
- // _PropertyDatabase.setProp( "INTERFACES:FLAGS", 0);
+// _PropertyDatabase.setProp( "INTERFACES:FLAGS", 0);
CBankAccessor_PLR::getINTERFACES().setFLAGS(_PropertyDatabase, 0);
+
// combat flags
//_ForbidPowerDates.writeUsablePowerFlags(_UsablePowerFlags);
setPowerFlagDates();
@@ -4554,28 +4314,29 @@ void CCharacter::initDatabase()
updateBrickFlagsDBEntry();
// defense interface
- for (uint i = 0; i < 6; ++i)
+ for (uint i = 0 ; i < 6 ; ++i)
{
- // _PropertyDatabase.setProp( NLMISC::toString("DEFENSE:SLOTS:%d:MODIFIER",i), 0 );
- CBankAccessor_PLR::getDEFENSE().getSLOTS().getArray(i).setMODIFIER(_PropertyDatabase, 0);
+// _PropertyDatabase.setProp( NLMISC::toString("DEFENSE:SLOTS:%d:MODIFIER",i), 0 );
+ CBankAccessor_PLR::getDEFENSE().getSLOTS().getArray(i).setMODIFIER(_PropertyDatabase, 0 );
}
// init death malus
- // _PropertyDatabase.setProp( "USER:DEATH_XP_MALUS", 255 );
- CBankAccessor_PLR::getUSER().setDEATH_XP_MALUS(_PropertyDatabase, 255);
+// _PropertyDatabase.setProp( "USER:DEATH_XP_MALUS", 255 );
+ CBankAccessor_PLR::getUSER().setDEATH_XP_MALUS(_PropertyDatabase, 255 );
+
// dodge and parry levels
- // _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeBase, _BaseDodgeLevel);
+// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeBase, _BaseDodgeLevel);
CBankAccessor_PLR::getCHARACTER_INFO().getDODGE().setBase(_PropertyDatabase, checkedCast(_BaseDodgeLevel));
- // _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeCurrent, _CurrentDodgeLevel);
- CBankAccessor_PLR::getCHARACTER_INFO().getDODGE().setCurrent(
- _PropertyDatabase, checkedCast(_CurrentDodgeLevel));
- // _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.ParryBase, _BaseParryLevel);
+// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.DodgeCurrent, _CurrentDodgeLevel);
+ CBankAccessor_PLR::getCHARACTER_INFO().getDODGE().setCurrent(_PropertyDatabase, checkedCast(_CurrentDodgeLevel));
+// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.ParryBase, _BaseParryLevel);
CBankAccessor_PLR::getCHARACTER_INFO().getPARRY().setBase(_PropertyDatabase, checkedCast(_BaseParryLevel));
- // _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.ParryCurrent, _CurrentParryLevel);
- CBankAccessor_PLR::getCHARACTER_INFO().getPARRY().setCurrent(
- _PropertyDatabase, checkedCast(_CurrentParryLevel));
- // _PropertyDatabase.setProp( "USER:SPEED_FACTOR", sint64(100) );
- CBankAccessor_PLR::getUSER().setSPEED_FACTOR(_PropertyDatabase, 100);
+// _PropertyDatabase.setProp(_DataIndexReminder->CHARACTER_INFO.ParryCurrent, _CurrentParryLevel);
+ CBankAccessor_PLR::getCHARACTER_INFO().getPARRY().setCurrent(_PropertyDatabase, checkedCast(_CurrentParryLevel));
+
+// _PropertyDatabase.setProp( "USER:SPEED_FACTOR", sint64(100) );
+ CBankAccessor_PLR::getUSER().setSPEED_FACTOR(_PropertyDatabase, 100 );
+
// consumable modifiers
parrySuccessModifier(0);
dodgeSuccessModifier(0);
@@ -4583,15 +4344,15 @@ void CCharacter::initDatabase()
meleeSuccessModifier(0);
rangeSuccessModifier(0);
magicSuccessModifier(0);
- _ForageSuccessModifiers.resize(ECOSYSTEM::NUM_ECOSYSTEM);
+ _ForageSuccessModifiers.resize( ECOSYSTEM::NUM_ECOSYSTEM );
+ for(uint8 i = 0; i < (uint8)ECOSYSTEM::NUM_ECOSYSTEM; ++i )
+ forageSuccessModifier((ECOSYSTEM::EECosystem)i,0);
- for (uint8 i = 0; i < (uint8)ECOSYSTEM::NUM_ECOSYSTEM; ++i)
- forageSuccessModifier((ECOSYSTEM::EECosystem)i, 0);
-
- // _PropertyDatabase.setProp("USER:DEFAULT_WEIGHT_HANDS", DefaultWeightHands);
+// _PropertyDatabase.setProp("USER:DEFAULT_WEIGHT_HANDS", DefaultWeightHands);
CBankAccessor_PLR::getUSER().setDEFAULT_WEIGHT_HANDS(_PropertyDatabase, DefaultWeightHands);
} // initDatabase //
+
extern CBitMemStream DBOutput; // global to avoid reallocation
//---------------------------------------------------
@@ -4601,42 +4362,39 @@ extern CBitMemStream DBOutput; // global to avoid reallocation
void CCharacter::databaseUpdate()
{
// Write the inventory updates
- _InventoryUpdater.sendAllUpdates(
- _Id); // must be before the sending of _PropertyDatabase, because it tests _PropertyDatabase.notSentYet()
+ _InventoryUpdater.sendAllUpdates( _Id ); // must be before the sending of _PropertyDatabase, because it tests _PropertyDatabase.notSentYet()
// Write the character's database delta (for comment numbers, see tutorial in cdb_group.h)
- if (_PropertyDatabase.getChangedPropertyCount() != 0) // ensures writeDelta() will return true
+ if ( _PropertyDatabase.getChangedPropertyCount() != 0 ) // ensures writeDelta() will return true
{
DBOutput.resetBufPos();
bool hasContentToSend = true;
-
- if (_PropertyDatabase.notSentYet())
+ if ( _PropertyDatabase.notSentYet() )
{
// The first message has a different name, because the client must know that it's the
// first message to inhibit its oberver callbacks, although it is not garanteed that
// it's the first message to arrive on the client (see impulsion channels on the FS).
- GenericMsgManager.pushNameToStream("DB_INIT:PLR", DBOutput);
+ GenericMsgManager.pushNameToStream( "DB_INIT:PLR", DBOutput );
// write the server tick, to ensure old DB update are not applied after newer
- TGameCycle serverTick = CTickEventHandler::getGameCycle();
+ TGameCycle serverTick= CTickEventHandler::getGameCycle();
DBOutput.serial(serverTick);
// write the delta DB
- _PropertyDatabase.writeDelta(DBOutput, ~0); // no size limit for first sending
- // egs_chinfo( "Sending 1st database packet" );
+ _PropertyDatabase.writeDelta( DBOutput, ~0 ); // no size limit for first sending
+ //egs_chinfo( "Sending 1st database packet" );
}
else
{
- uint16 databaseImpulseWindowBitSize = _AvailImpulseBitsize.isReadable() ? _AvailImpulseBitsize() : 91 * 8;
+ uint16 databaseImpulseWindowBitSize = _AvailImpulseBitsize.isReadable() ? _AvailImpulseBitsize() : 91*8;
sint32 characterBankMaxBitSize = ((sint32)databaseImpulseWindowBitSize);
-
- if (characterBankMaxBitSize > 0)
+ if ( characterBankMaxBitSize > 0 )
{
// Write using bandwith limit
- GenericMsgManager.pushNameToStream("DB_UPD_PLR", DBOutput);
+ GenericMsgManager.pushNameToStream( "DB_UPD_PLR", DBOutput );
// write the server tick, to ensure old DB update are not applied after newer
- TGameCycle serverTick = CTickEventHandler::getGameCycle();
+ TGameCycle serverTick= CTickEventHandler::getGameCycle();
DBOutput.serial(serverTick);
// write the delta DB
- _PropertyDatabase.writeDelta(DBOutput, (uint32)characterBankMaxBitSize);
+ _PropertyDatabase.writeDelta( DBOutput, (uint32)characterBankMaxBitSize );
}
else
hasContentToSend = false;
@@ -4649,16 +4407,18 @@ void CCharacter::databaseUpdate()
_PropertyDatabase.writeClientonlyPropertyChanges( DBOutput );*/
// Send impulsion to front-end service
- if (hasContentToSend)
+ if ( hasContentToSend )
{
- CMessage msgout("CDB_IMPULSION");
- msgout.serial(_Id);
- msgout.serialBufferWithSize((uint8*)DBOutput.buffer(), DBOutput.length());
- CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(_Id.getDynamicId()), msgout);
+ CMessage msgout( "CDB_IMPULSION" );
+ msgout.serial( _Id );
+ msgout.serialBufferWithSize( (uint8*)DBOutput.buffer(), DBOutput.length() );
+ CUnifiedNetwork::getInstance()->send( NLNET::TServiceId(_Id.getDynamicId()), msgout );
}
}
+
} // databaseUpdate //
+
/** Fill the TCharInfo struct used to send info to SU
*/
void CCharacter::fillCharInfo(CHARSYNC::TCharInfo &charInfo) const
@@ -4680,28 +4440,28 @@ void CCharacter::fillCharInfo(CHARSYNC::TCharInfo &charInfo) const
//---------------------------------------------------
// setId :
//---------------------------------------------------
-void CCharacter::setId(const CEntityId &id)
+void CCharacter::setId( const CEntityId& id )
{
_Id = id;
+
// set the Team
- // const uint16 teamId = (uint16) _UserId / 10;
- // TeamManager.addCharacterToTeam( this, teamId );
+ //const uint16 teamId = (uint16) _UserId / 10;
+ //TeamManager.addCharacterToTeam( this, teamId );
} // setId //
+
void CCharacter::setName(const ucstring &name)
{
// update only if different
- if (_Name != name)
+ if(_Name!=name)
{
CEntityBase::setName(name);
- // update the eid translator
- CPlayer* player = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
- if (player)
+ // update the eid translator
+ CPlayer * player = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
+ if(player)
{
- CEntityIdTranslator::getInstance()->updateEntity(getId(), capitalize(getName().toUtf8()),
- sint8(PlayerManager.getCharIndex(getId())), PlayerManager.getPlayerId(getId()), player->getUserName(),
- getHomeMainlandSessionId().asInt());
+ CEntityIdTranslator::getInstance()->updateEntity( getId(), capitalize( getName().toUtf8() ), sint8(PlayerManager.getCharIndex(getId())), PlayerManager.getPlayerId(getId()), player->getUserName(), getHomeMainlandSessionId().asInt() );
ICharNameMapperClient::getInstance()->mapCharacterName(getId(), getName());
}
}
@@ -4710,331 +4470,290 @@ void CCharacter::setName(const ucstring &name)
//-----------------------------------------------
// CCharacter::haveBrick check if player have the brick
//-----------------------------------------------
-bool CCharacter::haveBrick(const CSheetId &brickId)
+bool CCharacter::haveBrick( const CSheetId& brickId )
{
- const CStaticBrick* brickForm = CSheets::getSBrickForm(brickId);
-
- if (brickForm)
+ const CStaticBrick* brickForm = CSheets::getSBrickForm( brickId );
+ if( brickForm )
{
// if brick already known, just return
- if (_KnownBricks.find(brickId) != _KnownBricks.end())
+ if ( _KnownBricks.find( brickId ) != _KnownBricks.end())
return true;
}
-
return false;
}
//-----------------------------------------------
// CCharacter::addKnownBrick add a know brick
//-----------------------------------------------
-void CCharacter::addKnownBrick(const CSheetId &brickId)
+void CCharacter::addKnownBrick( const CSheetId& brickId )
{
- // egs_chinfo(" adding new known brick idSheet (%s)", brickId.toString().c_str() );
- const CStaticBrick* brickForm = CSheets::getSBrickForm(brickId);
-
- if (brickForm)
+// egs_chinfo(" adding new known brick idSheet (%s)", brickId.toString().c_str() );
+ const CStaticBrick* brickForm = CSheets::getSBrickForm( brickId );
+ if( brickForm )
{
// if brick already known, just return
- if (_KnownBricks.find(brickId) != _KnownBricks.end())
+ if ( _KnownBricks.find( brickId ) != _KnownBricks.end())
return;
log_Character_AddKnownBrick(brickId);
- _KnownBricks.insert(brickId);
+ _KnownBricks.insert( brickId );
// if the brick is a training brick, then apply charac increase
- if (BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
+ if ( BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
{
processTrainingBrick(brickForm);
}
// if the brick is a bonus that needs to be taken into account now, do it
- switch (brickForm->Family)
+ switch ( brickForm->Family )
{
case BRICK_FAMILIES::BPBHFEA:
processForageBonusBrick(brickForm);
break;
-
case BRICK_FAMILIES::BPBGLA:
processMiscBonusBrick(brickForm);
break;
-
- default:
- ;
+ default:;
}
// update the database
uint8 pos = (uint8)brickForm->IndexInFamily;
-
- if (INVALID_POSITION_ID < pos)
+ if ( INVALID_POSITION_ID < pos)
{
--pos;
}
- else if (INVALID_POSITION_ID == pos)
+ else if ( INVALID_POSITION_ID == pos)
{
nlwarning("brick id %s is invalid (index in family == INVALID_POSITION_ID", brickId.toString().c_str());
return;
}
- _BrickFamilyBitField[brickForm->Family] |= ((sint64)1 << (sint64)pos);
- // _PropertyDatabase.setProp( _DataIndexReminder->KnownBricksFamilies[brickForm->Family],
- //_BrickFamilyBitField[brickForm->Family]);
- CBankAccessor_PLR::getBRICK_FAMILY()
- .getArray(brickForm->Family)
- .setBRICKS(_PropertyDatabase, _BrickFamilyBitField[brickForm->Family]);
+ _BrickFamilyBitField[brickForm->Family] |= ( (sint64)1 << (sint64)pos);
+// _PropertyDatabase.setProp( _DataIndexReminder->KnownBricksFamilies[brickForm->Family], _BrickFamilyBitField[brickForm->Family]);
+ CBankAccessor_PLR::getBRICK_FAMILY().getArray(brickForm->Family).setBRICKS(_PropertyDatabase, _BrickFamilyBitField[brickForm->Family]);
+
// unlock the relative interface if it's the first brick of this type
INTERFACE_FLAGS::TInterfaceFlag flag = INTERFACE_FLAGS::Unknown;
-
- switch (BRICK_FAMILIES::brickType(brickForm->Family))
+ switch( BRICK_FAMILIES::brickType(brickForm->Family))
{
case BRICK_TYPE::COMBAT:
flag = INTERFACE_FLAGS::Combat;
break;
-
case BRICK_TYPE::MAGIC:
flag = INTERFACE_FLAGS::Magic;
break;
-
case BRICK_TYPE::COMMERCE:
flag = INTERFACE_FLAGS::Commerce;
break;
-
default:
flag = INTERFACE_FLAGS::Special;
break;
};
_InterfacesFlagsBitField |= SINT64_CONSTANT(1) << uint8(flag);
-
- // _PropertyDatabase.setProp( "INTERFACES:FLAGS", _InterfacesFlagsBitField);
+// _PropertyDatabase.setProp( "INTERFACES:FLAGS", _InterfacesFlagsBitField);
CBankAccessor_PLR::getINTERFACES().setFLAGS(_PropertyDatabase, _InterfacesFlagsBitField);
}
else
{
- nlwarning(" Can't add new known brick cause static form of idSheet (%s) missing",
- brickId.toString().c_str());
+ nlwarning(" Can't add new known brick cause static form of idSheet (%s) missing", brickId.toString().c_str() );
}
-} // addKnownBrick//
+} //addKnownBrick//
//-----------------------------------------------
// CCharacter::addKnownBrickBonus add a know brick bonus
//-----------------------------------------------
-void CCharacter::addKnownBrickBonus(const CSheetId &brickId)
+void CCharacter::addKnownBrickBonus( const CSheetId& brickId )
{
- // egs_chinfo(" adding new known brick idSheet (%s)", brickId.toString().c_str() );
- const CStaticBrick* brickForm = CSheets::getSBrickForm(brickId);
-
- if (brickForm)
+// egs_chinfo(" adding new known brick idSheet (%s)", brickId.toString().c_str() );
+ const CStaticBrick* brickForm = CSheets::getSBrickForm( brickId );
+ if( brickForm )
{
+
// if the brick is a training brick, then apply charac increase
- if (BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
+ if ( BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
{
processTrainingBrick(brickForm);
}
// if the brick is a bonus that needs to be taken into account now, do it
- switch (brickForm->Family)
+ switch ( brickForm->Family )
{
case BRICK_FAMILIES::BPBHFEA:
processForageBonusBrick(brickForm);
break;
-
case BRICK_FAMILIES::BPBGLA:
processMiscBonusBrick(brickForm);
break;
-
- default:
- ;
+ default:;
}
}
-} // addKnownBrickBonus//
+
+} //addKnownBrickBonus//
//-----------------------------------------------
// CCharacter::removeKnownBrick remove a known brick
//-----------------------------------------------
-void CCharacter::removeKnownBrick(const CSheetId &brickId)
+void CCharacter::removeKnownBrick( const CSheetId& brickId )
{
- // egs_chinfo(" removing a known brick idSheet (%s)", brickId.toString().c_str() );
- const CStaticBrick* brickForm = CSheets::getSBrickForm(brickId);
-
- if (brickForm)
+// egs_chinfo(" removing a known brick idSheet (%s)", brickId.toString().c_str() );
+ const CStaticBrick* brickForm = CSheets::getSBrickForm( brickId );
+ if( brickForm )
{
// if brick is not known, just return
- if (_KnownBricks.find(brickId) == _KnownBricks.end())
+ if ( _KnownBricks.find( brickId ) == _KnownBricks.end())
return;
log_Character_RemoveKnownBrick(brickId);
- _KnownBricks.erase(brickId);
+ _KnownBricks.erase( brickId );
// if the brick is a training brick, then apply charac increase
- if (BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
+ if ( BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
{
unprocessTrainingBrick(brickForm, true);
}
// if the brick is a bonus that needs to be taken into account now, do it
- switch (brickForm->Family)
+ switch ( brickForm->Family )
{
case BRICK_FAMILIES::BPBHFEA:
unprocessForageBonusBrick(brickForm);
break;
-
case BRICK_FAMILIES::BPBGLA:
unprocessMiscBonusBrick(brickForm);
break;
-
- default:
- ;
+ default:;
}
// update the database
uint8 pos = (uint8)brickForm->IndexInFamily;
-
- if (INVALID_POSITION_ID < pos)
+ if ( INVALID_POSITION_ID < pos)
{
--pos;
}
- else if (INVALID_POSITION_ID == pos)
+ else if ( INVALID_POSITION_ID == pos)
{
nlwarning("brick id %s is invalid (index in family == INVALID_POSITION_ID", brickId.toString().c_str());
return;
}
- _BrickFamilyBitField[brickForm->Family] |= ((sint64)1 << (sint64)pos);
- // _PropertyDatabase.setProp( _DataIndexReminder->KnownBricksFamilies[brickForm->Family],
- //_BrickFamilyBitField[brickForm->Family]);
- CBankAccessor_PLR::getBRICK_FAMILY()
- .getArray(brickForm->Family)
- .setBRICKS(_PropertyDatabase, _BrickFamilyBitField[brickForm->Family]);
+ _BrickFamilyBitField[brickForm->Family] |= ( (sint64)1 << (sint64)pos);
+// _PropertyDatabase.setProp( _DataIndexReminder->KnownBricksFamilies[brickForm->Family], _BrickFamilyBitField[brickForm->Family]);
+ CBankAccessor_PLR::getBRICK_FAMILY().getArray(brickForm->Family).setBRICKS(_PropertyDatabase, _BrickFamilyBitField[brickForm->Family]);
+
// unlock the relative interface if it's the first brick of this type
INTERFACE_FLAGS::TInterfaceFlag flag = INTERFACE_FLAGS::Unknown;
-
- switch (BRICK_FAMILIES::brickType(brickForm->Family))
+ switch( BRICK_FAMILIES::brickType(brickForm->Family))
{
case BRICK_TYPE::COMBAT:
flag = INTERFACE_FLAGS::Combat;
break;
-
case BRICK_TYPE::MAGIC:
flag = INTERFACE_FLAGS::Magic;
break;
-
case BRICK_TYPE::COMMERCE:
flag = INTERFACE_FLAGS::Commerce;
break;
-
default:
flag = INTERFACE_FLAGS::Special;
break;
};
_InterfacesFlagsBitField |= SINT64_CONSTANT(1) << uint8(flag);
-
- // _PropertyDatabase.setProp( "INTERFACES:FLAGS", _InterfacesFlagsBitField);
+// _PropertyDatabase.setProp( "INTERFACES:FLAGS", _InterfacesFlagsBitField);
CBankAccessor_PLR::getINTERFACES().setFLAGS(_PropertyDatabase, _InterfacesFlagsBitField);
}
else
{
- nlwarning(" Can't remove known brick cause static form of idSheet (%s) missing",
- brickId.toString().c_str());
+ nlwarning(" Can't remove known brick cause static form of idSheet (%s) missing", brickId.toString().c_str() );
}
-} // removeKnownBrick//
+} //removeKnownBrick//
//-----------------------------------------------
// CCharacter::removeKnownBrickBonus remove a known brick bonus
//-----------------------------------------------
-void CCharacter::removeKnownBrickBonus(const CSheetId &brickId)
+void CCharacter::removeKnownBrickBonus( const CSheetId& brickId )
{
- // egs_chinfo(" removing a known brick idSheet (%s)", brickId.toString().c_str()
- //);
- const CStaticBrick* brickForm = CSheets::getSBrickForm(brickId);
-
- if (brickForm)
+// egs_chinfo(" removing a known brick idSheet (%s)", brickId.toString().c_str() );
+ const CStaticBrick* brickForm = CSheets::getSBrickForm( brickId );
+ if( brickForm )
{
+
// if the brick is a training brick, then apply charac increase
- if (BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
+ if ( BRICK_FAMILIES::brickType(brickForm->Family) == BRICK_TYPE::TRAINING)
{
unprocessTrainingBrick(brickForm, true);
}
// if the brick is a bonus that needs to be taken into account now, do it
- switch (brickForm->Family)
+ switch ( brickForm->Family )
{
case BRICK_FAMILIES::BPBHFEA:
unprocessForageBonusBrick(brickForm);
break;
-
case BRICK_FAMILIES::BPBGLA:
unprocessMiscBonusBrick(brickForm);
break;
-
- default:
- ;
+ default:;
}
}
-} // removeKnownBrickBonus//
+
+} //removeKnownBrickBonus//
//-----------------------------------------------
// CCharacter::processTrainingBrick
//-----------------------------------------------
-void CCharacter::processTrainingBrick(const CStaticBrick* brick, bool sendChatMessage)
+void CCharacter::processTrainingBrick( const CStaticBrick *brick, bool sendChatMessage )
{
if (!brick)
return;
const uint nbParams = (uint)brick->Params.size();
-
- for (uint i = 0; i < nbParams; ++i)
+ for ( uint i = 0 ; i < nbParams ; ++i )
{
const TBrickParam::IId* param = brick->Params[i];
-
- switch (param->id())
- {
- case TBrickParam::CHARAC_UPGRADE:
+ switch(param->id())
{
- CHARACTERISTICS::TCharacteristics charac
- = CHARACTERISTICS::toCharacteristic((((CSBrickParamCharacUpgrade*)param)->Characteristic));
-
- if (charac == CHARACTERISTICS::Unknown)
- {
- nlwarning("Training brick %s has bad charc parameter %s", brick->SheetId.toString().c_str(),
- ((CSBrickParamCharacUpgrade*)param)->Characteristic.c_str());
- }
- else
+ case TBrickParam::CHARAC_UPGRADE:
{
- const sint16 modifier = (sint16)((CSBrickParamCharacUpgrade*)param)->Modifier;
- changeCharacteristic(charac, modifier);
-
- if (sendChatMessage)
+ CHARACTERISTICS::TCharacteristics charac = CHARACTERISTICS::toCharacteristic((((CSBrickParamCharacUpgrade *)param)->Characteristic));
+ if (charac == CHARACTERISTICS::Unknown)
+ {
+ nlwarning("Training brick %s has bad charc parameter %s", brick->SheetId.toString().c_str(), ((CSBrickParamCharacUpgrade *)param)->Characteristic.c_str());
+ }
+ else
{
- SM_STATIC_PARAMS_3(
- params, STRING_MANAGER::characteristic, STRING_MANAGER::integer, STRING_MANAGER::integer);
- params[0].Enum = charac;
- params[1].Int = _PhysCharacs._PhysicalCharacteristics[charac].Base;
- params[2].Int = brick->SkillPointPrice;
- PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "PHRASE_CHARAC_BUY", params);
+ const sint16 modifier = (sint16) ((CSBrickParamCharacUpgrade *)param)->Modifier;
+ changeCharacteristic(charac, modifier);
+
+ if (sendChatMessage)
+ {
+ SM_STATIC_PARAMS_3(params, STRING_MANAGER::characteristic, STRING_MANAGER::integer, STRING_MANAGER::integer);
+ params[0].Enum = charac;
+ params[1].Int = _PhysCharacs._PhysicalCharacteristics[charac].Base;
+ params[2].Int = brick->SkillPointPrice;
+ PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "PHRASE_CHARAC_BUY", params);
+ }
}
}
- }
- break;
+ break;
case TBrickParam::SCORE_UPGRADE:
- {
- const SCORES::TScores score = SCORES::toScore((((CSBrickParamScoreUpgrade*)param)->Score));
-
- if (score < 0 || score >= SCORES::NUM_SCORES)
{
- nlwarning("Training brick %s has bad score parameter %s", brick->SheetId.toString().c_str(),
- ((CSBrickParamScoreUpgrade*)param)->Score.c_str());
- }
- else
- {
- const sint32 modifier = ((CSBrickParamScoreUpgrade*)param)->Modifier;
- // change Score
- _ScorePermanentModifiers[score] += modifier;
- _PhysScores._PhysicalScores[score].Base += modifier;
+ const SCORES::TScores score = SCORES::toScore((((CSBrickParamScoreUpgrade *)param)->Score));
+ if ( score < 0 || score >= SCORES::NUM_SCORES)
+ {
+ nlwarning("Training brick %s has bad score parameter %s", brick->SheetId.toString().c_str(), ((CSBrickParamScoreUpgrade *)param)->Score.c_str());
+ }
+ else
+ {
+ const sint32 modifier = ((CSBrickParamScoreUpgrade *)param)->Modifier;
+ // change Score
+ _ScorePermanentModifiers[score] += modifier;
+ _PhysScores._PhysicalScores[ score ].Base += modifier;
+ }
}
- }
- break;
+ break;
default:
;
@@ -5042,68 +4761,61 @@ void CCharacter::processTrainingBrick(const CStaticBrick* brick, bool sendChatMe
}
}
+
//-----------------------------------------------
// CCharacter::processTrainingBrick
//-----------------------------------------------
-void CCharacter::unprocessTrainingBrick(const CStaticBrick* brick, bool sendChatMessage)
+void CCharacter::unprocessTrainingBrick( const CStaticBrick *brick, bool sendChatMessage )
{
if (!brick)
return;
const uint nbParams = (uint)brick->Params.size();
-
- for (uint i = 0; i < nbParams; ++i)
+ for ( uint i = 0 ; i < nbParams ; ++i )
{
- const TBrickParam::IId* param = brick->Params[i];
-
- switch (param->id())
- {
- case TBrickParam::CHARAC_UPGRADE:
+ const TBrickParam::IId* param = brick->Params[i];
+ switch(param->id())
{
- CHARACTERISTICS::TCharacteristics charac
- = CHARACTERISTICS::toCharacteristic((((CSBrickParamCharacUpgrade*)param)->Characteristic));
-
- if (charac == CHARACTERISTICS::Unknown)
- {
- nlwarning("Training brick %s has bad charc parameter %s", brick->SheetId.toString().c_str(),
- ((CSBrickParamCharacUpgrade*)param)->Characteristic.c_str());
- }
- else
+ case TBrickParam::CHARAC_UPGRADE:
{
- const sint16 modifier = (sint16)((CSBrickParamCharacUpgrade*)param)->Modifier;
- changeCharacteristic(charac, -modifier);
-
- if (sendChatMessage)
+ CHARACTERISTICS::TCharacteristics charac = CHARACTERISTICS::toCharacteristic((((CSBrickParamCharacUpgrade *)param)->Characteristic));
+ if (charac == CHARACTERISTICS::Unknown)
+ {
+ nlwarning("Training brick %s has bad charc parameter %s", brick->SheetId.toString().c_str(), ((CSBrickParamCharacUpgrade *)param)->Characteristic.c_str());
+ }
+ else
{
- SM_STATIC_PARAMS_3(
- params, STRING_MANAGER::characteristic, STRING_MANAGER::integer, STRING_MANAGER::integer);
- params[0].Enum = charac;
- params[1].Int = _PhysCharacs._PhysicalCharacteristics[charac].Base;
- params[2].Int = brick->SkillPointPrice;
- PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "PHRASE_CHARAC_BUY", params);
+ const sint16 modifier = (sint16) ((CSBrickParamCharacUpgrade *)param)->Modifier;
+ changeCharacteristic(charac, -modifier);
+
+ if (sendChatMessage)
+ {
+ SM_STATIC_PARAMS_3(params, STRING_MANAGER::characteristic, STRING_MANAGER::integer, STRING_MANAGER::integer);
+ params[0].Enum = charac;
+ params[1].Int = _PhysCharacs._PhysicalCharacteristics[charac].Base;
+ params[2].Int = brick->SkillPointPrice;
+ PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "PHRASE_CHARAC_BUY", params);
+ }
}
}
- }
- break;
+ break;
case TBrickParam::SCORE_UPGRADE:
- {
- const SCORES::TScores score = SCORES::toScore((((CSBrickParamScoreUpgrade*)param)->Score));
-
- if (score < 0 || score >= SCORES::NUM_SCORES)
- {
- nlwarning("Training brick %s has bad score parameter %s", brick->SheetId.toString().c_str(),
- ((CSBrickParamScoreUpgrade*)param)->Score.c_str());
- }
- else
{
- const sint32 modifier = ((CSBrickParamScoreUpgrade*)param)->Modifier;
- // change Score
- _ScorePermanentModifiers[score] -= modifier;
- _PhysScores._PhysicalScores[score].Base -= modifier;
+ const SCORES::TScores score = SCORES::toScore((((CSBrickParamScoreUpgrade *)param)->Score));
+ if ( score < 0 || score >= SCORES::NUM_SCORES)
+ {
+ nlwarning("Training brick %s has bad score parameter %s", brick->SheetId.toString().c_str(), ((CSBrickParamScoreUpgrade *)param)->Score.c_str());
+ }
+ else
+ {
+ const sint32 modifier = ((CSBrickParamScoreUpgrade *)param)->Modifier;
+ // change Score
+ _ScorePermanentModifiers[score] -= modifier;
+ _PhysScores._PhysicalScores[ score ].Base -= modifier;
+ }
}
- }
- break;
+ break;
default:
;
@@ -5111,56 +4823,56 @@ void CCharacter::unprocessTrainingBrick(const CStaticBrick* brick, bool sendChat
}
}
+
//-----------------------------------------------
// Return the values of properties of the known bricks of the specified family (useful for bonus values)
//-----------------------------------------------
-void CCharacter::getPropertiesFromKnownBricks(BRICK_FAMILIES::TBrickFamily brickFamily, CBrickProperties &results)
+void CCharacter::getPropertiesFromKnownBricks(
+ BRICK_FAMILIES::TBrickFamily brickFamily,
+ CBrickProperties& results )
{
results.clear();
+
// Browse the known bricks
- const std::set &knownBricks = getKnownBricks();
+ const std::set& knownBricks = getKnownBricks();
std::set::const_iterator it, end = knownBricks.end();
-
- for (it = knownBricks.begin(); it != end; ++it)
+ for ( it=knownBricks.begin(); it!=end; ++it )
{
- const NLMISC::CSheetId &brickSheetId = *it;
- const CStaticBrick* brick = CSheets::getSBrickForm(brickSheetId);
-
- if (brick)
+ const NLMISC::CSheetId& brickSheetId = *it;
+ const CStaticBrick* brick = CSheets::getSBrickForm( brickSheetId );
+ if ( brick )
{
- if (brick->Family == brickFamily)
+ if ( brick->Family == brickFamily )
{
// Browse the params of the brick matching the family
- for (std::vector::const_iterator ip = brick->Params.begin();
- ip != brick->Params.end(); ++ip)
+ for ( std::vector::const_iterator ip=brick->Params.begin(); ip!=brick->Params.end(); ++ip )
{
TBrickParam::IIdPtr param = (*ip);
+
// Add the value by property
- results[param->id()].push_back(param);
+ results[ param->id() ].push_back( param );
}
}
}
}
}
+
//-----------------------------------------------
// fillFaberMaterialArray
//-----------------------------------------------
-bool CCharacter::fillFaberMaterialArray(vector &materialsSelectedForFaber,
- vector &materials, uint16 &lowerMaterialQuality)
+bool CCharacter::fillFaberMaterialArray( vector& materialsSelectedForFaber, vector< const CStaticItem * >& materials, uint16& lowerMaterialQuality )
{
bool ok = true;
lowerMaterialQuality = USHRT_MAX;
-
- for (uint s = 0; s < materialsSelectedForFaber.size(); ++s)
+ for( uint s = 0; s < materialsSelectedForFaber.size(); ++s )
{
bool bOk = false;
CInventoryPtr pInv = NULL;
-
- if (materialsSelectedForFaber[s].getInvId() >= INVENTORIES::NUM_INVENTORY)
+ if( materialsSelectedForFaber[ s ].getInvId() >= INVENTORIES::NUM_INVENTORY )
{
// Also allow crafting from player's room
- if (materialsSelectedForFaber[s].getInvId() == INVENTORIES::player_room)
+ if (materialsSelectedForFaber[ s ].getInvId() == INVENTORIES::player_room)
{
if (getRoomInterface().isValid() && getRoomInterface().canUseInventory(this, this))
{
@@ -5169,110 +4881,96 @@ bool CCharacter::fillFaberMaterialArray(vector &materialsSelected
}
}
- if (!bOk)
+ if ( ! bOk)
{
- nlwarning(" CFaberMsgItem[%d] sended by client contains an invalid "
- "inventory index %d",
- s, materialsSelectedForFaber[s].getInvId());
+ nlwarning(" CFaberMsgItem[%d] sended by client contains an invalid inventory index %d", s, materialsSelectedForFaber[ s ].getInvId() );
return false;
}
}
else
{
- pInv = _Inventory[materialsSelectedForFaber[s].getInvId()];
+ pInv = _Inventory[ materialsSelectedForFaber[ s ].getInvId() ];
}
- if (materialsSelectedForFaber[s].IndexInInv >= pInv->getSlotCount())
+ if( materialsSelectedForFaber[ s ].IndexInInv >= pInv->getSlotCount() )
{
- nlwarning(" CFaberMsgItem[%d] sended by client contains an invalid "
- "index %d for inventory %d",
- s, materialsSelectedForFaber[s].IndexInInv, materialsSelectedForFaber[s].getInvId());
+ nlwarning(" CFaberMsgItem[%d] sended by client contains an invalid index %d for inventory %d", s, materialsSelectedForFaber[ s ].IndexInInv, materialsSelectedForFaber[ s ].getInvId() );
return false;
}
- uint quantityLeft = materialsSelectedForFaber[s].Quantity;
-
- for (uint i = 0; i < quantityLeft; ++i)
+ uint quantityLeft = materialsSelectedForFaber[ s ].Quantity;
+ for( uint i = 0; i < quantityLeft; ++i )
{
- CGameItemPtr material = pInv->getItem(materialsSelectedForFaber[s].IndexInInv);
-
+ CGameItemPtr material = pInv->getItem( materialsSelectedForFaber[ s ].IndexInInv );
if (material != 0)
{
- if (quantityLeft > material->getStackSize())
+ if( quantityLeft > material->getStackSize() )
{
- nlwarning(" CFaberMsgItem[%d] sended by client contains an "
- "invalid quantity %d asked because stack is smaller (size = %d)",
- s, materialsSelectedForFaber[s].Quantity,
- pInv->getItem(materialsSelectedForFaber[s].IndexInInv)->getStackSize());
+ nlwarning(" CFaberMsgItem[%d] sended by client contains an invalid quantity %d asked because stack is smaller (size = %d)", s, materialsSelectedForFaber[ s ].Quantity, pInv->getItem( materialsSelectedForFaber[ s ].IndexInInv )->getStackSize() );
return false;
}
}
- if (material != 0)
+ if( material != 0 )
{
- const CStaticItem* si = CSheets::getForm(material->getSheetId());
-
- if (si)
+ const CStaticItem * si = CSheets::getForm( material->getSheetId() );
+ if( si )
{
- if (si->Family == ITEMFAMILY::RAW_MATERIAL)
+ if( si->Family == ITEMFAMILY::RAW_MATERIAL )
{
- if (material->quality() < lowerMaterialQuality)
- lowerMaterialQuality = material->quality();
-
- materials.push_back(si);
+ if( material->quality() < lowerMaterialQuality ) lowerMaterialQuality = material->quality();
+ materials.push_back( si );
}
else
{
- nlwarning(" Static Form %s is a item of family %s, we must "
- "have RAW_MATERIAL item",
- material->getSheetId().toString().c_str(), ITEMFAMILY::toString(si->Family).c_str());
+ nlwarning(" Static Form %s is a item of family %s, we must have RAW_MATERIAL item", material->getSheetId().toString().c_str(), ITEMFAMILY::toString(si->Family).c_str() );
ok = false;
}
}
else
{
- nlwarning(" Static Form %s not found for raw material select "
- "index %d",
- material->getSheetId().toString().c_str(), i);
+ nlwarning(" Static Form %s not found for raw material select index %d", material->getSheetId().toString().c_str(), i );
ok = false;
}
}
else
{
- nlwarning(" Bag or stack contains no item in bag for slot %d, "
- "inventory %d",
- materialsSelectedForFaber[s].IndexInInv, materialsSelectedForFaber[s].getInvId());
+ nlwarning(" Bag or stack contains no item in bag for slot %d, inventory %d", materialsSelectedForFaber[ s ].IndexInInv, materialsSelectedForFaber[ s ].getInvId() );
ok = false;
}
}
}
-
return ok;
+
} // fillFaberMaterialArray //
+
+
//-----------------------------------------------
// CCharacter::getFillFaberRms: fill vector of const GameItem pointer with Raw material used for faber
//-----------------------------------------------
-bool CCharacter::getFillFaberRms(
- std::vector &rms, std::vector &rmsFormula, uint16 &lowerQuality)
+bool CCharacter::getFillFaberRms( std::vector< const CStaticItem * >& rms, std::vector< const CStaticItem * >& rmsFormula, uint16& lowerQuality )
{
//_TempInventoryMode = TEMP_INV_MODE::None;
leaveTempInventoryMode();
+
uint16 lowerRmQuality;
uint16 lowerRmFormulaQuality;
- if (fillFaberMaterialArray(_RmSelectedForFaber, rms, lowerRmQuality)
- && fillFaberMaterialArray(_RmFormulaSelectedForFaber, rmsFormula, lowerRmFormulaQuality))
+ if( fillFaberMaterialArray(_RmSelectedForFaber, rms, lowerRmQuality) &&
+ fillFaberMaterialArray(_RmFormulaSelectedForFaber, rmsFormula, lowerRmFormulaQuality) )
{
- lowerQuality = (lowerRmQuality < lowerRmFormulaQuality) ? lowerRmQuality : lowerRmFormulaQuality;
+ lowerQuality = ( lowerRmQuality < lowerRmFormulaQuality) ? lowerRmQuality : lowerRmFormulaQuality;
return true;
}
else
{
return false;
}
+
} // getFillFaberRms //
+
//-----------------------------------------------
// CCharacter::lockFaberRms: lock Faber raw material, return true if lock success
//-----------------------------------------------
@@ -5280,22 +4978,18 @@ bool CCharacter::lockFaberRms()
{
uint size = (uint)_RmSelectedForFaber.size();
- for (uint i = 0; i < size; ++i)
+ for( uint i = 0; i < size; ++i )
{
- if ((INVENTORIES::TInventory)_RmSelectedForFaber[i].getInvId() >= INVENTORIES::pet_animal
- && (INVENTORIES::TInventory)_RmSelectedForFaber[i].getInvId() < INVENTORIES::max_pet_animal)
+ if( (INVENTORIES::TInventory)_RmSelectedForFaber[ i ].getInvId() >= INVENTORIES::pet_animal && (INVENTORIES::TInventory)_RmSelectedForFaber[ i ].getInvId() < INVENTORIES::max_pet_animal )
{
- uint32 beastindex = _RmSelectedForFaber[i].getInvId() - INVENTORIES::pet_animal;
-
- if ((_PlayerPets[beastindex].AnimalStatus & ANIMAL_STATUS::InventoryAvailableFlag) == 0)
+ uint32 beastindex = _RmSelectedForFaber[ i ].getInvId() - INVENTORIES::pet_animal;
+ if( (_PlayerPets[ beastindex ].AnimalStatus & ANIMAL_STATUS::InventoryAvailableFlag) == 0 )
{
return false;
}
}
- if (lockItem((INVENTORIES::TInventory)_RmSelectedForFaber[i].getInvId(), _RmSelectedForFaber[i].IndexInInv,
- _RmSelectedForFaber[i].Quantity)
- == false)
+ if( lockItem( (INVENTORIES::TInventory)_RmSelectedForFaber[ i ].getInvId(), _RmSelectedForFaber[ i ].IndexInInv, _RmSelectedForFaber[ i ].Quantity ) == false )
{
return false;
}
@@ -5303,22 +4997,18 @@ bool CCharacter::lockFaberRms()
size = (uint)_RmFormulaSelectedForFaber.size();
- for (uint i = 0; i < size; ++i)
+ for( uint i = 0; i < size; ++i )
{
- if ((INVENTORIES::TInventory)_RmFormulaSelectedForFaber[i].getInvId() >= INVENTORIES::pet_animal
- && (INVENTORIES::TInventory)_RmFormulaSelectedForFaber[i].getInvId() < INVENTORIES::max_pet_animal)
+ if( (INVENTORIES::TInventory)_RmFormulaSelectedForFaber[ i ].getInvId() >= INVENTORIES::pet_animal && (INVENTORIES::TInventory)_RmFormulaSelectedForFaber[ i ].getInvId() < INVENTORIES::max_pet_animal )
{
- uint32 beastindex = _RmFormulaSelectedForFaber[i].getInvId() - INVENTORIES::pet_animal;
-
- if ((_PlayerPets[beastindex].AnimalStatus & ANIMAL_STATUS::InventoryAvailableFlag) == 0)
+ uint32 beastindex = _RmFormulaSelectedForFaber[ i ].getInvId() - INVENTORIES::pet_animal;
+ if( (_PlayerPets[ beastindex ].AnimalStatus & ANIMAL_STATUS::InventoryAvailableFlag) == 0 )
{
return false;
}
}
- if (lockItem((INVENTORIES::TInventory)_RmFormulaSelectedForFaber[i].getInvId(),
- _RmFormulaSelectedForFaber[i].IndexInInv, _RmFormulaSelectedForFaber[i].Quantity)
- == false)
+ if( lockItem( (INVENTORIES::TInventory)_RmFormulaSelectedForFaber[ i ].getInvId(), _RmFormulaSelectedForFaber[ i ].IndexInInv, _RmFormulaSelectedForFaber[ i ].Quantity ) == false )
{
return false;
}
@@ -5327,6 +5017,7 @@ bool CCharacter::lockFaberRms()
return true;
}
+
//-----------------------------------------------
// CCharacter::unlockFaberRms: unlock Faber raw material
//-----------------------------------------------
@@ -5334,21 +5025,20 @@ void CCharacter::unlockFaberRms()
{
uint size = (uint)_RmSelectedForFaber.size();
- for (uint i = 0; i < size; ++i)
+ for( uint i = 0; i < size; ++i )
{
- unLockItem((INVENTORIES::TInventory)_RmSelectedForFaber[i].getInvId(), _RmSelectedForFaber[i].IndexInInv,
- _RmSelectedForFaber[i].Quantity);
+ unLockItem( (INVENTORIES::TInventory)_RmSelectedForFaber[ i ].getInvId(), _RmSelectedForFaber[ i ].IndexInInv, _RmSelectedForFaber[ i ].Quantity );
}
size = (uint)_RmFormulaSelectedForFaber.size();
- for (uint i = 0; i < size; ++i)
+ for( uint i = 0; i < size; ++i )
{
- unLockItem((INVENTORIES::TInventory)_RmFormulaSelectedForFaber[i].getInvId(),
- _RmFormulaSelectedForFaber[i].IndexInInv, _RmFormulaSelectedForFaber[i].Quantity);
+ unLockItem( (INVENTORIES::TInventory)_RmFormulaSelectedForFaber[ i ].getInvId(), _RmFormulaSelectedForFaber[ i ].IndexInInv, _RmFormulaSelectedForFaber[ i ].Quantity );
}
}
+
//-----------------------------------------------
// CCharacter::consumeFaberRms: consume Faber raw material
//-----------------------------------------------
@@ -5358,178 +5048,153 @@ void CCharacter::consumeFaberRms(bool failed)
unlockFaberRms();
uint size = (uint)_RmSelectedForFaber.size();
- for (uint i = 0; i < size; ++i)
+ for( uint i = 0; i < size; ++i )
{
- if (failed == false || uint32((RandomGenerator.rand(99) + 1)) <= CraftFailureProbaMpLost)
- destroyItem(
- _RmSelectedForFaber[i].getInvId(), _RmSelectedForFaber[i].IndexInInv, _RmSelectedForFaber[i].Quantity);
+ if( failed == false || uint32((RandomGenerator.rand(99)+1)) <= CraftFailureProbaMpLost)
+ destroyItem( _RmSelectedForFaber[ i ].getInvId(), _RmSelectedForFaber[ i ].IndexInInv, _RmSelectedForFaber[ i ].Quantity );
}
size = (uint)_RmFormulaSelectedForFaber.size();
- for (uint i = 0; i < size; ++i)
+ for( uint i = 0; i < size; ++i )
{
- if (failed == false || uint32((RandomGenerator.rand(99) + 1)) <= CraftFailureProbaMpLost)
- destroyItem(_RmFormulaSelectedForFaber[i].getInvId(), _RmFormulaSelectedForFaber[i].IndexInInv,
- _RmFormulaSelectedForFaber[i].Quantity);
+ if( failed == false || uint32((RandomGenerator.rand(99)+1)) <= CraftFailureProbaMpLost)
+ destroyItem( _RmFormulaSelectedForFaber[ i ].getInvId(), _RmFormulaSelectedForFaber[ i ].IndexInInv, _RmFormulaSelectedForFaber[ i ].Quantity );
}
}
+
//-----------------------------------------------
// CCharacter::updateVisualInformation : update visual information before inventory manipulation
//-----------------------------------------------
-void CCharacter::updateVisualInformation(uint16 InventoryEmpty, uint16 SlotEmpty, uint16 InventoryFull, uint16 SlotFull,
- const CSheetId &IdSheetItem, CGameItemPtr Item)
+void CCharacter::updateVisualInformation( uint16 InventoryEmpty, uint16 SlotEmpty, uint16 InventoryFull, uint16 SlotFull, const CSheetId& IdSheetItem, CGameItemPtr Item )
{
- if (InventoryEmpty == INVENTORIES::handling)
+ if( InventoryEmpty == INVENTORIES::handling )
{
- if (SlotEmpty == INVENTORIES::right)
+ if( SlotEmpty == INVENTORIES::right )
{
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.WeaponRightHand, 0);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.RTrail, 0);
- _Items.Sheath[0].HandR = SMirrorEquipment(CSheetId(), 0);
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.WeaponRightHand, 0 );
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.RTrail, 0 );
+ _Items.Sheath[ 0 ].HandR = SMirrorEquipment( CSheetId(), 0 );
}
- else if (SlotEmpty == INVENTORIES::left)
+ else if( SlotEmpty == INVENTORIES::left )
{
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.WeaponLeftHand, 0);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.LTrail, 0);
- _Items.Sheath[0].HandL = SMirrorEquipment(CSheetId(), 0);
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.WeaponLeftHand, 0 );
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.LTrail, 0 );
+ _Items.Sheath[ 0 ].HandL = SMirrorEquipment( CSheetId(), 0 );
}
else
{
- _Items.Sheath[0].Ammo = SMirrorEquipment(CSheetId(), 0);
+ _Items.Sheath[ 0 ].Ammo = SMirrorEquipment( CSheetId(), 0 );
}
}
- else if (InventoryEmpty == INVENTORIES::equipment)
+ else if( InventoryEmpty == INVENTORIES::equipment )
{
- const CStaticRaceStats* raceForm = CSheets::getRaceStats(CSheetId(_SheetId));
+ const CStaticRaceStats * raceForm = CSheets::getRaceStats( CSheetId(_SheetId) );
const CStaticItem* srcForm = 0;
-
- if (raceForm)
+ if( raceForm )
{
- switch (SlotEmpty)
+ switch( SlotEmpty )
{
case SLOT_EQUIPMENT::HEAD:
// keep a NULL form and update visual information with custom properties
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatModel, _HairType);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatColor, _HairColor);
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.HatModel, _HairType );
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.HatColor, _HairColor );
break;
-
case SLOT_EQUIPMENT::CHEST:
- switch (_Gender)
+ switch( _Gender )
{
- case GSGENDER::male:
- srcForm = CSheets::getForm(CSheetId(raceForm->MaleDefaultEquipment.DefaultChest));
- break;
-
- case GSGENDER::female:
- srcForm = CSheets::getForm(CSheetId(raceForm->FemaleDefaultEquipment.DefaultChest));
- break;
+ case GSGENDER::male :
+ srcForm = CSheets::getForm( CSheetId( raceForm->MaleDefaultEquipment.DefaultChest ) );
+ break;
+ case GSGENDER::female :
+ srcForm = CSheets::getForm( CSheetId( raceForm->FemaleDefaultEquipment.DefaultChest ) );
+ break;
}
-
break;
-
case SLOT_EQUIPMENT::ARMS:
- switch (_Gender)
+ switch( _Gender )
{
- case GSGENDER::male:
- srcForm = CSheets::getForm(CSheetId(raceForm->MaleDefaultEquipment.DefaultArms));
- break;
-
- case GSGENDER::female:
- srcForm = CSheets::getForm(CSheetId(raceForm->FemaleDefaultEquipment.DefaultArms));
- break;
+ case GSGENDER::male :
+ srcForm = CSheets::getForm( CSheetId( raceForm->MaleDefaultEquipment.DefaultArms ) );
+ break;
+ case GSGENDER::female :
+ srcForm = CSheets::getForm( CSheetId( raceForm->FemaleDefaultEquipment.DefaultArms ) );
+ break;
}
-
break;
-
case SLOT_EQUIPMENT::HANDS:
- switch (_Gender)
+ switch( _Gender )
{
- case GSGENDER::male:
- srcForm = CSheets::getForm(CSheetId(raceForm->MaleDefaultEquipment.DefaultHands));
- break;
-
- case GSGENDER::female:
- srcForm = CSheets::getForm(CSheetId(raceForm->FemaleDefaultEquipment.DefaultHands));
- break;
+ case GSGENDER::male :
+ srcForm = CSheets::getForm( CSheetId( raceForm->MaleDefaultEquipment.DefaultHands ) );
+ break;
+ case GSGENDER::female :
+ srcForm = CSheets::getForm( CSheetId( raceForm->FemaleDefaultEquipment.DefaultHands ) );
+ break;
}
-
break;
-
case SLOT_EQUIPMENT::LEGS:
- switch (_Gender)
+ switch( _Gender )
{
- case GSGENDER::male:
- srcForm = CSheets::getForm(CSheetId(raceForm->MaleDefaultEquipment.DefaultLegs));
- break;
-
- case GSGENDER::female:
- srcForm = CSheets::getForm(CSheetId(raceForm->FemaleDefaultEquipment.DefaultLegs));
- break;
+ case GSGENDER::male :
+ srcForm = CSheets::getForm( CSheetId( raceForm->MaleDefaultEquipment.DefaultLegs ) );
+ break;
+ case GSGENDER::female :
+ srcForm = CSheets::getForm( CSheetId( raceForm->FemaleDefaultEquipment.DefaultLegs ) );
+ break;
}
-
break;
-
case SLOT_EQUIPMENT::FEET:
- switch (_Gender)
+ switch( _Gender )
{
- case GSGENDER::male:
- srcForm = CSheets::getForm(CSheetId(raceForm->MaleDefaultEquipment.DefaultFeet));
- break;
-
- case GSGENDER::female:
- srcForm = CSheets::getForm(CSheetId(raceForm->FemaleDefaultEquipment.DefaultFeet));
- break;
+ case GSGENDER::male :
+ srcForm = CSheets::getForm( CSheetId( raceForm->MaleDefaultEquipment.DefaultFeet ) );
+ break;
+ case GSGENDER::female :
+ srcForm = CSheets::getForm( CSheetId( raceForm->FemaleDefaultEquipment.DefaultFeet ) );
+ break;
}
-
break;
-
- default:
- ;
+ default:;
}
-
// update visual property only if srcForm is valid
- if (srcForm)
+ if(srcForm)
setVisualPropertyForEquipment(SlotEmpty, srcForm, 0, 254);
}
}
- if (InventoryFull == INVENTORIES::handling)
+ if( InventoryFull == INVENTORIES::handling )
{
- const CStaticItem* srcForm = CSheets::getForm(IdSheetItem);
-
- if (srcForm && Item != 0)
+ const CStaticItem* srcForm = CSheets::getForm( IdSheetItem );
+ if( srcForm && Item != 0 )
{
// get ref skill level
- const uint16 refSkillLevel = min((uint16)getSkillValue(srcForm->Skill), Item->quality());
-
- if (SlotFull == INVENTORIES::right)
+ const uint16 refSkillLevel = min( (uint16)getSkillValue(srcForm->Skill), Item->quality() );
+ if( SlotFull == INVENTORIES::right )
{
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.WeaponRightHand, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.RTrail, getRightTrailValue(refSkillLevel));
- _Items.Sheath[0].HandR = SMirrorEquipment(IdSheetItem, Item->quality());
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.WeaponRightHand, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.RTrail, getRightTrailValue(refSkillLevel) );
+ _Items.Sheath[ 0 ].HandR = SMirrorEquipment( IdSheetItem, Item->quality() );
}
- else if (SlotFull == INVENTORIES::left)
+ else if( SlotFull == INVENTORIES::left )
{
- SET_STRUCT_MEMBER(
- _VisualPropertyA, PropertySubData.WeaponLeftHand, srcForm->ItemIdSheetToModelNumberLeftHands);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.LTrail, getLeftTrailValue(refSkillLevel));
- _Items.Sheath[0].HandL = SMirrorEquipment(IdSheetItem, Item->quality());
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.WeaponLeftHand, srcForm->ItemIdSheetToModelNumberLeftHands );
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.LTrail, getLeftTrailValue(refSkillLevel) );
+ _Items.Sheath[ 0 ].HandL = SMirrorEquipment( IdSheetItem, Item->quality() );
}
else
{
- _Items.Sheath[0].Ammo = SMirrorEquipment(IdSheetItem, Item->quality());
+ _Items.Sheath[ 0 ].Ammo = SMirrorEquipment( IdSheetItem, Item->quality() );
}
}
}
- else if (InventoryFull == INVENTORIES::equipment)
+ else if( InventoryFull == INVENTORIES::equipment )
{
- const CStaticItem* srcForm = CSheets::getForm(IdSheetItem);
-
- if ((srcForm != 0) && (Item != NULL))
+ const CStaticItem* srcForm = CSheets::getForm( IdSheetItem );
+ if( ( srcForm != 0 ) && ( Item != NULL ) )
{
- setVisualPropertyForEquipment(SlotFull, srcForm, Item->quality(), Item->color());
+ setVisualPropertyForEquipment( SlotFull, srcForm, Item->quality(), Item->color() );
}
}
} // updateVisualInformation //
@@ -5537,110 +5202,91 @@ void CCharacter::updateVisualInformation(uint16 InventoryEmpty, uint16 SlotEmpty
//-----------------------------------------------
// CCharacter::setVisualPropertyForEquipment : update visual properties after equipment inventory manipulation
//-----------------------------------------------
-void CCharacter::setVisualPropertyForEquipment(uint16 slot, const CStaticItem* srcForm, uint16 quality, uint8 color)
+void CCharacter::setVisualPropertyForEquipment( uint16 slot, const CStaticItem* srcForm, uint16 quality, uint8 color )
{
- if (srcForm == NULL)
+ if( srcForm == NULL )
{
- nlwarning(
- " Character %s Try to set visual properties with null form");
+ nlwarning(" Character %s Try to set visual properties with null form");
return;
}
-
- switch (slot)
+ switch( slot )
{
- case SLOT_EQUIPMENT::HEADDRESS:
- _Items.Headdress = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::HEAD:
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatModel, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.HatColor, color);
- _Items.Head = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::EARL:
- _Items.EarL = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::EARR:
- _Items.EarR = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::NECKLACE:
- _Items.Neck = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::CHEST:
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.JacketModel, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.JacketColor, color);
- _Items.Chest = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::ARMS:
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.ArmModel, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.ArmColor, color);
- _Items.Arms = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::WRISTL:
- _Items.WristL = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::WRISTR:
- _Items.WristR = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::HANDS:
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.HandsModel, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.HandsColor, color);
- _Items.Hands = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::FINGERL:
- _Items.FingerL = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::FINGERR:
- _Items.FingerR = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::LEGS:
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.TrouserModel, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyA, PropertySubData.TrouserColor, color);
- _Items.Legs = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::ANKLEL:
- _Items.AnkleL = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::ANKLER:
- _Items.AnkleR = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- case SLOT_EQUIPMENT::FEET:
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.FeetModel, srcForm->ItemIdSheetToModelNumber);
- SET_STRUCT_MEMBER(_VisualPropertyB, PropertySubData.FeetColor, color);
- _Items.Feet = SMirrorEquipment(srcForm->SheetId, quality);
- break;
-
- default:
- ;
+ case SLOT_EQUIPMENT::HEADDRESS:
+ _Items.Headdress = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::HEAD:
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.HatModel, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.HatColor, color );
+ _Items.Head = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::EARL:
+ _Items.EarL = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::EARR:
+ _Items.EarR = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::NECKLACE:
+ _Items.Neck = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::CHEST:
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.JacketModel, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.JacketColor, color );
+ _Items.Chest = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::ARMS:
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.ArmModel, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.ArmColor, color );
+ _Items.Arms = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::WRISTL:
+ _Items.WristL = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::WRISTR:
+ _Items.WristR = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::HANDS:
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.HandsModel, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.HandsColor, color );
+ _Items.Hands = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::FINGERL:
+ _Items.FingerL = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::FINGERR:
+ _Items.FingerR = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::LEGS:
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.TrouserModel, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyA, PropertySubData.TrouserColor, color );
+ _Items.Legs = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::ANKLEL:
+ _Items.AnkleL = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::ANKLER:
+ _Items.AnkleR = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ case SLOT_EQUIPMENT::FEET:
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.FeetModel, srcForm->ItemIdSheetToModelNumber );
+ SET_STRUCT_MEMBER( _VisualPropertyB, PropertySubData.FeetColor, color );
+ _Items.Feet = SMirrorEquipment( srcForm->SheetId, quality );
+ break;
+ default:;
}
} // setVisualPropertyForEquipment //
+
//-----------------------------------------------
// CCharacter::teleportCharacter tp wanted, check if tp is regular and send a server tp command
// allowNearPetTp() or forbidNearPetTp() must have been called
//-----------------------------------------------
-void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWithMount, bool useHeading, float heading,
- uint8 continent, sint32 cell, uint8 season, bool fromVortex, const R2::TR2TpInfos &tpInfos)
+void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWithMount, bool useHeading, float heading, uint8 continent, sint32 cell, uint8 season, bool fromVortex, const R2::TR2TpInfos &tpInfos)
{
- if (!getEnterFlag()) // wait for the properties to be in the mirror
+ if ( ! getEnterFlag() ) // wait for the properties to be in the mirror
return;
// Check if player is dying
- if (currentHp() <= 0)
+ if( currentHp() <= 0 )
{
return;
}
@@ -5650,42 +5296,42 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
_RingSeason = season;
}
+
// force player to leave PVP if engaged
- if (getPVPInterface().isValid())
+ if ( getPVPInterface().isValid() )
getPVPInterface().leavePVP(IPVP::Teleport);
// take all items from temp inventory
sendCloseTempInventoryImpulsion();
+
// manage teleport in pvp
CPVPManager2::getInstance()->playerTeleports(this);
// force player to unmount
- if (TheDataset.isAccessible(_EntityMounted()))
+ if( TheDataset.isAccessible(_EntityMounted()) )
{
TDataSetRow creatureId = _EntityMounted;
- unmount(false);
+
+ unmount( false );
if (teleportWithMount)
{
// if player is a GM or DEV or better, also TP mounted creature
- CPlayer* player = PlayerManager.getPlayer(PlayerManager.getPlayerId(_Id));
-
+ CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(_Id) );
if (player != NULL)
{
- if (player->havePriv(TeleportWithMektoubPriv))
+ if ( player->havePriv(TeleportWithMektoubPriv) )
{
- CCreature* creature = CreatureManager.getCreature(creatureId);
-
+ CCreature *creature = CreatureManager.getCreature(creatureId);
if (creature)
{
- creature->tpWanted(x, y, z, useHeading, heading, continent, cell);
+ creature->tpWanted(x,y,z,useHeading,heading,continent,cell);
}
}
}
}
}
-
if (_PowoCell != 0 && _PowoCell != cell) // leave the current Powo
{
// open url
@@ -5717,18 +5363,15 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
else if (_PowoCell == 0)
CBuildingManager::getInstance()->removePlayerFromRoom(this);
-
-
// despawn pets or stop it
- for (uint i = 0; i < _PlayerPets.size(); i++)
+ for ( uint i = 0; i < _PlayerPets.size(); i++ )
{
- if (_PlayerPets[i].PetStatus == CPetAnimal::landscape)
+ if( _PlayerPets[ i ].PetStatus == CPetAnimal::landscape )
{
- if (TheDataset.isAccessible(_PlayerPets[i].SpawnedPets))
+ if( TheDataset.isAccessible(_PlayerPets[ i ].SpawnedPets) )
{
- CCreature* c = CreatureManager.getCreature(TheDataset.getEntityId(_PlayerPets[i].SpawnedPets));
-
- if (c)
+ CCreature * c = CreatureManager.getCreature( TheDataset.getEntityId( _PlayerPets[ i ].SpawnedPets ) );
+ if( c )
{
CVector2f animalPos;
CVector2f characterPos;
@@ -5736,23 +5379,16 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
getState().getVector2f(characterPos);
float squareDistance = (animalPos - characterPos).sqrnorm();
- const CStaticItem* form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
+ const CStaticItem *form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
-
- CContinent * cont = CZoneManager::getInstance().getContinent(_PlayerPets[i].Landscape_X, _PlayerPets[i].Landscape_Y);
+ CContinent *cont = CZoneManager::getInstance().getContinent(_PlayerPets[i].Landscape_X, _PlayerPets[i].Landscape_Y);
bool inCell = false;
if (cont)
{
CONTINENT::TContinent continent = (CONTINENT::TContinent)cont->getId();
- if (continent == CONTINENT::R2_ROOTS ||
- continent == CONTINENT::R2_FOREST ||
- continent == CONTINENT::R2_DESERT ||
- continent == CONTINENT::R2_LAKES ||
- continent == CONTINENT::R2_JUNGLE ||
- continent == CONTINENT::INDOORS
- )
+ if (continent == CONTINENT::R2_ROOTS || continent == CONTINENT::R2_FOREST || continent == CONTINENT::R2_DESERT || continent == CONTINENT::R2_LAKES || continent == CONTINENT::R2_JUNGLE || continent == CONTINENT::INDOORS)
{
nlinfo("pet in a powo/indoor");
inCell = true;
@@ -5760,18 +5396,17 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
}
// Teleport as well pets that are following or mounted or a pet and in the neighbourhood or... in a Powo/indoor
- if ((((isNearPetTpIsAllowed() || form->Type == ITEM_TYPE::ANIMAL_TICKET) && (_PlayerPets[i].IsFollowing || _PlayerPets[i].IsMounted)
- && squareDistance <= 50.0f * 50.0f)) || inCell)
+ if ((((isNearPetTpIsAllowed() || form->Type == ITEM_TYPE::ANIMAL_TICKET) && (_PlayerPets[i].IsFollowing || _PlayerPets[i].IsMounted) && squareDistance <= 50.0f * 50.0f)) || inCell)
{
// despawn it
- sendPetCommand(CPetCommandMsg::DESPAWN, i, true);
- _PlayerPets[i].SpawnedPets = TDataSetRow();
- _PlayerPets[i].PetStatus = CPetAnimal::tp_continent;
+ sendPetCommand( CPetCommandMsg::DESPAWN, i, true );
+ _PlayerPets[ i ].SpawnedPets = TDataSetRow();
+ _PlayerPets[ i ].PetStatus = CPetAnimal::tp_continent;
}
else
{
// stop it
- sendPetCommand(CPetCommandMsg::STAND, i, true);
+ sendPetCommand( CPetCommandMsg::STAND, i, true );
}
}
}
@@ -5784,29 +5419,28 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
_TpCoordinate.X = x;
_TpCoordinate.Y = y;
_TpCoordinate.Z = z;
- // outdoor teleport so cell is 0
+ //outdoor teleport so cell is 0
_TpCoordinate.Heading = heading;
_TpCoordinate.Cell = cell;
_TpCoordinate.Continent = continent;
+
CPhraseManager::getInstance().removeEntity(TheDataset.getDataSetRow(_Id), false);
- CMessage msgout("IMPULSION_ID");
- msgout.serial(_Id);
+ CMessage msgout( "IMPULSION_ID" );
+ msgout.serial( _Id );
CBitMemStream bms;
- GenericMsgManager.pushNameToStream(season == 0xff ? "TP:DEST" : "TP:DEST_WITH_SEASON", bms);
- bms.serial(x);
- bms.serial(y);
- bms.serial(z);
- bms.serialBit(useHeading);
-
- if (useHeading)
- bms.serial(heading);
-
+ GenericMsgManager.pushNameToStream(season == 0xff ? "TP:DEST" : "TP:DEST_WITH_SEASON", bms);
+ bms.serial( x );
+ bms.serial( y );
+ bms.serial( z );
+ bms.serialBit( useHeading );
+ if ( useHeading )
+ bms.serial( heading );
if (season != 0xff)
{
bms.serial(season);
}
- bms.serial(const_cast(tpInfos));
+ bms.serial(const_cast(tpInfos));
/*
R2::TTeleportContext tpContext = R2::TPContext_Unknown;
std::string tpReasonId;
@@ -5814,31 +5448,32 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
impulse.serial(tpReasonId);
impulse.serial(tpCancelTextId);
impulse.serialEnum(tpContext);
- */
- msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
- CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(_Id.getDynamicId()), msgout);
- CMessage msgout2("ENTITY_TELEPORTATION");
- msgout2.serial(_Id);
+*/
+
+ msgout.serialBufferWithSize ( (uint8*)bms.buffer(), bms.length() );
+ CUnifiedNetwork::getInstance()->send( NLNET::TServiceId(_Id.getDynamicId()), msgout);
+ CMessage msgout2("ENTITY_TELEPORTATION");
+ msgout2.serial( _Id );
if (IsRingShard)
{
- nlinfo("Asking GPMS to TP character %s to (0,0)", _Id.toString().c_str());
+ nlinfo("Asking GPMS to TP character %s to (0,0)",_Id.toString().c_str());
}
-
sendMessageViaMirror("GPMS", msgout2);
+
// send message to AIS to indicate this player has respawned/teleport and must be removed from aggro lists
CAIPlayerRespawnMsg respawnMsg;
respawnMsg.PlayerRowId = _EntityRowId;
CWorldInstances::instance().msgToAIInstance(getInstanceNumber(), respawnMsg);
- // respawnMsg.send("AIS");
+// respawnMsg.send("AIS");
+
// backup the who sees me property and set it to 0
- CMirrorPropValue whoSeesMe(TheDataset, _EntityRowId, DSPropertyWHO_SEES_ME);
+ CMirrorPropValue whoSeesMe(TheDataset, _EntityRowId, DSPropertyWHO_SEES_ME );
+
/*
- FOR AIS the change of property value AIInstance is handled before the sendAggro message send by setWhoSeesMe
- function.
- So we first change the AI Instance to prevent the setWhosSeesMe to send message to ais about and npc that is
- previously
+ FOR AIS the change of property value AIInstance is handled before the sendAggro message send by setWhoSeesMe function.
+ So we first change the AI Instance to prevent the setWhosSeesMe to send message to ais about and npc that is previously
removed of the aiInstance after the setInstanceNumber(INVALID_AI_INSTANCE).
*/
// reset the continent instance during tp
@@ -5847,34 +5482,33 @@ void CCharacter::teleportCharacter(sint32 x, sint32 y, sint32 z, bool teleportWi
else
setInstanceNumber(INVALID_AI_INSTANCE);
+
//////////////////////////////////////////////////////////////////////////
// Looking for invisibility bug
- uint64 NOT_TELEPORTING_FLAG = (((uint64)0x12345678) << 32) | (uint64)0x87654321;
-
- if (_WhoSeesMeBeforeTP != NOT_TELEPORTING_FLAG)
+ uint64 NOT_TELEPORTING_FLAG= (((uint64)0x12345678)<<32)| (uint64)0x87654321;
+ if ( _WhoSeesMeBeforeTP != NOT_TELEPORTING_FLAG )
{
- nlwarning("INVISIBILITY (teleportCharacter) Player %s already being Tp as _WhoSeesMeBeforeTp is = %" NL_I64
- "u and WhoSeesMe = %" NL_I64 "u",
- _Id.toString().c_str(), _WhoSeesMeBeforeTP, whoSeesMe.getValue());
- nlwarning("INVISIBILITY (teleportCharacter) Current Coordinates :(%d, %d, %d) TP coordinates : (%d, %d, %d)", x,
- y, z);
+ nlwarning("INVISIBILITY (teleportCharacter) Player %s already being Tp as _WhoSeesMeBeforeTp is = %" NL_I64 "u and WhoSeesMe = %" NL_I64 "u", _Id.toString().c_str(), _WhoSeesMeBeforeTP, whoSeesMe.getValue() );
+ nlwarning("INVISIBILITY (teleportCharacter) Current Coordinates :(%d, %d, %d) TP coordinates : (%d, %d, %d)", x,y,z);
}
else
{
_WhoSeesMeBeforeTP = whoSeesMe.getValue();
- setWhoSeesMe(IsRingShard ? R2_VISION::buildWhoSeesMe(R2_VISION::WHOSEESME_INVISIBLE_PLAYER, false) : uint64(0));
+ setWhoSeesMe( IsRingShard? R2_VISION::buildWhoSeesMe(R2_VISION::WHOSEESME_INVISIBLE_PLAYER,false): uint64(0));
}
-
//////////////////////////////////////////////////////////////////////////
+
if (IsRingShard)
{
_RingSeason = season;
}
+
}
+
//-----------------------------------------------
-void CCharacter::setCurrentContinent(CONTINENT::TContinent continent)
+void CCharacter::setCurrentContinent (CONTINENT::TContinent continent)
{
_CurrentContinent = continent;
}
@@ -5884,7 +5518,7 @@ void CCharacter::setCurrentContinent(CONTINENT::TContinent continent)
//-----------------------------------------------
bool CCharacter::addCharacterAnimal(const CSheetId &PetTicket, uint32 Price, CGameItemPtr ptr, uint8 size, const ucstring &customName)
{
- if (!PackAnimalSystemEnabled)
+ if ( !PackAnimalSystemEnabled )
return false;
CPetAnimal pet;
@@ -5895,37 +5529,39 @@ bool CCharacter::addCharacterAnimal(const CSheetId &PetTicket, uint32 Price, CGa
pet.OwnerId = _Id;
pet.Size = size;
- if (checkAnimalCount(PetTicket, true, 1))
+ if( checkAnimalCount( PetTicket, true, 1 ) )
{
- const CStaticItem* form = CSheets::getForm(PetTicket);
+ const CStaticItem* form = CSheets::getForm( PetTicket );
pet.PetSheetId = form->PetSheet;
pet.Satiety = form->PetHungerCount;
pet.MaxSatiety = form->PetHungerCount;
uint8 startSlot = 0;
if (form->Type == ITEM_TYPE::ANIMAL_TICKET) // Use only last slots for pets
- startSlot = MAX_PACK_ANIMAL+MAX_MEKTOUB_MOUNT;
+ startSlot = MAX_PACK_ANIMAL + MAX_MEKTOUB_MOUNT;
sint32 i = getFreePetSlot(startSlot);
if (i >= 0)
{
- _PlayerPets[i] = pet;
+ _PlayerPets[ i ] = pet;
+
pet.ItemPtr->setPetIndex(i);
pet.Slot = ptr->getInventorySlot();
// init pet inventory
- if (!initPetInventory(i))
+ if ( ! initPetInventory( i ))
{
return false;
}
if (!customName.empty())
setAnimalName(i, customName);
- return spawnCharacterAnimal(i);
+
+ return spawnCharacterAnimal( i );
}
}
-
return false;
}
+
//-----------------------------------------------
// CCharacter::getFreePetSlot return free slot for pet spawn or -1 if there are no free slot
//-----------------------------------------------
@@ -5933,12 +5569,11 @@ sint32 CCharacter::getFreePetSlot(uint8 startSlot)
{
for (sint32 i = startSlot; i < (sint32)_PlayerPets.size(); ++i)
{
- if (_PlayerPets[i].TicketPetSheetId == CSheetId::Unknown)
+ if( _PlayerPets[ i ].TicketPetSheetId == CSheetId::Unknown )
{
return i;
}
}
-
return -1;
}
@@ -5955,7 +5590,7 @@ sint32 CCharacter::getMountOrFirstPetSlot()
if (slot == -1)
slot = i;
- const CStaticItem* form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
+ const CStaticItem *form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
if (form->Type == ITEM_TYPE::MEKTOUB_MOUNT_TICKET)
return i;
@@ -5975,7 +5610,7 @@ string CCharacter::getPets()
{
if (_PlayerPets[i].TicketPetSheetId != CSheetId::Unknown)
{
- const CStaticItem* form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
+ const CStaticItem *form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
if (form->Type == ITEM_TYPE::MEKTOUB_MOUNT_TICKET)
pets += "M";
else if (form->Type == ITEM_TYPE::MEKTOUB_PACKER_TICKET)
@@ -5984,7 +5619,7 @@ string CCharacter::getPets()
pets += "A";
CPetAnimal::TStatus status = _PlayerPets[i].PetStatus;
- if (status != CPetAnimal::db_unknown)
+ if (status != CPetAnimal::db_unknown)
pets += toString("%d", (uint32)(status));
else
pets += "0";
@@ -6025,7 +5660,7 @@ string CCharacter::getPetsInfos()
if (_PlayerPets[i].TicketPetSheetId != CSheetId::Unknown)
{
- const CStaticItem* form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
+ const CStaticItem *form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
if (form->Type == ITEM_TYPE::MEKTOUB_MOUNT_TICKET)
type = "M";
else if (form->Type == ITEM_TYPE::MEKTOUB_PACKER_TICKET)
@@ -6035,7 +5670,7 @@ string CCharacter::getPetsInfos()
}
CPetAnimal::TStatus status = _PlayerPets[i].PetStatus;
- if (status != CPetAnimal::db_unknown)
+ if (status != CPetAnimal::db_unknown)
state = toString("%d", (uint32)(status));
else
state += "0";
@@ -6047,65 +5682,54 @@ string CCharacter::getPetsInfos()
uint32 weight = _Inventory[packInv]->getInventoryWeight();
uint32 max_weight = _Inventory[packInv]->getMaxWeight();
- pets += sheet+"|"+ticketSheet+"|"+type+"|"+state+"|"+toString("%d", _PlayerPets[i].Size)+"|"+toString("%d", _PlayerPets[i].StableId)+"|"+toString("%d,%d,%d", _PlayerPets[i].Landscape_X, _PlayerPets[i].Landscape_Y, _PlayerPets[i].Landscape_Z)+"|"+toString("%u", timeBeforeDespawn)+"|"+toString("%f/%f", _PlayerPets[i].Satiety, _PlayerPets[i].MaxSatiety)+"|"+toString("%u|%u/%u|%u/%u", slots, bulk, max_bulk, weight, max_weight)+"|"+inBag+"|"+spawnFlag+"|"+name+"\n";
+ pets += sheet + "|" + ticketSheet + "|" + type + "|" + state + "|" + toString("%d", _PlayerPets[i].Size) + "|" + toString("%d", _PlayerPets[i].StableId) + "|" + toString("%d,%d,%d", _PlayerPets[i].Landscape_X, _PlayerPets[i].Landscape_Y, _PlayerPets[i].Landscape_Z) + "|" + toString("%u", timeBeforeDespawn) + "|" + toString("%f/%f", _PlayerPets[i].Satiety, _PlayerPets[i].MaxSatiety) + "|" + toString("%u|%u/%u|%u/%u", slots, bulk, max_bulk, weight, max_weight) + "|" + inBag + "|" + spawnFlag + "|" + name + "\n";
}
return pets;
}
-
-
//-----------------------------------------------
// CCharacter::checkAnimalCount return true if can add 'delta' pets to current player pets
//-----------------------------------------------
-bool CCharacter::checkAnimalCount(const CSheetId &PetTicket, bool sendMessage, sint32 delta)
+bool CCharacter::checkAnimalCount( const CSheetId& PetTicket, bool sendMessage, sint32 delta )
{
- if (!PackAnimalSystemEnabled)
+ if ( !PackAnimalSystemEnabled )
return false;
- const CStaticItem* form = CSheets::getForm(PetTicket);
-
- if (form == 0)
+ const CStaticItem* form = CSheets::getForm( PetTicket );
+ if( form == 0 )
{
- if (sendMessage)
+ if( sendMessage )
{
- nlwarning(
- " Can't find static sheet for item %s (Character %s buy this pet )",
- PetTicket.toString().c_str(), _Id.toString().c_str());
+ nlwarning(" Can't find static sheet for item %s (Character %s buy this pet )", PetTicket.toString().c_str(), _Id.toString().c_str() );
}
-
return false;
}
-
- if (form->Family != ITEMFAMILY::PET_ANIMAL_TICKET)
+ if( form->Family != ITEMFAMILY::PET_ANIMAL_TICKET )
{
- if (sendMessage)
+ if( sendMessage )
{
- nlwarning(" Sheet %s have not right item family (%s) (Character %s buy "
- "this pet )",
- PetTicket.toString().c_str(), ITEMFAMILY::toString(form->Family).c_str(), _Id.toString().c_str());
+ nlwarning(" Sheet %s have not right item family (%s) (Character %s buy this pet )", PetTicket.toString().c_str(), ITEMFAMILY::toString( form->Family ).c_str(), _Id.toString().c_str() );
}
-
return false;
}
- if (form->PetSheet == CSheetId::Unknown)
+
+ if( form->PetSheet == CSheetId::Unknown )
{
- if (sendMessage)
+ if( sendMessage )
{
- nlwarning(" Cant found sheet name of creature found in ticket %s",
- PetTicket.toString().c_str());
+ nlwarning(" Cant found sheet name of creature found in ticket %s", PetTicket.toString().c_str() );
}
-
return false;
}
- if (form->Type == ITEM_TYPE::MEKTOUB_MOUNT_TICKET)
+
+ if( form->Type == ITEM_TYPE::MEKTOUB_MOUNT_TICKET )
{
uint32 nbMektoubMount = 0;
-
- for (vector::const_iterator it = _PlayerPets.begin(); it != _PlayerPets.end(); ++it)
+ for( vector< CPetAnimal >::const_iterator it = _PlayerPets.begin(); it != _PlayerPets.end(); ++it )
{
- const CStaticItem* ticket_form = CSheets::getForm((*it).TicketPetSheetId);
+ const CStaticItem *ticket_form = CSheets::getForm((*it).TicketPetSheetId);
CSheetId petSheetId = CSheetId::Unknown;
if (ticket_form)
petSheetId = ticket_form->PetSheet;
@@ -6113,75 +5737,66 @@ bool CCharacter::checkAnimalCount(const CSheetId &PetTicket, bool sendMessage, s
// check sheet is asigned (prevent an useless warning)
if (petSheetId != CSheetId::Unknown)
{
- const CStaticCreatures* form = CSheets::getCreaturesForm(petSheetId);
-
+ const CStaticCreatures *form = CSheets::getCreaturesForm(petSheetId);
if (form)
{
- if (form->getRace() == EGSPD::CPeople::MektoubMount)
+ if( form->getRace() == EGSPD::CPeople::MektoubMount )
{
++nbMektoubMount;
}
}
}
}
-
// check we can add delta mount
- if ((nbMektoubMount + delta) > MAX_MEKTOUB_MOUNT)
+ if( (nbMektoubMount + delta) > MAX_MEKTOUB_MOUNT )
{
- if (sendMessage)
+ if( sendMessage )
{
- sendDynamicSystemMessage(_Id, "EGS_ALREADY_HAVE_MOUNT");
+ sendDynamicSystemMessage( _Id, "EGS_ALREADY_HAVE_MOUNT" );
}
-
return false;
}
}
- else if (form->Type == ITEM_TYPE::MEKTOUB_PACKER_TICKET)
+ else if( form->Type == ITEM_TYPE::MEKTOUB_PACKER_TICKET )
{
uint32 nbMektoubPacker = 0;
-
- for (vector::const_iterator it = _PlayerPets.begin(); it != _PlayerPets.end(); ++it)
+ for( vector< CPetAnimal >::const_iterator it = _PlayerPets.begin(); it != _PlayerPets.end(); ++it )
{
- const CStaticItem* ticket_form = CSheets::getForm((*it).TicketPetSheetId);
+ const CStaticItem *ticket_form = CSheets::getForm((*it).TicketPetSheetId);
CSheetId petSheetId = CSheetId::Unknown;
if (ticket_form)
petSheetId = ticket_form->PetSheet;
// check sheet is asigned (prevent an useless warning)
if (petSheetId != CSheetId::Unknown)
{
- const CStaticCreatures* form = CSheets::getCreaturesForm(petSheetId);
-
+ const CStaticCreatures *form = CSheets::getCreaturesForm(petSheetId);
if (form)
{
- if (form->getRace() == EGSPD::CPeople::MektoubPacker)
+ if( form->getRace() == EGSPD::CPeople::MektoubPacker )
{
++nbMektoubPacker;
}
}
}
}
-
// check we can add delta packer
- if ((nbMektoubPacker + delta) > MAX_PACK_ANIMAL)
+ if( (nbMektoubPacker + delta) > MAX_PACK_ANIMAL )
{
- if (sendMessage)
+ if( sendMessage )
{
- sendDynamicSystemMessage(_Id, "EGS_CANT_BUY_ANOTHER_PACKER");
+ sendDynamicSystemMessage( _Id, "EGS_CANT_BUY_ANOTHER_PACKER" );
}
-
return false;
}
- CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
- BOMB_IF(p == NULL, "Failed to find player record for character: " << getId().toString(), return 0.0);
-
- if (p->isTrialPlayer())
+ CPlayer * p = PlayerManager.getPlayer(PlayerManager.getPlayerId( getId() ));
+ BOMB_IF(p == NULL,"Failed to find player record for character: "<isTrialPlayer() )
{
- if (sendMessage)
+ if( sendMessage )
{
- sendDynamicSystemMessage(_Id, "EGS_CANT_BUY_PACKER_IS_TRIAL_PLAYER");
+ sendDynamicSystemMessage( _Id, "EGS_CANT_BUY_PACKER_IS_TRIAL_PLAYER" );
}
-
return false;
}
}
@@ -6190,14 +5805,14 @@ bool CCharacter::checkAnimalCount(const CSheetId &PetTicket, bool sendMessage, s
uint32 nbAnimals = 0;
for (vector::const_iterator it = _PlayerPets.begin(); it != _PlayerPets.end(); ++it)
{
- const CStaticItem* ticket_form = CSheets::getForm((*it).TicketPetSheetId);
+ const CStaticItem *ticket_form = CSheets::getForm((*it).TicketPetSheetId);
CSheetId petSheetId = CSheetId::Unknown;
if (ticket_form)
petSheetId = ticket_form->PetSheet;
// check sheet is asigned (prevent an useless warning)
if (petSheetId != CSheetId::Unknown)
{
- const CStaticCreatures* form = CSheets::getCreaturesForm(petSheetId);
+ const CStaticCreatures *form = CSheets::getCreaturesForm(petSheetId);
if (form)
{
@@ -6219,7 +5834,7 @@ bool CCharacter::checkAnimalCount(const CSheetId &PetTicket, bool sendMessage, s
return false;
}
- CPlayer* p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
+ CPlayer *p = PlayerManager.getPlayer(PlayerManager.getPlayerId(getId()));
BOMB_IF(p == NULL, "Failed to find player record for character: " << getId().toString(), return 0.0);
if (p->isTrialPlayer())
@@ -6234,177 +5849,166 @@ bool CCharacter::checkAnimalCount(const CSheetId &PetTicket, bool sendMessage, s
}
else
{
- if (sendMessage)
+ if( sendMessage )
{
- nlwarning(
- " PetAnimal %s not yet implemented", PetTicket.toString().c_str());
+ nlwarning(" PetAnimal %s not yet implemented", PetTicket.toString().c_str() );
}
-
return false;
}
-
return true;
}
+
//-----------------------------------------------
// CCharacter::respawnPet respawn all pet of player
//-----------------------------------------------
void CCharacter::respawnPet()
{
- for (uint i = 0; i < _PlayerPets.size(); ++i)
+ for( uint i = 0; i < _PlayerPets.size(); ++i )
{
if (_PlayerPets[i].PetStatus == CPetAnimal::in_bag)
continue;
- if (_PlayerPets[i].PetStatus != CPetAnimal::not_present
- && (_PlayerPets[i].PetStatus != CPetAnimal::stable || _RespawnMainLandInTown))
+ if (_PlayerPets[i].PetStatus != CPetAnimal::not_present && (_PlayerPets[i].PetStatus != CPetAnimal::stable || _RespawnMainLandInTown))
{
- if (_PlayerPets[i].TicketPetSheetId != CSheetId::Unknown)
+ if( _PlayerPets[ i ].TicketPetSheetId != CSheetId::Unknown )
{
- spawnCharacterAnimal(i);
+ spawnCharacterAnimal( i );
}
}
- else if (_PlayerPets[i].PetStatus == CPetAnimal::stable)
+ else if( _PlayerPets[ i ].PetStatus == CPetAnimal::stable )
{
// check if stable exist
CStable::TStableData stableData;
-
- if (!CStable::getInstance()->getStableData((uint16)_PlayerPets[i].StableId, stableData))
+ if( ! CStable::getInstance()->getStableData( (uint16)_PlayerPets[ i ].StableId, stableData ) )
{
- _PlayerPets[i].PetStatus = CPetAnimal::waiting_spawn;
- spawnCharacterAnimal(i);
+ _PlayerPets[ i ].PetStatus = CPetAnimal::waiting_spawn;
+ spawnCharacterAnimal( i );
}
}
}
}
//-----------------------------------------------------------------------------
-void CCharacter::respawnPetForInstance(uint32 InstanceNumber, const std::string &InstanceContinent)
+void CCharacter::respawnPetForInstance( uint32 InstanceNumber, const std::string& InstanceContinent )
{
- for (uint i = 0; i < _PlayerPets.size(); ++i)
+ for( uint i = 0; i < _PlayerPets.size(); ++i )
{
- if (_PlayerPets[i].PetStatus != CPetAnimal::not_present && _PlayerPets[i].PetStatus != CPetAnimal::stable)
+ if( _PlayerPets[ i ].PetStatus != CPetAnimal::not_present && _PlayerPets[ i ].PetStatus != CPetAnimal::stable )
{
- if (_PlayerPets[i].TicketPetSheetId != CSheetId::Unknown)
+ if( _PlayerPets[ i ].TicketPetSheetId != CSheetId::Unknown )
{
uint32 instance = INVALID_AI_INSTANCE;
- CContinent* cont
- = CZoneManager::getInstance().getContinent(_PlayerPets[i].Landscape_X, _PlayerPets[i].Landscape_Y);
-
- if (cont)
+ CContinent * cont = CZoneManager::getInstance().getContinent( _PlayerPets[ i ].Landscape_X, _PlayerPets[ i ].Landscape_Y );
+ if ( cont )
{
- instance = CUsedContinent::instance().getInstanceForContinent(CONTINENT::TContinent(cont->getId()));
-
- if (instance != INVALID_AI_INSTANCE)
+ instance = CUsedContinent::instance().getInstanceForContinent( CONTINENT::TContinent(cont->getId()) );
+ if ( instance != INVALID_AI_INSTANCE )
{
- if (InstanceNumber == instance)
+ if( InstanceNumber == instance )
{
- spawnCharacterAnimal(i);
+ spawnCharacterAnimal( i );
continue;
}
}
}
- if (instance == INVALID_AI_INSTANCE)
+ if( instance == INVALID_AI_INSTANCE )
{
- nlwarning(
- " Pet %d are not in a continent, re-spawn it near player...",
- i);
- _PlayerPets[i].PetStatus = CPetAnimal::waiting_spawn;
- spawnCharacterAnimal(i);
+ nlwarning(" Pet %d are not in a continent, re-spawn it near player...", i );
+ _PlayerPets[ i ].PetStatus = CPetAnimal::waiting_spawn;
+ spawnCharacterAnimal( i );
}
}
}
- else if (_PlayerPets[i].PetStatus == CPetAnimal::stable)
+ else if( _PlayerPets[ i ].PetStatus == CPetAnimal::stable )
{
// check if stable exist
CStable::TStableData stableData;
-
- if (!CStable::getInstance()->getStableData((uint16)_PlayerPets[i].StableId, stableData))
+ if( ! CStable::getInstance()->getStableData( (uint16)_PlayerPets[ i ].StableId, stableData ) )
{
- _PlayerPets[i].PetStatus = CPetAnimal::waiting_spawn;
- spawnCharacterAnimal(i);
+ _PlayerPets[ i ].PetStatus = CPetAnimal::waiting_spawn;
+ spawnCharacterAnimal( i );
}
}
}
}
//-----------------------------------------------------------------------------
-void CCharacter::respawnPetAfterTp(const SGameCoordinate &destination, uint32 destAIInstance)
+void CCharacter::respawnPetAfterTp( const SGameCoordinate& destination, uint32 destAIInstance )
{
if (destination.Continent == CONTINENT::UNKNOWN)
return;
- for (uint i = 0; i < _PlayerPets.size(); ++i)
+ for ( uint i = 0; i < _PlayerPets.size(); ++i )
{
- if (_PlayerPets[i].PetStatus == CPetAnimal::tp_continent)
+ if ( _PlayerPets[ i ].PetStatus == CPetAnimal::tp_continent )
{
- _PlayerPets[i].PetStatus = CPetAnimal::waiting_spawn;
- spawnWaitingCharacterAnimalNear(i, destination, destAIInstance);
+ _PlayerPets[ i ].PetStatus = CPetAnimal::waiting_spawn;
+ spawnWaitingCharacterAnimalNear( i, destination, destAIInstance );
}
}
}
+
//-----------------------------------------------
// Specialized version of spawnCharacterAnimal() for respawnPetAfterTp()
//-----------------------------------------------
-bool CCharacter::spawnWaitingCharacterAnimalNear(uint index, const SGameCoordinate &destination, uint32 destAIInstance)
+bool CCharacter::spawnWaitingCharacterAnimalNear( uint index, const SGameCoordinate& destination, uint32 destAIInstance )
{
- if (index >= _PlayerPets.size())
+ if ( index >= _PlayerPets.size() )
return false;
- if (TheDataset.isAccessible(_PlayerPets[index].SpawnedPets))
+ if ( TheDataset.isAccessible(_PlayerPets[ index ].SpawnedPets) )
{
- nlwarning("Pets index %d already spawned has creature row %d for player %s", index,
- _PlayerPets[index].SpawnedPets.getIndex(), _Id.toString().c_str());
+ nlwarning("Pets index %d already spawned has creature row %d for player %s", index, _PlayerPets[ index ].SpawnedPets.getIndex(), _Id.toString().c_str() );
return false;
}
const float distFromPlayer = 2000.f * (index + 1);
+
CPetSpawnMsg msg;
- msg.SpawnMode
- = CPetSpawnMsg::NEAR_POINT; // if NEAR_PLAYER, the AIS would take the pos of the player (0,0,0 at this time)
+ msg.SpawnMode = CPetSpawnMsg::NEAR_POINT; // if NEAR_PLAYER, the AIS would take the pos of the player (0,0,0 at this time)
msg.Coordinate_X = destination.X - sint32(cos(getHeading()) * distFromPlayer);
msg.Coordinate_Y = destination.Y - sint32(sin(getHeading()) * distFromPlayer);
msg.Coordinate_H = destination.Z;
msg.Heading = getHeading();
msg.CharacterMirrorRow = _EntityRowId;
- msg.PetSheetId = _PlayerPets[index].PetSheetId;
+ msg.PetSheetId = _PlayerPets[ index ].PetSheetId;
msg.PetIdx = index;
msg.Cell = destination.Cell;
_PlayerPets[index].Cell = destination.Cell;
msg.CustomName = _PlayerPets[index].CustomName;
msg.AIInstanceId = (uint16)destAIInstance;
- CWorldInstances::instance().msgToAIInstance(msg.AIInstanceId, msg);
+ CWorldInstances::instance().msgToAIInstance( msg.AIInstanceId, msg);
// The row will be received in AnimalSpawned()
+
return true;
}
+
//-----------------------------------------------
// CCharacter::spawnCharacterAnimal want spawn one of own creature
//-----------------------------------------------
-bool CCharacter::spawnCharacterAnimal(uint index)
+bool CCharacter::spawnCharacterAnimal(uint index )
{
- if (index == 255)
+ if( index == 255 )
{
bool returnValue = true;
-
- for (uint i = 0; i < _PlayerPets.size(); ++i)
+ for( uint i = 0; i < _PlayerPets.size(); ++i )
{
- if (_PlayerPets[i].PetStatus != CPetAnimal::not_present)
+ if( _PlayerPets[ i ].PetStatus != CPetAnimal::not_present )
{
- if (!TheDataset.isAccessible(_PlayerPets[i].SpawnedPets))
+ if( !TheDataset.isAccessible( _PlayerPets[ i ].SpawnedPets ) )
{
- returnValue &= spawnCharacterAnimal(i);
+ returnValue &= spawnCharacterAnimal( i );
}
}
}
-
return returnValue;
}
-
TDataSetRow dsr = getEntityRowId();
CMirrorPropValueRO srcCell(TheDataset, dsr, DSPropertyCELL);
sint32 cell;
@@ -6412,10 +6016,9 @@ bool CCharacter::spawnCharacterAnimal(uint index)
if (index < _PlayerPets.size())
{
- if (!TheDataset.isAccessible(_PlayerPets[index].SpawnedPets))
+ if( !TheDataset.isAccessible(_PlayerPets[ index ].SpawnedPets) )
{
CPetSpawnMsg msg;
-
switch (_PlayerPets[index].PetStatus)
{
case CPetAnimal::waiting_spawn: // see also spawnWaitingCharacterAnimalNear()
@@ -6428,7 +6031,6 @@ bool CCharacter::spawnCharacterAnimal(uint index)
msg.Heading = 0.0f;
break;
-
case CPetAnimal::death:
if ((_PlayerPets[index].DeathTick + 3 * 24 * 36000 < CTickEventHandler::getGameCycle()))
{
@@ -6439,7 +6041,6 @@ bool CCharacter::spawnCharacterAnimal(uint index)
{
updateAnimalDespawnDb(index);
}
-
// same as landscape if come here, so it's normal we haven't break here !
case CPetAnimal::landscape:
msg.SpawnMode = CPetSpawnMsg::NEAR_POINT;
@@ -6449,20 +6050,17 @@ bool CCharacter::spawnCharacterAnimal(uint index)
msg.Heading = 0.0f;
msg.Cell = 0;
break;
-
case CPetAnimal::stable:
+
if (_PlayerPets[index].StableId != _CurrentStable)
{
- nlwarning(" Received spawn message for animal in stable "
- "(index:%d) but player is not near the animal stable",
- index);
+ nlwarning(" Received spawn message for animal in stable (index:%d) but player is not near the animal stable", index);
return false;
}
msg.SpawnMode = CPetSpawnMsg::NEAR_POINT;
{
CStable::TStableData stable;
-
if (CStable::getInstance()->getStableData(_CurrentStable, stable))
{
msg.Coordinate_X = stable.StableExitX;
@@ -6472,8 +6070,7 @@ bool CCharacter::spawnCharacterAnimal(uint index)
}
else
{
- nlwarning("