Merge branch 'master' into 303

Conflicts:
	src/game/Creature.cpp
This commit is contained in:
tomrus88 2008-11-26 19:44:03 +03:00
commit af6acab8f8
23 changed files with 288 additions and 129 deletions

View file

@ -46,6 +46,7 @@
# define MANGOS_IMPORT __cdecl
# define MANGOS_SCRIPT_EXT ".dll"
# define MANGOS_SCRIPT_NAME "MaNGOSScript"
# define MANGOS_PATH_MAX MAX_PATH
#else //PLATFORM != PLATFORM_WINDOWS
# define MANGOS_LIBRARY_HANDLE void*
# define MANGOS_EXPORT export
@ -59,6 +60,7 @@
# endif //__APPLE_CC__ && BIG_ENDIAN
# define MANGOS_SCRIPT_EXT ".so"
# define MANGOS_SCRIPT_NAME "libmangosscript"
# define MANGOS_PATH_MAX PATH_MAX
#endif //PLATFORM
#if PLATFORM == PLATFORM_WINDOWS

View file

@ -276,7 +276,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
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());
}

View file

@ -173,7 +173,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
++j;
continue;
}
if (plr->isAlive() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
if (plr->isAllowUseBattleGroundObject() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
{
//player joined point!
//show progress bar
@ -216,7 +216,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
++j;
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
{
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);

View file

@ -756,7 +756,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, st
{
Player* p = m_session->GetPlayer();
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(),
GetLogNameForGuid(sel_guid),GUID_LOPART(sel_guid));
}

View file

@ -91,6 +91,27 @@ VendorItem const* VendorItemData::FindItem(uint32 item_id) const
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() :
Unit(), i_AI(NULL),
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_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_isVehicle(false),
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_regenTimer = 200;
@ -1659,13 +1680,13 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
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)
{
std::list<Creature*> assistList;
@ -1685,16 +1706,46 @@ void Creature::CallAssistence()
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);
if((*iter)->AI())
(*iter)->AI()->AttackStart(getVictim());
AssistDelayEvent *e = new AssistDelayEvent(getVictim()->GetGUID(), *this);
while (!assistList.empty())
{
// 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()
{
if(isPet() || !m_DBTableGuid)

View file

@ -27,6 +27,8 @@
#include "Database/DatabaseEnv.h"
#include "Cell.h"
#include <list>
struct SpellEntry;
class CreatureAI;
@ -544,8 +546,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
float GetAttackDistance(Unit const* pl) const;
void CallAssistence();
void SetNoCallAssistence(bool val) { m_AlreadyCallAssistence = val; }
void CallAssistance();
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
bool CanAssistTo(const Unit* u, const Unit* enemy) const;
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
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_equipmentId;
bool m_AlreadyCallAssistence;
bool m_AlreadyCallAssistance;
bool m_regenHealth;
bool m_AI_locked;
bool m_isDeadByDefault;
@ -645,4 +648,20 @@ class MANGOS_DLL_SPEC Creature : public Unit
GridReference<Creature> m_gridRef;
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

View file

@ -721,32 +721,15 @@ namespace MaNGOS
if(u == i_funit)
return false;
// we don't need help from zombies :)
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() )
if ( !u->CanAssistTo(i_funit, i_enemy) )
return false;
// too far
if( !i_funit->IsWithinDistInMap(u, i_range) )
return false;
// skip non hostile to caster enemy creatures
if( !u->IsHostileTo(i_enemy) )
return false;
// only if see assisted creature
if(!u->IsWithinLOSInMap(i_funit) )
if( !i_funit->IsWithinLOSInMap(u) )
return false;
return true;

View file

@ -984,7 +984,7 @@ void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data )
// logging money
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);
}
@ -1378,7 +1378,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank
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(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
GuildId);
@ -1447,7 +1447,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank (before items merge
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(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),SplitedAmount,GuildId);
}
@ -1473,7 +1473,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank
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(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
GuildId);
@ -1523,7 +1523,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
// logging item move to bank
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(),
pItemChar->GetProto()->Name1,pItemChar->GetEntry(),pItemChar->GetCount(),
GuildId);

View file

@ -5592,9 +5592,23 @@ bool ChatHandler::HandleWritePDumpCommand(const char *args)
if(!file || !p2)
return false;
uint32 guid = objmgr.GetPlayerGUIDByName(p2);
if(!guid)
uint32 guid;
// character name can't start from number
if (isNumeric(p2[0]))
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))
{

View file

@ -230,7 +230,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
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);
}
@ -249,7 +249,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
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);
}
}
@ -458,7 +458,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data )
if(!objmgr.GetPlayerNameByGUID(sender_guid,sender_name))
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);
}
else if(!receive)

View file

@ -1338,14 +1338,12 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return;
}
if(charname.empty())
if(charname.empty() || !normalizePlayerName (charname))
{
SendNotification(LANG_NEED_CHARACTER_NAME);
return;
}
normalizePlayerName (charname);
Player *plr = objmgr.GetPlayer(charname.c_str());
if(!plr)

View file

@ -342,7 +342,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
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);
}
}

View file

@ -11908,7 +11908,7 @@ void Player::SendPreparedQuest( uint64 guid )
else if( status == DIALOG_STATUS_INCOMPLETE )
PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, false, true );
// 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 );
else
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)
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))
return false;
@ -12756,6 +12756,15 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg )
if(exclude_Id == qInfo->GetQuestId())
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 );
// alternative quest already started or completed
@ -14596,7 +14605,8 @@ void Player::_LoadQuestStatus(QueryResult *result)
// add to quest log
if( slot < MAX_QUEST_LOG_SIZE &&
( 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);

View file

@ -3735,10 +3735,12 @@ void Spell::EffectEnchantItemPerm(uint32 i)
return;
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(),
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
item_owner->ApplyEnchantment(itemTarget,PERM_ENCHANTMENT_SLOT,false);
@ -3864,10 +3866,12 @@ void Spell::EffectEnchantItemTmp(uint32 i)
return;
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(),
itemTarget->GetProto()->Name1,itemTarget->GetEntry(),
item_owner->GetName(),item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false);

View file

@ -193,10 +193,12 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
// logging
sLog.outDebug("partner storing: %u",myItems[i]->GetGUIDLow());
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(),
myItems[i]->GetProto()->Name1,myItems[i]->GetEntry(),myItems[i]->GetCount(),
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
}
// store
_player->pTrader->MoveItemToInventory( traderDst, myItems[i], true, true);
@ -206,10 +208,12 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
// logging
sLog.outDebug("player storing: %u",hisItems[i]->GetGUIDLow());
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(),
hisItems[i]->GetProto()->Name1,hisItems[i]->GetEntry(),hisItems[i]->GetCount(),
_player->GetName(),_player->GetSession()->GetAccountId());
}
// store
_player->MoveItemToInventory( playerDst, hisItems[i], true, true);
@ -376,16 +380,20 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
if(sWorld.getConfig(CONFIG_GM_LOG_TRADE))
{
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->tradeGold,
_player->pTrader->GetName(),_player->pTrader->GetSession()->GetAccountId());
}
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->tradeGold,
_player->GetName(),_player->GetSession()->GetAccountId());
}
}
// update money
_player->ModifyMoney( -int32(_player->tradeGold) );

View file

@ -6951,7 +6951,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
data << uint32(AI_REACTION_AGGRO); // Aggro sound
((WorldObject*)this)->SendMessageToSet(&data, true);
((Creature*)this)->CallAssistence();
((Creature*)this)->CallAssistance();
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
}
@ -6985,7 +6985,7 @@ bool Unit::AttackStop()
if( GetTypeId()==TYPEID_UNIT )
{
// reset call assistance
((Creature*)this)->SetNoCallAssistence(false);
((Creature*)this)->SetNoCallAssistance(false);
}
SendAttackStop(victim);

View file

@ -757,7 +757,8 @@ void World::LoadConfigSettings(bool reload)
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);

View file

@ -144,7 +144,8 @@ enum WorldConfigs
CONFIG_CHATFLOOD_MESSAGE_DELAY,
CONFIG_CHATFLOOD_MUTE_TIME,
CONFIG_EVENT_ANNOUNCE,
CONFIG_CREATURE_FAMILY_ASSISTEMCE_RADIUS,
CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS,
CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY,
CONFIG_WORLD_BOSS_LEVEL_DIFF,
CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF,
CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF,

View file

@ -252,14 +252,21 @@ AddonChannel = 1
# 1 - include dumping chars to log
#
# GmLogFile
# Log file of gm commands
# GM Log file of gm commands
# Default: "" (Disable)
#
# GmLogTimestamp
# Logfile with timestamp of server start in name
# GM Logfile with timestamp of server start 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
#
# 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
# Log file of RA commands
# Default: "Ra.log"
@ -291,6 +298,7 @@ CharLogTimestamp = 0
CharLogDump = 0
GmLogFile = ""
GmLogTimestamp = 0
GmLogPerAccount = 0
RaLogFile = ""
LogColors = ""
@ -613,11 +621,15 @@ TalentsInspecting = 1
# 1.5 - 150%
# 0 - off (0%)
#
# CreatureFamilyAssistenceRadius
# Creature family assistence radius
# CreatureFamilyAssistanceRadius
# Creature family assistance radius
# Default: 10
# 0 - off
#
# CreatureFamilyAssistanceDelay
# Reaction time for creature assistance call
# Default: 1500 (1.5s)
#
# WorldBossLevelDiff
# Difference for boss dynamic level with target
# Default: 3
@ -674,7 +686,8 @@ TalentsInspecting = 1
ThreatRadius = 100
Rate.Creature.Aggro = 1
CreatureFamilyAssistenceRadius = 10
CreatureFamilyAssistanceRadius = 10
CreatureFamilyAssistanceDelay = 1500
WorldBossLevelDiff = 3
Corpse.Decay.NORMAL = 60
Corpse.Decay.RARE = 300

View file

@ -36,6 +36,13 @@ enum LogType
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)
{
if(str.empty())
@ -173,73 +180,56 @@ void Log::SetLogFileLevel(char *Level)
void Log::Initialize()
{
std::string logsDir = sConfig.GetStringDefault("LogsDir","");
if(!logsDir.empty())
/// Common log files data
m_logsDir = sConfig.GetStringDefault("LogsDir","");
if(!m_logsDir.empty())
{
if((logsDir.at(logsDir.length()-1)!='/') && (logsDir.at(logsDir.length()-1)!='\\'))
logsDir.append("/");
if((m_logsDir.at(m_logsDir.length()-1)!='/') && (m_logsDir.at(m_logsDir.length()-1)!='\\'))
m_logsDir.append("/");
}
std::string logfn=sConfig.GetStringDefault("LogFile", "");
if(!logfn.empty())
{
if(sConfig.GetBoolDefault("LogTimestamp",false))
{
std::string logTimestamp = GetTimestampStr();
logTimestamp.insert(0,"_");
size_t dot_pos = logfn.find_last_of(".");
if(dot_pos!=logfn.npos)
logfn.insert(dot_pos,logTimestamp);
m_logsTimestamp = "_" + GetTimestampStr();
/// 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
logfn += logTimestamp;
}
logfile = fopen((logsDir+logfn).c_str(), "w");
}
std::string gmlogname = sConfig.GetStringDefault("GMLogFile", "");
if(!gmlogname.empty())
{
if(sConfig.GetBoolDefault("GmLogTimestamp",false))
// GM log settings for per account case
m_gmlog_filename_format = sConfig.GetStringDefault("GMLogFile", "");
if(!m_gmlog_filename_format.empty())
{
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);
bool m_gmlog_timestamp = sConfig.GetBoolDefault("GmLogTimestamp",false);
size_t dot_pos = m_gmlog_filename_format.find_last_of(".");
if(dot_pos!=m_gmlog_filename_format.npos)
{
if(m_gmlog_timestamp)
m_gmlog_filename_format.insert(dot_pos,m_logsTimestamp);
m_gmlog_filename_format.insert(dot_pos,"_#%u");
}
else
gmlogname += gmLogTimestamp;
}
gmLogfile = fopen((logsDir+gmlogname).c_str(), "a");
{
m_gmlog_filename_format += "_#%u";
if(m_gmlog_timestamp)
m_gmlog_filename_format += m_logsTimestamp;
}
std::string charlogname = sConfig.GetStringDefault("CharLogFile", "");
if(!charlogname.empty())
{
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;
m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
}
charLogfile = fopen((logsDir+charlogname).c_str(), "a");
}
std::string dberlogname = sConfig.GetStringDefault("DBErrorLogFile", "");
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");
}
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
raLogfile = openLogFile("RaLogFile",NULL,"a");
// Main log file settings
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
m_logLevel = sConfig.GetIntDefault("LogLevel", 0);
m_logFileLevel = sConfig.GetIntDefault("LogFileLevel", 0);
@ -254,9 +244,38 @@ void Log::Initialize()
if(sConfig.GetBoolDefault("LogFilter_VisibilityChanges", true))
m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES;
// Char log settings
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)
{
time_t t = time(NULL);
@ -575,7 +594,7 @@ void Log::outDebug( const char * str, ... )
fflush(stdout);
}
void Log::outCommand( const char * str, ... )
void Log::outCommand( uint32 account, const char * str, ... )
{
if( !str )
return;
@ -605,7 +624,21 @@ void Log::outCommand( const char * str, ... )
va_end(ap);
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;
outTimestamp(gmLogfile);
@ -615,6 +648,7 @@ void Log::outCommand( const char * str, ... )
va_end(ap);
fflush(gmLogfile);
}
fflush(stdout);
}

View file

@ -56,7 +56,8 @@ const int Color_count = int(WHITE)+1;
class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThread::FastMutex> >
{
friend class MaNGOS::OperatorNew<Log>;
Log() : raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL), m_colored(false) { Initialize(); }
Log();
~Log()
{
if( logfile != NULL )
@ -83,7 +84,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
void Initialize();
void InitColors(std::string init_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
// any log level
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 IsIncludeTime() const { return m_includeTime; }
private:
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
FILE* openGmlogPerAccount(uint32 account);
FILE* raLogfile;
FILE* logfile;
FILE* gmLogfile;
@ -132,9 +136,16 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
Color m_colors[4];
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
bool m_charLog_Dump;
// gm log control
bool m_gmlog_per_account;
std::string m_gmlog_filename_format;
};
#define sLog MaNGOS::Singleton<Log>::Instance()

View file

@ -170,9 +170,19 @@ inline bool isEastAsianCharacter(wchar_t wchar)
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)
{
return (wchar >= L'0' && wchar <=L'9') || wchar == L' ';
return isNumeric(wchar) || wchar == L' ';
}
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6841"
#define REVISION_NR "6849"
#endif // __REVISION_NR_H__