From 01f178a1db0bf42b58bb4fefcafa020ce71e5f74 Mon Sep 17 00:00:00 2001 From: krz Date: Mon, 25 May 2009 23:35:09 +0200 Subject: Fix for 4s rule while drinking in arena. --HG-- branch : trunk --- src/game/SpellAuras.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6dd2930b1bd..dc8616e2fa7 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5917,13 +5917,14 @@ void Aura::PeriodicDummyTick() if ((*i)->GetId() == GetId()) { BattleGround *bg = ((Player*)m_target)->GetBattleGround(); - // Get tick number - int32 tick = (m_maxduration - m_duration) / m_modifier.periodictime; - // Default case (not on arenas) - if (tick == 0 ) + if(!bg || !bg->isArena()) { - (*i)->GetModifier()->m_amount = m_modifier.m_amount; - + // default case - not in arena + m_isPeriodic = false; + if(m_tickNumber == 1) + (*i)->GetModifier()->m_amount = m_modifier.m_amount; + ((Player*)m_target)->UpdateManaRegen(); + return; } //********************************************** // This feature uses only in arenas @@ -5932,26 +5933,19 @@ void Aura::PeriodicDummyTick() // on 0 tick - 0 (handled in 2 second) // on 1 tick - 166% (handled in 4 second) // on 2 tick - 133% (handled in 6 second) - // Not need update after 3 tick - - if(!bg || !bg->isArena()) - { - m_isPeriodic = false; - ((Player*)m_target)->UpdateManaRegen(); - return; - } - if (tick > 3) + // Not need update after 4 tick + if (m_tickNumber > 4) return; - // Apply bonus for 0 - 3 tick - switch (tick) + // Apply bonus for 1 - 4 tick + switch (m_tickNumber) { - case 0: // 0% - (*i)->GetModifier()->m_amount = m_modifier.m_amount = 0; + case 1: // 0% + (*i)->GetModifier()->m_amount = 0; break; - case 1: // 166% + case 2: // 166% (*i)->GetModifier()->m_amount = m_modifier.m_amount * 5 / 3; break; - case 2: // 133% + case 3: // 133% (*i)->GetModifier()->m_amount = m_modifier.m_amount * 4 / 3; break; default: // 100% - normal regen -- cgit v1.2.3 From 33424eb608eccfcb6cddb97282aaae937efc119e Mon Sep 17 00:00:00 2001 From: Paradox Date: Tue, 26 May 2009 07:15:54 -0400 Subject: Fix genrevision to get correct hash and set revision as Archive, if compiled from bitbucket archive --HG-- branch : trunk --- src/tools/genrevision/genrevision.cpp | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'src') diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index 1c22655c782..be5a38e1be8 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -96,6 +96,47 @@ void extractDataFromHG(FILE* EntriesFile, std::string path, bool url, RawData& d strcpy(data.time_str,"*"); } +void extractDataFromArchive(FILE* EntriesFile, std::string path, bool url, RawData& data) +{ + char buf[200]; + + char hash_str[200]; + char revision_str[200]; + + bool found = false; + fgets(buf,200,EntriesFile); + while(fgets(buf,200,EntriesFile)) + { + if(sscanf(buf,"%s %s",revision_str,hash_str)==2) + { + found = true; + break; + } + } + + if(!found) + { + strcpy(data.hash_str,"*"); + strcpy(data.rev_str,"*"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); + return; + } + + char thash_str[200]; + for(int i = 11;i >= 0; --i) + { + thash_str[i] = hash_str[i]; + } + thash_str[12] = '\0'; + + strcpy(data.hash_str,thash_str); + strcpy(data.rev_str,"Archive"); + + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); +} + void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& data) { char buf[200]; @@ -241,6 +282,17 @@ bool extractDataFromHG(std::string filename, std::string path, bool url, RawData return true; } +bool extractDataFromArchive(std::string filename, std::string path, bool url, RawData& data) +{ + FILE* EntriesFile = fopen(filename.c_str(), "r"); + if(!EntriesFile) + return false; + + extractDataFromArchive(EntriesFile,path,url,data); + fclose(EntriesFile); + return true; +} + std::string generateHeader(char const* rev_str, char const* date_str, char const* time_str, char const* hash_str) { std::ostringstream newData; @@ -339,6 +391,11 @@ int main(int argc, char **argv) res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data); if (!res) res = extractDataFromGit(path+"_git/FETCH_HEAD",path,use_url,data); + // Archive data + if (!res) + res = extractDataFromArchive(path+".hg_archival.txt",path,use_url,data); + if (!res) + res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data); } else if(git_prefered) { @@ -360,6 +417,11 @@ int main(int argc, char **argv) res = extractDataFromSvn(path+".svn/entries",use_url,data); if (!res) res = extractDataFromSvn(path+"_svn/entries",use_url,data); + // Archive data + if (!res) + res = extractDataFromArchive(path+".hg_archival.txt",path,use_url,data); + if (!res) + res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data); } else if(hg_prefered) @@ -382,7 +444,13 @@ int main(int argc, char **argv) res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data); if (!res) res = extractDataFromGit(path+"_git/FETCH_HEAD",path,use_url,data); + // Archive data + if (!res) + res = extractDataFromArchive(path+".hg_archival.txt",path,use_url,data); + if (!res) + res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data); } + if(res) newData = generateHeader(data.rev_str,data.date_str,data.time_str,data.hash_str); else -- cgit v1.2.3 From fac0b28ece7de0ae7cab3d9ff87ae1ff7c69fda3 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Wed, 27 May 2009 09:29:32 +0200 Subject: * Use free() rather than delete operator to deallocate memory allocated by strdup --HG-- branch : trunk --- src/game/Chat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 5d0901b0596..81655dad638 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -766,7 +766,7 @@ void ChatHandler::SendGlobalGMSysMessage(const char *str) FillSystemMessageData(&data, line); sWorld.SendGlobalGMMessage(&data); } - delete buf; + free(buf); } void ChatHandler::SendSysMessage(int32 entry) -- cgit v1.2.3 From 0c38d04691ac19ce3fdcf2c0515c34c9def91d71 Mon Sep 17 00:00:00 2001 From: Alyen Date: Wed, 27 May 2009 18:53:31 +0200 Subject: *Some changes in Nexus-Prince Shaffar's script. --HG-- branch : trunk --- sql/updates/TC1_1534_world.sql | 3 + sql/world_scripts_full.sql | 1 + .../mana_tombs/boss_nexusprince_shaffar.cpp | 155 ++++++++++++++++++--- 3 files changed, 136 insertions(+), 23 deletions(-) create mode 100644 sql/updates/TC1_1534_world.sql (limited to 'src') diff --git a/sql/updates/TC1_1534_world.sql b/sql/updates/TC1_1534_world.sql new file mode 100644 index 00000000000..593069435fd --- /dev/null +++ b/sql/updates/TC1_1534_world.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName` = 'mob_ethereal_apprentice' WHERE `entry` = 18431; + +DELETE FROM `creature` WHERE `id` = 18431; diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index d074a524da4..3832574dc34 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -130,6 +130,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_ruul_snowhoof' WHERE `entry` = UPDATE `creature_template` SET `ScriptName`='boss_pandemonius' WHERE `entry`=18341; UPDATE `creature_template` SET `ScriptName`='boss_nexusprince_shaffar' WHERE `entry`=18344; UPDATE `creature_template` SET `ScriptName`='mob_ethereal_beacon' WHERE `entry`=18431; +UPDATE `creature_template` SET `ScriptName`='mob_ethereal_apprentice' WHERE `entry`=18431; /* AUCHENAI CRYPTS */ UPDATE `creature_template` SET `ScriptName`='boss_exarch_maladaar' WHERE `entry`=18373; diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp index 72d9030bca6..872a8c94637 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp @@ -42,8 +42,8 @@ EndContentData */ #define SAY_DEAD -1557007 #define SPELL_BLINK 34605 -#define SPELL_FROSTBOLT 32364 -#define SPELL_FIREBALL 32363 +#define SPELL_FROSTBOLT 32370 +#define SPELL_FIREBALL 20420 #define SPELL_FROSTNOVA 32365 #define SPELL_ETHEREAL_BEACON 32371 // Summon 18431 @@ -52,6 +52,8 @@ EndContentData */ #define ENTRY_BEACON 18431 #define ENTRY_SHAFFAR 18344 +#define NR_INITIAL_BEACONS 3 + struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI { boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c) {} @@ -62,9 +64,18 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI uint32 Frostbolt_Timer; uint32 FrostNova_Timer; + Creature* Beacon[NR_INITIAL_BEACONS]; + bool HasTaunted; bool CanBlink; + void RemoveBeaconFromList(Creature* targetBeacon) + { + for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++) + if(Beacon[i] && Beacon[i]->GetGUID() == targetBeacon->GetGUID()) + Beacon[i] = NULL; + } + void Reset() { Blink_Timer = 1500; @@ -75,6 +86,36 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI HasTaunted = false; CanBlink = false; + + float dist = 8.0f; + float posX, posY, posZ, angle; + m_creature->GetHomePosition(posX, posY, posZ, angle); + + Beacon[0] = m_creature->SummonCreature(ENTRY_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + Beacon[1] = m_creature->SummonCreature(ENTRY_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + Beacon[2] = m_creature->SummonCreature(ENTRY_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + + for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++) + { + if(Beacon[i]) + Beacon[i]->CastSpell(Beacon[i], SPELL_ETHEREAL_BEACON_VISUAL, false); + } + } + + void EnterEvadeMode() + { + //Despawn still living initial beacons. + for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++) + { + if(Beacon[i] && Beacon[i]->isAlive()) + { + Beacon[i]->RemoveAllAuras(); + Beacon[i]->CombatStop(); + Beacon[i]->StopMoving(); + Beacon[i]->Kill(Beacon[i]); + } + } + ScriptedAI::EnterEvadeMode(); } void MoveInLineOfSight(Unit *who) @@ -107,6 +148,11 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; } + + // Send initial beacons to join the fight if not already + for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++) + if(Beacon[i] && Beacon[i]->isAlive() && !Beacon[i]->isInCombat()) + Beacon[i]->AI()->AttackStart(who); } void JustSummoned(Creature *summoned) @@ -204,26 +250,36 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c) { HeroicMode = m_creature->GetMap()->IsHeroic(); - CanEvade = false; } bool HeroicMode; - bool CanEvade; uint32 Apprentice_Timer; uint32 ArcaneBolt_Timer; + uint32 Check_Timer; - void Reset() + void KillSelf() { - if( CanEvade ) - m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->Kill(m_creature); + } - CanEvade = false; + void Reset() + { Apprentice_Timer = (HeroicMode ? 10000 : 20000); ArcaneBolt_Timer = 1000; + Check_Timer = 1000; } void Aggro(Unit *who) { + // Send Shaffar to fight + Unit* Shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); + if(!Shaffar || Shaffar->isDead()) + { + KillSelf(); + return; + } + if(!Shaffar->isInCombat()) + ((Creature*)Shaffar)->AI()->AttackStart(who); } void JustSummoned(Creature *summoned) @@ -231,22 +287,33 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI summoned->AI()->AttackStart(m_creature->getVictim()); } + void JustDied(Unit* Killer) + { + Unit *Shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); + if(Shaffar) + ((boss_nexusprince_shaffarAI*)(((Creature*)Shaffar)->AI()))->RemoveBeaconFromList(m_creature); + } + void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; + if(Check_Timer < diff) + { + Unit *Shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); + if(!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) + { + KillSelf(); + return; + } + Check_Timer = 1000; + }else Check_Timer -= diff; + if( ArcaneBolt_Timer < diff ) { DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); ArcaneBolt_Timer = 2000 + rand()%2500; - Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature); - if(!shaffar || shaffar->isDead()) - { - m_creature->SetVisibility(VISIBILITY_OFF); - m_creature->SetLootRecipient(NULL); - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } }else ArcaneBolt_Timer -= diff; if( Apprentice_Timer < diff ) @@ -257,22 +324,59 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI m_creature->CastSpell(m_creature,SPELL_ETHEREAL_APPRENTICE,true); if( m_creature->isPet() ) ((Pet*)m_creature)->SetDuration(0); - CanEvade = true; + KillSelf(); + return; }else Apprentice_Timer -= diff; + } +}; - if( CanEvade ) - { - EnterEvadeMode(); +CreatureAI* GetAI_mob_ethereal_beacon(Creature *_Creature) +{ + return new mob_ethereal_beaconAI (_Creature); +} + +#define SPELL_ETHEREAL_APPRENTICE_FIREBOLT 32369 +#define SPELL_ETHEREAL_APPRENTICE_FROSTBOLT 32370 + +struct TRINITY_DLL_DECL mob_ethereal_apprenticeAI : public ScriptedAI +{ + mob_ethereal_apprenticeAI(Creature *c) : ScriptedAI(c) {} + + uint32 Cast_Timer; + + bool isFireboltTurn; + + void Reset() + { + Cast_Timer = 3000; + isFireboltTurn = true; + } + + void Aggro(Unit* who) {} + + void UpdateAI(const uint32 diff) + { + if(!UpdateVictim()) return; - } - DoMeleeAttackIfReady(); + if(Cast_Timer < diff) + { + if(isFireboltTurn) + { + m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FIREBOLT, true); + isFireboltTurn = false; + }else{ + m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FROSTBOLT, true); + isFireboltTurn = true; + } + Cast_Timer = 3000; + }else Cast_Timer -= diff; } }; -CreatureAI* GetAI_mob_ethereal_beacon(Creature *_Creature) +CreatureAI* GetAI_mob_ethereal_apprentice(Creature *_Creature) { - return new mob_ethereal_beaconAI (_Creature); + return new mob_ethereal_apprenticeAI (_Creature); } void AddSC_boss_nexusprince_shaffar() @@ -288,5 +392,10 @@ void AddSC_boss_nexusprince_shaffar() newscript->Name="mob_ethereal_beacon"; newscript->GetAI = &GetAI_mob_ethereal_beacon; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_ethereal_apprentice"; + newscript->GetAI = &GetAI_mob_ethereal_apprentice; + newscript->RegisterSelf(); } -- cgit v1.2.3