diff options
| author | XTZGZoReX <none@none> | 2009-03-20 15:17:58 +0100 |
|---|---|---|
| committer | XTZGZoReX <none@none> | 2009-03-20 15:17:58 +0100 |
| commit | d1adac0d11847c893b2df0778b81dbbbb79b20ee (patch) | |
| tree | bef465fd25746ed1e276ede2238f155b1a347a4a /src | |
| parent | 3c713189fb6ac6666e6d8e7faa2e1fec6b425725 (diff) | |
| parent | 4d7ee8208e0e1762ca70d1cee253e51d3c517551 (diff) | |
* Merge.
--HG--
branch : trunk
Diffstat (limited to 'src')
45 files changed, 1954 insertions, 1085 deletions
diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index b8df85fab45..701d2db3673 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -1875,7 +1875,6 @@ RelativePath="..\scripts\zone\caverns_of_time\dark_portal\instance_dark_portal.cpp" > </File> - </Filter> <Filter Name="Battle for Mt. Hyjal" @@ -1936,9 +1935,6 @@ > </File> </Filter> - <Filter - Name="Culling of Stratholme"> - </Filter> </Filter> <Filter Name="Silvermoon City" @@ -2008,12 +2004,63 @@ </Filter> <Filter Name="Azjol-Nerub"> - <Filter - Name="Ahn'kahet"> - </Filter> - <Filter - Name="Azjol-Nerub"> - </Filter> + <Filter + Name="Ahn'kahet" + > + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_amanitar.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_elder_nadox.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_herald_volazj.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_jedoga_shadowseeker.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_prince_taldaram.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\def_ahnkahet.h" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\instance_ahnkahet.cpp" + > + </File> + </Filter> + <Filter + Name="Azjol-Nerub" + > + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_anubarak.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_hadronox.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_krikthir_the_gatewatcher.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\def_azjol_nerub.h" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\instance_azjol_nerub.cpp" + > + </File> + </Filter> + </Filter> <Filter Name="Drak'Tharon Keep"> diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 2ebc38618cc..b7311a6debb 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -1114,12 +1114,63 @@ </Filter> <Filter Name="Azjol-Nerub"> - <Filter - Name="Ahn'kahet"> - </Filter> - <Filter - Name="Azjol-Nerub"> - </Filter> + <Filter + Name="Ahn'kahet" + > + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_amanitar.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_elder_nadox.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_herald_volazj.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_jedoga_shadowseeker.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_prince_taldaram.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\def_ahnkahet.h" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\instance_ahnkahet.cpp" + > + </File> + </Filter> + <Filter + Name="Azjol-Nerub" + > + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_anubarak.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_hadronox.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_krikthir_the_gatewatcher.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\def_azjol_nerub.h" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\instance_azjol_nerub.cpp" + > + </File> + </Filter> + </Filter> <Filter Name="Drak'Tharon Keep"> @@ -2195,9 +2246,6 @@ </File> </Filter> <Filter - Name="Culling of Stratholme"> - </Filter> - <Filter Name="Culling of Stratholme" > </Filter> diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 5569aa33c41..cd5612a4f71 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -807,10 +807,58 @@ <Filter Name="Ahn'kahet" > + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_amanitar.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_elder_nadox.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_herald_volazj.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_jedoga_shadowseeker.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\boss_prince_taldaram.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\def_ahnkahet.h" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Ahn'kahet\instance_ahnkahet.cpp" + > + </File> </Filter> <Filter Name="Azjol-Nerub" > + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_anubarak.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_hadronox.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_krikthir_the_gatewatcher.cpp" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\def_azjol_nerub.h" + > + </File> + <File + RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\instance_azjol_nerub.cpp" + > + </File> </Filter> </Filter> <Filter @@ -2225,10 +2273,6 @@ > </Filter> <Filter - Name="Culling of Stratholme" - > - </Filter> - <Filter Name="Old Hillsbrad" > <File diff --git a/src/bindings/scripts/include/precompiled.h b/src/bindings/scripts/include/precompiled.h index 28b37a98349..2c36cc924e0 100644 --- a/src/bindings/scripts/include/precompiled.h +++ b/src/bindings/scripts/include/precompiled.h @@ -12,6 +12,7 @@ #include "GridNotifiersImpl.h" #include "Unit.h" #include "GameObject.h" +#include "TemporarySummon.h" #include "sc_creature.h" #include "sc_gossip.h" #include "sc_instance.h" diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp new file mode 100644 index 00000000000..14480a8b725 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_amanitar +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Ahn'kahet +EndScriptData */ + +#include "precompiled.h" +#include "def_ahnkahet.h" diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp new file mode 100644 index 00000000000..059500ad593 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_elder_nadox +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Ahn'kahet +EndScriptData */ + +#include "precompiled.h" +#include "def_ahnkahet.h" + +#define SPELL_BROOD_PLAGUE 56130 +#define H_SPELL_BROOD_PLAGUE 59467 +#define SPELL_BROOD_RAGE 59465 + +#define MOB_AHNKAHAR_SWARMER 30178 +#define SPELL_SUMMON_SWARMERS 56119//2x 30178 + +#define MOB_AHNKAHAR_SWARMER 30178 +#define SPELL_SUMMON_SWARM_GUARD 56120//1x 30176 +#define SPELL_DEADLY_POISON 56145// Proc trigger +#define H_SPELL_DEADLY_POISON 59479// Proc trigger +#define SPELL_GUARDIAN_AURA 56151 diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp new file mode 100644 index 00000000000..389e828c881 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_herald_volazj +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Ahn'kahet +EndScriptData */ + +#include "precompiled.h" +#include "def_ahnkahet.h" diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp new file mode 100644 index 00000000000..efcd811641f --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_jedoga_shadowseeker +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Ahn'kahet +EndScriptData */ + +#include "precompiled.h" +#include "def_ahnkahet.h" + +#define SPELL_CYCLONE_STRIKE 56855 +#define H_SPELL_CYCLONE_STRIKE 60030//kein unterschied zu 56855 außer das 60030 1,5sec cast ist +#define SPELL_LIGHTNING_BOLT 56891 +#define H_SPELL_LIGHTNING_BOLT 60032 +#define SPELL_THUNDERSHOCK 56926//AOE works +#define H_SPELL_THUNDERSHOCK 60029//AOE works + +#define SPELL_GIFT_OF_THE_HERALD 56219//triggert if sucessfull sacreficed diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp new file mode 100644 index 00000000000..c03fe85a7f1 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_prince_taldaram +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Ahn'kahet +EndScriptData */ + +#include "precompiled.h" +#include "def_ahnkahet.h" + +#define SPELL_BLOODTHIRST 55968 //Trigger Spell + add aura +#define SPELL_CONJURE_FLAME_SPHERE 55931 + +#define SPELL_FLAME_SPHERE_SUMMON_1 55895// 1x 30106 +#define H_SPELL_FLAME_SPHERE_SUMMON_1 59511// 1x 31686 +#define H_SPELL_FLAME_SPHERE_SUMMON_2 59512// 1x 31687 +#define SPELL_FLAME_SPHERE_SPAWN_EFFEKT 55891 +#define SPELL_FLAME_SPHERE_VISUAL 55928 +#define SPELL_FLAME_SPHERE_PERIODIC 55926 +#define H_SPELL_FLAME_SPHERE_PERIODIC 59508 +#define SPELL_FLAME_SPHERE_DEATH_EFFEKT 55947 + +#define SPELL_EMBRACE_OF_THE_VAMPYR 55959 +#define H_SPELL_EMBRACE_OF_THE_VAMPYR 59513 + +#define SPELL_VANISH 55964 diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/def_ahnkahet.h b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/def_ahnkahet.h new file mode 100644 index 00000000000..97c0db55d72 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/def_ahnkahet.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 + */ + +#ifndef DEF_AHNKAHET_H +#define DEF_AHNKAHET_H + +#define DATA_ELDER_NADOX 1 +#define DATA_PRINCE_TALDARAM 2 +#define DATA_JEDOGA_SHADOWSEEKER 3 +#define DATA_HERALD_VOLAZJ 4 +#define DATA_AMANITAR 5 + +#define DATA_ELDER_NADOX_EVENT 6 +#define DATA_PRINCE_TALDARAM_EVENT 7 +#define DATA_JEDOGA_SHADOWSEEKER_EVENT 8 +#define DATA_HERALD_VOLAZJ_EVENT 9 +#define DATA_AMANITAR_EVENT 10 +#endif diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/instance_ahnkahet.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/instance_ahnkahet.cpp new file mode 100644 index 00000000000..3da7f28d95f --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/instance_ahnkahet.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: Instance_Azjol_Nerub +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Azjol Nerub +EndScriptData */ + +#include "precompiled.h" +#include "def_ahnkahet.h" + +#define ENCOUNTERS 5 + +/* Ahn'kahet encounters: +0 - Elder Nadox +1 - Prince Taldaram +2 - Jedoga Shadowseeker +3 - Herald Volazj +4 - Amanitar (Heroic only) +*/ + +struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance +{ + instance_ahnkahet(Map *Map) : ScriptedInstance(Map) {Initialize();}; + + uint64 Elder_Nadox; + uint64 Prince_Taldaram; + uint64 Jedoga_Shadowseeker; + uint64 Herald_Volazj; + uint64 Amanitar; + + uint32 Encounters[ENCOUNTERS]; + + void Initialize() + { + Elder_Nadox =0; + Prince_Taldaram =0; + Jedoga_Shadowseeker =0; + Herald_Volazj =0; + Amanitar =0; + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + Encounters[i] = NOT_STARTED; + } + + bool IsEncounterInProgress() const + { + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if(Encounters[i] == IN_PROGRESS) return true; + + return false; + } + + + void OnCreatureCreate(Creature *creature, uint32 creature_entry) + { + switch(creature_entry) + { + case 29309: Elder_Nadox = creature->GetGUID(); break; + case 29308: Prince_Taldaram = creature->GetGUID(); break; + case 29310: Jedoga_Shadowseeker = creature->GetGUID(); break; + case 29311: Herald_Volazj = creature->GetGUID(); break; + case 30258: Amanitar = creature->GetGUID(); break; + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_ELDER_NADOX: return Elder_Nadox; + case DATA_PRINCE_TALDARAM: return Prince_Taldaram; + case DATA_JEDOGA_SHADOWSEEKER: return Jedoga_Shadowseeker; + case DATA_HERALD_VOLAZJ: return Herald_Volazj; + case DATA_AMANITAR: return Amanitar; + } + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_ELDER_NADOX_EVENT: + Encounters[0] = data;break; + case DATA_PRINCE_TALDARAM_EVENT: + Encounters[1] = data; break; + case DATA_JEDOGA_SHADOWSEEKER_EVENT: + Encounters[2] = data; break; + case DATA_HERALD_VOLAZJ: + Encounters[3] = data; break; + case DATA_AMANITAR: + Encounters[4] = data; break; + } + + if (data == DONE) + { + SaveToDB(); + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_ELDER_NADOX_EVENT: return Encounters[0]; + case DATA_PRINCE_TALDARAM_EVENT: return Encounters[1]; + case DATA_JEDOGA_SHADOWSEEKER_EVENT: return Encounters[2]; + case DATA_HERALD_VOLAZJ: return Encounters[3]; + case DATA_AMANITAR: return Encounters[4]; + } + return 0; + } + + const char* Save() + { + OUT_SAVE_INST_DATA; + + std::string str_data; + + std::ostringstream saveStream; + saveStream << "A K " << Encounters[0] << " " << Encounters[1] << " " + << Encounters[2] << Encounters[3] << Encounters[4]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data.c_str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0,data1,data2,data3,data4; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + + if( dataHead1 == 'A' && dataHead2 == 'K') + { + Encounters[0] = data0; + Encounters[1] = data1; + Encounters[2] = data2; + Encounters[3] = data3; + Encounters[4] = data4; + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + + }else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } +}; + +InstanceData* GetInstanceData_instance_ahnkahet(Map* map) +{ + return new instance_ahnkahet(map); +} + +void AddSC_instance_ahnkahet() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_ahnkahet"; + newscript->GetInstanceData = &GetInstanceData_instance_ahnkahet; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp new file mode 100644 index 00000000000..f9922581733 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_anubarak +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Azjol Nerub +EndScriptData */ + +#include "precompiled.h" +#include "def_azjol_nerub.h" diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp new file mode 100644 index 00000000000..72bcb708429 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_hadronox +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Azjol Nerub +EndScriptData */ + +#include "precompiled.h" +#include "def_azjol_nerub.h" + +#define SPELL_WEB_FRONT_DOORS 53177//dummy + +#define SPELL_ACID_CLOUD 53400 +#define H_SPELL_ACID_CLOUD 59419 +#define SPELL_LEECH_POISON 53030 +#define H_SPELL_LEECH_POISON 59417 +#define SPELL_LEECH_POISON_DEADTRIGGER 53800//heal 10% heroic und normal +#define SPELL_PIECE_ARMOR 53418 +#define SPELL_WEB_GRAB 53406 +#define H_SPELL_WEB_GRAB 59420
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp new file mode 100644 index 00000000000..27f4d3070fc --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: boss_krikthir_the_gatewatcher +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Azjol Nerub +EndScriptData */ + +#include "precompiled.h" +#include "def_azjol_nerub.h" + +#define SPELL_MIND_FLAY 52586 +#define H_SPELL_MIND_FLAY 59367 +#define SPELL_CURSE_OF_FATIGUE 52592 +#define H_SPELL_CURSE_OF_FATIGUE 59368 +#define SPELL_FRENZY 28747 + +#define MOB_SKITTERING_SWARMER 28735 +#define MOB_SKITTERING_SWARMER_CONTROLLER 32593 +#define SPELL_SUMMON_SKITTERING_SWARMER 52438//AOE Effekt 140 +#define SPELL_SUMMON_SKITTERING_SWARMER 52439//Summon 3x 28735
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/def_azjol_nerub.h b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/def_azjol_nerub.h new file mode 100644 index 00000000000..9e319e8fde0 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/def_azjol_nerub.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 + */ + +#ifndef DEF_AZJOL_NERUB_H +#define DEF_AZJOL_NERUB_H + +#define DATA_KRIKTHIR_THE_GATEWATCHER 1 +#define DATA_HADRONOX 2 +#define DATA_ANUBARAK 3 + +#define DATA_KRIKTHIR_THE_GATEWATCHER_EVENT 4 +#define DATA_HADRONOX_EVENT 5 +#define DATA_ANUBARAK_EVENT 6 +#endif diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/instance_azjol_nerub.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/instance_azjol_nerub.cpp new file mode 100644 index 00000000000..30acaa0c842 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/instance_azjol_nerub.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 +SDName: Instance_Azjol_Nerub +SD%Complete: 0 +SDComment: Placeholder +SDCategory: Azjol Nerub +EndScriptData */ + +#include "precompiled.h" +#include "def_azjol_nerub.h" + +#define ENCOUNTERS 3 + +/* Azjol Nerub encounters: +0 - Krik'thir the Gatewatcher +1 - Hadronox +2 - Anub'arak +*/ + +struct TRINITY_DLL_DECL instance_azjol_nerub : public ScriptedInstance +{ + instance_azjol_nerub(Map *Map) : ScriptedInstance(Map) {Initialize();}; + + uint64 Krikthir; + uint64 Hadronox; + uint64 Anubarak; + + uint32 Encounters[ENCOUNTERS]; + + void Initialize() + { + Krikthir = 0; + Hadronox = 0; + Anubarak =0; + + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + Encounters[i] = NOT_STARTED; + } + + bool IsEncounterInProgress() const + { + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if(Encounters[i] == IN_PROGRESS) return true; + + return false; + } + + + void OnCreatureCreate(Creature *creature, uint32 creature_entry) + { + switch(creature_entry) + { + case 28684: Krikthir = creature->GetGUID(); break; + case 28921: Hadronox = creature->GetGUID(); break; + case 29120: Anubarak = creature->GetGUID(); break; + + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_KRIKTHIR_THE_GATEWATCHER: return Krikthir; + case DATA_HADRONOX: return Hadronox; + case DATA_ANUBARAK: return Anubarak; + } + + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_KRIKTHIR_THE_GATEWATCHER_EVENT: + Encounters[0] = data;break; + case DATA_HADRONOX_EVENT: + Encounters[1] = data; break; + case DATA_ANUBARAK_EVENT: + Encounters[2] = data; break; + } + + if (data == DONE) + { + SaveToDB(); + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_KRIKTHIR_THE_GATEWATCHER_EVENT: return Encounters[0]; + case DATA_HADRONOX_EVENT: return Encounters[1]; + case DATA_ANUBARAK_EVENT: return Encounters[2]; + } + + return 0; + } + + const char* Save() + { + OUT_SAVE_INST_DATA; + + std::string str_data; + + std::ostringstream saveStream; + saveStream << "A N " << Encounters[0] << " " << Encounters[1] << " " + << Encounters[2]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data.c_str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0,data1,data2; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2; + + if( dataHead1 == 'A' && dataHead2 == 'N') + { + Encounters[0] = data0; + Encounters[1] = data1; + Encounters[2] = data2; + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + + }else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } +}; + +InstanceData* GetInstanceData_instance_azjol_nerub(Map* map) +{ + return new instance_azjol_nerub(map); +} + +void AddSC_instance_azjol_nerub() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_azjol_nerub"; + newscript->GetInstanceData = &GetInstanceData_instance_azjol_nerub; + newscript->RegisterSelf(); +} diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 7ea44fd023a..83b383fb7b1 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -74,53 +74,199 @@ ChatCommand * ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverSetCommandTable[] = + static ChatCommand banCommandTable[] = { - { "loglevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogLevelCommand, "", NULL }, - { "difftime", SEC_CONSOLE, true, &ChatHandler::HandleServerSetDiffTimeCommand, "", NULL }, - { "motd", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetMotdCommand, "", NULL }, + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverIdleRestartCommandTable[] = + static ChatCommand baninfoCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, - { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleRestartCommand, "", NULL }, + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverIdleShutdownCommandTable[] = + static ChatCommand banlistCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, - { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleShutDownCommand, "", NULL }, + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverRestartCommandTable[] = + static ChatCommand castCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, - { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerRestartCommand, "", NULL }, + { "back", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastBackCommand, "", NULL }, + { "dist", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastDistCommand, "", NULL }, + { "self", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastSelfCommand, "", NULL }, + { "target", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastTargetCommand, "", NULL }, + { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverShutdownCommandTable[] = + static ChatCommand debugCommandTable[] = { - { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, - { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCommand, "", NULL }, + { "inarc", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugInArcCommand, "", NULL }, + { "spellfail", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpellFailCommand, "", NULL }, + { "setpoi", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetPoiCommand, "", NULL }, + { "qpartymsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestPartyMsgCommand, "", NULL }, + { "qinvalidmsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestInvalidMsgCommand, "", NULL }, + { "equiperr", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugEquipErrorCommand, "", NULL }, + { "sellerr", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSellErrorCommand, "", NULL }, + { "buyerr", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBuyErrorCommand, "", NULL }, + { "sendopcode", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendOpcodeCommand, "", NULL }, + { "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicle, "", NULL }, + { "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateWorldStateCommand, "", NULL }, + { "ps", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugPlaySound2Command, "", NULL }, + { "scn", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendChannelNotifyCommand, "", NULL }, + { "scm", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendChatMsgCommand, "", NULL }, + { "sps", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendSetPhaseShiftCommand, "", NULL }, + { "getitemstate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemState, "", NULL }, + { "playsound", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlaySoundCommand, "", NULL }, + { "update", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdate, "", NULL }, + { "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValue, "", NULL }, + { "getvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetValue, "", NULL }, + { "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSet32Bit, "", NULL }, + { "Mod32Value", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugMod32Value, "", NULL }, + { "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugAnimCommand, "", NULL }, + { "lootrecipient", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugGetLootRecipient, "", NULL }, + { "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL }, + { "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL }, + { "sendlargepacket",SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendLargePacketCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand eventCommandTable[] = + { + { "activelist", SEC_GAMEMASTER, true, &ChatHandler::HandleEventActiveListCommand, "", NULL }, + { "start", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStartCommand, "", NULL }, + { "stop", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStopCommand, "", NULL }, + { "", SEC_GAMEMASTER, true, &ChatHandler::HandleEventInfoCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand serverCommandTable[] = + static ChatCommand gmCommandTable[] = { - { "corpses", SEC_GAMEMASTER, true, &ChatHandler::HandleServerCorpsesCommand, "", NULL }, - { "exit", SEC_CONSOLE, true, &ChatHandler::HandleServerExitCommand, "", NULL }, - { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, - { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, - { "info", SEC_PLAYER, true, &ChatHandler::HandleServerInfoCommand, "", NULL }, - { "motd", SEC_PLAYER, true, &ChatHandler::HandleServerMotdCommand, "", NULL }, - { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, - { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, - { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, + { "chat", SEC_MODERATOR, false, &ChatHandler::HandleGMChatCommand, "", NULL }, + { "ingame", SEC_PLAYER, true, &ChatHandler::HandleGMListIngameCommand, "", NULL }, + { "list", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMListFullCommand, "", NULL }, + { "visible", SEC_MODERATOR, false, &ChatHandler::HandleGMVisibleCommand, "", NULL }, + { "fly", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGMFlyModeCommand, "", NULL }, + { "", SEC_MODERATOR, false, &ChatHandler::HandleGMmodeCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand goCommandTable[] = + { + { "grid", SEC_MODERATOR, false, &ChatHandler::HandleGoGridCommand, "", NULL }, + { "creature", SEC_GAMEMASTER, false, &ChatHandler::HandleGoCreatureCommand, "", NULL }, + { "object", SEC_GAMEMASTER, false, &ChatHandler::HandleGoObjectCommand, "", NULL }, + { "trigger", SEC_GAMEMASTER, false, &ChatHandler::HandleGoTriggerCommand, "", NULL }, + { "graveyard", SEC_GAMEMASTER, false, &ChatHandler::HandleGoGraveyardCommand, "", NULL }, + { "zonexy", SEC_MODERATOR, false, &ChatHandler::HandleGoZoneXYCommand, "", NULL }, + { "xy", SEC_MODERATOR, false, &ChatHandler::HandleGoXYCommand, "", NULL }, + { "xyz", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, + { "", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand gobjectCommandTable[] = + { + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectAddCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectDeleteCommand, "", NULL }, + { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectMoveCommand, "", NULL }, + { "near", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectNearCommand, "", NULL }, + { "setphase", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectPhaseCommand, "", NULL }, + { "target", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectTargetCommand, "", NULL }, + { "turn", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectTurnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand groupCommandTable[] = + { + { "leader", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupLeaderCommand, "", NULL }, + { "disband", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupDisbandCommand, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupRemoveCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand guildCommandTable[] = + { + { "create", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildCreateCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildDeleteCommand, "", NULL }, + { "invite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildInviteCommand, "", NULL }, + { "uninvite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildUninviteCommand, "", NULL }, + { "rank", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildRankCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand honorCommandTable[] = + { + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorAddCommand, "", NULL }, + { "addkill", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorAddKillCommand, "", NULL }, + { "update", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorUpdateCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand instanceCommandTable[] = + { + { "listbinds", SEC_MODERATOR, false, &ChatHandler::HandleInstanceListBindsCommand, "", NULL }, + { "unbind", SEC_MODERATOR, false, &ChatHandler::HandleInstanceUnbindCommand, "", NULL }, + { "stats", SEC_MODERATOR, true, &ChatHandler::HandleInstanceStatsCommand, "", NULL }, + { "savedata", SEC_MODERATOR, false, &ChatHandler::HandleInstanceSaveDataCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand learnCommandTable[] = + { + { "all", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllCommand, "", NULL }, + { "all_gm", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllGMCommand, "", NULL }, + { "all_crafts", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllCraftsCommand, "", NULL }, + { "all_default", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllDefaultCommand, "", NULL }, + { "all_lang", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllLangCommand, "", NULL }, + { "all_myclass", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyClassCommand, "", NULL }, + { "all_myspells", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMySpellsCommand, "", NULL }, + { "all_mytalents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyTalentsCommand, "", NULL }, + { "all_recipes", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllRecipesCommand, "", NULL }, + { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand listCommandTable[] = + { + { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListCreatureCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListItemCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListObjectCommand, "", NULL }, + { "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand lookupPlayerCommandTable[] = + { + { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, + { "account", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, + { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand lookupCommandTable[] = + { + { "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL }, + { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupCreatureCommand, "", NULL }, + { "event", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupEventCommand, "", NULL }, + { "faction", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupFactionCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemCommand, "", NULL }, + { "itemset", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemSetCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupObjectCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupQuestCommand, "", NULL }, + { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, + { "skill", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSkillCommand, "", NULL }, + { "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL }, + { "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -147,112 +293,71 @@ ChatCommand * ChatHandler::getCommandTable() { "honor", SEC_MODERATOR, false, &ChatHandler::HandleModifyHonorCommand, "", NULL }, { "rep", SEC_MODERATOR, false, &ChatHandler::HandleModifyRepCommand, "", NULL }, { "arena", SEC_MODERATOR, false, &ChatHandler::HandleModifyArenaCommand, "", NULL }, - { "drunk", SEC_MODERATOR, false, &ChatHandler::HandleDrunkCommand, "", NULL }, - { "standstate", SEC_GAMEMASTER, false, &ChatHandler::HandleStandStateCommand, "", NULL }, - { "morph", SEC_GAMEMASTER, false, &ChatHandler::HandleMorphCommand, "", NULL }, + { "drunk", SEC_MODERATOR, false, &ChatHandler::HandleModifyDrunkCommand, "", NULL }, + { "standstate", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyStandStateCommand, "", NULL }, + { "morph", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyMorphCommand, "", NULL }, { "phase", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_ADMINISTRATOR, false, &ChatHandler::HandleModifyGenderCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand wpCommandTable[] = - { - { "show", SEC_GAMEMASTER, false, &ChatHandler::HandleWpShowCommand, "", NULL }, - { "addwp", SEC_GAMEMASTER, false, &ChatHandler::HandleWpAddCommand, "", NULL }, - { "load", SEC_GAMEMASTER, false, &ChatHandler::HandleWpLoadPathCommand, "", NULL }, - { "modify", SEC_GAMEMASTER, false, &ChatHandler::HandleWpModifyCommand, "", NULL }, - { "event", SEC_GAMEMASTER, false, &ChatHandler::HandleWpEventCommand, "", NULL }, - { "unload", SEC_GAMEMASTER, false, &ChatHandler::HandleWpUnLoadPathCommand, "", NULL }, - - { NULL, 0, false, NULL, "", NULL } - }; - - - static ChatCommand banCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanAccountCommand, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanCharacterCommand, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanIPCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand baninfoCommandTable[] = + static ChatCommand npcCommandTable[] = { - { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoAccountCommand, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoCharacterCommand, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoIPCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddCommand, "", NULL }, + { "additem", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddVendorItemCommand, "", NULL }, + { "addmove", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddMoveCommand, "", NULL }, + { "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcChangeEntryCommand, "", NULL }, + { "changelevel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcChangeLevelCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcDeleteCommand, "", NULL }, + { "factionid", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFactionIdCommand, "", NULL }, + { "flag", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFlagCommand, "", NULL }, + { "follow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFollowCommand, "", NULL }, + { "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL }, + { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcMoveCommand, "", NULL }, + { "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcPlayEmoteCommand, "", NULL }, + { "setmodel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetModelCommand, "", NULL }, + { "setmovetype", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetMoveTypeCommand, "", NULL }, + { "setphase", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetPhaseCommand, "", NULL }, + { "spawndist", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnDistCommand, "", NULL }, + { "spawntime", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnTimeCommand, "", NULL }, + { "say", SEC_MODERATOR, false, &ChatHandler::HandleNpcSayCommand, "", NULL }, + { "textemote", SEC_MODERATOR, false, &ChatHandler::HandleNpcTextEmoteCommand, "", NULL }, + { "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL }, + { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, + { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, + { "tame", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcTameCommand, "", NULL }, + { "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL }, - static ChatCommand banlistCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListAccountCommand, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListCharacterCommand, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListIPCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; + //{ TODO: fix or remove this commands + { "addweapon", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcAddWeaponCommand, "", NULL }, + { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcNameCommand, "", NULL }, + { "subname", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSubNameCommand, "", NULL }, + //} - static ChatCommand unbanCommandTable[] = - { - { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL }, - { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanCharacterCommand, "", NULL }, - { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand debugCommandTable[] = + static ChatCommand petCommandTable[] = { - { "inarc", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugInArcCommand, "", NULL }, - { "spellfail", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpellFailCommand, "", NULL }, - { "setpoi", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSetPoiCommand, "", NULL }, - { "qpartymsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendQuestPartyMsgCommand, "", NULL }, - { "qinvalidmsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendQuestInvalidMsgCommand, "", NULL }, - { "equiperr", SEC_ADMINISTRATOR, false, &ChatHandler::HandleEquipErrorCommand, "", NULL }, - { "sellerr", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSellErrorCommand, "", NULL }, - { "buyerr", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBuyErrorCommand, "", NULL }, - { "sendopcode", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendOpcodeCommand, "", NULL }, - { "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSpawnVehicle, "", NULL }, - { "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUpdateWorldStateCommand, "", NULL }, - { "ps", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePlaySound2Command, "", NULL }, - { "scn", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendChannelNotifyCommand, "", NULL }, - { "scm", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendChatMsgCommand, "", NULL }, - { "sps", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendSetPhaseShiftCommand, "", NULL }, - { "getitemstate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGetItemState, "", NULL }, - { "playsound", SEC_MODERATOR, false, &ChatHandler::HandlePlaySoundCommand, "", NULL }, - { "update", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUpdate, "", NULL }, - { "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSetValue, "", NULL }, - { "getvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGetValue, "", NULL }, - { "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSet32Bit, "", NULL }, - { "Mod32Value", SEC_ADMINISTRATOR, false, &ChatHandler::HandleMod32Value, "", NULL }, - { "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleAnimCommand, "", NULL }, - { "lootrecipient", SEC_GAMEMASTER, false, &ChatHandler::HandleGetLootRecipient, "", NULL }, - { "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL }, - { "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL }, - { "sendlargepacket",SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendLargePacketCommand, "", NULL }, + { "create", SEC_GAMEMASTER, false, &ChatHandler::HandleCreatePetCommand, "", NULL }, + { "learn", SEC_GAMEMASTER, false, &ChatHandler::HandlePetLearnCommand, "", NULL }, + { "unlearn", SEC_GAMEMASTER, false, &ChatHandler::HandlePetUnlearnCommand, "", NULL }, + { "tp", SEC_GAMEMASTER, false, &ChatHandler::HandlePetTpCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand eventCommandTable[] = + static ChatCommand pdumpCommandTable[] = { - { "activelist", SEC_GAMEMASTER, true, &ChatHandler::HandleEventActiveListCommand, "", NULL }, - { "start", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStartCommand, "", NULL }, - { "stop", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStopCommand, "", NULL }, - { "", SEC_GAMEMASTER, true, &ChatHandler::HandleEventInfoCommand, "", NULL }, + { "load", SEC_ADMINISTRATOR, true, &ChatHandler::HandlePDumpLoadCommand, "", NULL }, + { "write", SEC_ADMINISTRATOR, true, &ChatHandler::HandlePDumpWriteCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand learnCommandTable[] = + static ChatCommand questCommandTable[] = { - { "all", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllCommand, "", NULL }, - { "all_gm", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllGMCommand, "", NULL }, - { "all_crafts", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllCraftsCommand, "", NULL }, - { "all_default", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllDefaultCommand, "", NULL }, - { "all_lang", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllLangCommand, "", NULL }, - { "all_myclass", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyClassCommand, "", NULL }, - { "all_myspells", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMySpellsCommand, "", NULL }, - { "all_mytalents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyTalentsCommand, "", NULL }, - { "all_recipes", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllRecipesCommand, "", NULL }, - { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnCommand, "", NULL }, + { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestAdd, "", NULL }, + { "complete", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestComplete, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestRemove, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -338,67 +443,6 @@ ChatCommand * ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand honorCommandTable[] = - { - { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleAddHonorCommand, "", NULL }, - { "addkill", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorAddKillCommand, "", NULL }, - { "update", SEC_GAMEMASTER, false, &ChatHandler::HandleUpdateHonorFieldsCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand guildCommandTable[] = - { - { "create", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildCreateCommand, "", NULL }, - { "delete", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildDeleteCommand, "", NULL }, - { "invite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildInviteCommand, "", NULL }, - { "uninvite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildUninviteCommand, "", NULL }, - { "rank", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildRankCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand petCommandTable[] = - { - { "create", SEC_GAMEMASTER, false, &ChatHandler::HandleCreatePetCommand, "", NULL }, - { "learn", SEC_GAMEMASTER, false, &ChatHandler::HandlePetLearnCommand, "", NULL }, - { "unlearn", SEC_GAMEMASTER, false, &ChatHandler::HandlePetUnlearnCommand, "", NULL }, - { "tp", SEC_GAMEMASTER, false, &ChatHandler::HandlePetTpCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - - static ChatCommand groupCommandTable[] = - { - { "leader", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupLeaderCommand, "", NULL }, - { "disband", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupDisbandCommand, "", NULL }, - { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupRemoveCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand lookupPlayerCommandTable[] = - { - { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, - { "account", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, - { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand lookupCommandTable[] = - { - { "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL }, - { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupCreatureCommand, "", NULL }, - { "event", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupEventCommand, "", NULL }, - { "faction", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupFactionCommand, "", NULL }, - { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemCommand, "", NULL }, - { "itemset", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemSetCommand, "", NULL }, - { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupObjectCommand, "", NULL }, - { "quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupQuestCommand, "", NULL }, - { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, - { "skill", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSkillCommand, "", NULL }, - { "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL }, - { "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - static ChatCommand resetCommandTable[] = { { "achievements", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetAchievementsCommand, "", NULL }, @@ -411,133 +455,82 @@ ChatCommand * ChatHandler::getCommandTable() { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand castCommandTable[] = - { - { "back", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastBackCommand, "", NULL }, - { "dist", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastDistCommand, "", NULL }, - { "self", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastSelfCommand, "", NULL }, - { "target", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastTargetCommand, "", NULL }, - { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } - }; - - static ChatCommand pdumpCommandTable[] = + static ChatCommand serverIdleRestartCommandTable[] = { - { "load", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLoadPDumpCommand, "", NULL }, - { "write", SEC_ADMINISTRATOR, true, &ChatHandler::HandleWritePDumpCommand, "", NULL }, + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleRestartCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand listCommandTable[] = + static ChatCommand serverIdleShutdownCommandTable[] = { - { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListCreatureCommand, "", NULL }, - { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListItemCommand, "", NULL }, - { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListObjectCommand, "", NULL }, - { "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL }, + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleShutDownCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand teleCommandTable[] = + static ChatCommand serverRestartCommandTable[] = { - { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddTeleCommand, "", NULL }, - { "del", SEC_ADMINISTRATOR, true, &ChatHandler::HandleDelTeleCommand, "", NULL }, - { "name", SEC_MODERATOR, true, &ChatHandler::HandleNameTeleCommand, "", NULL }, - { "group", SEC_MODERATOR, false, &ChatHandler::HandleGroupTeleCommand, "", NULL }, - { "", SEC_MODERATOR, false, &ChatHandler::HandleTeleCommand, "", NULL }, + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerRestartCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand npcCommandTable[] = + static ChatCommand serverShutdownCommandTable[] = { - { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddCommand, "", NULL }, - { "additem", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddVendorItemCommand, "", NULL }, - { "addmove", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddMoveCommand, "", NULL }, - { "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcChangeEntryCommand, "", NULL }, - { "changelevel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcChangeLevelCommand, "", NULL }, - { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcDeleteCommand, "", NULL }, - { "factionid", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFactionIdCommand, "", NULL }, - { "flag", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFlagCommand, "", NULL }, - { "follow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFollowCommand, "", NULL }, - { "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL }, - { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcMoveCommand, "", NULL }, - { "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcPlayEmoteCommand, "", NULL }, - { "setmodel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetModelCommand, "", NULL }, - { "setmovetype", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetMoveTypeCommand, "", NULL }, - { "setphase", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetPhaseCommand, "", NULL }, - { "spawndist", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnDistCommand, "", NULL }, - { "spawntime", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnTimeCommand, "", NULL }, - { "say", SEC_MODERATOR, false, &ChatHandler::HandleNpcSayCommand, "", NULL }, - { "textemote", SEC_MODERATOR, false, &ChatHandler::HandleNpcTextEmoteCommand, "", NULL }, - { "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL }, - { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, - { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, - { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL }, - { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, - { "tame", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcTameCommand, "", NULL }, - { "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL }, - - //{ TODO: fix or remove this commands - { "addweapon", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcAddWeaponCommand, "", NULL }, - { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcNameCommand, "", NULL }, - { "subname", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSubNameCommand, "", NULL }, - //} - + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand goCommandTable[] = + static ChatCommand serverSetCommandTable[] = { - { "grid", SEC_MODERATOR, false, &ChatHandler::HandleGoGridCommand, "", NULL }, - { "creature", SEC_GAMEMASTER, false, &ChatHandler::HandleGoCreatureCommand, "", NULL }, - { "object", SEC_GAMEMASTER, false, &ChatHandler::HandleGoObjectCommand, "", NULL }, - { "trigger", SEC_GAMEMASTER, false, &ChatHandler::HandleGoTriggerCommand, "", NULL }, - { "graveyard", SEC_GAMEMASTER, false, &ChatHandler::HandleGoGraveyardCommand, "", NULL }, - { "zonexy", SEC_MODERATOR, false, &ChatHandler::HandleGoZoneXYCommand, "", NULL }, - { "xy", SEC_MODERATOR, false, &ChatHandler::HandleGoXYCommand, "", NULL }, - { "xyz", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, - { "", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, + { "difftime", SEC_CONSOLE, true, &ChatHandler::HandleServerSetDiffTimeCommand, "", NULL }, + { "loglevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogLevelCommand, "", NULL }, + { "motd", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetMotdCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand gobjectCommandTable[] = + static ChatCommand serverCommandTable[] = { - { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectCommand, "", NULL }, - { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleDelObjectCommand, "", NULL }, - { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleMoveObjectCommand, "", NULL }, - { "near", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNearObjectCommand, "", NULL }, - { "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL }, - { "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempGameObjectCommand, "", NULL }, - { "setphase", SEC_GAMEMASTER, false, &ChatHandler::HandleGOPhaseCommand, "", NULL }, - { "target", SEC_GAMEMASTER, false, &ChatHandler::HandleTargetObjectCommand, "", NULL }, - { "turn", SEC_GAMEMASTER, false, &ChatHandler::HandleTurnObjectCommand, "", NULL }, + { "corpses", SEC_GAMEMASTER, true, &ChatHandler::HandleServerCorpsesCommand, "", NULL }, + { "exit", SEC_CONSOLE, true, &ChatHandler::HandleServerExitCommand, "", NULL }, + { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, + { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "info", SEC_PLAYER, true, &ChatHandler::HandleServerInfoCommand, "", NULL }, + { "motd", SEC_PLAYER, true, &ChatHandler::HandleServerMotdCommand, "", NULL }, + { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, + { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand questCommandTable[] = + static ChatCommand teleCommandTable[] = { - { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddQuest, "", NULL }, - { "complete", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCompleteQuest, "", NULL }, - { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleRemoveQuest, "", NULL }, + { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleTeleAddCommand, "", NULL }, + { "del", SEC_ADMINISTRATOR, true, &ChatHandler::HandleTeleDelCommand, "", NULL }, + { "name", SEC_MODERATOR, true, &ChatHandler::HandleTeleNameCommand, "", NULL }, + { "group", SEC_MODERATOR, false, &ChatHandler::HandleTeleGroupCommand, "", NULL }, + { "", SEC_MODERATOR, false, &ChatHandler::HandleTeleCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand gmCommandTable[] = + static ChatCommand unbanCommandTable[] = { - { "chat", SEC_MODERATOR, false, &ChatHandler::HandleGMChatCommand, "", NULL }, - { "ingame", SEC_PLAYER, true, &ChatHandler::HandleGMListIngameCommand, "", NULL }, - { "list", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMListFullCommand, "", NULL }, - { "visible", SEC_MODERATOR, false, &ChatHandler::HandleVisibleCommand, "", NULL }, - { "fly", SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlyModeCommand, "", NULL }, - { "", SEC_MODERATOR, false, &ChatHandler::HandleGMmodeCommand, "", NULL }, + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanIPCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; - static ChatCommand instanceCommandTable[] = + static ChatCommand wpCommandTable[] = { - { "listbinds", SEC_MODERATOR, false, &ChatHandler::HandleInstanceListBindsCommand, "", NULL }, - { "unbind", SEC_MODERATOR, false, &ChatHandler::HandleInstanceUnbindCommand, "", NULL }, - { "stats", SEC_MODERATOR, true, &ChatHandler::HandleInstanceStatsCommand, "", NULL }, - { "savedata", SEC_MODERATOR, false, &ChatHandler::HandleInstanceSaveDataCommand, "", NULL }, + { "show", SEC_GAMEMASTER, false, &ChatHandler::HandleWpShowCommand, "", NULL }, + { "addwp", SEC_GAMEMASTER, false, &ChatHandler::HandleWpAddCommand, "", NULL }, + { "load", SEC_GAMEMASTER, false, &ChatHandler::HandleWpLoadPathCommand, "", NULL }, + { "modify", SEC_GAMEMASTER, false, &ChatHandler::HandleWpModifyCommand, "", NULL }, + { "event", SEC_GAMEMASTER, false, &ChatHandler::HandleWpEventCommand, "", NULL }, + { "unload", SEC_GAMEMASTER, false, &ChatHandler::HandleWpUnLoadPathCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; @@ -653,8 +646,7 @@ ChatCommand * ChatHandler::getCommandTable() { "cometome", SEC_ADMINISTRATOR, false, &ChatHandler::HandleComeToMeCommand, "", NULL }, { "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL }, { "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL }, - { "ahbotoptions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL }, - { "flusharenapoints", SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, + { "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, { "chardelete", SEC_CONSOLE, true, &ChatHandler::HandleCharacterDeleteCommand, "", NULL }, { "sendmessage", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMessageCommand, "", NULL }, { "playall", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePlayAllCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index abae5c132af..5d8dd5e646c 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -120,13 +120,13 @@ class ChatHandler bool HandleGMNotifyCommand(const char* args); bool HandleGMmodeCommand(const char* args); bool HandleGMChatCommand(const char* args); - bool HandleVisibleCommand(const char* args); + bool HandleGMVisibleCommand(const char* args); bool HandleGPSCommand(const char* args); bool HandleTaxiCheatCommand(const char* args); bool HandleWhispersCommand(const char* args); - bool HandleNameTeleCommand(const char* args); - bool HandleGroupTeleCommand(const char* args); - bool HandleDrunkCommand(const char* args); + bool HandleTeleNameCommand(const char* args); + bool HandleTeleGroupCommand(const char* args); + bool HandleModifyDrunkCommand(const char* args); bool HandleSendItemsCommand(const char* args); bool HandleSendMailCommand(const char* args); bool HandleSendMoneyCommand(const char* args); @@ -315,13 +315,13 @@ class ChatHandler bool HandleServerShutDownCommand(const char* args); bool HandleServerShutDownCancelCommand(const char* args); - bool HandleAddHonorCommand(const char* args); + bool HandleHonorAddCommand(const char* args); bool HandleHonorAddKillCommand(const char* args); - bool HandleUpdateHonorFieldsCommand(const char* args); + bool HandleHonorUpdateCommand(const char* args); bool HandleLoadScriptsCommand(const char* args); - bool HandleSendQuestPartyMsgCommand(const char* args); - bool HandleSendQuestInvalidMsgCommand(const char* args); + bool HandleDebugSendQuestPartyMsgCommand(const char* args); + bool HandleDebugSendQuestInvalidMsgCommand(const char* args); bool HandleDebugInArcCommand(const char* args); bool HandleDebugSpellFailCommand(const char* args); @@ -329,18 +329,18 @@ class ChatHandler bool HandleGUIDCommand(const char* args); bool HandleItemMoveCommand(const char* args); bool HandleDeMorphCommand(const char* args); - bool HandleSetPoiCommand(const char* args); - bool HandleEquipErrorCommand(const char* args); + bool HandleDebugSetPoiCommand(const char* args); + bool HandleDebugEquipErrorCommand(const char* args); bool HandleGoCreatureCommand(const char* args); bool HandleGoObjectCommand(const char* args); bool HandleGoTriggerCommand(const char* args); bool HandleGoGraveyardCommand(const char* args); - bool HandleTargetObjectCommand(const char* args); - bool HandleDelObjectCommand(const char* args); - bool HandleMoveObjectCommand(const char* args); - bool HandleGOPhaseCommand(const char* args); - bool HandleTurnObjectCommand(const char* args); - bool HandleObjectStateCommand(const char* args); + bool HandleGameObjectTargetCommand(const char* args); + bool HandleGameObjectDeleteCommand(const char* args); + bool HandleGameObjectMoveCommand(const char* args); + bool HandleGameObjectPhaseCommand(const char* args); + bool HandleGameObjectTurnCommand(const char* args); + bool HandleGameObjectStateCommand(const char* args); bool HandlePInfoCommand(const char* args); bool HandlePLimitCommand(const char* args); bool HandleMuteCommand(const char* args); @@ -373,14 +373,14 @@ class ChatHandler bool HandleCooldownCommand(const char* args); bool HandleUnLearnCommand(const char* args); bool HandleGetDistanceCommand(const char* args); - bool HandleGameObjectCommand(const char* args); - bool HandleAnimCommand(const char* args); - bool HandlePlaySoundCommand(const char* args); - bool HandleStandStateCommand(const char* args); + bool HandleGameObjectAddCommand(const char* args); + bool HandleDebugAnimCommand(const char* args); + bool HandleDebugPlaySoundCommand(const char* args); + bool HandleModifyStandStateCommand(const char* args); bool HandleDieCommand(const char* args); bool HandleDamageCommand(const char *args); bool HandleReviveCommand(const char* args); - bool HandleMorphCommand(const char* args); + bool HandleModifyMorphCommand(const char* args); bool HandleAuraCommand(const char* args); bool HandleUnAuraCommand(const char* args); bool HandleLinkGraveCommand(const char* args); @@ -409,13 +409,13 @@ class ChatHandler bool HandleGuildUninviteCommand(const char* args); bool HandleGuildRankCommand(const char* args); bool HandleGuildDeleteCommand(const char* args); - bool HandleUpdate(const char* args); + bool HandleDebugUpdate(const char* args); bool HandleBankCommand(const char* args); bool HandleChangeWeather(const char* args); bool HandleKickPlayerCommand(const char * args); bool HandleTeleCommand(const char * args); - bool HandleAddTeleCommand(const char * args); - bool HandleDelTeleCommand(const char * args); + bool HandleTeleAddCommand(const char * args); + bool HandleTeleDelCommand(const char * args); bool HandleListAurasCommand(const char * args); bool HandleResetAchievementsCommand(const char * args); @@ -447,7 +447,7 @@ class ChatHandler bool HandleListCreatureCommand(const char* args); bool HandleListItemCommand(const char* args); bool HandleListObjectCommand(const char* args); - bool HandleNearObjectCommand(const char* args); + bool HandleGameObjectNearCommand(const char* args); bool HandlePasswordCommand(const char* args); bool HandleLockAccountCommand(const char* args); bool HandleRespawnCommand(const char* args); @@ -460,19 +460,18 @@ class ChatHandler bool HandleWpEventCommand(const char* args); bool HandleWpShowCommand(const char* args); bool HandleReloadAllPaths(const char *args); - - bool HandleFlyModeCommand(const char* args); - bool HandleSendOpcodeCommand(const char* args); - bool HandleSellErrorCommand(const char* args); - bool HandleBuyErrorCommand(const char* args); - bool HandleUpdateWorldStateCommand(const char* args); - bool HandlePlaySound2Command(const char* args); - bool HandleSendChannelNotifyCommand(const char* args); - bool HandleSendChatMsgCommand(const char* args); + bool HandleGMFlyModeCommand(const char* args); + bool HandleDebugSendOpcodeCommand(const char* args); + bool HandleDebugSellErrorCommand(const char* args); + bool HandleDebugBuyErrorCommand(const char* args); + bool HandleDebugUpdateWorldStateCommand(const char* args); + bool HandleDebugPlaySound2Command(const char* args); + bool HandleDebugSendChannelNotifyCommand(const char* args); + bool HandleDebugSendChatMsgCommand(const char* args); bool HandleRenameCommand(const char * args); bool HandleCustomizeCommand(const char * args); - bool HandleLoadPDumpCommand(const char *args); - bool HandleWritePDumpCommand(const char *args); + bool HandlePDumpLoadCommand(const char *args); + bool HandlePDumpWriteCommand(const char *args); bool HandleCastCommand(const char *args); bool HandleCastBackCommand(const char *args); bool HandleCastDistCommand(const char *args); @@ -490,16 +489,16 @@ class ChatHandler bool HandleTempAddSpwCommand(const char* args); //! Development Commands - bool HandleSetValue(const char* args); - bool HandleGetValue(const char* args); - bool HandleSet32Bit(const char* args); - bool HandleMod32Value(const char* args); - bool HandleAddQuest(const char * args); - bool HandleRemoveQuest(const char * args); - bool HandleCompleteQuest(const char * args); + bool HandleDebugSetValue(const char* args); + bool HandleDebugGetValue(const char* args); + bool HandleDebugSet32Bit(const char* args); + bool HandleDebugMod32Value(const char* args); + bool HandleQuestAdd(const char * args); + bool HandleQuestRemove(const char * args); + bool HandleQuestComplete(const char * args); bool HandleSaveAllCommand(const char* args); - bool HandleGetItemState(const char * args); - bool HandleGetLootRecipient(const char * args); + bool HandleDebugGetItemState(const char * args); + bool HandleDebugGetLootRecipient(const char * args); bool HandleDebugArenaCommand(const char * args); bool HandleDebugThreatList(const char * args); bool HandleDebugHostilRefList(const char * args); @@ -508,9 +507,9 @@ class ChatHandler bool HandleBindSightCommand(const char* args); bool HandleUnbindSightCommand(const char* args); bool HandleDebugBattlegroundCommand(const char * args); - bool HandleSpawnVehicle(const char * args); - bool HandleSendLargePacketCommand(const char * args); - bool HandleSendSetPhaseShiftCommand(const char * args); + bool HandleDebugSpawnVehicle(const char * args); + bool HandleDebugSendLargePacketCommand(const char * args); + bool HandleDebugSendSetPhaseShiftCommand(const char * args); Player* getSelectedPlayer(); Creature* getSelectedCreature(); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 7cac1c6a460..03f5740fd1c 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -139,7 +139,7 @@ m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_resp m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isVehicle(false), m_isTotem(false), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formationID(0) +m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formationID(0), m_isSummon(false) { m_regenTimer = 200; m_valuesCount = UNIT_END; diff --git a/src/game/Creature.h b/src/game/Creature.h index 7a2a9508216..8d4a160aab3 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -436,6 +436,7 @@ class TRINITY_DLL_SPEC Creature : public Unit void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const; uint32 GetEquipmentId() const { return m_equipmentId; } + bool isSummon() const { return m_isSummon; } bool isPet() const { return m_isPet; } bool isVehicle() const { return m_isVehicle; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } @@ -668,6 +669,7 @@ class TRINITY_DLL_SPEC Creature : public Unit GossipOptionList m_goptions; uint8 m_emoteState; + bool m_isSummon; bool m_isPet; // set only in Pet::Pet bool m_isVehicle; // set only in Vehicle::Vehicle bool m_isTotem; // set only in Totem::Totem diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 40b9f0c0c07..402ea7ae2fb 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -26,6 +26,7 @@ #include "MovementGenerator.h" #include "ScriptCalls.h" #include "Pet.h" +#include "TemporarySummon.h" INSTANTIATE_SINGLETON_1(CreatureAIRegistry); INSTANTIATE_SINGLETON_1(MovementGeneratorRegistry); @@ -63,6 +64,8 @@ namespace FactorySelector ai_factory = ai_registry.GetRegistryItem("PetAI"); else if(creature->isTotem()) ai_factory = ai_registry.GetRegistryItem("TotemAI"); + else if(creature->isSummon() && ((TempSummon*)creature)->m_properties && ((TempSummon*)creature)->m_properties->Type == SUMMON_TYPE_MINIPET) + ai_factory = ai_registry.GetRegistryItem("CritterAI"); else if(creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) ai_factory = ai_registry.GetRegistryItem("NullCreatureAI"); else if(creature->GetCreatureType() == CREATURE_TYPE_CRITTER) diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index 8a28ae72e00..53ae820bcbc 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -68,7 +68,7 @@ bool ChatHandler::HandleDebugSpellFailCommand(const char* args) return true; } -bool ChatHandler::HandleSetPoiCommand(const char* args) +bool ChatHandler::HandleDebugSetPoiCommand(const char* args) { Player *pPlayer = m_session->GetPlayer(); Unit* target = getSelectedUnit(); @@ -94,7 +94,7 @@ bool ChatHandler::HandleSetPoiCommand(const char* args) return true; } -bool ChatHandler::HandleEquipErrorCommand(const char* args) +bool ChatHandler::HandleDebugEquipErrorCommand(const char* args) { if(!args) return false; @@ -104,7 +104,7 @@ bool ChatHandler::HandleEquipErrorCommand(const char* args) return true; } -bool ChatHandler::HandleSellErrorCommand(const char* args) +bool ChatHandler::HandleDebugSellErrorCommand(const char* args) { if(!args) return false; @@ -114,7 +114,7 @@ bool ChatHandler::HandleSellErrorCommand(const char* args) return true; } -bool ChatHandler::HandleBuyErrorCommand(const char* args) +bool ChatHandler::HandleDebugBuyErrorCommand(const char* args) { if(!args) return false; @@ -124,7 +124,7 @@ bool ChatHandler::HandleBuyErrorCommand(const char* args) return true; } -bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) +bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/) { Unit *unit = getSelectedUnit(); Player *player = NULL; @@ -221,7 +221,7 @@ bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleUpdateWorldStateCommand(const char* args) +bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args) { char* w = strtok((char*)args, " "); char* s = strtok(NULL, " "); @@ -235,7 +235,7 @@ bool ChatHandler::HandleUpdateWorldStateCommand(const char* args) return true; } -bool ChatHandler::HandlePlaySound2Command(const char* args) +bool ChatHandler::HandleDebugPlaySound2Command(const char* args) { if(!args) return false; @@ -246,7 +246,7 @@ bool ChatHandler::HandlePlaySound2Command(const char* args) } //Send notification in channel -bool ChatHandler::HandleSendChannelNotifyCommand(const char* args) +bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args) { if(!args) return false; @@ -264,7 +264,7 @@ bool ChatHandler::HandleSendChannelNotifyCommand(const char* args) } //Send notification in chat -bool ChatHandler::HandleSendChatMsgCommand(const char* args) +bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args) { if(!args) return false; @@ -277,14 +277,14 @@ bool ChatHandler::HandleSendChatMsgCommand(const char* args) return true; } -bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args) +bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(const char* args) { uint32 msg = atol((char*)args); m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg); return true; } -bool ChatHandler::HandleGetLootRecipient(const char* /*args*/) +bool ChatHandler::HandleDebugGetLootRecipient(const char* /*args*/) { Creature* target = getSelectedCreature(); if(!target) @@ -294,14 +294,14 @@ bool ChatHandler::HandleGetLootRecipient(const char* /*args*/) return true; } -bool ChatHandler::HandleSendQuestInvalidMsgCommand(const char* args) +bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(const char* args) { uint32 msg = atol((char*)args); m_session->GetPlayer()->SendCanTakeQuestResponse(msg); return true; } -bool ChatHandler::HandleGetItemState(const char* args) +bool ChatHandler::HandleDebugGetItemState(const char* args) { if (!args) return false; @@ -590,7 +590,7 @@ bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/) return true; } -bool ChatHandler::HandleSpawnVehicle(const char* args) +bool ChatHandler::HandleDebugSpawnVehicle(const char* args) { if(!args) return false; @@ -640,7 +640,7 @@ bool ChatHandler::HandleSpawnVehicle(const char* args) return true; } -bool ChatHandler::HandleSendLargePacketCommand(const char* /*args*/) +bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/) { const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; std::ostringstream ss; @@ -650,7 +650,7 @@ bool ChatHandler::HandleSendLargePacketCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleSendSetPhaseShiftCommand(const char* args) +bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) { if(!args) return false; diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 00e60395ce4..f17533f04cb 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1406,20 +1406,21 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 /*=0.0f*/) { - SetFloatValue(GAMEOBJECT_FACING, GetOrientation()); + static double const atan_pow = atan(pow(2.0f, -20.0f)); - int64 rotation = 0; + SetFloatValue(GAMEOBJECT_FACING, GetOrientation()); double f_rot1 = sin(GetOrientation() / 2.0f); - int64 i_rot1 = int64(f_rot1 / atan(pow(2.0f, -20.0f))); - rotation |= (i_rot1 << 43 >> 43) & 0x00000000001FFFFF; + double f_rot2 = cos(GetOrientation() / 2.0f); + int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f)); + int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF; SetUInt64Value(GAMEOBJECT_ROTATION, rotation); if(rotation2==0.0f && rotation3==0.0f) { - rotation2 = sin(GetOrientation()/2); - rotation3 = cos(GetOrientation()/2); + rotation2 = f_rot1; + rotation3 = f_rot2; } SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index c1e8fa0fd76..f4c9c62ba09 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -626,7 +626,7 @@ bool ChatHandler::HandleGMTicketReloadCommand(const char*) } //Enable\Dissable Invisible mode -bool ChatHandler::HandleVisibleCommand(const char* args) +bool ChatHandler::HandleGMVisibleCommand(const char* args) { if (!*args) { @@ -2384,7 +2384,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args) } //Play sound -bool ChatHandler::HandlePlaySoundCommand(const char* args) +bool ChatHandler::HandleDebugPlaySoundCommand(const char* args) { // USAGE: .debug playsound #soundid // #soundid - ID decimal number from SoundEntries.dbc (1st column) @@ -2501,7 +2501,7 @@ bool ChatHandler::HandleSendMailCommand(const char* args) } // teleport player to given game_tele.entry -bool ChatHandler::HandleNameTeleCommand(const char * args) +bool ChatHandler::HandleTeleNameCommand(const char * args) { if(!*args) return false; @@ -2586,7 +2586,7 @@ bool ChatHandler::HandleNameTeleCommand(const char * args) } //Teleport group to given game_tele.entry -bool ChatHandler::HandleGroupTeleCommand(const char * args) +bool ChatHandler::HandleTeleGroupCommand(const char * args) { if(!*args) return false; @@ -2985,7 +2985,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args) return true; } -bool ChatHandler::HandleDrunkCommand(const char* args) +bool ChatHandler::HandleModifyDrunkCommand(const char* args) { if(!*args) return false; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 4c5a8f51ce0..342d4e85234 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -157,20 +157,280 @@ bool ChatHandler::HandleUnmuteCommand(const char* args) return true; } -bool ChatHandler::HandleTargetObjectCommand(const char* args) +bool ChatHandler::HandleGoTriggerCommand(const char* args) +{ + Player* _player = m_session->GetPlayer(); + + if (!*args) + return false; + + char *atId = strtok((char*)args, " "); + if (!atId) + return false; + + int32 i_atId = atoi(atId); + + if(!i_atId) + return false; + + AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId); + if (!at) + { + PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND,i_atId); + SetSentErrorMessage(true); + return false; + } + + if(!MapManager::IsValidMapCoord(at->mapid,at->x,at->y,at->z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,at->x,at->y,at->mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if(_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(at->mapid, at->x, at->y, at->z, _player->GetOrientation()); + return true; +} + +bool ChatHandler::HandleGoGraveyardCommand(const char* args) +{ + Player* _player = m_session->GetPlayer(); + + if (!*args) + return false; + + char *gyId = strtok((char*)args, " "); + if (!gyId) + return false; + + int32 i_gyId = atoi(gyId); + + if(!i_gyId) + return false; + + WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId); + if (!gy) + { + PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST,i_gyId); + SetSentErrorMessage(true); + return false; + } + + if(!MapManager::IsValidMapCoord(gy->map_id,gy->x,gy->y,gy->z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,gy->x,gy->y,gy->map_id); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if(_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, _player->GetOrientation()); + return true; +} + +/** \brief Teleport the GM to the specified creature +* +* .gocreature <GUID> --> TP using creature.guid +* .gocreature azuregos --> TP player to the mob with this name +* Warning: If there is more than one mob with this name +* you will be teleported to the first one that is found. +* .gocreature id 6109 --> TP player to the mob, that has this creature_template.entry +* Warning: If there is more than one mob with this "id" +* you will be teleported to the first one that is found. +*/ +//teleport to creature +bool ChatHandler::HandleGoCreatureCommand(const char* args) +{ + if(!*args) + return false; + Player* _player = m_session->GetPlayer(); + + // "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + char* pParam1 = extractKeyFromLink((char*)args,"Hcreature"); + if (!pParam1) + return false; + + std::ostringstream whereClause; + + // User wants to teleport to the NPC's template entry + if( strcmp(pParam1, "id") == 0 ) + { + //sLog.outError("DEBUG: ID found"); + + // Get the "creature_template.entry" + // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + char* tail = strtok(NULL,""); + if(!tail) + return false; + char* cId = extractKeyFromLink(tail,"Hcreature_entry"); + if(!cId) + return false; + + int32 tEntry = atoi(cId); + //sLog.outError("DEBUG: ID value: %d", tEntry); + if(!tEntry) + return false; + + whereClause << "WHERE id = '" << tEntry << "'"; + } + else + { + //sLog.outError("DEBUG: ID *not found*"); + + int32 guid = atoi(pParam1); + + // Number is invalid - maybe the user specified the mob's name + if(!guid) + { + std::string name = pParam1; + WorldDatabase.escape_string(name); + whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << "'"; + } + else + { + whereClause << "WHERE guid = '" << guid << "'"; + } + } + //sLog.outError("DEBUG: %s", whereClause.c_str()); + + QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str() ); + if (!result) + { + SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND); + SetSentErrorMessage(true); + return false; + } + if( result->GetRowCount() > 1 ) + { + SendSysMessage(LANG_COMMAND_GOCREATMULTIPLE); + } + + Field *fields = result->Fetch(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + float ort = fields[3].GetFloat(); + int mapid = fields[4].GetUInt16(); + + delete result; + + if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if(_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, ort); + return true; +} + +//teleport to gameobject +bool ChatHandler::HandleGoObjectCommand(const char* args) +{ + if(!*args) + return false; + + Player* _player = m_session->GetPlayer(); + + // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if(!cId) + return false; + + int32 guid = atoi(cId); + if(!guid) + return false; + + float x, y, z, ort; + int mapid; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(guid)) + { + x = go_data->posX; + y = go_data->posY; + z = go_data->posZ; + ort = go_data->orientation; + mapid = go_data->mapid; + } + else + { + SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND); + SetSentErrorMessage(true); + return false; + } + + if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if(_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, ort); + return true; +} + +bool ChatHandler::HandleGameObjectTargetCommand(const char* args) { Player* pl = m_session->GetPlayer(); QueryResult *result; GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList(); if(*args) { - int32 id = atoi((char*)args); + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry"); + if(!cId) + return false; + + uint32 id = atol(cId); + if(id) result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1", pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(),id); else { - std::string name = args; + std::string name = cId; WorldDatabase.escape_string(name); result = WorldDatabase.PQuery( "SELECT guid, id, position_x, position_y, position_z, orientation, map, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ " @@ -266,257 +526,333 @@ bool ChatHandler::HandleTargetObjectCommand(const char* args) return true; } -//teleport to gameobject -bool ChatHandler::HandleGoObjectCommand(const char* args) +//delete object by selection or guid +bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) { - if(!*args) - return false; - - Player* _player = m_session->GetPlayer(); - // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hgameobject"); if(!cId) return false; - int32 guid = atoi(cId); - if(!guid) + uint32 lowguid = atoi(cId); + if(!lowguid) return false; - float x, y, z, ort; - int mapid; + GameObject* obj = NULL; // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(guid)) - { - x = go_data->posX; - y = go_data->posY; - z = go_data->posZ; - ort = go_data->orientation; - mapid = go_data->mapid; - } - else - { - SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND); - SetSentErrorMessage(true); - return false; - } + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) + if(!obj) { - PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); SetSentErrorMessage(true); return false; } - // stop flight if need - if(_player->isInFlight()) + uint64 owner_guid = obj->GetOwnerGUID(); + if(owner_guid) { - _player->GetMotionMaster()->MovementExpired(); - _player->m_taxi.ClearTaxiDestinations(); + Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid); + if(!owner && !IS_PLAYER_GUID(owner_guid)) + { + PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); + SetSentErrorMessage(true); + return false; + } + + owner->RemoveGameObject(obj,false); } - // save only in non-flight case - else - _player->SaveRecallPosition(); - _player->TeleportTo(mapid, x, y, z, ort); + obj->SetRespawnTime(0); // not save respawn time + obj->Delete(); + obj->DeleteFromDB(); + + PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow()); + return true; } -bool ChatHandler::HandleGoTriggerCommand(const char* args) +//turn selected object +bool ChatHandler::HandleGameObjectTurnCommand(const char* args) { - Player* _player = m_session->GetPlayer(); - - if (!*args) + // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if(!cId) return false; - char *atId = strtok((char*)args, " "); - if (!atId) + uint32 lowguid = atoi(cId); + if(!lowguid) return false; - int32 i_atId = atoi(atId); + GameObject* obj = NULL; - if(!i_atId) - return false; + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId); - if (!at) + if(!obj) { - PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND,i_atId); + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); SetSentErrorMessage(true); return false; } - if(!MapManager::IsValidMapCoord(at->mapid,at->x,at->y,at->z)) - { - PSendSysMessage(LANG_INVALID_TARGET_COORD,at->x,at->y,at->mapid); - SetSentErrorMessage(true); - return false; - } + char* po = strtok(NULL, " "); + float o; - // stop flight if need - if(_player->isInFlight()) + if (po) { - _player->GetMotionMaster()->MovementExpired(); - _player->m_taxi.ClearTaxiDestinations(); + o = (float)atof(po); } - // save only in non-flight case else - _player->SaveRecallPosition(); + { + Player *chr = m_session->GetPlayer(); + o = chr->GetOrientation(); + } + + Map* map = obj->GetMap(); + map->Remove(obj,false); + + obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o); + obj->UpdateRotationFields(); + + map->Add(obj); + + obj->SaveToDB(); + obj->Refresh(); + + PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow(), o); - _player->TeleportTo(at->mapid, at->x, at->y, at->z, _player->GetOrientation()); return true; } -bool ChatHandler::HandleGoGraveyardCommand(const char* args) +//move selected object +bool ChatHandler::HandleGameObjectMoveCommand(const char* args) { - Player* _player = m_session->GetPlayer(); - - if (!*args) + // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if(!cId) return false; - char *gyId = strtok((char*)args, " "); - if (!gyId) + uint32 lowguid = atoi(cId); + if(!lowguid) return false; - int32 i_gyId = atoi(gyId); + GameObject* obj = NULL; - if(!i_gyId) - return false; + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId); - if (!gy) + if(!obj) { - PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST,i_gyId); + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); SetSentErrorMessage(true); return false; } - if(!MapManager::IsValidMapCoord(gy->map_id,gy->x,gy->y,gy->z)) - { - PSendSysMessage(LANG_INVALID_TARGET_COORD,gy->x,gy->y,gy->map_id); - SetSentErrorMessage(true); - return false; - } + char* px = strtok(NULL, " "); + char* py = strtok(NULL, " "); + char* pz = strtok(NULL, " "); - // stop flight if need - if(_player->isInFlight()) + if (!px) { - _player->GetMotionMaster()->MovementExpired(); - _player->m_taxi.ClearTaxiDestinations(); + Player *chr = m_session->GetPlayer(); + + Map* map = obj->GetMap(); + map->Remove(obj,false); + + obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation()); + obj->SetFloatValue(GAMEOBJECT_POS_X, chr->GetPositionX()); + obj->SetFloatValue(GAMEOBJECT_POS_Y, chr->GetPositionY()); + obj->SetFloatValue(GAMEOBJECT_POS_Z, chr->GetPositionZ()); + + map->Add(obj); } - // save only in non-flight case else - _player->SaveRecallPosition(); + { + if(!py || !pz) + return false; + + float x = (float)atof(px); + float y = (float)atof(py); + float z = (float)atof(pz); + + if(!MapManager::IsValidMapCoord(obj->GetMapId(),x,y,z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,obj->GetMapId()); + SetSentErrorMessage(true); + return false; + } + + Map* map = obj->GetMap(); + map->Remove(obj,false); + + obj->Relocate(x, y, z, obj->GetOrientation()); + obj->SetFloatValue(GAMEOBJECT_POS_X, x); + obj->SetFloatValue(GAMEOBJECT_POS_Y, y); + obj->SetFloatValue(GAMEOBJECT_POS_Z, z); + + map->Add(obj); + } + + obj->SaveToDB(); + obj->Refresh(); + + PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow()); - _player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, _player->GetOrientation()); return true; } -/** \brief Teleport the GM to the specified creature - * - * .gocreature <GUID> --> TP using creature.guid - * .gocreature azuregos --> TP player to the mob with this name - * Warning: If there is more than one mob with this name - * you will be teleported to the first one that is found. - * .gocreature id 6109 --> TP player to the mob, that has this creature_template.entry - * Warning: If there is more than one mob with this "id" - * you will be teleported to the first one that is found. - */ -//teleport to creature -bool ChatHandler::HandleGoCreatureCommand(const char* args) +//spawn go +bool ChatHandler::HandleGameObjectAddCommand(const char* args) { - if(!*args) + if (!*args) return false; - Player* _player = m_session->GetPlayer(); - // "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r - char* pParam1 = extractKeyFromLink((char*)args,"Hcreature"); - if (!pParam1) + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry"); + if(!cId) return false; - std::ostringstream whereClause; + uint32 id = atol(cId); + if(!id) + return false; - // User wants to teleport to the NPC's template entry - if( strcmp(pParam1, "id") == 0 ) + char* spawntimeSecs = strtok(NULL, " "); + + const GameObjectInfo *goI = objmgr.GetGameObjectInfo(id); + + if (!goI) { - //sLog.outError("DEBUG: ID found"); + PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id); + SetSentErrorMessage(true); + return false; + } - // Get the "creature_template.entry" - // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r - char* tail = strtok(NULL,""); - if(!tail) - return false; - char* cId = extractKeyFromLink(tail,"Hcreature_entry"); - if(!cId) - return false; + Player *chr = m_session->GetPlayer(); + float x = float(chr->GetPositionX()); + float y = float(chr->GetPositionY()); + float z = float(chr->GetPositionZ()); + float o = float(chr->GetOrientation()); + Map *map = chr->GetMap(); - int32 tEntry = atoi(cId); - //sLog.outError("DEBUG: ID value: %d", tEntry); - if(!tEntry) - return false; + GameObject* pGameObj = new GameObject; + uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); - whereClause << "WHERE id = '" << tEntry << "'"; + if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) + { + delete pGameObj; + return false; } - else + + if( spawntimeSecs ) { - //sLog.outError("DEBUG: ID *not found*"); + uint32 value = atoi((char*)spawntimeSecs); + pGameObj->SetRespawnTime(value); + //sLog.outDebug("*** spawntimeSecs: %d", value); + } - int32 guid = atoi(pParam1); + // fill the gameobject data and save to the db + pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()),chr->GetPhaseMaskForSpawn()); - // Number is invalid - maybe the user specified the mob's name - if(!guid) - { - std::string name = pParam1; - WorldDatabase.escape_string(name); - whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << "'"; - } - else - { - whereClause << "WHERE guid = '" << guid << "'"; - } + // this will generate a new guid if the object is in an instance + if(!pGameObj->LoadFromDB(db_lowGUID, map)) + { + delete pGameObj; + return false; } - //sLog.outError("DEBUG: %s", whereClause.c_str()); - QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str() ); - if (!result) + sLog.outDebug(GetMangosString(LANG_GAMEOBJECT_CURRENT), goI->name, db_lowGUID, x, y, z, o); + + map->Add(pGameObj); + + // TODO: is it really necessary to add both the real and DB table guid here ? + objmgr.AddGameobjectToGrid(db_lowGUID, objmgr.GetGOData(db_lowGUID)); + + PSendSysMessage(LANG_GAMEOBJECT_ADD,id,goI->name,db_lowGUID,x,y,z); + return true; +} + +//set pahsemask for selected object +bool ChatHandler::HandleGameObjectPhaseCommand(const char* args) +{ + // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if(!cId) + return false; + + uint32 lowguid = atoi(cId); + if(!lowguid) + return false; + + GameObject* obj = NULL; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + + if(!obj) { - SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND); + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); SetSentErrorMessage(true); return false; } - if( result->GetRowCount() > 1 ) - { - SendSysMessage(LANG_COMMAND_GOCREATMULTIPLE); - } - - Field *fields = result->Fetch(); - float x = fields[0].GetFloat(); - float y = fields[1].GetFloat(); - float z = fields[2].GetFloat(); - float ort = fields[3].GetFloat(); - int mapid = fields[4].GetUInt16(); - delete result; - - if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) + char* phaseStr = strtok (NULL, " "); + uint32 phasemask = phaseStr? atoi(phaseStr) : 0; + if ( phasemask == 0 ) { - PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); return false; } - // stop flight if need - if(_player->isInFlight()) + obj->SetPhaseMask(phasemask,true); + obj->SaveToDB(); + return true; +} + +bool ChatHandler::HandleGameObjectNearCommand(const char* args) +{ + float distance = (!*args) ? 10 : atol(args); + uint32 count = 0; + + Player* pl = m_session->GetPlayer(); + QueryResult *result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, " + "(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ " + "FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), + pl->GetMapId(),pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),distance*distance); + + if (result) { - _player->GetMotionMaster()->MovementExpired(); - _player->m_taxi.ClearTaxiDestinations(); + do + { + Field *fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + uint32 entry = fields[1].GetUInt32(); + float x = fields[2].GetFloat(); + float y = fields[3].GetFloat(); + float z = fields[4].GetFloat(); + int mapid = fields[5].GetUInt16(); + + GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry); + + if(!gInfo) + continue; + + PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); + + ++count; + } while (result->NextRow()); + + delete result; } - // save only in non-flight case - else - _player->SaveRecallPosition(); - _player->TeleportTo(mapid, x, y, z, ort); + PSendSysMessage(LANG_COMMAND_NEAROBJMESSAGE,distance,count); return true; } @@ -1707,186 +2043,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) return true; } -//delete object by selection or guid -bool ChatHandler::HandleDelObjectCommand(const char* args) -{ - // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r - char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; - - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; - - GameObject* obj = NULL; - - // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - - if(!obj) - { - PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); - SetSentErrorMessage(true); - return false; - } - - uint64 owner_guid = obj->GetOwnerGUID(); - if(owner_guid) - { - Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid); - if(!owner && !IS_PLAYER_GUID(owner_guid)) - { - PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); - SetSentErrorMessage(true); - return false; - } - - owner->RemoveGameObject(obj,false); - } - - obj->SetRespawnTime(0); // not save respawn time - obj->Delete(); - obj->DeleteFromDB(); - - PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow()); - - return true; -} - -//turn selected object -bool ChatHandler::HandleTurnObjectCommand(const char* args) -{ - // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r - char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; - - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; - - GameObject* obj = NULL; - - // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - - if(!obj) - { - PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); - SetSentErrorMessage(true); - return false; - } - - char* po = strtok(NULL, " "); - float o; - - if (po) - { - o = (float)atof(po); - } - else - { - Player *chr = m_session->GetPlayer(); - o = chr->GetOrientation(); - } - - Map* map = obj->GetMap(); - map->Remove(obj,false); - - obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o); - obj->UpdateRotationFields(); - - map->Add(obj); - - obj->SaveToDB(); - obj->Refresh(); - - PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), o); - - return true; -} - -//move selected object -bool ChatHandler::HandleMoveObjectCommand(const char* args) -{ - // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r - char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; - - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; - - GameObject* obj = NULL; - - // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - - if(!obj) - { - PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); - SetSentErrorMessage(true); - return false; - } - - char* px = strtok(NULL, " "); - char* py = strtok(NULL, " "); - char* pz = strtok(NULL, " "); - - if (!px) - { - Player *chr = m_session->GetPlayer(); - - Map* map = obj->GetMap(); - map->Remove(obj,false); - - obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation()); - obj->SetFloatValue(GAMEOBJECT_POS_X, chr->GetPositionX()); - obj->SetFloatValue(GAMEOBJECT_POS_Y, chr->GetPositionY()); - obj->SetFloatValue(GAMEOBJECT_POS_Z, chr->GetPositionZ()); - - map->Add(obj); - } - else - { - if(!py || !pz) - return false; - - float x = (float)atof(px); - float y = (float)atof(py); - float z = (float)atof(pz); - - if(!MapManager::IsValidMapCoord(obj->GetMapId(),x,y,z)) - { - PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,obj->GetMapId()); - SetSentErrorMessage(true); - return false; - } - - Map* map = obj->GetMap(); - map->Remove(obj,false); - - obj->Relocate(x, y, z, obj->GetOrientation()); - obj->SetFloatValue(GAMEOBJECT_POS_X, x); - obj->SetFloatValue(GAMEOBJECT_POS_Y, y); - obj->SetFloatValue(GAMEOBJECT_POS_Z, z); - - map->Add(obj); - } - - obj->SaveToDB(); - obj->Refresh(); - - PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, obj->GetGUIDLow()); - - return true; -} - //demorph player or unit bool ChatHandler::HandleDeMorphCommand(const char* /*args*/) { @@ -1905,7 +2061,7 @@ bool ChatHandler::HandleDeMorphCommand(const char* /*args*/) } //morph creature or player -bool ChatHandler::HandleMorphCommand(const char* args) +bool ChatHandler::HandleModifyMorphCommand(const char* args) { if (!*args) return false; @@ -3544,77 +3700,8 @@ bool ChatHandler::HandleCustomizeCommand(const char* args) return true; } -//spawn go -bool ChatHandler::HandleGameObjectCommand(const char* args) -{ - if (!*args) - return false; - - char* pParam1 = strtok((char*)args, " "); - if (!pParam1) - return false; - - uint32 id = atoi((char*)pParam1); - if(!id) - return false; - - char* spawntimeSecs = strtok(NULL, " "); - - const GameObjectInfo *goI = objmgr.GetGameObjectInfo(id); - - if (!goI) - { - PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id); - SetSentErrorMessage(true); - return false; - } - - Player *chr = m_session->GetPlayer(); - float x = float(chr->GetPositionX()); - float y = float(chr->GetPositionY()); - float z = float(chr->GetPositionZ()); - float o = float(chr->GetOrientation()); - Map *map = chr->GetMap(); - - GameObject* pGameObj = new GameObject; - uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); - - if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) - { - delete pGameObj; - return false; - } - - if( spawntimeSecs ) - { - uint32 value = atoi((char*)spawntimeSecs); - pGameObj->SetRespawnTime(value); - //sLog.outDebug("*** spawntimeSecs: %d", value); - } - - // fill the gameobject data and save to the db - pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()),chr->GetPhaseMaskForSpawn()); - - // this will generate a new guid if the object is in an instance - if(!pGameObj->LoadFromDB(db_lowGUID, map)) - { - delete pGameObj; - return false; - } - - sLog.outDebug(GetTrinityString(LANG_GAMEOBJECT_CURRENT), goI->name, db_lowGUID, x, y, z, o); - - map->Add(pGameObj); - - // TODO: is it really necessary to add both the real and DB table guid here ? - objmgr.AddGameobjectToGrid(db_lowGUID, objmgr.GetGOData(db_lowGUID)); - - PSendSysMessage(LANG_GAMEOBJECT_ADD,id,goI->name,db_lowGUID,x,y,z); - return true; -} - //show animation -bool ChatHandler::HandleAnimCommand(const char* args) +bool ChatHandler::HandleDebugAnimCommand(const char* args) { if (!*args) return false; @@ -3625,7 +3712,7 @@ bool ChatHandler::HandleAnimCommand(const char* args) } //change standstate -bool ChatHandler::HandleStandStateCommand(const char* args) +bool ChatHandler::HandleModifyStandStateCommand(const char* args) { if (!*args) return false; @@ -3636,7 +3723,7 @@ bool ChatHandler::HandleStandStateCommand(const char* args) return true; } -bool ChatHandler::HandleAddHonorCommand(const char* args) +bool ChatHandler::HandleHonorAddCommand(const char* args) { if (!*args) return false; @@ -3676,7 +3763,7 @@ bool ChatHandler::HandleHonorAddKillCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleUpdateHonorFieldsCommand(const char* /*args*/) +bool ChatHandler::HandleHonorUpdateCommand(const char* /*args*/) { Player *target = getSelectedPlayer(); if(!target) @@ -4521,42 +4608,3 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args) return true; } - -//set pahsemask for selected object -bool ChatHandler::HandleGOPhaseCommand(const char* args) -{ - // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r - char* cId = extractKeyFromLink((char*)args,"Hgameobject"); - if(!cId) - return false; - - uint32 lowguid = atoi(cId); - if(!lowguid) - return false; - - GameObject* obj = NULL; - - // by DB guid - if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); - - if(!obj) - { - PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); - SetSentErrorMessage(true); - return false; - } - - char* phaseStr = strtok (NULL, " "); - uint32 phasemask = phaseStr? atoi(phaseStr) : 0; - if ( phasemask == 0 ) - { - SendSysMessage(LANG_BAD_VALUE); - SetSentErrorMessage(true); - return false; - } - - obj->SetPhaseMask(phasemask,true); - obj->SaveToDB(); - return true; -} diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 7ca960775a6..5974e818361 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -2901,48 +2901,7 @@ bool ChatHandler::HandleListObjectCommand(const char* args) return true; } -bool ChatHandler::HandleNearObjectCommand(const char* args) -{ - float distance = (!*args) ? 10 : atol(args); - uint32 count = 0; - - Player* pl = m_session->GetPlayer(); - QueryResult *result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, " - "(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ " - "FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_", - pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), - pl->GetMapId(),pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),distance*distance); - - if (result) - { - do - { - Field *fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); - uint32 entry = fields[1].GetUInt32(); - float x = fields[2].GetFloat(); - float y = fields[3].GetFloat(); - float z = fields[4].GetFloat(); - int mapid = fields[5].GetUInt16(); - - GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry); - - if(!gInfo) - continue; - - PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); - - ++count; - } while (result->NextRow()); - - delete result; - } - - PSendSysMessage(LANG_COMMAND_NEAROBJMESSAGE,distance,count); - return true; -} - -bool ChatHandler::HandleObjectStateCommand(const char* args) +bool ChatHandler::HandleGameObjectStateCommand(const char* args) { // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r char* cId = extractKeyFromLink((char*)args, "Hgameobject"); @@ -2976,8 +2935,6 @@ bool ChatHandler::HandleObjectStateCommand(const char* args) gobj->SetGoState(state); return true; - - return true; } bool ChatHandler::HandleListCreatureCommand(const char* args) @@ -4556,7 +4513,7 @@ bool ChatHandler::HandleHideAreaCommand(const char* args) return true; } -bool ChatHandler::HandleUpdate(const char* args) +bool ChatHandler::HandleDebugUpdate(const char* args) { if(!*args) return false; @@ -4656,7 +4613,7 @@ bool ChatHandler::HandleChangeWeather(const char* args) return true; } -bool ChatHandler::HandleSetValue(const char* args) +bool ChatHandler::HandleDebugSetValue(const char* args) { if(!*args) return false; @@ -4707,7 +4664,7 @@ bool ChatHandler::HandleSetValue(const char* args) return true; } -bool ChatHandler::HandleGetValue(const char* args) +bool ChatHandler::HandleDebugGetValue(const char* args) { if(!*args) return false; @@ -4756,7 +4713,7 @@ bool ChatHandler::HandleGetValue(const char* args) return true; } -bool ChatHandler::HandleSet32Bit(const char* args) +bool ChatHandler::HandleDebugSet32Bit(const char* args) { if(!*args) return false; @@ -4789,7 +4746,7 @@ bool ChatHandler::HandleSet32Bit(const char* args) return true; } -bool ChatHandler::HandleMod32Value(const char* args) +bool ChatHandler::HandleDebugMod32Value(const char* args) { if(!*args) return false; @@ -4821,7 +4778,7 @@ bool ChatHandler::HandleMod32Value(const char* args) return true; } -bool ChatHandler::HandleAddTeleCommand(const char * args) +bool ChatHandler::HandleTeleAddCommand(const char * args) { if(!*args) return false; @@ -4861,7 +4818,7 @@ bool ChatHandler::HandleAddTeleCommand(const char * args) return true; } -bool ChatHandler::HandleDelTeleCommand(const char * args) +bool ChatHandler::HandleTeleDelCommand(const char * args) { if(!*args) return false; @@ -5459,7 +5416,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char* args) return true; } -bool ChatHandler::HandleAddQuest(const char* args) +bool ChatHandler::HandleQuestAdd(const char* args) { Player* player = getSelectedPlayer(); if(!player) @@ -5513,7 +5470,7 @@ bool ChatHandler::HandleAddQuest(const char* args) return true; } -bool ChatHandler::HandleRemoveQuest(const char* args) +bool ChatHandler::HandleQuestRemove(const char* args) { Player* player = getSelectedPlayer(); if(!player) @@ -5563,7 +5520,7 @@ bool ChatHandler::HandleRemoveQuest(const char* args) return true; } -bool ChatHandler::HandleCompleteQuest(const char* args) +bool ChatHandler::HandleQuestComplete(const char* args) { Player* player = getSelectedPlayer(); if(!player) @@ -6155,7 +6112,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleFlyModeCommand(const char* args) +bool ChatHandler::HandleGMFlyModeCommand(const char* args) { if(!args) return false; @@ -6181,7 +6138,7 @@ bool ChatHandler::HandleFlyModeCommand(const char* args) return true; } -bool ChatHandler::HandleLoadPDumpCommand(const char *args) +bool ChatHandler::HandlePDumpLoadCommand(const char *args) { if(!args) return false; @@ -6292,7 +6249,7 @@ bool ChatHandler::HandleLoadPDumpCommand(const char *args) return true; } -bool ChatHandler::HandleWritePDumpCommand(const char *args) +bool ChatHandler::HandlePDumpWriteCommand(const char *args) { if(!args) return false; diff --git a/src/game/Object.cpp b/src/game/Object.cpp index a8dff0b73ab..eda29509b8c 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1578,9 +1578,9 @@ void WorldObject::AddObjectToRemoveList() map->AddObjectToRemoveList(this); } -Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime) +TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime) { - TemporarySummon* pCreature = new TemporarySummon(GetGUID()); + TempSummon* pCreature = new TempSummon(GetGUID()); uint32 team = 0; if (GetTypeId()==TYPEID_PLAYER) @@ -1625,12 +1625,13 @@ Vehicle* WorldObject::SummonVehicle(uint32 entry, float x, float y, float z, flo { CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); if(!ci) - return false; + return NULL; uint32 id = ci->spells[7]; //temp store id here + if(!id) id = 156; VehicleEntry const *ve = sVehicleStore.LookupEntry(id); if(!ve) - return false; + return NULL; Vehicle *v = new Vehicle; Map *map = GetMap(); diff --git a/src/game/Object.h b/src/game/Object.h index 7ae42ea3a70..4107a6e5aa4 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -104,6 +104,7 @@ class Player; class UpdateMask; class InstanceData; class GameObject; +class TempSummon; class Vehicle; typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType; @@ -499,7 +500,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object Map * GetMap() const; Map const* GetBaseMap() const; - Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); + TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); Vehicle* SummonVehicle(uint32 entry, float x, float y, float z, float ang); GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime); Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 32ffd80801b..d7721070e63 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -51,7 +51,7 @@ m_declinedname(NULL) // pets always have a charminfo, even if they are not actually charmed CharmInfo* charmInfo = InitCharmInfo(); - if(type == MINI_PET || type == POSSESSED_PET) // always passive + if(type == POSSESSED_PET) // always passive SetReactState(REACT_PASSIVE); else if(type == GUARDIAN_PET) // always aggressive SetReactState(REACT_AGGRESSIVE); @@ -744,11 +744,6 @@ bool Pet::CreateBaseAtCreature(Creature* creature) return false; } - if(cinfo->type == CREATURE_TYPE_CRITTER) - { - setPetType(MINI_PET); - return true; - } SetDisplayId(creature->GetDisplayId()); SetNativeDisplayId(creature->GetNativeDisplayId()); SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS)); @@ -1725,9 +1720,6 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint3 SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - if(getPetType() == MINI_PET) // always non-attackable - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - return true; } diff --git a/src/game/Pet.h b/src/game/Pet.h index 71eeed483e1..d8053fdfd67 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -30,9 +30,8 @@ enum PetType SUMMON_PET = 0, HUNTER_PET = 1, GUARDIAN_PET = 2, - MINI_PET = 3, - POSSESSED_PET = 4, - MAX_PET_TYPE = 5 + POSSESSED_PET = 3, + MAX_PET_TYPE = 4 }; extern char const* petTypeSuffix[MAX_PET_TYPE]; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 14565e74411..ee168c274b5 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -458,7 +458,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this) m_mover = this; m_seer = this; - m_miniPet = 0; m_bgAfkReportedTimer = 0; m_contestedPvPTimer = 0; @@ -1426,7 +1425,6 @@ void Player::setDeathState(DeathState s) RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); // remove uncontrolled pets - RemoveMiniPet(); RemoveGuardians(); // save value before aura remove in Unit::setDeathState @@ -1888,8 +1886,6 @@ void Player::RemoveFromWorld() ///- Release charmed creatures, unsummon totems and remove pets/guardians StopCastingCharm(); StopCastingBindSight(); - UnsummonAllTotems(); - RemoveMiniPet(); RemoveGuardians(); } @@ -17055,9 +17051,6 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) // only if current pet in slot switch(pet->getPetType()) { - case MINI_PET: - m_miniPet = 0; - break; case GUARDIAN_PET: m_guardianPets.erase(pet->GetGUID()); break; @@ -17105,22 +17098,6 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) } } -void Player::RemoveMiniPet() -{ - if(Pet* pet = GetMiniPet()) - { - pet->Remove(PET_SAVE_AS_DELETED); - m_miniPet = 0; - } -} - -Pet* Player::GetMiniPet() -{ - if(!m_miniPet) - return NULL; - return ObjectAccessor::GetPet(m_miniPet); -} - void Player::RemoveGuardians() { while(!m_guardianPets.empty()) diff --git a/src/game/Player.h b/src/game/Player.h index b96753b6175..aec16d27b71 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1052,9 +1052,6 @@ class TRINITY_DLL_SPEC Player : public Unit Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime); void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); - void RemoveMiniPet(); - Pet* GetMiniPet(); - void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); } void RemoveGuardians(); bool HasGuardianWithEntry(uint32 entry); void AddGuardian(Pet* pet) { m_guardianPets.insert(pet->GetGUID()); } @@ -2423,7 +2420,6 @@ class TRINITY_DLL_SPEC Player : public Unit uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; - uint64 m_miniPet; GuardianPetList m_guardianPets; // Player summoning diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 8e0f1cffbf9..02bc03bced2 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2375,13 +2375,19 @@ enum DungeonDifficulties TOTAL_DIFFICULTIES }; +enum SummonCategory +{ + SUMMON_CATEGORY_WILD = 0, + SUMMON_CATEGORY_ALLY = 1, + SUMMON_CATEGORY_GUARDIAN = 2, + SUMMON_CATEGORY_POSSESSED = 3, + SUMMON_CATEGORY_VEHICLE = 4, +}; + enum SummonType { - //SUMMON_TYPE_WILD = 0, - //SUMMON_TYPE_ALLY = 1, - //SUMMON_TYPE_GUARDIAN = 2, - SUMMON_TYPE_POSSESSED = 3, - SUMMON_TYPE_VEHICLE = 4, + SUMMON_TYPE_MINIPET = 5, + SUMMON_TYPE_CRITTER = 41, SUMMON_TYPE_GUARDIAN = 61, SUMMON_TYPE_TOTEM_SLOT1 = 63, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3dd11e105c3..881a68e6c19 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1524,7 +1524,6 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) // TagUnitMap.push_back(target); //else m_caster->GetRaidMember(TagUnitMap, radius_f); - TagUnitMap.push_back(m_caster); break; } }break; @@ -1541,7 +1540,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) switch(cur) { case TARGET_UNIT_MINIPET: - if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet() && ((Pet*)target)->getPetType() == MINI_PET) + if(target->GetGUID() == m_caster->m_TotemSlot[4]) TagUnitMap.push_back(target); break; case TARGET_UNIT_TARGET_ALLY: @@ -4172,9 +4171,9 @@ SpellCastResult Spell::CheckCast(bool strict) SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]); if(!SummonProperties) break; - switch(SummonProperties->Group) + switch(SummonProperties->Category) { - case SUMMON_TYPE_POSSESSED: + case SUMMON_CATEGORY_POSSESSED: { if(m_caster->GetPetGUID()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; diff --git a/src/game/Spell.h b/src/game/Spell.h index ac7106eaa62..0301f5537eb 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -598,6 +598,9 @@ class Spell void SpellDamageSchoolDmg(uint32 i); void SpellDamageWeaponDmg(uint32 i); void SpellDamageHeal(uint32 i); + + void GetSummonPosition(float &x, float &y, float &z, float radius = 0.0f, uint32 count = 0); + SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue); // ------------------------------------------- diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6415638169f..97112095d62 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -651,7 +651,7 @@ void AreaAura::Update(uint32 diff) caster->GetPartyMember(targets, m_radius); break; case AREA_AURA_RAID: - caster->GetRaidMember(targets, m_radius); + caster->GetRaidMember(targets, m_radius); break; case AREA_AURA_FRIEND: { diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 8645d1ab7d4..e363b2cb41e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1166,7 +1166,7 @@ void Spell::EffectDummy(uint32 i) if(!unitTarget) return; - TemporarySummon* tempSummon = dynamic_cast<TemporarySummon*>(unitTarget); + TempSummon* tempSummon = dynamic_cast<TempSummon*>(unitTarget); if(!tempSummon) return; @@ -3333,11 +3333,6 @@ void Spell::EffectSummonType(uint32 i) case SUMMON_TYPE_SUMMON: EffectSummon(i); break; - case SUMMON_TYPE_CRITTER: - case SUMMON_TYPE_CRITTER2: - case SUMMON_TYPE_CRITTER3: - EffectSummonCritter(i); - break; case SUMMON_TYPE_TOTEM_SLOT1: case SUMMON_TYPE_TOTEM_SLOT2: case SUMMON_TYPE_TOTEM_SLOT3: @@ -3358,15 +3353,18 @@ void Spell::EffectSummonType(uint32 i) sLog.outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->EffectMiscValueB[i]); return; } - switch(SummonProperties->Group) + switch(SummonProperties->Category) { default: - EffectSummonWild(i); + if(SummonProperties->Type == SUMMON_TYPE_MINIPET) + EffectSummonCritter(i); + else + EffectSummonWild(i); break; - case SUMMON_TYPE_POSSESSED: + case SUMMON_CATEGORY_POSSESSED: EffectSummonPossessed(i); break; - case SUMMON_TYPE_VEHICLE: + case SUMMON_CATEGORY_VEHICLE: EffectSummonVehicle(i); break; } @@ -3683,11 +3681,6 @@ void Spell::EffectSummonWild(uint32 i) } } - // select center of summon position - float center_x = m_targets.m_destX; - float center_y = m_targets.m_destY; - float center_z = m_targets.m_destZ; - float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); int32 amount = damage > 0 ? damage : 1; @@ -3695,23 +3688,7 @@ void Spell::EffectSummonWild(uint32 i) for(int32 count = 0; count < amount; ++count) { float px, py, pz; - // If dest location if present - if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) - { - // Summon 1 unit in dest location - if (count == 0) - { - px = m_targets.m_destX; - py = m_targets.m_destY; - pz = m_targets.m_destZ; - } - // Summon in random point all other units if location present - else - m_caster->GetRandomPoint(center_x,center_y,center_z,radius,px,py,pz); - } - // Summon if dest location not present near caster - else - m_caster->GetClosePoint(px,py,pz,3.0f); + GetSummonPosition(px, py, pz, radius, count); int32 duration = GetSpellDuration(m_spellInfo); @@ -5101,6 +5078,22 @@ void Spell::EffectScriptEffect(uint32 effIndex) DoCreateItem( effIndex, itemtype ); return; } + // Everlasting Affliction + case 47422: + // Refresh corruption on target + Unit::AuraMap& auras = unitTarget->GetAuras(); + for(Unit::AuraMap::iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); + if( spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && + spellInfo->SpellFamilyFlags[0] & 0x2 && + (*itr).second->GetCasterGUID() == m_caster->GetGUID()) + { + unitTarget->RefreshAurasByCasterSpell(spellInfo->Id, m_caster->GetGUID()); + return; + } + } + break; } break; } @@ -5122,7 +5115,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) spellInfo->SpellFamilyFlags[0] & 0x8000 && (*itr).second->GetCasterGUID() == m_caster->GetGUID()) { - (*itr).second->RefreshAura(); + unitTarget->RefreshAurasByCasterSpell((*itr).second->GetId(), m_caster->GetGUID()); return; } } @@ -5572,10 +5565,8 @@ void Spell::EffectSummonTotem(uint32 i) return; } - float angle = slot < MAX_TOTEM ? M_PI/MAX_TOTEM - (slot*2*M_PI/MAX_TOTEM) : 0; - float x,y,z; - m_caster->GetClosePoint(x,y,z,pTotem->GetObjectSize(),2.0f,angle); + GetSummonPosition(x, y, z); // totem must be at same Z in case swimming caster and etc. if( fabs( z - m_caster->GetPositionZ() ) > 5 ) @@ -6036,76 +6027,33 @@ void Spell::EffectSummonCritter(uint32 i) if(!pet_entry) return; - Pet* old_critter = player->GetMiniPet(); - - // for same pet just despawn - if(old_critter && old_critter->GetEntry() == pet_entry) - { - player->RemoveMiniPet(); - return; - } - - // despawn old pet before summon new - if(old_critter) - player->RemoveMiniPet(); - - // summon new pet - Pet* critter = new Pet(MINI_PET); - - Map *map = m_caster->GetMap(); - uint32 pet_number = objmgr.GeneratePetNumber(); - if(!critter->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), - pet_entry, pet_number)) - { - sLog.outError("Spell::EffectSummonCritter, spellid %u: no such creature entry %u", m_spellInfo->Id, pet_entry); - delete critter; - return; - } - float x,y,z; - // If dest location if present - if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) - { - x = m_targets.m_destX; - y = m_targets.m_destY; - z = m_targets.m_destZ; - } - // Summon if dest location not present near caster - else - m_caster->GetClosePoint(x,y,z,critter->GetObjectSize()); - - critter->Relocate(x,y,z,m_caster->GetOrientation()); + GetSummonPosition(x, y, z); - if(!critter->IsPositionValid()) - { - sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", - critter->GetGUIDLow(), critter->GetEntry(), critter->GetPositionX(), critter->GetPositionY()); - delete critter; + int32 duration = GetSpellDuration(m_spellInfo); + TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; + TempSummon *critter = m_caster->SummonCreature(pet_entry, x, y, z, m_caster->GetOrientation(), summonType, duration); + if(!critter) return; - } critter->SetOwnerGUID(m_caster->GetGUID()); critter->SetCreatorGUID(m_caster->GetGUID()); critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); - critter->AIM_Initialize(); - critter->InitPetCreateSpells(); // e.g. disgusting oozeling has a create spell as critter... + //critter->InitPetCreateSpells(); // e.g. disgusting oozeling has a create spell as critter... critter->SetMaxHealth(1); critter->SetHealth(1); critter->SetLevel(1); - // set timer for unsummon - int32 duration = GetSpellDuration(m_spellInfo); - if(duration > 0) - critter->SetDuration(duration); + critter->SetReactState(REACT_PASSIVE); + critter->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); std::string name = player->GetName(); - name.append(petTypeSuffix[critter->getPetType()]); + name.append(petTypeSuffix[3]); critter->SetName( name ); - player->SetMiniPet(critter); - map->Add((Creature*)critter); + critter->SetSummonProperties(sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i])); } void Spell::EffectKnockBack(uint32 i) @@ -6554,11 +6502,6 @@ void Spell::EffectSkill(uint32 /*i*/) void Spell::EffectSummonDemon(uint32 i) { - // select center of summon position - float center_x = m_targets.m_destX; - float center_y = m_targets.m_destY; - float center_z = m_targets.m_destZ; - float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); int32 amount = damage > 0 ? damage : 1; @@ -6566,23 +6509,7 @@ void Spell::EffectSummonDemon(uint32 i) for(int32 count = 0; count < amount; ++count) { float px, py, pz; - // If dest location if present - if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) - { - // Summon 1 unit in dest location - if (count == 0) - { - px = m_targets.m_destX; - py = m_targets.m_destY; - pz = m_targets.m_destZ; - } - // Summon in random point all other units if location present - else - m_caster->GetRandomPoint(center_x,center_y,center_z,radius,px,py,pz); - } - // Summon if dest location not present near caster - else - m_caster->GetClosePoint(px,py,pz,3.0f); + GetSummonPosition(px, py, pz, radius, count); int32 duration = GetSpellDuration(m_spellInfo); @@ -6787,10 +6714,32 @@ void Spell::EffectSummonVehicle(uint32 i) float x, y, z; m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Vehicle *vehicle = m_caster->SummonVehicle(entry, x, y, z, m_caster->GetOrientation()); + if(!vehicle) + return; vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); } +void Spell::GetSummonPosition(float &x, float &y, float &z, float radius, uint32 count) +{ + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + { + // Summon 1 unit in dest location + if (count == 0) + { + x = m_targets.m_destX; + y = m_targets.m_destY; + z = m_targets.m_destZ; + } + // Summon in random point all other units if location present + else + m_caster->GetRandomPoint(m_targets.m_destX,m_targets.m_destY,m_targets.m_destZ,radius,x,y,z); + } + // Summon if dest location not present near caster + else + m_caster->GetClosePoint(x,y,z,3.0f); +} + void Spell::EffectRenamePet(uint32 /*eff_idx*/) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index bd655ef144f..110549fb6e0 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -23,12 +23,14 @@ #include "ObjectAccessor.h" #include "CreatureAI.h" -TemporarySummon::TemporarySummon( uint64 summoner ) : +TempSummon::TempSummon( uint64 summoner ) : Creature(), m_type(TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN), m_timer(0), m_lifetime(0), m_summoner(summoner) +, m_properties(NULL) { + m_isSummon = true; } -void TemporarySummon::Update( uint32 diff ) +void TempSummon::Update( uint32 diff ) { if (m_deathState == DEAD) { @@ -157,7 +159,7 @@ void TemporarySummon::Update( uint32 diff ) Creature::Update( diff ); } -void TemporarySummon::Summon(TempSummonType type, uint32 lifetime) +void TempSummon::Summon(TempSummonType type, uint32 lifetime) { m_type = type; m_timer = lifetime; @@ -168,19 +170,51 @@ void TemporarySummon::Summon(TempSummonType type, uint32 lifetime) AIM_Initialize(); } -void TemporarySummon::UnSummon() +void TempSummon::UnSummon() { CleanupsBeforeDelete(); AddObjectToRemoveList(); - Unit* sum = m_summoner ? ObjectAccessor::GetUnit(*this, m_summoner) : NULL; - if (sum && sum->GetTypeId() == TYPEID_UNIT && ((Creature*)sum)->IsAIEnabled) + Unit* owner = GetSummoner(); + if(owner) { - ((Creature*)sum)->AI()->SummonedCreatureDespawn(this); + if(owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled) + ((Creature*)owner)->AI()->SummonedCreatureDespawn(this); + if(uint32 slot = m_properties->Slot) + { + --slot; + owner->m_TotemSlot[slot] = 0; + } + } +} + +void TempSummon::SetSummonProperties(SummonPropertiesEntry const *properties) +{ + if(!properties) + return; + + m_properties = properties; + + if(uint32 slot = m_properties->Slot) + { + --slot; + Unit* owner = GetSummoner(); + if(owner) + { + if(owner->m_TotemSlot[slot] && owner->m_TotemSlot[slot] != GetGUID()) + { + Creature *OldTotem = ObjectAccessor::GetCreature(*this, owner->m_TotemSlot[slot]); + if(OldTotem && OldTotem->isSummon()) + ((TempSummon*)OldTotem)->UnSummon(); + } + owner->m_TotemSlot[slot] = GetGUID(); + } } + + AIM_Initialize(); } -void TemporarySummon::SaveToDB() +void TempSummon::SaveToDB() { } diff --git a/src/game/TemporarySummon.h b/src/game/TemporarySummon.h index eaefbab1d84..4b22a9e5d77 100644 --- a/src/game/TemporarySummon.h +++ b/src/game/TemporarySummon.h @@ -24,16 +24,19 @@ #include "Creature.h" #include "ObjectAccessor.h" -class TemporarySummon : public Creature +class TempSummon : public Creature { public: - explicit TemporarySummon(uint64 summoner = 0); - virtual ~TemporarySummon(){}; + explicit TempSummon(uint64 summoner = 0); + virtual ~TempSummon(){}; void Update(uint32 time); void Summon(TempSummonType type, uint32 lifetime); - void UnSummon(); + virtual void UnSummon(); void SaveToDB(); Unit* GetSummoner() const { return m_summoner ? ObjectAccessor::GetUnit(*this, m_summoner) : NULL; } + + void SetSummonProperties(SummonPropertiesEntry const *properties); + SummonPropertiesEntry const *m_properties; private: TempSummonType m_type; uint32 m_timer; diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 25e2b2b2ad2..0dc1ac41546 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -26,7 +26,7 @@ #include "ObjectMgr.h" #include "SpellMgr.h" -Totem::Totem() : Creature() +Totem::Totem() : TempSummon(0) { m_isTotem = true; m_duration = 0; diff --git a/src/game/Totem.h b/src/game/Totem.h index af2ca7a4023..baf4ac2c571 100644 --- a/src/game/Totem.h +++ b/src/game/Totem.h @@ -21,7 +21,7 @@ #ifndef TRINITYCORE_TOTEM_H #define TRINITYCORE_TOTEM_H -#include "Creature.h" +#include "TemporarySummon.h" enum TotemType { @@ -32,7 +32,7 @@ enum TotemType #define SENTRY_TOTEM_ENTRY 3968 -class Totem : public Creature +class Totem : public TempSummon { public: explicit Totem(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d0f55f33e5e..e745aec5d6f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -50,6 +50,7 @@ #include "PetAI.h" #include "NullCreatureAI.h" #include "Traveller.h" +#include "TemporarySummon.h" #include <math.h> @@ -4133,6 +4134,23 @@ void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 caste } } +void Unit::RefreshAurasByCasterSpell(uint32 spellId, uint64 casterGUID) +{ + // Lookup for auras already applied from spell + for(uint8 i = 0; i < 3; ++i) + { + spellEffectPair spair = spellEffectPair(spellId, i); + for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr) + { + if(itr->second->GetCasterGUID()==casterGUID) + { + itr->second->RefreshAura(); + break; + } + } + } +} + void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler) { for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) @@ -4381,7 +4399,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) { if(AurSpellInfo->Effect[i] == SPELL_EFFECT_SUMMON) if(SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(AurSpellInfo->EffectMiscValueB[i])) - if(SummonProperties->Group == SUMMON_TYPE_POSSESSED) + if(SummonProperties->Category == SUMMON_CATEGORY_POSSESSED) { ((Player*)caster)->StopCastingCharm(); break; @@ -4614,17 +4632,25 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) { assert(gameObj && gameObj->GetOwnerGUID()==GetGUID()); + gameObj->SetOwnerGUID(0); + // GO created by some spell - if ( GetTypeId()==TYPEID_PLAYER && gameObj->GetSpellId() ) + if (uint32 spellid = gameObj->GetSpellId()) { - SpellEntry const* createBySpell = sSpellStore.LookupEntry(gameObj->GetSpellId()); - // Need activate spell use for owner - if (createBySpell && createBySpell->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) - // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases) - ((Player*)this)->SendCooldownEvent(createBySpell); + RemoveAurasDueToSpell(spellid); + + if (GetTypeId()==TYPEID_PLAYER) + { + SpellEntry const* createBySpell = sSpellStore.LookupEntry(spellid ); + // Need activate spell use for owner + if (createBySpell && createBySpell->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) + // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases) + ((Player*)this)->SendCooldownEvent(createBySpell); + } } - gameObj->SetOwnerGUID(0); + m_gameObj.remove(gameObj); + if(del) { gameObj->SetRespawnTime(0); @@ -5640,6 +5666,23 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 30295: case 30296: { + // Improved Soul Leech + AuraList const& SoulLeechAuras = GetAurasByType(SPELL_AURA_DUMMY); + for(Unit::AuraList::const_iterator i = SoulLeechAuras.begin();i != SoulLeechAuras.end(); ++i) + { + if ((*i)->GetId()==54117 || (*i)->GetId()==54118) + { + basepoints0 = int32((*i)->GetModifier()->m_amount); + if (target = GetPet()) + { + // regen mana for pet + CastCustomSpell(target,54607,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); + } + // regen mana for caster + CastCustomSpell(this,59117,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); + break; + } + } // health basepoints0 = int32(damage*triggerAmount/100); target = this; @@ -8325,8 +8368,8 @@ void Unit::UnsummonAllTotems() continue; Creature *OldTotem = ObjectAccessor::GetCreature(*this, m_TotemSlot[i]); - if (OldTotem && OldTotem->isTotem()) - ((Totem*)OldTotem)->UnSummon(); + if(OldTotem && OldTotem->isSummon()) + ((TempSummon*)OldTotem)->UnSummon(); } } @@ -11355,6 +11398,7 @@ void Unit::RemoveFromWorld() // cleanup if(IsInWorld()) { + UnsummonAllTotems(); RemoveCharmAuras(); RemoveBindSightAuras(); RemoveNotOwnSingleTargetAuras(); @@ -12656,7 +12700,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry con if(Player* modOwner = GetSpellModOwner()) { modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_CHANCE_OF_SUCCESS,chance); - modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_PROC_CHANCE,chance); + modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_PROC_PER_MINUTE,chance); } return roll_chance_f(chance); @@ -13376,17 +13420,25 @@ void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius) return; Group *pGroup = owner->GetGroup(); - if(!pGroup) - return; - - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + if(pGroup) { - Player* Target = itr->getSource(); + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* Target = itr->getSource(); - // IsHostileTo check duel and controlled by enemy - if( Target && Target != this && Target->isAlive() - && IsWithinDistInMap(Target, radius) && !IsHostileTo(Target) ) - nearMembers.push_back(Target); + // IsHostileTo check duel and controlled by enemy + if( Target && Target != this && Target->isAlive() + && IsWithinDistInMap(Target, radius) && !IsHostileTo(Target) ) + nearMembers.push_back(Target); + } + } + else + { + if(owner->isAlive() && (owner == this || IsWithinDistInMap(owner, radius))) + nearMembers.push_back(owner); + if(Pet* pet = owner->GetPet()) + if(pet->isAlive() && (pet == this && IsWithinDistInMap(pet, radius))) + nearMembers.push_back(pet); } } diff --git a/src/game/Unit.h b/src/game/Unit.h index bb8284d6ba3..f153c725edf 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -114,7 +114,7 @@ enum SpellModOp SPELLMOD_EFFECT3 = 23, SPELLMOD_SPELL_BONUS_DAMAGE = 24, // spellmod 25 - SPELLMOD_PROC_CHANCE = 26, + SPELLMOD_PROC_PER_MINUTE = 26, SPELLMOD_MULTIPLE_VALUE = 27, SPELLMOD_RESIST_DISPEL_CHANCE = 28, SPELLMOD_CRIT_DAMAGE_BONUS_2 = 29, //one not used spell @@ -822,7 +822,8 @@ enum ReactiveType }; #define MAX_REACTIVE 3 -#define MAX_TOTEM 4 +#define MAX_TOTEM 4 +#define MAX_SUMMON_SLOT 6 struct AuraSlotEntry { @@ -1235,6 +1236,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT); void RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT); + void RefreshAurasByCasterSpell(uint32 spellId, uint64 casterGUID); void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); void RemoveAurasDueToSpellByCancel(uint32 spellId); diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp index 001d0d5dc12..b15bb456945 100644 --- a/src/shared/Database/DBCStores.cpp +++ b/src/shared/Database/DBCStores.cpp @@ -337,7 +337,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore, dbcPath,"SpellRuneCost.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore, dbcPath,"SpellShapeshiftForm.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc"); - //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc"); // create talent spells set diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h index a511c97013c..6fb43567a3a 100644 --- a/src/shared/Database/DBCStructure.h +++ b/src/shared/Database/DBCStructure.h @@ -1401,7 +1401,7 @@ struct StableSlotPricesEntry struct SummonPropertiesEntry { uint32 Id; // 0 - uint32 Group; // 1, 0 - can't be controlled?, 1 - something guardian?, 2 - pet?, 3 - something controllable?, 4 - taxi/mount? + uint32 Category; // 1, 0 - can't be controlled?, 1 - something guardian?, 2 - pet?, 3 - something controllable?, 4 - taxi/mount? uint32 Unk2; // 2, 14 rows > 0 uint32 Type; // 3, see enum uint32 Slot; // 4, 0-6 |
