From 14c31135cee70413712ee64c77adbf204b08365d Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Tue, 30 Dec 2008 01:50:43 +0100 Subject: *Partly implemented heroic support for darkweaver syth - by Iskander *Script for Shirrak the dead Wather - by Iskander --HG-- branch : trunk --- src/bindings/scripts/Makefile.am | 1 + src/bindings/scripts/ScriptMgr.cpp | 3 + src/bindings/scripts/VC71/71ScriptDev2.vcproj | 4 + src/bindings/scripts/VC80/80ScriptDev2.vcproj | 4 + src/bindings/scripts/VC90/90ScriptDev2.vcproj | 4 + .../boss_shirrak_the_dead_watcher.cpp | 195 +++++++++++++++++++++ .../sethekk_halls/boss_darkweaver_syth.cpp | 58 ++++-- 7 files changed, 253 insertions(+), 16 deletions(-) create mode 100644 src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp (limited to 'src') diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 94a01ac23af..278d702c00c 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -72,6 +72,7 @@ scripts/zone/alterac_mountains/alterac_mountains.cpp \ scripts/zone/arathi_highlands/arathi_highlands.cpp \ scripts/zone/ashenvale_forest/ashenvale.cpp\ scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp \ +scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher \ scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp \ scripts/zone/aunchindoun/mana_tombs/boss_pandemonius.cpp \ scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp \ diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 49a1dc79cc8..5d78d40030d 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -116,6 +116,8 @@ extern void AddSC_ashenvale(); //Aunchindoun //--Auchenai Crypts extern void AddSC_boss_exarch_maladaar(); +extern void AddSC_boss_shirrak_the_dead_watcher(); + //--Mana Tombs extern void AddSC_boss_nexusprince_shaffar(); extern void AddSC_boss_pandemonius(); @@ -1317,6 +1319,7 @@ void ScriptsInit() //Aunchindoun //--Auchenai Crypts AddSC_boss_exarch_maladaar(); + AddSC_boss_shirrak_the_dead_watcher(); //--Mana Tombs AddSC_boss_nexusprince_shaffar(); diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index 5d8da080d66..24b76d9d4cf 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -1259,6 +1259,10 @@ RelativePath="..\scripts\zone\aunchindoun\auchenai_crypts\boss_exarch_maladaar.cpp" > + + + + + + + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +Name: Boss_Shirrak_the_dead_watcher +%Complete: 80 +Comment: InhibitMagic should stack slower far from the boss, proper Visual for Focus Fire, heroic implemented +Category: Auchindoun, Auchenai Crypts +EndScriptData */ + +#include "precompiled.h" + +#define SPELL_INHABITMAGIC 32264 +#define SPELL_ATTRACTMAGIC 32265 +#define N_SPELL_CARNIVOROUSBITE 36383 +#define H_SPELL_CARNIVOROUSBITE 39382 +#define SPELL_CARNIVOROUSBITE (HeroicMode?H_SPELL_CARNIVOROUSBITE:N_SPELL_CARNIVOROUSBITE) + +#define ENTRY_FOCUS_FIRE 18374 + +#define N_SPELL_FIERY_BLAST 32302 +#define H_SPELL_FIERY_BLAST 38382 +#define SPELL_FIERY_BLAST (HeroicMode?H_SPELL_FIERY_BLAST:N_SPELL_FIERY_BLAST) +#define SPELL_FOCUS_FIRE_VISUAL 42075 //need to find better visual + +struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI +{ + boss_shirrak_the_dead_watcherAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } + + uint32 Inhabitmagic_Timer; + uint32 Attractmagic_Timer; + uint32 Carnivorousbite_Timer; + uint32 FocusFire_Timer; + bool HeroicMode; + Unit *focusedTarget; + + void Reset() + { + Inhabitmagic_Timer = 3000; + Attractmagic_Timer = 28000; + Carnivorousbite_Timer = 10000; + FocusFire_Timer = 17000; + focusedTarget = NULL; + } + + void Aggro(Unit *who) + { } + + void JustSummoned(Creature *summoned) + { + if (summoned && summoned->GetEntry() == ENTRY_FOCUS_FIRE) + { + summoned->CastSpell(summoned,SPELL_FOCUS_FIRE_VISUAL,false); + summoned->setFaction(m_creature->getFaction()); + summoned->SetLevel(m_creature->getLevel()); + summoned->addUnitState(UNIT_STAT_ROOT); + + if(focusedTarget) + summoned->AI()->AttackStart(focusedTarget); + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) + return; + + //Inhabitmagic_Timer + if (Inhabitmagic_Timer < diff) + { + DoCast(m_creature,SPELL_INHABITMAGIC); + Inhabitmagic_Timer = 2000+(rand()%2000); + }else Inhabitmagic_Timer -= diff; + + //Attractmagic_Timer + if (Attractmagic_Timer < diff) + { + DoCast(m_creature,SPELL_ATTRACTMAGIC); + Attractmagic_Timer = 30000; + }else Attractmagic_Timer -= diff; + + //Carnivorousbite_Timer + if (Carnivorousbite_Timer < diff) + { + DoCast(m_creature,SPELL_CARNIVOROUSBITE); + Carnivorousbite_Timer = 10000; + }else Carnivorousbite_Timer -= diff; + + //FocusFire_Timer + if (FocusFire_Timer < diff) + { + // Summon Focus Fire & Emote + Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0); + if (target && target->GetTypeId() == TYPEID_PLAYER) + { + focusedTarget = target; + m_creature->SummonCreature(ENTRY_FOCUS_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500); + + // Emote + std::string *emote = new std::string("focuses his energy on "); + emote->append(target->GetName()); + DoTextEmote(emote->c_str(),NULL,true); + delete emote; + + FocusFire_Timer = 15000+(rand()%5000); + } + }else FocusFire_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_shirrak_the_dead_watcher(Creature *_Creature) +{ + return new boss_shirrak_the_dead_watcherAI (_Creature); +} + +struct TRINITY_DLL_DECL mob_focus_fireAI : public ScriptedAI +{ + mob_focus_fireAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } + + bool HeroicMode; + uint32 FieryBlast_Timer; + bool fiery1, fiery2, fiery3; + + void Reset() + { + FieryBlast_Timer = 3000+(rand()%1000); + fiery1 = fiery2 = true; + } + + void Aggro(Unit *who) + { } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) + return; + + //FieryBlast_Timer + if (fiery2 && FieryBlast_Timer < diff) + { + DoCast(m_creature,SPELL_FIERY_BLAST); + + if(fiery1) fiery1 = false; + else if(fiery2) fiery2 = false; + + FieryBlast_Timer = 1000; + }else FieryBlast_Timer -= diff; + + //DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_focus_fire(Creature *_Creature) +{ + return new mob_focus_fireAI (_Creature); +} + +void AddSC_boss_shirrak_the_dead_watcher() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_shirrak_the_dead_watcher"; + newscript->GetAI = &GetAI_boss_shirrak_the_dead_watcher; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_focus_fire"; + newscript->GetAI = &GetAI_mob_focus_fire; + newscript->RegisterSelf(); +} \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp index c566ab40230..f38b144da90 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Boss_Darkweaver_Syth SD%Complete: 85 -SDComment: Shock spells/times need more work. Heroic not implemented. +SDComment: Shock spells/times need more work. Heroic partly implemented. SDCategory: Auchindoun, Sethekk Halls EndScriptData */ @@ -34,30 +34,31 @@ EndScriptData */ #define SAY_DEATH -1556006 -#define SPELL_FROST_SHOCK 37865 +#define SPELL_FROST_SHOCK 21401 //37865 #define SPELL_FLAME_SHOCK 34354 #define SPELL_SHADOW_SHOCK 30138 #define SPELL_ARCANE_SHOCK 37132 -#define SPELL_CHAIN_LIGHTNING 39945 +#define SPELL_CHAIN_LIGHTNING 15659 //15305 #define SPELL_SUMMON_SYTH_FIRE 33537 // Spawns 19203 #define SPELL_SUMMON_SYTH_ARCANE 33538 // Spawns 19205 #define SPELL_SUMMON_SYTH_FROST 33539 // Spawns 19204 #define SPELL_SUMMON_SYTH_SHADOW 33540 // Spawns 19206 -#define SPELL_FLAME_BUFFET 33526 -#define H_SPELL_FLAME_BUFFET 38141 -#define SPELL_ARCANE_BUFFET 33527 -#define H_SPELL_ARCANE_BUFFET 38138 -#define SPELL_FROST_BUFFET 33528 -#define H_SPELL_FROST_BUFFET 38142 -#define SPELL_SHADOW_BUFFET 33529 -#define H_SPELL_SHADOW_BUFFET 38143 +#define SPELL_FLAME_BUFFET (HeroicMode?38141:33526) +#define SPELL_ARCANE_BUFFET (HeroicMode?38138:33527) +#define SPELL_FROST_BUFFET (HeroicMode?38142:33528) +#define SPELL_SHADOW_BUFFET (HeroicMode?38143:33529) struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI { - boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) {Reset();} + boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } uint32 flameshock_timer; uint32 arcaneshock_timer; @@ -68,6 +69,7 @@ struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI bool summon90; bool summon50; bool summon10; + bool HeroicMode; void Reset() { @@ -204,10 +206,16 @@ CreatureAI* GetAI_boss_darkweaver_syth(Creature *_Creature) struct TRINITY_DLL_DECL mob_syth_fireAI : public ScriptedAI { - mob_syth_fireAI(Creature *c) : ScriptedAI(c) {Reset();} + mob_syth_fireAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } uint32 flameshock_timer; uint32 flamebuffet_timer; + bool HeroicMode; void Reset() { @@ -250,10 +258,16 @@ CreatureAI* GetAI_mob_syth_fire(Creature *_Creature) struct TRINITY_DLL_DECL mob_syth_arcaneAI : public ScriptedAI { - mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) {Reset();} + mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } uint32 arcaneshock_timer; uint32 arcanebuffet_timer; + bool HeroicMode; void Reset() { @@ -296,10 +310,16 @@ CreatureAI* GetAI_mob_syth_arcane(Creature *_Creature) struct TRINITY_DLL_DECL mob_syth_frostAI : public ScriptedAI { - mob_syth_frostAI(Creature *c) : ScriptedAI(c) {Reset();} + mob_syth_frostAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } uint32 frostshock_timer; uint32 frostbuffet_timer; + bool HeroicMode; void Reset() { @@ -342,10 +362,16 @@ CreatureAI* GetAI_mob_syth_frost(Creature *_Creature) struct TRINITY_DLL_DECL mob_syth_shadowAI : public ScriptedAI { - mob_syth_shadowAI(Creature *c) : ScriptedAI(c) {Reset();} + mob_syth_shadowAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + Reset(); + } uint32 shadowshock_timer; uint32 shadowbuffet_timer; + bool HeroicMode; void Reset() { -- cgit v1.2.3 From e775ddfcb79f951f56916f91ee297a6d63487360 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Tue, 30 Dec 2008 12:40:36 +0100 Subject: *Fixed compile on linux - by Drahy --HG-- branch : trunk --- src/bindings/scripts/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 278d702c00c..6c473cb8d4c 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -72,7 +72,7 @@ scripts/zone/alterac_mountains/alterac_mountains.cpp \ scripts/zone/arathi_highlands/arathi_highlands.cpp \ scripts/zone/ashenvale_forest/ashenvale.cpp\ scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp \ -scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher \ +scripts/zone/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp \ scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp \ scripts/zone/aunchindoun/mana_tombs/boss_pandemonius.cpp \ scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp \ -- cgit v1.2.3 From b8a721c9ab111b59ef38fbb5b051d1d56104cec2 Mon Sep 17 00:00:00 2001 From: QAston Date: Tue, 30 Dec 2008 21:33:40 +0100 Subject: *Fix display of auras owned by out of range raid/party members. --HG-- branch : trunk --- src/game/GroupHandler.cpp | 10 ++++++++-- src/game/SpellAuras.cpp | 4 ++-- src/game/Unit.cpp | 12 +++--------- src/game/Unit.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 3890a9f77a6..e2a575162f6 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -720,8 +720,11 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke { if(auramask & (uint64(1) << i)) { - *data << uint16(player->GetUInt32Value(UNIT_FIELD_AURA + i)); + uint32 updatedAura=player->GetUInt32Value(UNIT_FIELD_AURA + i); + *data << uint16(updatedAura); *data << uint8(1); + if(!updatedAura) + player->UnsetAuraUpdateMask(i); } } } @@ -801,8 +804,11 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke { if(auramask & (uint64(1) << i)) { - *data << uint16(pet->GetUInt32Value(UNIT_FIELD_AURA + i)); + uint32 updatedAura=pet->GetUInt32Value(UNIT_FIELD_AURA + i); + *data << uint16(updatedAura); *data << uint8(1); + if(!updatedAura) + pet->UnsetAuraUpdateMask(i); } } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index d22266f2e15..36e62831f61 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -886,7 +886,7 @@ void Aura::_AddAura() UpdateAuraCharges(); // update for out of range group members - m_target->UpdateAuraForGroup(slot, true); + m_target->UpdateAuraForGroup(slot); } } else // use found slot @@ -973,7 +973,7 @@ void Aura::_RemoveAura() SetAuraApplication(slot, 0); // update for out of range group members - m_target->UpdateAuraForGroup(slot, false); + m_target->UpdateAuraForGroup(slot); if( IsSealSpell(GetSpellProto()) ) m_target->ModifyAuraState(AURA_STATE_JUDGEMENT,false); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b830b7b4c7e..3f8eb4ac447 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12286,7 +12286,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT return CastingTime; } -void Unit::UpdateAuraForGroup(uint8 slot, bool apply) +void Unit::UpdateAuraForGroup(uint8 slot) { if(GetTypeId() == TYPEID_PLAYER) { @@ -12294,10 +12294,7 @@ void Unit::UpdateAuraForGroup(uint8 slot, bool apply) if(player->GetGroup()) { player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS); - if(apply) - player->SetAuraUpdateMask(slot); - else - player->UnsetAuraUpdateMask(slot); + player->SetAuraUpdateMask(slot); } } else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) @@ -12309,10 +12306,7 @@ void Unit::UpdateAuraForGroup(uint8 slot, bool apply) if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup()) { ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_AURAS); - if(apply) - pet->SetAuraUpdateMask(slot); - else - pet->UnsetAuraUpdateMask(slot); + pet->SetAuraUpdateMask(slot); } } } diff --git a/src/game/Unit.h b/src/game/Unit.h index 2f1af0c32d8..c3f5be3adb1 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1392,7 +1392,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void UpdateReactives(uint32 p_time); // group updates - void UpdateAuraForGroup(uint8 slot, bool apply); + void UpdateAuraForGroup(uint8 slot); // pet auras typedef std::set PetAuraSet; -- cgit v1.2.3 From 8592e5606bf3d7342dc0c97df8d9e8a6206994a9 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 30 Dec 2008 16:49:45 -0600 Subject: *A temp fix for the crash caused by instance::add. --HG-- branch : trunk --- src/game/Map.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Map.cpp b/src/game/Map.cpp index c2fe5bfec74..99474bfedf9 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1778,7 +1778,8 @@ bool InstanceMap::Add(Player *player) { sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); if(groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); - assert(false); + player->UnbindInstance(GetId(), GetSpawnMode()); + //assert(false); } // bind to the group or keep using the group save if(!groupBind) -- cgit v1.2.3 From d088021a507eadf0f985f2d6452bca8fc9714005 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 30 Dec 2008 18:03:26 -0600 Subject: *Write update time diff into log to display server performance. --HG-- branch : trunk --- src/game/Level0.cpp | 2 ++ src/game/World.cpp | 20 ++++++++++++++++++++ src/game/World.h | 5 +++++ src/trinitycore/trinitycore.conf.dist | 11 ++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index db319215ded..75f7a257caf 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -93,6 +93,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) uint32 maxActiveClientsNum = sWorld.GetMaxActiveSessionCount(); uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount(); std::string str = secsToTimeString(sWorld.GetUptime()); + uint32 updateTime = sWorld.GetUpdateTime(); PSendSysMessage(_FULLVERSION); //char const* full; //if(m_session) @@ -105,6 +106,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) //PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion()); PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum); PSendSysMessage(LANG_UPTIME, str.c_str()); + PSendSysMessage("Update time diff: %u.", updateTime); return true; } diff --git a/src/game/World.cpp b/src/game/World.cpp index 7769c9a7942..0215426afbd 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -112,6 +112,9 @@ World::World() m_defaultDbcLocale = LOCALE_enUS; m_availableDbcLocaleMask = 0; + + m_updateTimeSum = 0; + m_updateTimeCount = 0; } /// World destructor @@ -989,6 +992,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_PVP_TOKEN_COUNT] = 1; m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false); m_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfig.GetBoolDefault("ShowKickInWorld", false); + m_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000); std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", ""); char * forbiddenMaps = new char[forbiddenmaps.length() + 1]; @@ -1409,6 +1413,22 @@ void World::DetectDBCLang() /// Update the World ! void World::Update(time_t diff) { + m_updateTime = uint32(diff); + if(m_configs[CONFIG_INTERVAL_LOG_UPDATE]) + { + if(m_updateTimeSum > m_configs[CONFIG_INTERVAL_LOG_UPDATE]) + { + sLog.outString("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); + m_updateTimeSum = m_updateTime; + m_updateTimeCount = 1; + } + else + { + m_updateTimeSum += m_updateTime; + ++m_updateTimeCount; + } + } + ///- Update the different timers for(int i = 0; i < WUPDATE_COUNT; i++) if(m_timers[i].GetCurrent()>=0) diff --git a/src/game/World.h b/src/game/World.h index 4dab7b97b88..50a9ec6f836 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -197,6 +197,7 @@ enum WorldConfigs CONFIG_PVP_TOKEN_COUNT, CONFIG_NO_RESET_TALENT_COST, CONFIG_SHOW_KICK_IN_WORLD, + CONFIG_INTERVAL_LOG_UPDATE, CONFIG_VALUE_COUNT }; @@ -407,6 +408,8 @@ class World time_t const& GetGameTime() const { return m_gameTime; } /// Uptime (in secs) uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); } + /// Update time + uint32 GetUpdateTime() const { return m_updateTime; } /// Get the maximum skill level a player can reach uint16 GetConfigMaxSkillValue() const @@ -524,6 +527,8 @@ class World IntervalTimer m_timers[WUPDATE_COUNT]; uint32 mail_timer; uint32 mail_timer_expires; + uint32 m_updateTime, m_updateTimeSum; + uint32 m_updateTimeCount; typedef UNORDERED_MAP WeatherMap; WeatherMap m_weathers; diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index de93143c6ad..7855b616082 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -1251,12 +1251,20 @@ Ra.Secure = 1 # example: "538,90" # Note that it's HIGHLY DISCOURAGED to forbid starting maps (0, 1, 530)! # -# ShowKickInWorld +# ShowKickInWorld # determines wether a message is broadcasted to the entire server when a player gets kicked # Default: 0 # 1 = Enable # 0 = Disable # +# RecordUpdateTimeDiffInterval +# record update time diff to the log file +# update diff can be used as a criterion of performance +# diff < 300: good performance +# diff > 600: bad performance, may be caused by high cpu usage +# Default: 60000 (diff is written into log every 60000 ms or 1 minute. +# >0 = Interval +# 0 = Disable ################################################################################################################### PlayerStart.AllReputation = 0 @@ -1271,3 +1279,4 @@ PvPToken.ItemID = 29434 PvPToken.ItemCount = 1 NoResetTalentsCost = 0 ShowKickInWorld = 0 +RecordUpdateTimeDiffInterval = 60000 -- cgit v1.2.3 From bf3f1877853041dcb86db0429d719adba77776a2 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 30 Dec 2008 18:10:11 -0600 Subject: *Fix the bug of rockbiter. --HG-- branch : trunk --- src/game/SpellEffects.cpp | 2 +- src/game/WaypointMovementGenerator.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 85984eeaa3d..e693cd9adbd 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3820,7 +3820,7 @@ void Spell::EffectEnchantItemTmp(uint32 i) // Shaman Rockbiter Weapon if(i==0 && m_spellInfo->Effect[1]==SPELL_EFFECT_DUMMY) { - int32 enchnting_damage = m_currentBasePoints[1];//+1; + int32 enchnting_damage = damage;//+1; // enchanting id selected by calculated damage-per-sec stored in Effect[1] base value // with already applied percent bonus from Elemental Weapons talent diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index adc4345fdfc..50219bfb6f4 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -152,6 +152,7 @@ WaypointMovementGenerator::Update(Creature &unit, const uint32 &diff) { if(StopedByPlayer) { + assert(node); InitTraveller(unit,node); i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); -- cgit v1.2.3 From 12d4ce413e7b3b9d697b160bac6c918564b2fd1e Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 30 Dec 2008 19:39:43 -0600 Subject: *Update waypoint movement code. Also fix Linux build. --HG-- branch : trunk --- src/game/Object.cpp | 2 +- src/game/WaypointMovementGenerator.cpp | 24 ++++++++++++------------ src/game/WaypointMovementGenerator.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/game/Object.cpp b/src/game/Object.cpp index efd041f34c2..51eea6ecc83 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1519,7 +1519,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa { TemporarySummon* pCreature = new TemporarySummon(GetGUID()); - pCreature->SetInstanceId(GetInstanceId()); + //pCreature->SetInstanceId(GetInstanceId()); uint32 team = 0; if (GetTypeId()==TYPEID_PLAYER) team = ((Player*)this)->GetTeam(); diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 50219bfb6f4..c4025d9de5e 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -107,7 +107,7 @@ WaypointMovementGenerator::Initialize(Creature &u) Traveller traveller(u); node = *(waypoints->at(i_currentNode)); InitTraveller(u,node); - i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); + i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); }*/ } @@ -153,8 +153,8 @@ WaypointMovementGenerator::Update(Creature &unit, const uint32 &diff) if(StopedByPlayer) { assert(node); - InitTraveller(unit,node); - i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); + InitTraveller(unit, *node); + i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); StopedByPlayer = false; return true; @@ -166,7 +166,7 @@ WaypointMovementGenerator::Update(Creature &unit, const uint32 &diff) i_currentNode = 0; //Start moving all over again else { - unit.SetHomePosition(node.x, node.y, node.z, unit.GetOrientation()); + unit.SetHomePosition(node->x, node->y, node->z, unit.GetOrientation()); unit.GetMotionMaster()->Initialize(); return false; //Clear the waypoint movement } @@ -174,24 +174,24 @@ WaypointMovementGenerator::Update(Creature &unit, const uint32 &diff) else i_currentNode++; - node = *(waypoints->at(i_currentNode)); - InitTraveller(unit,node); - i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); + node = waypoints->at(i_currentNode); + InitTraveller(unit, *node); + i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); } else { //Determine waittime - if(node.delay) - i_nextMoveTime.Reset(node.delay); + if(node->delay) + i_nextMoveTime.Reset(node->delay); - if(node.event_id && rand()%100 < node.event_chance) - sWorld.ScriptsStart(sWaypointScripts, node.event_id, &unit, NULL); + if(node->event_id && rand()%100 < node->event_chance) + sWorld.ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL); MovementInform(unit); unit.UpdateWaypointID(i_currentNode); unit.clearUnitState(UNIT_STAT_MOVING); - unit.Relocate(node.x, node.y, node.z); + unit.Relocate(node->x, node->y, node->z); } } else diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 99d111063de..899c55a5925 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -80,7 +80,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } private: - WaypointData node; + WaypointData *node; uint32 path_id; TimeTrackerSmall i_nextMoveTime; WaypointPath *waypoints; -- cgit v1.2.3