--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-01 15:53:03 -05:00
7 changed files with 49 additions and 7 deletions
@@ -247,7 +247,7 @@ CreatureAI* GetAI_boss_nexusprince_shaffar(Creature *_Creature)
struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
{ {
mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c), CanEvade(false) mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c)
{ {
HeroicMode = m_creature->GetMap()->IsHeroic(); HeroicMode = m_creature->GetMap()->IsHeroic();
} }
@@ -272,7 +272,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
void EnterCombat(Unit *who) void EnterCombat(Unit *who)
{ {
// Send Shaffar to fight // Send Shaffar to fight
Unit* Shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); Unit* Shaffar = me->FindNearestCreature(ENTRY_SHAFFAR, 100);
if(!Shaffar || Shaffar->isDead()) if(!Shaffar || Shaffar->isDead())
{ {
KillSelf(); KillSelf();
@@ -289,7 +289,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
void JustDied(Unit* Killer) void JustDied(Unit* Killer)
{ {
Unit *Shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); Unit *Shaffar = me->FindNearestCreature(ENTRY_SHAFFAR, 100);
if(Shaffar) if(Shaffar)
((boss_nexusprince_shaffarAI*)(((Creature*)Shaffar)->AI()))->RemoveBeaconFromList(m_creature); ((boss_nexusprince_shaffarAI*)(((Creature*)Shaffar)->AI()))->RemoveBeaconFromList(m_creature);
} }
@@ -301,7 +301,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
if(Check_Timer < diff) if(Check_Timer < diff)
{ {
Unit *Shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); Unit *Shaffar = me->FindNearestCreature(ENTRY_SHAFFAR, 100);
if(!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) if(!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat())
{ {
KillSelf(); KillSelf();
+9 -1
View File
@@ -74,6 +74,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
AddMember(CaptainGuid); AddMember(CaptainGuid);
sLog.outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain GUID: %u]", GetId(), GetType(), GetCaptain());
return true; return true;
} }
@@ -143,6 +144,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
// hide promote/remove buttons // hide promote/remove buttons
if(CaptainGuid != PlayerGuid) if(CaptainGuid != PlayerGuid)
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + 1, 1); pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + 1, 1);
sLog.outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", pl->GetName(), pl->GetGUID(), GetType(), GetId());
} }
return true; return true;
} }
@@ -249,7 +251,10 @@ void ArenaTeam::SetCaptain(const uint64& guid)
// enable remove/promote buttons // enable remove/promote buttons
Player *newcaptain = objmgr.GetPlayer(guid); Player *newcaptain = objmgr.GetPlayer(guid);
if(newcaptain) if(newcaptain)
{
newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 0); newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 0);
sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUID(), newcaptain->GetName(), newcaptain->GetGUID(), GetId(), GetType());
}
} }
void ArenaTeam::DelMember(uint64 guid) void ArenaTeam::DelMember(uint64 guid)
@@ -274,8 +279,8 @@ void ArenaTeam::DelMember(uint64 guid)
{ {
player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + i, 0); player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6) + i, 0);
} }
sLog.outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), guid, GetType(), GetId());
} }
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid)); CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid));
} }
@@ -292,6 +297,9 @@ void ArenaTeam::Disband(WorldSession *session)
DelMember(members.front().guid); DelMember(members.front().guid);
} }
if(Player *player = session->GetPlayer())
sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUID(), GetType(), GetId());
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", Id); CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", Id);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", Id); //< this should be alredy done by calling DelMember(memberGuids[j]); for each member CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", Id); //< this should be alredy done by calling DelMember(memberGuids[j]); for each member
+3 -1
View File
@@ -691,6 +691,7 @@ void BattleGround::EndBattleGround(uint32 winner)
sLog.outDebug("--- Winner rating: %u, Loser rating: %u, Winner change: %u, Losser change: %u ---", winner_rating, loser_rating, winner_change, loser_change); sLog.outDebug("--- Winner rating: %u, Loser rating: %u, Winner change: %u, Losser change: %u ---", winner_rating, loser_rating, winner_change, loser_change);
SetArenaTeamRatingChangeForTeam(winner, winner_change); SetArenaTeamRatingChangeForTeam(winner, winner_change);
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
sLog.outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. RatingChange: %i.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change);
} }
else else
{ {
@@ -1097,8 +1098,9 @@ void BattleGround::StartBattleGround()
{ {
///this method should spawn spirit guides and so on ///this method should spawn spirit guides and so on
SetStartTime(0); SetStartTime(0);
SetLastResurrectTime(0); SetLastResurrectTime(0);
if(m_IsRated)
sLog.outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
} }
void BattleGround::AddPlayer(Player *plr) void BattleGround::AddPlayer(Player *plr)
+1 -1
View File
@@ -451,7 +451,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
// determine reflection // determine reflection
m_canReflect = false; m_canReflect = false;
if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)) if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !IsAreaOfEffectSpell(m_spellInfo) && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED))
{ {
for(int j = 0;j < 3; ++j) for(int j = 0;j < 3; ++j)
{ {
+25
View File
@@ -32,6 +32,7 @@ INSTANTIATE_SINGLETON_1( Log );
Log::Log() : Log::Log() :
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
dberLogfile(NULL), chatLogfile(NULL), m_gmlog_per_account(false), m_colored(false) dberLogfile(NULL), chatLogfile(NULL), m_gmlog_per_account(false), m_colored(false)
, arenaLogFile(NULL)
{ {
Initialize(); Initialize();
} }
@@ -61,6 +62,10 @@ Log::~Log()
if (chatLogfile != NULL) if (chatLogfile != NULL)
fclose(chatLogfile); fclose(chatLogfile);
chatLogfile = NULL; chatLogfile = NULL;
if (arenaLogFile != NULL)
fclose(arenaLogFile);
arenaLogFile = NULL;
} }
void Log::SetLogLevel(char *Level) void Log::SetLogLevel(char *Level)
@@ -154,6 +159,7 @@ void Log::Initialize()
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a"); dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
raLogfile = openLogFile("RaLogFile",NULL,"a"); raLogfile = openLogFile("RaLogFile",NULL,"a");
chatLogfile = openLogFile("ChatLogFile","ChatLogTimestamp","a"); chatLogfile = openLogFile("ChatLogFile","ChatLogTimestamp","a");
arenaLogFile = openLogFile("ArenaLogFile",NULL,"a");
// Main log file settings // Main log file settings
m_logLevel = sConfig.GetIntDefault("LogLevel", LOGL_NORMAL); m_logLevel = sConfig.GetIntDefault("LogLevel", LOGL_NORMAL);
@@ -173,6 +179,7 @@ void Log::Initialize()
// Char log settings // 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) FILE* Log::openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode)
@@ -491,6 +498,24 @@ void Log::outError( const char * err, ... )
fflush(stderr); fflush(stderr);
} }
void Log::outArena( const char * str, ... )
{
if( !str )
return;
if(arenaLogFile)
{
va_list ap;
outTimestamp(arenaLogFile);
va_start(ap, str);
vfprintf(arenaLogFile, str, ap);
fprintf(arenaLogFile, "\n" );
va_end(ap);
fflush(arenaLogFile);
}
fflush(stdout);
}
void Log::outErrorDb( const char * err, ... ) void Log::outErrorDb( const char * err, ... )
{ {
if( !err ) if( !err )
+2
View File
@@ -109,6 +109,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ACE_
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4); void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4);
void outRemote( const char * str, ... ) ATTR_PRINTF(2,3); void outRemote( const char * str, ... ) ATTR_PRINTF(2,3);
void outChat( const char * str, ... ) ATTR_PRINTF(2,3); void outChat( const char * str, ... ) ATTR_PRINTF(2,3);
void outArena( const char * str, ... ) ATTR_PRINTF(2,3);
void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ); void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name );
static void outTimestamp(FILE* file); static void outTimestamp(FILE* file);
@@ -137,6 +138,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ACE_
FILE* charLogfile; FILE* charLogfile;
FILE* dberLogfile; FILE* dberLogfile;
FILE* chatLogfile; FILE* chatLogfile;
FILE* arenaLogFile;
// cache values for after initilization use (like gm log per account case) // cache values for after initilization use (like gm log per account case)
std::string m_logsDir; std::string m_logsDir;
+5
View File
@@ -310,6 +310,10 @@ AddonChannel = 1
# Default: "Ra.log" # Default: "Ra.log"
# "" - Empty name for disable # "" - Empty name for disable
# #
# ArenaLogFile
# Log file of arena fights and arena team creations
# Default: "" - do not create arena log file
#
# LogColors # LogColors
# Color for messages (format "normal basic detail debug") # Color for messages (format "normal basic detail debug")
# Colors: 0 - BLACK, 1 - RED, 2 - GREEN, 3 - BROWN, 4 - BLUE, 5 - MAGENTA, 6 - CYAN, 7 - GREY, # Colors: 0 - BLACK, 1 - RED, 2 - GREEN, 3 - BROWN, 4 - BLUE, 5 - MAGENTA, 6 - CYAN, 7 - GREY,
@@ -419,6 +423,7 @@ GmLogFile = "gm_commands.log"
GmLogTimestamp = 0 GmLogTimestamp = 0
GmLogPerAccount = 0 GmLogPerAccount = 0
RaLogFile = "ra_commands.log" RaLogFile = "ra_commands.log"
ArenaLogFile = ""
LogColors = "" LogColors = ""
EnableLogDB = 0 EnableLogDB = 0
DBLogLevel = 1 DBLogLevel = 1