mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +00:00
Merge branch 'master' into 303
Conflicts: src/game/Creature.cpp
This commit is contained in:
commit
af6acab8f8
23 changed files with 288 additions and 129 deletions
|
|
@ -46,6 +46,7 @@
|
||||||
# define MANGOS_IMPORT __cdecl
|
# define MANGOS_IMPORT __cdecl
|
||||||
# define MANGOS_SCRIPT_EXT ".dll"
|
# define MANGOS_SCRIPT_EXT ".dll"
|
||||||
# define MANGOS_SCRIPT_NAME "MaNGOSScript"
|
# define MANGOS_SCRIPT_NAME "MaNGOSScript"
|
||||||
|
# define MANGOS_PATH_MAX MAX_PATH
|
||||||
#else //PLATFORM != PLATFORM_WINDOWS
|
#else //PLATFORM != PLATFORM_WINDOWS
|
||||||
# define MANGOS_LIBRARY_HANDLE void*
|
# define MANGOS_LIBRARY_HANDLE void*
|
||||||
# define MANGOS_EXPORT export
|
# define MANGOS_EXPORT export
|
||||||
|
|
@ -59,6 +60,7 @@
|
||||||
# endif //__APPLE_CC__ && BIG_ENDIAN
|
# endif //__APPLE_CC__ && BIG_ENDIAN
|
||||||
# define MANGOS_SCRIPT_EXT ".so"
|
# define MANGOS_SCRIPT_EXT ".so"
|
||||||
# define MANGOS_SCRIPT_NAME "libmangosscript"
|
# define MANGOS_SCRIPT_NAME "libmangosscript"
|
||||||
|
# define MANGOS_PATH_MAX PATH_MAX
|
||||||
#endif //PLATFORM
|
#endif //PLATFORM
|
||||||
|
|
||||||
#if PLATFORM == PLATFORM_WINDOWS
|
#if PLATFORM == PLATFORM_WINDOWS
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
||||||
|
|
||||||
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
|
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
|
||||||
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount());
|
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
||||||
++j;
|
++j;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plr->isAlive() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
|
if (plr->isAllowUseBattleGroundObject() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
|
||||||
{
|
{
|
||||||
//player joined point!
|
//player joined point!
|
||||||
//show progress bar
|
//show progress bar
|
||||||
|
|
@ -216,7 +216,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||||
++j;
|
++j;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!plr->isAlive() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
|
if (!plr->isAllowUseBattleGroundObject() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
|
||||||
//move player out of point (add him to players that are out of points
|
//move player out of point (add him to players that are out of points
|
||||||
{
|
{
|
||||||
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
|
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
|
||||||
|
|
|
||||||
|
|
@ -756,7 +756,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, st
|
||||||
{
|
{
|
||||||
Player* p = m_session->GetPlayer();
|
Player* p = m_session->GetPlayer();
|
||||||
uint64 sel_guid = p->GetSelection();
|
uint64 sel_guid = p->GetSelection();
|
||||||
sLog.outCommand("Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]",
|
sLog.outCommand(m_session->GetAccountId(),"Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]",
|
||||||
fullcmd.c_str(),p->GetName(),m_session->GetAccountId(),p->GetPositionX(),p->GetPositionY(),p->GetPositionZ(),p->GetMapId(),
|
fullcmd.c_str(),p->GetName(),m_session->GetAccountId(),p->GetPositionX(),p->GetPositionY(),p->GetPositionZ(),p->GetMapId(),
|
||||||
GetLogNameForGuid(sel_guid),GUID_LOPART(sel_guid));
|
GetLogNameForGuid(sel_guid),GUID_LOPART(sel_guid));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,27 @@ VendorItem const* VendorItemData::FindItem(uint32 item_id) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
|
{
|
||||||
|
Unit* victim = Unit::GetUnit(m_owner, m_victim);
|
||||||
|
if (victim)
|
||||||
|
{
|
||||||
|
while (!m_assistants.empty())
|
||||||
|
{
|
||||||
|
Creature* assistant = (Creature*)Unit::GetUnit(m_owner, *m_assistants.begin());
|
||||||
|
m_assistants.pop_front();
|
||||||
|
|
||||||
|
if (assistant && assistant->CanAssistTo(&m_owner, victim))
|
||||||
|
{
|
||||||
|
assistant->SetNoCallAssistance(true);
|
||||||
|
if(assistant->AI())
|
||||||
|
assistant->AI()->AttackStart(victim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Creature::Creature() :
|
Creature::Creature() :
|
||||||
Unit(), i_AI(NULL),
|
Unit(), i_AI(NULL),
|
||||||
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
|
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
|
||||||
|
|
@ -98,7 +119,7 @@ m_lootMoney(0), m_lootRecipient(0),
|
||||||
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
|
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
|
||||||
m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_isVehicle(false),
|
m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_isVehicle(false),
|
||||||
m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
|
m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
|
||||||
m_AlreadyCallAssistence(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
|
m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
|
||||||
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0)
|
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0)
|
||||||
{
|
{
|
||||||
m_regenTimer = 200;
|
m_regenTimer = 200;
|
||||||
|
|
@ -1659,13 +1680,13 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::CallAssistence()
|
void Creature::CallAssistance()
|
||||||
{
|
{
|
||||||
if( !m_AlreadyCallAssistence && getVictim() && !isPet() && !isCharmed())
|
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
|
||||||
{
|
{
|
||||||
SetNoCallAssistence(true);
|
SetNoCallAssistance(true);
|
||||||
|
|
||||||
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS);
|
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
|
||||||
if(radius > 0)
|
if(radius > 0)
|
||||||
{
|
{
|
||||||
std::list<Creature*> assistList;
|
std::list<Creature*> assistList;
|
||||||
|
|
@ -1685,16 +1706,46 @@ void Creature::CallAssistence()
|
||||||
cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap());
|
cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
|
if (!assistList.empty())
|
||||||
{
|
{
|
||||||
(*iter)->SetNoCallAssistence(true);
|
AssistDelayEvent *e = new AssistDelayEvent(getVictim()->GetGUID(), *this);
|
||||||
if((*iter)->AI())
|
while (!assistList.empty())
|
||||||
(*iter)->AI()->AttackStart(getVictim());
|
{
|
||||||
|
// Pushing guids because in delay can happen some creature gets despawned => invalid pointer
|
||||||
|
e->AddAssistant((*assistList.begin())->GetGUID());
|
||||||
|
assistList.pop_front();
|
||||||
|
}
|
||||||
|
m_Events.AddEvent(e, m_Events.CalculateTime(sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy) const
|
||||||
|
{
|
||||||
|
// we don't need help from zombies :)
|
||||||
|
if( !isAlive() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// skip fighting creature
|
||||||
|
if( isInCombat() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// only from same creature faction
|
||||||
|
if(getFaction() != u->getFaction() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// only free creature
|
||||||
|
if( GetCharmerOrOwnerGUID() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// skip non hostile to caster enemy creatures
|
||||||
|
if( !IsHostileTo(enemy) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Creature::SaveRespawnTime()
|
void Creature::SaveRespawnTime()
|
||||||
{
|
{
|
||||||
if(isPet() || !m_DBTableGuid)
|
if(isPet() || !m_DBTableGuid)
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
struct SpellEntry;
|
struct SpellEntry;
|
||||||
|
|
||||||
class CreatureAI;
|
class CreatureAI;
|
||||||
|
|
@ -544,8 +546,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
|
|
||||||
float GetAttackDistance(Unit const* pl) const;
|
float GetAttackDistance(Unit const* pl) const;
|
||||||
|
|
||||||
void CallAssistence();
|
void CallAssistance();
|
||||||
void SetNoCallAssistence(bool val) { m_AlreadyCallAssistence = val; }
|
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
|
||||||
|
bool CanAssistTo(const Unit* u, const Unit* enemy) const;
|
||||||
|
|
||||||
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
||||||
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
||||||
|
|
@ -630,7 +633,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
|
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
|
||||||
uint32 m_equipmentId;
|
uint32 m_equipmentId;
|
||||||
|
|
||||||
bool m_AlreadyCallAssistence;
|
bool m_AlreadyCallAssistance;
|
||||||
bool m_regenHealth;
|
bool m_regenHealth;
|
||||||
bool m_AI_locked;
|
bool m_AI_locked;
|
||||||
bool m_isDeadByDefault;
|
bool m_isDeadByDefault;
|
||||||
|
|
@ -645,4 +648,20 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
GridReference<Creature> m_gridRef;
|
GridReference<Creature> m_gridRef;
|
||||||
CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AssistDelayEvent : public BasicEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AssistDelayEvent(const uint64& victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
|
||||||
|
|
||||||
|
bool Execute(uint64 e_time, uint32 p_time);
|
||||||
|
void AddAssistant(const uint64& guid) { m_assistants.push_back(guid); }
|
||||||
|
private:
|
||||||
|
AssistDelayEvent();
|
||||||
|
|
||||||
|
uint64 m_victim;
|
||||||
|
std::list<uint64> m_assistants;
|
||||||
|
Unit& m_owner;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -721,32 +721,15 @@ namespace MaNGOS
|
||||||
if(u == i_funit)
|
if(u == i_funit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// we don't need help from zombies :)
|
if ( !u->CanAssistTo(i_funit, i_enemy) )
|
||||||
if( !u->isAlive() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// skip fighting creature
|
|
||||||
if( u->isInCombat() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// only from same creature faction
|
|
||||||
if(u->getFaction() != i_funit->getFaction() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// only free creature
|
|
||||||
if( u->GetCharmerOrOwnerGUID() )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// too far
|
// too far
|
||||||
if( !i_funit->IsWithinDistInMap(u, i_range) )
|
if( !i_funit->IsWithinDistInMap(u, i_range) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// skip non hostile to caster enemy creatures
|
|
||||||
if( !u->IsHostileTo(i_enemy) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// only if see assisted creature
|
// only if see assisted creature
|
||||||
if(!u->IsWithinLOSInMap(i_funit) )
|
if( !i_funit->IsWithinLOSInMap(u) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -984,7 +984,7 @@ void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data )
|
||||||
// logging money
|
// logging money
|
||||||
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId);
|
_player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1378,7 +1378,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
|
||||||
// logging item move to bank
|
// logging item move to bank
|
||||||
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),
|
_player->GetName(),_player->GetSession()->GetAccountId(),
|
||||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
||||||
GuildId);
|
GuildId);
|
||||||
|
|
@ -1447,7 +1447,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
|
||||||
// logging item move to bank (before items merge
|
// logging item move to bank (before items merge
|
||||||
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),
|
_player->GetName(),_player->GetSession()->GetAccountId(),
|
||||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),SplitedAmount,GuildId);
|
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),SplitedAmount,GuildId);
|
||||||
}
|
}
|
||||||
|
|
@ -1473,7 +1473,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
|
||||||
// logging item move to bank
|
// logging item move to bank
|
||||||
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),
|
_player->GetName(),_player->GetSession()->GetAccountId(),
|
||||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
||||||
GuildId);
|
GuildId);
|
||||||
|
|
@ -1523,7 +1523,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
|
||||||
// logging item move to bank
|
// logging item move to bank
|
||||||
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u )",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),
|
_player->GetName(),_player->GetSession()->GetAccountId(),
|
||||||
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
|
||||||
GuildId);
|
GuildId);
|
||||||
|
|
|
||||||
|
|
@ -5592,9 +5592,23 @@ bool ChatHandler::HandleWritePDumpCommand(const char *args)
|
||||||
if(!file || !p2)
|
if(!file || !p2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 guid = objmgr.GetPlayerGUIDByName(p2);
|
uint32 guid;
|
||||||
if(!guid)
|
// character name can't start from number
|
||||||
|
if (isNumeric(p2[0]))
|
||||||
guid = atoi(p2);
|
guid = atoi(p2);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string name = p2;
|
||||||
|
|
||||||
|
if (!normalizePlayerName (name))
|
||||||
|
{
|
||||||
|
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage (true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
if(!objmgr.GetPlayerAccountIdByGUID(guid))
|
if(!objmgr.GetPlayerAccountIdByGUID(guid))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||||
|
|
||||||
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
|
sLog.outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
|
||||||
GetPlayerName(), GetAccountId(), mailItem.item->GetProto()->Name1, mailItem.item->GetEntry(), mailItem.item->GetCount(), receiver.c_str(), rc_account);
|
GetPlayerName(), GetAccountId(), mailItem.item->GetProto()->Name1, mailItem.item->GetEntry(), mailItem.item->GetCount(), receiver.c_str(), rc_account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,7 +249,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||||
|
|
||||||
if(money > 0 && GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(money > 0 && GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
sLog.outCommand("GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
|
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
|
||||||
GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account);
|
GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -458,7 +458,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data )
|
||||||
if(!objmgr.GetPlayerNameByGUID(sender_guid,sender_name))
|
if(!objmgr.GetPlayerNameByGUID(sender_guid,sender_name))
|
||||||
sender_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
sender_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||||
}
|
}
|
||||||
sLog.outCommand("GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
|
sLog.outCommand(GetAccountId(),"GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
|
||||||
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount(),m->COD,sender_name.c_str(),sender_accId);
|
GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount(),m->COD,sender_name.c_str(),sender_accId);
|
||||||
}
|
}
|
||||||
else if(!receive)
|
else if(!receive)
|
||||||
|
|
|
||||||
|
|
@ -1338,14 +1338,12 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(charname.empty())
|
if(charname.empty() || !normalizePlayerName (charname))
|
||||||
{
|
{
|
||||||
SendNotification(LANG_NEED_CHARACTER_NAME);
|
SendNotification(LANG_NEED_CHARACTER_NAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizePlayerName (charname);
|
|
||||||
|
|
||||||
Player *plr = objmgr.GetPlayer(charname.c_str());
|
Player *plr = objmgr.GetPlayer(charname.c_str());
|
||||||
|
|
||||||
if(!plr)
|
if(!plr)
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
|
||||||
|
|
||||||
uint32 owner_accid = GetPlayerAccountIdByGUID(auction->owner);
|
uint32 owner_accid = GetPlayerAccountIdByGUID(auction->owner);
|
||||||
|
|
||||||
sLog.outCommand("GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
||||||
bidder_name.c_str(),bidder_accId,pItem->GetProto()->Name1,pItem->GetEntry(),pItem->GetCount(),auction->bid,owner_name.c_str(),owner_accid);
|
bidder_name.c_str(),bidder_accId,pItem->GetProto()->Name1,pItem->GetEntry(),pItem->GetCount(),auction->bid,owner_name.c_str(),owner_accid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11908,7 +11908,7 @@ void Player::SendPreparedQuest( uint64 guid )
|
||||||
else if( status == DIALOG_STATUS_INCOMPLETE )
|
else if( status == DIALOG_STATUS_INCOMPLETE )
|
||||||
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, false, true );
|
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, false, true );
|
||||||
// Send completable on repeatable quest if player don't have quest
|
// Send completable on repeatable quest if player don't have quest
|
||||||
else if( pQuest->IsRepeatable() )
|
else if( pQuest->IsRepeatable() && !pQuest->IsDaily() )
|
||||||
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanCompleteRepeatableQuest(pQuest), true );
|
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanCompleteRepeatableQuest(pQuest), true );
|
||||||
else
|
else
|
||||||
PlayerTalkClass->SendQuestGiverQuestDetails( pQuest, guid, true );
|
PlayerTalkClass->SendQuestGiverQuestDetails( pQuest, guid, true );
|
||||||
|
|
@ -12150,7 +12150,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg )
|
||||||
if(!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE)
|
if(!pQuest->IsAutoComplete() && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// daily quest can't be rewarded (10 daily quest already completed)
|
// daily quest can't be rewarded (25 daily quest already completed)
|
||||||
if(!SatisfyQuestDay(pQuest,true))
|
if(!SatisfyQuestDay(pQuest,true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -12756,6 +12756,15 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
|
||||||
if(exclude_Id == qInfo->GetQuestId())
|
if(exclude_Id == qInfo->GetQuestId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// not allow have daily quest if daily quest from exclusive group already recently completed
|
||||||
|
Quest const* Nquest = objmgr.GetQuestTemplate(exclude_Id);
|
||||||
|
if( !SatisfyQuestDay(Nquest, false) )
|
||||||
|
{
|
||||||
|
if( msg )
|
||||||
|
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id );
|
QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id );
|
||||||
|
|
||||||
// alternative quest already started or completed
|
// alternative quest already started or completed
|
||||||
|
|
@ -14596,7 +14605,8 @@ void Player::_LoadQuestStatus(QueryResult *result)
|
||||||
// add to quest log
|
// add to quest log
|
||||||
if( slot < MAX_QUEST_LOG_SIZE &&
|
if( slot < MAX_QUEST_LOG_SIZE &&
|
||||||
( questStatusData.m_status==QUEST_STATUS_INCOMPLETE ||
|
( questStatusData.m_status==QUEST_STATUS_INCOMPLETE ||
|
||||||
questStatusData.m_status==QUEST_STATUS_COMPLETE && !questStatusData.m_rewarded ) )
|
questStatusData.m_status==QUEST_STATUS_COMPLETE &&
|
||||||
|
(!questStatusData.m_rewarded || pQuest->IsDaily()) ) )
|
||||||
{
|
{
|
||||||
SetQuestSlot(slot,quest_id,quest_time);
|
SetQuestSlot(slot,quest_id,quest_time);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3735,10 +3735,12 @@ void Spell::EffectEnchantItemPerm(uint32 i)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
||||||
sLog.outCommand("GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
|
{
|
||||||
|
sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)",
|
||||||
p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
|
p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
|
||||||
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
|
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
|
||||||
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
|
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
|
||||||
|
}
|
||||||
|
|
||||||
// remove old enchanting before applying new if equipped
|
// remove old enchanting before applying new if equipped
|
||||||
item_owner->ApplyEnchantment(itemTarget,PERM_ENCHANTMENT_SLOT,false);
|
item_owner->ApplyEnchantment(itemTarget,PERM_ENCHANTMENT_SLOT,false);
|
||||||
|
|
@ -3864,10 +3866,12 @@ void Spell::EffectEnchantItemTmp(uint32 i)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
||||||
sLog.outCommand("GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
|
{
|
||||||
|
sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)",
|
||||||
p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
|
p_caster->GetName(),p_caster->GetSession()->GetAccountId(),
|
||||||
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
|
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
|
||||||
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
|
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
|
||||||
|
}
|
||||||
|
|
||||||
// remove old enchanting before applying new if equipped
|
// remove old enchanting before applying new if equipped
|
||||||
item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false);
|
item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false);
|
||||||
|
|
|
||||||
|
|
@ -193,10 +193,12 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||||
// logging
|
// logging
|
||||||
sLog.outDebug("partner storing: %u",myItems[i]->GetGUIDLow());
|
sLog.outDebug("partner storing: %u",myItems[i]->GetGUIDLow());
|
||||||
if( _player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
if( _player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
||||||
sLog.outCommand("GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
|
{
|
||||||
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),
|
_player->GetName(),_player->GetSession()->GetAccountId(),
|
||||||
myItems[i]->GetProto()->Name1,myItems[i]->GetEntry(),myItems[i]->GetCount(),
|
myItems[i]->GetProto()->Name1,myItems[i]->GetEntry(),myItems[i]->GetCount(),
|
||||||
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
|
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
|
||||||
|
}
|
||||||
|
|
||||||
// store
|
// store
|
||||||
_player->pTrader->MoveItemToInventory( traderDst, myItems[i], true, true);
|
_player->pTrader->MoveItemToInventory( traderDst, myItems[i], true, true);
|
||||||
|
|
@ -206,10 +208,12 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||||
// logging
|
// logging
|
||||||
sLog.outDebug("player storing: %u",hisItems[i]->GetGUIDLow());
|
sLog.outDebug("player storing: %u",hisItems[i]->GetGUIDLow());
|
||||||
if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) )
|
||||||
sLog.outCommand("GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
|
{
|
||||||
|
sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)",
|
||||||
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
|
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
|
||||||
hisItems[i]->GetProto()->Name1,hisItems[i]->GetEntry(),hisItems[i]->GetCount(),
|
hisItems[i]->GetProto()->Name1,hisItems[i]->GetEntry(),hisItems[i]->GetCount(),
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId());
|
_player->GetName(),_player->GetSession()->GetAccountId());
|
||||||
|
}
|
||||||
|
|
||||||
// store
|
// store
|
||||||
_player->MoveItemToInventory( playerDst, hisItems[i], true, true);
|
_player->MoveItemToInventory( playerDst, hisItems[i], true, true);
|
||||||
|
|
@ -376,15 +380,19 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||||
if(sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
if(sWorld.getConfig(CONFIG_GM_LOG_TRADE))
|
||||||
{
|
{
|
||||||
if( _player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0)
|
if( _player->GetSession()->GetSecurity() > SEC_PLAYER && _player->tradeGold > 0)
|
||||||
sLog.outCommand("GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
|
{
|
||||||
|
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId(),
|
_player->GetName(),_player->GetSession()->GetAccountId(),
|
||||||
_player->tradeGold,
|
_player->tradeGold,
|
||||||
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
|
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
|
||||||
|
}
|
||||||
if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0)
|
if( _player->pTrader->GetSession()->GetSecurity() > SEC_PLAYER && _player->pTrader->tradeGold > 0)
|
||||||
sLog.outCommand("GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
|
{
|
||||||
|
sLog.outCommand(_player->pTrader->GetSession()->GetAccountId(),"GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
|
||||||
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
|
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId(),
|
||||||
_player->pTrader->tradeGold,
|
_player->pTrader->tradeGold,
|
||||||
_player->GetName(),_player->GetSession()->GetAccountId());
|
_player->GetName(),_player->GetSession()->GetAccountId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update money
|
// update money
|
||||||
|
|
|
||||||
|
|
@ -6951,7 +6951,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
data << uint32(AI_REACTION_AGGRO); // Aggro sound
|
data << uint32(AI_REACTION_AGGRO); // Aggro sound
|
||||||
((WorldObject*)this)->SendMessageToSet(&data, true);
|
((WorldObject*)this)->SendMessageToSet(&data, true);
|
||||||
|
|
||||||
((Creature*)this)->CallAssistence();
|
((Creature*)this)->CallAssistance();
|
||||||
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6985,7 +6985,7 @@ bool Unit::AttackStop()
|
||||||
if( GetTypeId()==TYPEID_UNIT )
|
if( GetTypeId()==TYPEID_UNIT )
|
||||||
{
|
{
|
||||||
// reset call assistance
|
// reset call assistance
|
||||||
((Creature*)this)->SetNoCallAssistence(false);
|
((Creature*)this)->SetNoCallAssistance(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendAttackStop(victim);
|
SendAttackStop(victim);
|
||||||
|
|
|
||||||
|
|
@ -757,7 +757,8 @@ void World::LoadConfigSettings(bool reload)
|
||||||
|
|
||||||
m_configs[CONFIG_EVENT_ANNOUNCE] = sConfig.GetIntDefault("Event.Announce",0);
|
m_configs[CONFIG_EVENT_ANNOUNCE] = sConfig.GetIntDefault("Event.Announce",0);
|
||||||
|
|
||||||
m_configs[CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS] = sConfig.GetIntDefault("CreatureFamilyAssistenceRadius",10);
|
m_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = sConfig.GetIntDefault("CreatureFamilyAssistanceRadius",10);
|
||||||
|
m_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY] = sConfig.GetIntDefault("CreatureFamilyAssistanceDelay",1500);
|
||||||
|
|
||||||
m_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfig.GetIntDefault("WorldBossLevelDiff",3);
|
m_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfig.GetIntDefault("WorldBossLevelDiff",3);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,8 @@ enum WorldConfigs
|
||||||
CONFIG_CHATFLOOD_MESSAGE_DELAY,
|
CONFIG_CHATFLOOD_MESSAGE_DELAY,
|
||||||
CONFIG_CHATFLOOD_MUTE_TIME,
|
CONFIG_CHATFLOOD_MUTE_TIME,
|
||||||
CONFIG_EVENT_ANNOUNCE,
|
CONFIG_EVENT_ANNOUNCE,
|
||||||
CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS,
|
CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS,
|
||||||
|
CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY,
|
||||||
CONFIG_WORLD_BOSS_LEVEL_DIFF,
|
CONFIG_WORLD_BOSS_LEVEL_DIFF,
|
||||||
CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF,
|
CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF,
|
||||||
CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF,
|
CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF,
|
||||||
|
|
|
||||||
|
|
@ -252,14 +252,21 @@ AddonChannel = 1
|
||||||
# 1 - include dumping chars to log
|
# 1 - include dumping chars to log
|
||||||
#
|
#
|
||||||
# GmLogFile
|
# GmLogFile
|
||||||
# Log file of gm commands
|
# GM Log file of gm commands
|
||||||
# Default: "" (Disable)
|
# Default: "" (Disable)
|
||||||
#
|
#
|
||||||
# GmLogTimestamp
|
# GmLogTimestamp
|
||||||
# Logfile with timestamp of server start in name
|
# GM Logfile with timestamp of server start in name
|
||||||
# Default: 0 - no timestamp in name
|
# Default: 0 - no timestamp in name
|
||||||
# 1 - add timestamp in name in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
|
# 1 - add timestamp in name in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
|
||||||
#
|
#
|
||||||
|
# GmLogPerAccount
|
||||||
|
# GM Logfiles with GM account id (Note: logs not created if GmLogFile not set)
|
||||||
|
# Default: 0 - add gm log data to single log file
|
||||||
|
# 1 - add gm log data to account specific log files with name
|
||||||
|
# in form Logname_#ID_YYYY-MM-DD_HH-MM-SS.Ext
|
||||||
|
# or form Logname_#ID.Ext
|
||||||
|
#
|
||||||
# RaLogFile
|
# RaLogFile
|
||||||
# Log file of RA commands
|
# Log file of RA commands
|
||||||
# Default: "Ra.log"
|
# Default: "Ra.log"
|
||||||
|
|
@ -291,6 +298,7 @@ CharLogTimestamp = 0
|
||||||
CharLogDump = 0
|
CharLogDump = 0
|
||||||
GmLogFile = ""
|
GmLogFile = ""
|
||||||
GmLogTimestamp = 0
|
GmLogTimestamp = 0
|
||||||
|
GmLogPerAccount = 0
|
||||||
RaLogFile = ""
|
RaLogFile = ""
|
||||||
LogColors = ""
|
LogColors = ""
|
||||||
|
|
||||||
|
|
@ -613,11 +621,15 @@ TalentsInspecting = 1
|
||||||
# 1.5 - 150%
|
# 1.5 - 150%
|
||||||
# 0 - off (0%)
|
# 0 - off (0%)
|
||||||
#
|
#
|
||||||
# CreatureFamilyAssistenceRadius
|
# CreatureFamilyAssistanceRadius
|
||||||
# Creature family assistence radius
|
# Creature family assistance radius
|
||||||
# Default: 10
|
# Default: 10
|
||||||
# 0 - off
|
# 0 - off
|
||||||
#
|
#
|
||||||
|
# CreatureFamilyAssistanceDelay
|
||||||
|
# Reaction time for creature assistance call
|
||||||
|
# Default: 1500 (1.5s)
|
||||||
|
#
|
||||||
# WorldBossLevelDiff
|
# WorldBossLevelDiff
|
||||||
# Difference for boss dynamic level with target
|
# Difference for boss dynamic level with target
|
||||||
# Default: 3
|
# Default: 3
|
||||||
|
|
@ -674,7 +686,8 @@ TalentsInspecting = 1
|
||||||
|
|
||||||
ThreatRadius = 100
|
ThreatRadius = 100
|
||||||
Rate.Creature.Aggro = 1
|
Rate.Creature.Aggro = 1
|
||||||
CreatureFamilyAssistenceRadius = 10
|
CreatureFamilyAssistanceRadius = 10
|
||||||
|
CreatureFamilyAssistanceDelay = 1500
|
||||||
WorldBossLevelDiff = 3
|
WorldBossLevelDiff = 3
|
||||||
Corpse.Decay.NORMAL = 60
|
Corpse.Decay.NORMAL = 60
|
||||||
Corpse.Decay.RARE = 300
|
Corpse.Decay.RARE = 300
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,13 @@ enum LogType
|
||||||
|
|
||||||
const int LogType_count = int(LogError) +1;
|
const int LogType_count = int(LogError) +1;
|
||||||
|
|
||||||
|
Log::Log() :
|
||||||
|
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
|
||||||
|
dberLogfile(NULL), m_colored(false), m_includeTime(false), m_gmlog_per_account(false)
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
void Log::InitColors(std::string str)
|
void Log::InitColors(std::string str)
|
||||||
{
|
{
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
|
|
@ -173,73 +180,56 @@ void Log::SetLogFileLevel(char *Level)
|
||||||
|
|
||||||
void Log::Initialize()
|
void Log::Initialize()
|
||||||
{
|
{
|
||||||
std::string logsDir = sConfig.GetStringDefault("LogsDir","");
|
/// Common log files data
|
||||||
|
m_logsDir = sConfig.GetStringDefault("LogsDir","");
|
||||||
if(!logsDir.empty())
|
if(!m_logsDir.empty())
|
||||||
{
|
{
|
||||||
if((logsDir.at(logsDir.length()-1)!='/') && (logsDir.at(logsDir.length()-1)!='\\'))
|
if((m_logsDir.at(m_logsDir.length()-1)!='/') && (m_logsDir.at(m_logsDir.length()-1)!='\\'))
|
||||||
logsDir.append("/");
|
m_logsDir.append("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string logfn=sConfig.GetStringDefault("LogFile", "");
|
m_logsTimestamp = "_" + GetTimestampStr();
|
||||||
if(!logfn.empty())
|
|
||||||
|
/// Open specific log files
|
||||||
|
logfile = openLogFile("LogFile","LogTimestamp","w");
|
||||||
|
|
||||||
|
m_gmlog_per_account = sConfig.GetBoolDefault("GmLogPerAccount",false);
|
||||||
|
if(!m_gmlog_per_account)
|
||||||
|
gmLogfile = openLogFile("GMLogFile","GmLogTimestamp","a");
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if(sConfig.GetBoolDefault("LogTimestamp",false))
|
// GM log settings for per account case
|
||||||
|
m_gmlog_filename_format = sConfig.GetStringDefault("GMLogFile", "");
|
||||||
|
if(!m_gmlog_filename_format.empty())
|
||||||
{
|
{
|
||||||
std::string logTimestamp = GetTimestampStr();
|
bool m_gmlog_timestamp = sConfig.GetBoolDefault("GmLogTimestamp",false);
|
||||||
logTimestamp.insert(0,"_");
|
|
||||||
size_t dot_pos = logfn.find_last_of(".");
|
size_t dot_pos = m_gmlog_filename_format.find_last_of(".");
|
||||||
if(dot_pos!=logfn.npos)
|
if(dot_pos!=m_gmlog_filename_format.npos)
|
||||||
logfn.insert(dot_pos,logTimestamp);
|
{
|
||||||
|
if(m_gmlog_timestamp)
|
||||||
|
m_gmlog_filename_format.insert(dot_pos,m_logsTimestamp);
|
||||||
|
|
||||||
|
m_gmlog_filename_format.insert(dot_pos,"_#%u");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
logfn += logTimestamp;
|
{
|
||||||
|
m_gmlog_filename_format += "_#%u";
|
||||||
|
|
||||||
|
if(m_gmlog_timestamp)
|
||||||
|
m_gmlog_filename_format += m_logsTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
logfile = fopen((logsDir+logfn).c_str(), "w");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string gmlogname = sConfig.GetStringDefault("GMLogFile", "");
|
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
|
||||||
if(!gmlogname.empty())
|
|
||||||
{
|
|
||||||
if(sConfig.GetBoolDefault("GmLogTimestamp",false))
|
|
||||||
{
|
|
||||||
std::string gmLogTimestamp = GetTimestampStr();
|
|
||||||
gmLogTimestamp.insert(0,"_");
|
|
||||||
size_t dot_pos = gmlogname.find_last_of(".");
|
|
||||||
if(dot_pos!=gmlogname.npos)
|
|
||||||
gmlogname.insert(dot_pos,gmLogTimestamp);
|
|
||||||
else
|
|
||||||
gmlogname += gmLogTimestamp;
|
|
||||||
}
|
|
||||||
gmLogfile = fopen((logsDir+gmlogname).c_str(), "a");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string charlogname = sConfig.GetStringDefault("CharLogFile", "");
|
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
|
||||||
if(!charlogname.empty())
|
raLogfile = openLogFile("RaLogFile",NULL,"a");
|
||||||
{
|
|
||||||
if(sConfig.GetBoolDefault("CharLogTimestamp",false))
|
|
||||||
{
|
|
||||||
std::string charLogTimestamp = GetTimestampStr();
|
|
||||||
charLogTimestamp.insert(0,"_");
|
|
||||||
size_t dot_pos = charlogname.find_last_of(".");
|
|
||||||
if(dot_pos!=charlogname.npos)
|
|
||||||
charlogname.insert(dot_pos,charLogTimestamp);
|
|
||||||
else
|
|
||||||
charlogname += charLogTimestamp;
|
|
||||||
}
|
|
||||||
charLogfile = fopen((logsDir+charlogname).c_str(), "a");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string dberlogname = sConfig.GetStringDefault("DBErrorLogFile", "");
|
// Main log file settings
|
||||||
if(!dberlogname.empty())
|
|
||||||
{
|
|
||||||
dberLogfile = fopen((logsDir+dberlogname).c_str(), "a");
|
|
||||||
}
|
|
||||||
std::string ralogname = sConfig.GetStringDefault("RaLogFile", "");
|
|
||||||
if(!ralogname.empty())
|
|
||||||
{
|
|
||||||
raLogfile = fopen((logsDir+ralogname).c_str(), "a");
|
|
||||||
}
|
|
||||||
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
|
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
|
||||||
m_logLevel = sConfig.GetIntDefault("LogLevel", 0);
|
m_logLevel = sConfig.GetIntDefault("LogLevel", 0);
|
||||||
m_logFileLevel = sConfig.GetIntDefault("LogFileLevel", 0);
|
m_logFileLevel = sConfig.GetIntDefault("LogFileLevel", 0);
|
||||||
|
|
@ -254,9 +244,38 @@ void Log::Initialize()
|
||||||
if(sConfig.GetBoolDefault("LogFilter_VisibilityChanges", true))
|
if(sConfig.GetBoolDefault("LogFilter_VisibilityChanges", true))
|
||||||
m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES;
|
m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES;
|
||||||
|
|
||||||
|
// Char log settings
|
||||||
m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false);
|
m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FILE* Log::openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode)
|
||||||
|
{
|
||||||
|
std::string logfn=sConfig.GetStringDefault(configFileName, "");
|
||||||
|
if(logfn.empty())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(configTimeStampFlag && sConfig.GetBoolDefault(configTimeStampFlag,false))
|
||||||
|
{
|
||||||
|
size_t dot_pos = logfn.find_last_of(".");
|
||||||
|
if(dot_pos!=logfn.npos)
|
||||||
|
logfn.insert(dot_pos,m_logsTimestamp);
|
||||||
|
else
|
||||||
|
logfn += m_logsTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fopen((m_logsDir+logfn).c_str(), mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE* Log::openGmlogPerAccount(uint32 account)
|
||||||
|
{
|
||||||
|
if(m_gmlog_filename_format.empty())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
char namebuf[MANGOS_PATH_MAX];
|
||||||
|
snprintf(namebuf,MANGOS_PATH_MAX,m_gmlog_filename_format.c_str(),account);
|
||||||
|
return fopen(namebuf, "a");
|
||||||
|
}
|
||||||
|
|
||||||
void Log::outTimestamp(FILE* file)
|
void Log::outTimestamp(FILE* file)
|
||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
|
|
@ -575,7 +594,7 @@ void Log::outDebug( const char * str, ... )
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::outCommand( const char * str, ... )
|
void Log::outCommand( uint32 account, const char * str, ... )
|
||||||
{
|
{
|
||||||
if( !str )
|
if( !str )
|
||||||
return;
|
return;
|
||||||
|
|
@ -605,7 +624,21 @@ void Log::outCommand( const char * str, ... )
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fflush(logfile);
|
fflush(logfile);
|
||||||
}
|
}
|
||||||
if(gmLogfile)
|
|
||||||
|
if (m_gmlog_per_account)
|
||||||
|
{
|
||||||
|
if (FILE* per_file = openGmlogPerAccount (account))
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
outTimestamp(per_file);
|
||||||
|
va_start(ap, str);
|
||||||
|
vfprintf(per_file, str, ap);
|
||||||
|
fprintf(per_file, "\n" );
|
||||||
|
va_end(ap);
|
||||||
|
fclose(per_file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (gmLogfile)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
outTimestamp(gmLogfile);
|
outTimestamp(gmLogfile);
|
||||||
|
|
@ -615,6 +648,7 @@ void Log::outCommand( const char * str, ... )
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
fflush(gmLogfile);
|
fflush(gmLogfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ const int Color_count = int(WHITE)+1;
|
||||||
class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThread::FastMutex> >
|
class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThread::FastMutex> >
|
||||||
{
|
{
|
||||||
friend class MaNGOS::OperatorNew<Log>;
|
friend class MaNGOS::OperatorNew<Log>;
|
||||||
Log() : raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL), m_colored(false) { Initialize(); }
|
Log();
|
||||||
|
|
||||||
~Log()
|
~Log()
|
||||||
{
|
{
|
||||||
if( logfile != NULL )
|
if( logfile != NULL )
|
||||||
|
|
@ -83,7 +84,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void InitColors(std::string init_str);
|
void InitColors(std::string init_str);
|
||||||
void outTitle( const char * str);
|
void outTitle( const char * str);
|
||||||
void outCommand( const char * str, ...) ATTR_PRINTF(2,3);
|
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4);
|
||||||
void outString(); // any log level
|
void outString(); // any log level
|
||||||
// any log level
|
// any log level
|
||||||
void outString( const char * str, ... ) ATTR_PRINTF(2,3);
|
void outString( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||||
|
|
@ -118,6 +119,9 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
|
||||||
bool IsOutCharDump() const { return m_charLog_Dump; }
|
bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||||
bool IsIncludeTime() const { return m_includeTime; }
|
bool IsIncludeTime() const { return m_includeTime; }
|
||||||
private:
|
private:
|
||||||
|
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
||||||
|
FILE* openGmlogPerAccount(uint32 account);
|
||||||
|
|
||||||
FILE* raLogfile;
|
FILE* raLogfile;
|
||||||
FILE* logfile;
|
FILE* logfile;
|
||||||
FILE* gmLogfile;
|
FILE* gmLogfile;
|
||||||
|
|
@ -132,9 +136,16 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
|
||||||
Color m_colors[4];
|
Color m_colors[4];
|
||||||
uint32 m_logFilter;
|
uint32 m_logFilter;
|
||||||
|
|
||||||
|
// cache values for after initilization use (like gm log per account case)
|
||||||
|
std::string m_logsDir;
|
||||||
|
std::string m_logsTimestamp;
|
||||||
|
|
||||||
// char log control
|
// char log control
|
||||||
bool m_charLog_Dump;
|
bool m_charLog_Dump;
|
||||||
|
|
||||||
|
// gm log control
|
||||||
|
bool m_gmlog_per_account;
|
||||||
|
std::string m_gmlog_filename_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sLog MaNGOS::Singleton<Log>::Instance()
|
#define sLog MaNGOS::Singleton<Log>::Instance()
|
||||||
|
|
|
||||||
|
|
@ -170,9 +170,19 @@ inline bool isEastAsianCharacter(wchar_t wchar)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool isNumeric(wchar_t wchar)
|
||||||
|
{
|
||||||
|
return (wchar >= L'0' && wchar <=L'9');
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isNumeric(char c)
|
||||||
|
{
|
||||||
|
return (c >= '0' && c <='9');
|
||||||
|
}
|
||||||
|
|
||||||
inline bool isNumericOrSpace(wchar_t wchar)
|
inline bool isNumericOrSpace(wchar_t wchar)
|
||||||
{
|
{
|
||||||
return (wchar >= L'0' && wchar <=L'9') || wchar == L' ';
|
return isNumeric(wchar) || wchar == L' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
|
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6841"
|
#define REVISION_NR "6849"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue