diff options
author | Seline <none@none> | 2008-10-14 11:57:03 -0500 |
---|---|---|
committer | Seline <none@none> | 2008-10-14 11:57:03 -0500 |
commit | 2265aef916e3b2d63d87faa68a2b51e7d747c54c (patch) | |
tree | b05420685b7d202aade6f70a6f511adbfb79e37f /src | |
parent | 222cbfd4644412fb8e5aeed7c37c88797d09964a (diff) |
[svn] * Merge Temp dev SVN with Assembla.
* Changes include:
- Implementation of w12x's Outdoor PvP and Game Event Systems.
- Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed).
- All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql).
- Improved Config cleanup.
- And many more changes.
--HG--
branch : trunk
Diffstat (limited to 'src')
435 files changed, 10331 insertions, 7517 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index aec367d734b..40787fa17d0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/bindings/Makefile.am b/src/bindings/Makefile.am index e1b48cb9f8e..5e85dfe15bc 100644 --- a/src/bindings/Makefile.am +++ b/src/bindings/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/bindings/interface/Makefile.am b/src/bindings/interface/Makefile.am index 7da976f6cbf..bcca2128203 100644 --- a/src/bindings/interface/Makefile.am +++ b/src/bindings/interface/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -52,3 +52,4 @@ libtrinityscript_la_LIBADD = $(MYSQL_LIBS) $(POSTGRE_LIBS) EXTRA_DIST = \ Readme.txt + diff --git a/src/bindings/interface/ScriptMgr.cpp b/src/bindings/interface/ScriptMgr.cpp index 100159803f5..2db437526d1 100644 --- a/src/bindings/interface/ScriptMgr.cpp +++ b/src/bindings/interface/ScriptMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" @@ -34,7 +36,7 @@ int num_inst_scripts; extern void AddSC_default(); // ------------------- -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT void ScriptsFree() { // Free resources before library unload for(int i=0;i<nrscripts;i++) @@ -47,7 +49,7 @@ void ScriptsFree() num_inst_scripts = 0; } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT void ScriptsInit() { nrscripts = 0; @@ -76,7 +78,7 @@ Script* GetScriptByName(std::string Name) return NULL; } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GossipHello ( Player * player, Creature *_Creature ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -86,7 +88,7 @@ bool GossipHello ( Player * player, Creature *_Creature ) return tmpscript->pGossipHello(player,_Creature); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GossipSelect( Player *player, Creature *_Creature,uint32 sender, uint32 action ) { debug_log("DEBUG: Gossip selection, sender: %d, action: %d",sender, action); @@ -98,7 +100,7 @@ bool GossipSelect( Player *player, Creature *_Creature,uint32 sender, uint32 act return tmpscript->pGossipSelect(player,_Creature,sender,action); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ) { debug_log("DEBUG: Gossip selection, sender: %d, action: %d",sender, action); @@ -110,7 +112,7 @@ bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, u return tmpscript->pGossipSelectWithCode(player,_Creature,sender,action,sCode); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool QuestAccept( Player *player, Creature *_Creature, Quest *_Quest ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -120,7 +122,7 @@ bool QuestAccept( Player *player, Creature *_Creature, Quest *_Quest ) return tmpscript->pQuestAccept(player,_Creature,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool QuestSelect( Player *player, Creature *_Creature, Quest *_Quest ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -130,7 +132,7 @@ bool QuestSelect( Player *player, Creature *_Creature, Quest *_Quest ) return tmpscript->pQuestSelect(player,_Creature,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool QuestComplete( Player *player, Creature *_Creature, Quest *_Quest ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -140,7 +142,7 @@ bool QuestComplete( Player *player, Creature *_Creature, Quest *_Quest ) return tmpscript->pQuestComplete(player,_Creature,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ChooseReward( Player *player, Creature *_Creature, Quest *_Quest, uint32 opt ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -150,7 +152,7 @@ bool ChooseReward( Player *player, Creature *_Creature, Quest *_Quest, uint32 op return tmpscript->pChooseReward(player,_Creature,_Quest,opt); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT uint32 NPCDialogStatus( Player *player, Creature *_Creature ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -160,7 +162,7 @@ uint32 NPCDialogStatus( Player *player, Creature *_Creature ) return tmpscript->pNPCDialogStatus(player,_Creature); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT uint32 GODialogStatus( Player *player, GameObject *_GO ) { Script *tmpscript = NULL; @@ -172,7 +174,7 @@ uint32 GODialogStatus( Player *player, GameObject *_GO ) return tmpscript->pGODialogStatus(player,_GO); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ItemHello( Player *player, Item *_Item, Quest *_Quest ) { Script *tmpscript = NULL; @@ -184,7 +186,7 @@ bool ItemHello( Player *player, Item *_Item, Quest *_Quest ) return tmpscript->pItemHello(player,_Item,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ItemQuestAccept( Player *player, Item *_Item, Quest *_Quest ) { Script *tmpscript = NULL; @@ -196,7 +198,7 @@ bool ItemQuestAccept( Player *player, Item *_Item, Quest *_Quest ) return tmpscript->pItemQuestAccept(player,_Item,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GOHello( Player *player, GameObject *_GO ) { Script *tmpscript = NULL; @@ -208,7 +210,7 @@ bool GOHello( Player *player, GameObject *_GO ) return tmpscript->pGOHello(player,_GO); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GOQuestAccept( Player *player, GameObject *_GO, Quest *_Quest ) { Script *tmpscript = NULL; @@ -220,7 +222,7 @@ bool GOQuestAccept( Player *player, GameObject *_GO, Quest *_Quest ) return tmpscript->pGOQuestAccept(player,_GO,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GOChooseReward( Player *player, GameObject *_GO, Quest *_Quest, uint32 opt ) { Script *tmpscript = NULL; @@ -232,7 +234,7 @@ bool GOChooseReward( Player *player, GameObject *_GO, Quest *_Quest, uint32 opt return tmpscript->pGOChooseReward(player,_GO,_Quest,opt); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool AreaTrigger ( Player *player, AreaTriggerEntry* atEntry ) { Script *tmpscript = NULL; @@ -243,7 +245,7 @@ bool AreaTrigger ( Player *player, AreaTriggerEntry* atEntry ) return tmpscript->pAreaTrigger(player, atEntry); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ReceiveEmote ( Player *player, Creature *_Creature, uint32 emote ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -252,7 +254,7 @@ bool ReceiveEmote ( Player *player, Creature *_Creature, uint32 emote ) return tmpscript->pReceiveEmote(player,_Creature, emote); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) { Script *tmpscript = NULL; @@ -263,7 +265,7 @@ bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) return tmpscript->pItemUse(player,_Item,targets); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT CreatureAI* GetAI(Creature *_Creature ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -272,7 +274,7 @@ CreatureAI* GetAI(Creature *_Creature ) return tmpscript->GetAI(_Creature); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT InstanceData* CreateInstanceData(Map *map) { if(!map->IsDungeon()) return NULL; diff --git a/src/bindings/interface/ScriptMgr.h b/src/bindings/interface/ScriptMgr.h index 0cc0b4362b8..45bf084bc6a 100644 --- a/src/bindings/interface/ScriptMgr.h +++ b/src/bindings/interface/ScriptMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SCRIPTMGR_H @@ -86,7 +88,7 @@ extern int num_inst_scripts; #define VISIBLE_RANGE (50.0f) -struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI +struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { ScriptedAI(Creature* creature) : m_creature(creature) {} ~ScriptedAI() {} diff --git a/src/bindings/interface/Scripts/sc_default.cpp b/src/bindings/interface/Scripts/sc_default.cpp index a37ef14c796..6125747d355 100644 --- a/src/bindings/interface/Scripts/sc_default.cpp +++ b/src/bindings/interface/Scripts/sc_default.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sc_defines.h" diff --git a/src/bindings/interface/Scripts/sc_defines.cpp b/src/bindings/interface/Scripts/sc_defines.cpp index 0c93b89649b..787c68d246b 100644 --- a/src/bindings/interface/Scripts/sc_defines.cpp +++ b/src/bindings/interface/Scripts/sc_defines.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sc_defines.h" diff --git a/src/bindings/interface/Scripts/sc_defines.h b/src/bindings/interface/Scripts/sc_defines.h index c906726f09d..0e47bfb2e2d 100644 --- a/src/bindings/interface/Scripts/sc_defines.h +++ b/src/bindings/interface/Scripts/sc_defines.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SC_DEFINES_H diff --git a/src/bindings/interface/config.h b/src/bindings/interface/config.h index 68d428a3809..6959677178f 100644 --- a/src/bindings/interface/config.h +++ b/src/bindings/interface/config.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CONFIG_H @@ -23,9 +25,9 @@ #ifdef WIN32 //#include <windows.h> -#define MANGOS_DLL_EXPORT extern "C" __declspec(dllexport) +#define TRINITY_DLL_EXPORT extern "C" __declspec(dllexport) #elif defined( __GNUC__ ) -#define MANGOS_DLL_EXPORT extern "C" +#define TRINITY_DLL_EXPORT extern "C" #else -#define MANGOS_DLL_EXPORT extern "C" export +#define TRINITY_DLL_EXPORT extern "C" export #endif diff --git a/src/bindings/interface/system.cpp b/src/bindings/interface/system.cpp index ad5548072e6..8da34985fe4 100644 --- a/src/bindings/interface/system.cpp +++ b/src/bindings/interface/system.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef WIN32 diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 6f1b9284ca1..7e63fef6245 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -415,3 +415,4 @@ install-data-hook: done + diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index d66bd891b5e..db69ef04934 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -633,7 +633,7 @@ void LoadDatabase() // Load Script Text outstring_log("TSCR: Loading Script Texts..."); - LoadMangosStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,(TEXT_SOURCE_RANGE*2)+1); + LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,(TEXT_SOURCE_RANGE*2)+1); // Gather Additional data from Script Texts result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM script_texts"); @@ -697,7 +697,7 @@ void LoadDatabase() // Load Custom Text outstring_log("TSCR: Loading Custom Texts..."); - LoadMangosStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,(TEXT_SOURCE_RANGE*3)+1); + LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,(TEXT_SOURCE_RANGE*3)+1); // Gather Additional data from Custom Texts result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM custom_texts"); @@ -1174,7 +1174,7 @@ struct TSpellSummary { uint8 Effects; // set of enum SelectEffect }extern *SpellSummary; -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT void ScriptsFree() { // Free Spell Summary @@ -1187,7 +1187,7 @@ void ScriptsFree() nrscripts = 0; } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT void ScriptsInit() { bool CanLoadDB = true; @@ -1931,7 +1931,7 @@ Script* GetScriptByName(std::string Name) //******************************** //*** Functions to be Exported *** -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GossipHello ( Player * player, Creature *_Creature ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -1941,7 +1941,7 @@ bool GossipHello ( Player * player, Creature *_Creature ) return tmpscript->pGossipHello(player,_Creature); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GossipSelect( Player *player, Creature *_Creature, uint32 sender, uint32 action ) { debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); @@ -1953,7 +1953,7 @@ bool GossipSelect( Player *player, Creature *_Creature, uint32 sender, uint32 ac return tmpscript->pGossipSelect(player,_Creature,sender,action); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ) { debug_log("TSCR: Gossip selection with code, sender: %d, action: %d",sender, action); @@ -1965,7 +1965,7 @@ bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, u return tmpscript->pGossipSelectWithCode(player,_Creature,sender,action,sCode); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool QuestAccept( Player *player, Creature *_Creature, Quest const *_Quest ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -1975,7 +1975,7 @@ bool QuestAccept( Player *player, Creature *_Creature, Quest const *_Quest ) return tmpscript->pQuestAccept(player,_Creature,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool QuestSelect( Player *player, Creature *_Creature, Quest const *_Quest ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -1985,7 +1985,7 @@ bool QuestSelect( Player *player, Creature *_Creature, Quest const *_Quest ) return tmpscript->pQuestSelect(player,_Creature,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool QuestComplete( Player *player, Creature *_Creature, Quest const *_Quest ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -1995,7 +1995,7 @@ bool QuestComplete( Player *player, Creature *_Creature, Quest const *_Quest ) return tmpscript->pQuestComplete(player,_Creature,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ChooseReward( Player *player, Creature *_Creature, Quest const *_Quest, uint32 opt ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -2005,7 +2005,7 @@ bool ChooseReward( Player *player, Creature *_Creature, Quest const *_Quest, uin return tmpscript->pChooseReward(player,_Creature,_Quest,opt); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT uint32 NPCDialogStatus( Player *player, Creature *_Creature ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -2015,7 +2015,7 @@ uint32 NPCDialogStatus( Player *player, Creature *_Creature ) return tmpscript->pNPCDialogStatus(player,_Creature); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT uint32 GODialogStatus( Player *player, GameObject *_GO ) { Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); @@ -2025,7 +2025,7 @@ uint32 GODialogStatus( Player *player, GameObject *_GO ) return tmpscript->pGODialogStatus(player,_GO); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ItemHello( Player *player, Item *_Item, Quest const *_Quest ) { Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); @@ -2035,7 +2035,7 @@ bool ItemHello( Player *player, Item *_Item, Quest const *_Quest ) return tmpscript->pItemHello(player,_Item,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ItemQuestAccept( Player *player, Item *_Item, Quest const *_Quest ) { Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); @@ -2045,7 +2045,7 @@ bool ItemQuestAccept( Player *player, Item *_Item, Quest const *_Quest ) return tmpscript->pItemQuestAccept(player,_Item,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GOHello( Player *player, GameObject *_GO ) { Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); @@ -2055,7 +2055,7 @@ bool GOHello( Player *player, GameObject *_GO ) return tmpscript->pGOHello(player,_GO); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GOQuestAccept( Player *player, GameObject *_GO, Quest const *_Quest ) { Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); @@ -2065,7 +2065,7 @@ bool GOQuestAccept( Player *player, GameObject *_GO, Quest const *_Quest ) return tmpscript->pGOQuestAccept(player,_GO,_Quest); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool GOChooseReward( Player *player, GameObject *_GO, Quest const *_Quest, uint32 opt ) { Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); @@ -2075,7 +2075,7 @@ bool GOChooseReward( Player *player, GameObject *_GO, Quest const *_Quest, uint3 return tmpscript->pGOChooseReward(player,_GO,_Quest,opt); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool AreaTrigger( Player *player, AreaTriggerEntry * atEntry) { Script *tmpscript = NULL; @@ -2086,7 +2086,7 @@ bool AreaTrigger( Player *player, AreaTriggerEntry * atEntry) return tmpscript->pAreaTrigger(player, atEntry); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT CreatureAI* GetAI(Creature *_Creature) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -2095,7 +2095,7 @@ CreatureAI* GetAI(Creature *_Creature) return tmpscript->GetAI(_Creature); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) { Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); @@ -2104,7 +2104,7 @@ bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) return tmpscript->pItemUse(player,_Item,targets); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote ) { Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); @@ -2113,7 +2113,7 @@ bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote ) return tmpscript->pReceiveEmote(player, _Creature, emote); } -MANGOS_DLL_EXPORT +TRINITY_DLL_EXPORT InstanceData* CreateInstanceData(Map *map) { Script *tmpscript = NULL; diff --git a/src/bindings/scripts/ScriptMgr.h b/src/bindings/scripts/ScriptMgr.h index 5709a9e496b..1d275535081 100644 --- a/src/bindings/scripts/ScriptMgr.h +++ b/src/bindings/scripts/ScriptMgr.h @@ -1,4 +1,7 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ @@ -78,11 +81,11 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); #endif #ifdef WIN32 - #define MANGOS_DLL_EXPORT extern "C" __declspec(dllexport) + #define TRINITY_DLL_EXPORT extern "C" __declspec(dllexport) #elif defined( __GNUC__ ) - #define MANGOS_DLL_EXPORT extern "C" + #define TRINITY_DLL_EXPORT extern "C" #else - #define MANGOS_DLL_EXPORT extern "C" export + #define TRINITY_DLL_EXPORT extern "C" export #endif #endif diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 80271821ade..b18d018c5a9 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -1,4 +1,7 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ @@ -506,21 +509,21 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float x, float y, float z, float Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) { - CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Unit* pUnit = NULL; - MaNGOS::MostHPMissingInRange u_check(m_creature, range, MinHPDiff); - MaNGOS::UnitLastSearcher<MaNGOS::MostHPMissingInRange> searcher(pUnit, u_check); + Trinity::MostHPMissingInRange u_check(m_creature, range, MinHPDiff); + Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(pUnit, u_check); /* typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes; This means that if we only search grid then we cannot possibly return pets or players so this is safe */ - TypeContainerVisitor<MaNGOS::UnitLastSearcher<MaNGOS::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap())); @@ -529,17 +532,17 @@ Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range) { - CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> pList; - MaNGOS::FriendlyCCedInRange u_check(m_creature, range); - MaNGOS::CreatureListSearcher<MaNGOS::FriendlyCCedInRange> searcher(pList, u_check); + Trinity::FriendlyCCedInRange u_check(m_creature, range); + Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(pList, u_check); - TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap())); @@ -549,17 +552,17 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range) std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellid) { - CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); std::list<Creature*> pList; - MaNGOS::FriendlyMissingBuffInRange u_check(m_creature, range, spellid); - MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRange> searcher(pList, u_check); + Trinity::FriendlyMissingBuffInRange u_check(m_creature, range, spellid); + Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(pList, u_check); - TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap())); diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index 949689bffc7..802c118c1d5 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -1,4 +1,7 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ @@ -8,7 +11,7 @@ #include "CreatureAI.h" #include "Creature.h" -struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI +struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false) {} ~ScriptedAI() {} @@ -26,7 +29,7 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI //Called at stoping attack by any attacker void EnterEvadeMode(); - //Called at any heal cast/item used (call non implemented in mangos) + //Called at any heal cast/item used (call non implemented in Trinity) void HealBy(Unit *healer, uint32 amount_healed) {} // Called at any Damage to any victim (before damage apply) @@ -153,7 +156,7 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered = false); }; -struct MANGOS_DLL_DECL Scripted_NoMovementAI : public ScriptedAI +struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI { Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {} diff --git a/src/bindings/scripts/include/sc_gossip.h b/src/bindings/scripts/include/sc_gossip.h index 9857661ae9a..ec4ba0ae3f9 100644 --- a/src/bindings/scripts/include/sc_gossip.h +++ b/src/bindings/scripts/include/sc_gossip.h @@ -1,4 +1,7 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ diff --git a/src/bindings/scripts/include/sc_instance.h b/src/bindings/scripts/include/sc_instance.h index f16590f2a83..8de13c10f72 100644 --- a/src/bindings/scripts/include/sc_instance.h +++ b/src/bindings/scripts/include/sc_instance.h @@ -22,7 +22,7 @@ enum EncounterState #define OUT_LOAD_INST_DATA_COMPLETE debug_log("SD2: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA_FAIL error_log("SD2: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -class MANGOS_DLL_DECL ScriptedInstance : public InstanceData +class TRINITY_DLL_DECL ScriptedInstance : public InstanceData { public: diff --git a/src/bindings/scripts/sql/Makefile.am b/src/bindings/scripts/sql/Makefile.am index e4b461b8d80..5240206df69 100644 --- a/src/bindings/scripts/sql/Makefile.am +++ b/src/bindings/scripts/sql/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/bindings/scripts/sql/Makefile.in b/src/bindings/scripts/sql/Makefile.in index ff75548d53f..34863ce031f 100644 --- a/src/bindings/scripts/sql/Makefile.in +++ b/src/bindings/scripts/sql/Makefile.in @@ -20,7 +20,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/bindings/scripts/system.cpp b/src/bindings/scripts/system.cpp index 5133963daa3..a4f9619c676 100644 --- a/src/bindings/scripts/system.cpp +++ b/src/bindings/scripts/system.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "precompiled.h" diff --git a/src/framework/Dynamic/FactoryHolder.h b/src/framework/Dynamic/FactoryHolder.h index 7041c4ecbfa..d5268d310b7 100644 --- a/src/framework/Dynamic/FactoryHolder.h +++ b/src/framework/Dynamic/FactoryHolder.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_FACTORY_HOLDER -#define MANGOS_FACTORY_HOLDER +#ifndef TRINITY_FACTORY_HOLDER +#define TRINITY_FACTORY_HOLDER #include "Platform/Define.h" #include "Utilities/TypeList.h" @@ -27,11 +29,11 @@ /** FactoryHolder holds a factory object of a specific type */ template<class T, class Key = std::string> -class MANGOS_DLL_DECL FactoryHolder +class TRINITY_DLL_DECL FactoryHolder { public: typedef ObjectRegistry<FactoryHolder<T, Key >, Key > FactoryHolderRegistry; - typedef MaNGOS::Singleton<FactoryHolderRegistry > FactoryHolderRepository; + typedef Trinity::Singleton<FactoryHolderRegistry > FactoryHolderRepository; FactoryHolder(Key k) : i_key(k) {} virtual ~FactoryHolder() {} diff --git a/src/framework/Dynamic/ObjectRegistry.h b/src/framework/Dynamic/ObjectRegistry.h index e0d885d2b9b..4f4d7dd9c8b 100644 --- a/src/framework/Dynamic/ObjectRegistry.h +++ b/src/framework/Dynamic/ObjectRegistry.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_OBJECTREGISTRY_H -#define MANGOS_OBJECTREGISTRY_H +#ifndef TRINITY_OBJECTREGISTRY_H +#define TRINITY_OBJECTREGISTRY_H #include "Platform/Define.h" #include "Utilities/HashMap.h" @@ -29,7 +31,7 @@ /** ObjectRegistry holds all registry item of the same type */ template<class T, class Key = std::string> -class MANGOS_DLL_DECL ObjectRegistry +class TRINITY_DLL_DECL ObjectRegistry { public: typedef std::map<Key, T *> RegistryMapType; @@ -93,7 +95,7 @@ class MANGOS_DLL_DECL ObjectRegistry private: RegistryMapType i_registeredObjects; - friend class MaNGOS::OperatorNew<ObjectRegistry<T, Key> >; + friend class Trinity::OperatorNew<ObjectRegistry<T, Key> >; // protected for friend use since it should be a singleton ObjectRegistry() {} diff --git a/src/framework/GameSystem/Grid.h b/src/framework/GameSystem/Grid.h index f4a274a51a6..cfa57116c16 100644 --- a/src/framework/GameSystem/Grid.h +++ b/src/framework/GameSystem/Grid.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GRID_H -#define MANGOS_GRID_H +#ifndef TRINITY_GRID_H +#define TRINITY_GRID_H /* @class Grid - Grid is a logical segment of the game world represented inside MaNGOS. + Grid is a logical segment of the game world represented inside TrinIty. Grid is bind at compile time to a particular type of object which we call it the object of interested. There are many types of loader, specially, dynamic loader, static loader, or on-demand loader. There's @@ -43,9 +45,9 @@ template class ACTIVE_OBJECT, class WORLD_OBJECT_TYPES, class GRID_OBJECT_TYPES, -class ThreadModel = MaNGOS::SingleThreaded<ACTIVE_OBJECT> +class ThreadModel = Trinity::SingleThreaded<ACTIVE_OBJECT> > -class MANGOS_DLL_DECL Grid +class TRINITY_DLL_DECL Grid { // allows the GridLoader to access its internals template<class A, class T, class O> friend class GridLoader; diff --git a/src/framework/GameSystem/GridLoader.h b/src/framework/GameSystem/GridLoader.h index 07982a613f5..d73f417278a 100644 --- a/src/framework/GameSystem/GridLoader.h +++ b/src/framework/GameSystem/GridLoader.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GRIDLOADER_H -#define MANGOS_GRIDLOADER_H +#ifndef TRINITY_GRIDLOADER_H +#define TRINITY_GRIDLOADER_H /** @class GridLoader @@ -40,7 +42,7 @@ class ACTIVE_OBJECT, class WORLD_OBJECT_TYPES, class GRID_OBJECT_TYPES > -class MANGOS_DLL_DECL GridLoader +class TRINITY_DLL_DECL GridLoader { public: diff --git a/src/framework/GameSystem/GridRefManager.h b/src/framework/GameSystem/GridRefManager.h index fb402a1c6d3..6e7d0262880 100644 --- a/src/framework/GameSystem/GridRefManager.h +++ b/src/framework/GameSystem/GridRefManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GRIDREFMANAGER diff --git a/src/framework/GameSystem/GridReference.h b/src/framework/GameSystem/GridReference.h index 92d30e54ae1..6cdffdcb3d2 100644 --- a/src/framework/GameSystem/GridReference.h +++ b/src/framework/GameSystem/GridReference.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GRIDREFERENCE_H @@ -25,7 +27,7 @@ template<class OBJECT> class GridRefManager; template<class OBJECT> -class MANGOS_DLL_SPEC GridReference : public Reference<GridRefManager<OBJECT>, OBJECT> +class TRINITY_DLL_SPEC GridReference : public Reference<GridRefManager<OBJECT>, OBJECT> { protected: void targetObjectBuildLink() diff --git a/src/framework/GameSystem/NGrid.h b/src/framework/GameSystem/NGrid.h index 941a90282e2..571a218416d 100644 --- a/src/framework/GameSystem/NGrid.h +++ b/src/framework/GameSystem/NGrid.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_NGRID_H -#define MANGOS_NGRID_H +#ifndef TRINITY_NGRID_H +#define TRINITY_NGRID_H /** NGrid is nothing more than a wrapper of the Grid with an NxN cells */ @@ -58,9 +60,9 @@ unsigned int N, class ACTIVE_OBJECT, class WORLD_OBJECT_TYPES, class GRID_OBJECT_TYPES, -class ThreadModel = MaNGOS::SingleThreaded<ACTIVE_OBJECT> +class ThreadModel = Trinity::SingleThreaded<ACTIVE_OBJECT> > -class MANGOS_DLL_DECL NGrid +class TRINITY_DLL_DECL NGrid { public: diff --git a/src/framework/GameSystem/TypeContainer.h b/src/framework/GameSystem/TypeContainer.h index c07d8229a99..0622927dfa5 100644 --- a/src/framework/GameSystem/TypeContainer.h +++ b/src/framework/GameSystem/TypeContainer.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TYPECONTAINER_H -#define MANGOS_TYPECONTAINER_H +#ifndef TRINITY_TYPECONTAINER_H +#define TRINITY_TYPECONTAINER_H /* * Here, you'll find a series of containers that allow you to hold multiple @@ -95,27 +97,27 @@ template<class H, class T> struct ContainerList<TypeList<H, T> > */ template<class OBJECT_TYPES> -class MANGOS_DLL_DECL TypeMapContainer +class TRINITY_DLL_DECL TypeMapContainer { public: - template<class SPECIFIC_TYPE> size_t Count() const { return MaNGOS::Count(i_elements, (SPECIFIC_TYPE*)NULL); } + template<class SPECIFIC_TYPE> size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); } - template<class SPECIFIC_TYPE> SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) { return MaNGOS::Find(i_elements, hdl,fake); } + template<class SPECIFIC_TYPE> SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) { return Trinity::Find(i_elements, hdl,fake); } /// find a specific type of object in the container - template<class SPECIFIC_TYPE> const SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) const { return MaNGOS::Find(i_elements, hdl,fake); } + template<class SPECIFIC_TYPE> const SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) const { return Trinity::Find(i_elements, hdl,fake); } /// inserts a specific object into the container template<class SPECIFIC_TYPE> bool insert(OBJECT_HANDLE hdl, SPECIFIC_TYPE *obj) { - SPECIFIC_TYPE* t = MaNGOS::Insert(i_elements, obj, hdl); + SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj, hdl); return (t != NULL); } /// Removes the object from the container, and returns the removed object template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj, OBJECT_HANDLE hdl) { - SPECIFIC_TYPE* t = MaNGOS::Remove(i_elements, obj, hdl); + SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj, hdl); return (t != NULL); } diff --git a/src/framework/GameSystem/TypeContainerFunctions.h b/src/framework/GameSystem/TypeContainerFunctions.h index 81a6a5f876b..033b7ff1561 100644 --- a/src/framework/GameSystem/TypeContainerFunctions.h +++ b/src/framework/GameSystem/TypeContainerFunctions.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TYPECONTAINER_FUNCTIONS_H @@ -29,7 +31,7 @@ #include "Utilities/TypeList.h" #include <map> -namespace MaNGOS +namespace Trinity { /* ContainerMapList Helpers */ // count functions diff --git a/src/framework/GameSystem/TypeContainerFunctionsPtr.h b/src/framework/GameSystem/TypeContainerFunctionsPtr.h index 37ede0f6411..45b19f93969 100644 --- a/src/framework/GameSystem/TypeContainerFunctionsPtr.h +++ b/src/framework/GameSystem/TypeContainerFunctionsPtr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TYPECONTAINER_FUNCTIONS_PTR_H @@ -29,7 +31,7 @@ #include "Utilities/TypeList.h" #include <map> -namespace MaNGOS +namespace Trinity { /* ContainerMapList Helpers */ // count functions diff --git a/src/framework/GameSystem/TypeContainerVisitor.h b/src/framework/GameSystem/TypeContainerVisitor.h index 8920b6d14d9..f43604a058f 100644 --- a/src/framework/GameSystem/TypeContainerVisitor.h +++ b/src/framework/GameSystem/TypeContainerVisitor.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TYPECONTAINERVISITOR_H -#define MANGOS_TYPECONTAINERVISITOR_H +#ifndef TRINITY_TYPECONTAINERVISITOR_H +#define TRINITY_TYPECONTAINERVISITOR_H /* * @class TypeContainerVisitor is implemented as a visitor pattern. It is @@ -95,7 +97,7 @@ template<class VISITOR, class OBJECT_TYPES> void VisitorHelper(VISITOR &v, TypeM } template<class VISITOR, class TYPE_CONTAINER> -class MANGOS_DLL_DECL TypeContainerVisitor +class TRINITY_DLL_DECL TypeContainerVisitor { public: TypeContainerVisitor(VISITOR &v) : i_visitor(v) {} diff --git a/src/framework/Makefile.am b/src/framework/Makefile.am index f09790ab68a..b88de200305 100644 --- a/src/framework/Makefile.am +++ b/src/framework/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -64,3 +64,4 @@ EXTRA_DIST = \ Utilities/LinkedList.h \ Utilities/TypeList.h + diff --git a/src/framework/Network/SocketDefines.h b/src/framework/Network/SocketDefines.h index 5b03758815b..34611d8d57f 100644 --- a/src/framework/Network/SocketDefines.h +++ b/src/framework/Network/SocketDefines.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SOCKETDEFINES_H -#define MANGOS_SOCKETDEFINES_H +#ifndef TRINITY_SOCKETDEFINES_H +#define TRINITY_SOCKETDEFINES_H #ifdef WIN32 diff --git a/src/framework/Platform/CompilerDefs.h b/src/framework/Platform/CompilerDefs.h index c0f659d55c4..6467dc4a1e7 100644 --- a/src/framework/Platform/CompilerDefs.h +++ b/src/framework/Platform/CompilerDefs.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_COMPILERDEFS_H -#define MANGOS_COMPILERDEFS_H +#ifndef TRINITY_COMPILERDEFS_H +#define TRINITY_COMPILERDEFS_H #define PLATFORM_WINDOWS 0 #define PLATFORM_UNIX 1 diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h index 268cc4aab1b..1c17618fdd0 100644 --- a/src/framework/Platform/Define.h +++ b/src/framework/Platform/Define.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_DEFINE_H -#define MANGOS_DEFINE_H +#ifndef TRINITY_DEFINE_H +#define TRINITY_DEFINE_H #include "Platform/CompilerDefs.h" #include <sys/types.h> @@ -87,102 +89,102 @@ It may well fail, in which case the definitions will need to be set by editing at the points marked **** EDIT HERE IF NECESSARY **** below. */ -#define MANGOS_LITTLEENDIAN 0 -#define MANGOS_BIGENDIAN 1 +#define TRINITY_LITTLEENDIAN 0 +#define TRINITY_BIGENDIAN 1 -#if !defined(MANGOS_ENDIAN) +#if !defined(TRINITY_ENDIAN) # if defined(LITTLE_ENDIAN) || defined(BIG_ENDIAN) # if defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) # if defined(BYTE_ORDER) # if (BYTE_ORDER == LITTLE_ENDIAN) -# define MANGOS_ENDIAN MANGOS_LITTLEENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # elif (BYTE_ORDER == BIG_ENDIAN) -# define MANGOS_ENDIAN MANGOS_BIGENDIAN +# define TRINITY_ENDIAN TRINITY_BIGENDIAN # endif # endif # elif defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) -# define MANGOS_ENDIAN MANGOS_LITTLEENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # elif !defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) -# define MANGOS_ENDIAN MANGOS_BIGENDIAN +# define TRINITY_ENDIAN TRINITY_BIGENDIAN # endif # elif defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN) # if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) # if defined(_BYTE_ORDER) # if (_BYTE_ORDER == _LITTLE_ENDIAN) -# define MANGOS_ENDIAN MANGOS_LITTLEENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # elif (_BYTE_ORDER == _BIG_ENDIAN) -# define MANGOS_ENDIAN MANGOS_BIGENDIAN +# define TRINITY_ENDIAN TRINITY_BIGENDIAN # endif # endif # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -# define MANGOS_ENDIAN MANGOS_LITTLE_ENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLE_ENDIAN # elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) -# define MANGOS_ENDIAN MANGOS_BIGENDIAN +# define TRINITY_ENDIAN TRINITY_BIGENDIAN # endif # elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define MANGOS_ENDIAN MANGOS_LITTLEENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # elif 0 /* **** EDIT HERE IF NECESSARY **** */ -# define MANGOS_ENDIAN MANGOS_BIGENDIAN +# define TRINITY_ENDIAN TRINITY_BIGENDIAN # elif (('1234' >> 24) == '1') -# define MANGOS_ENDIAN MANGOS_LITTLEENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # elif (('4321' >> 24) == '1') -# define MANGOS_ENDIAN MANGOS_BIGENDIAN +# define TRINITY_ENDIAN TRINITY_BIGENDIAN # else -# define MANGOS_ENDIAN MANGOS_LITTLEENDIAN +# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN # endif #endif /* End of Endian detection code from sha2.c: */ #if PLATFORM == PLATFORM_WINDOWS -#define MANGOS_EXPORT __declspec(dllexport) -#define MANGOS_LIBRARY_HANDLE HMODULE -#define MANGOS_LOAD_LIBRARY(a) LoadLibrary(a) -#define MANGOS_CLOSE_LIBRARY FreeLibrary -#define MANGOS_GET_PROC_ADDR GetProcAddress -#define MANGOS_IMPORT __cdecl -#define MANGOS_SCRIPT_EXT ".dll" -#define MANGOS_SCRIPT_NAME "TrinityScript" +#define TRINITY_EXPORT __declspec(dllexport) +#define TRINITY_LIBRARY_HANDLE HMODULE +#define TRINITY_LOAD_LIBRARY(a) LoadLibrary(a) +#define TRINITY_CLOSE_LIBRARY FreeLibrary +#define TRINITY_GET_PROC_ADDR GetProcAddress +#define TRINITY_IMPORT __cdecl +#define TRINITY_SCRIPT_EXT ".dll" +#define TRINITY_SCRIPT_NAME "TrinityScript" #else -#define MANGOS_LIBRARY_HANDLE void* -#define MANGOS_EXPORT export -#define MANGOS_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW) -#define MANGOS_CLOSE_LIBRARY dlclose -#define MANGOS_GET_PROC_ADDR dlsym +#define TRINITY_LIBRARY_HANDLE void* +#define TRINITY_EXPORT export +#define TRINITY_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW) +#define TRINITY_CLOSE_LIBRARY dlclose +#define TRINITY_GET_PROC_ADDR dlsym #if defined(__APPLE_CC__) && defined(BIG_ENDIAN) -#define MANGOS_IMPORT __attribute__ ((longcall)) +#define TRINITY_IMPORT __attribute__ ((longcall)) #else -#define MANGOS_IMPORT __attribute__ ((cdecl)) +#define TRINITY_IMPORT __attribute__ ((cdecl)) #endif -#define MANGOS_SCRIPT_EXT ".so" -#define MANGOS_SCRIPT_NAME "libtrinityscript" +#define TRINITY_SCRIPT_EXT ".so" +#define TRINITY_SCRIPT_NAME "libtrinityscript" #endif #ifdef WIN32 -#ifdef MANGOS_WIN32_DLL_IMPORT +#ifdef TRINITY_WIN32_DLL_IMPORT -#define MANGOS_DLL_DECL __declspec(dllimport) +#define TRINITY_DLL_DECL __declspec(dllimport) #else -#ifdef MANGOS_WIND_DLL_EXPORT -#define MANGOS_DLL_DECL __declspec(dllexport) +#ifdef TRINITY_WIND_DLL_EXPORT +#define TRINITY_DLL_DECL __declspec(dllexport) #else -#define MANGOS_DLL_DECL +#define TRINITY_DLL_DECL #endif #endif #else -#define MANGOS_DLL_DECL +#define TRINITY_DLL_DECL #endif #ifndef DEBUG -#define MANGOS_INLINE inline +#define TRINITY_INLINE inline #else -#ifndef MANGOS_DEBUG -#define MANGOS_DEBUG +#ifndef TRINITY_DEBUG +#define TRINITY_DEBUG #endif -#define MANGOS_INLINE +#define TRINITY_INLINE #endif #if COMPILER == COMPILER_MICROSOFT @@ -209,12 +211,12 @@ typedef uint32 DWORD; typedef uint64 OBJECT_HANDLE; #if PLATFORM == PLATFORM_WINDOWS -# define MANGOS_DLL_SPEC __declspec(dllexport) +# define TRINITY_DLL_SPEC __declspec(dllexport) # ifndef DECLSPEC_NORETURN # define DECLSPEC_NORETURN __declspec(noreturn) # endif #else -# define MANGOS_DLL_SPEC +# define TRINITY_DLL_SPEC # define DECLSPEC_NORETURN #endif diff --git a/src/framework/Policies/CreationPolicy.h b/src/framework/Policies/CreationPolicy.h index 20419982965..fbf606dc28b 100644 --- a/src/framework/Policies/CreationPolicy.h +++ b/src/framework/Policies/CreationPolicy.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,27 +10,27 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CREATIONPOLICY_H -#define MANGOS_CREATIONPOLICY_H +#ifndef TRINITY_CREATIONPOLICY_H +#define TRINITY_CREATIONPOLICY_H #include <stdlib.h> #include "Platform/Define.h" -namespace MaNGOS +namespace Trinity { /** * OperatorNew policy creates an object on the heap using new. */ template <class T> - class MANGOS_DLL_DECL OperatorNew + class TRINITY_DLL_DECL OperatorNew { public: static T* Create(void) { return (new T); } @@ -40,7 +42,7 @@ namespace MaNGOS * the first time call Create. */ template <class T> - class MANGOS_DLL_DECL LocalStaticCreation + class TRINITY_DLL_DECL LocalStaticCreation { union MaxAlign { @@ -69,7 +71,7 @@ namespace MaNGOS * CreateUsingMalloc by pass the memory manger. */ template<class T> - class MANGOS_DLL_DECL CreateUsingMalloc + class TRINITY_DLL_DECL CreateUsingMalloc { public: static T* Create() @@ -90,7 +92,7 @@ namespace MaNGOS * CreateOnCallBack creates the object base on the call back. */ template<class T, class CALL_BACK> - class MANGOS_DLL_DECL CreateOnCallBack + class TRINITY_DLL_DECL CreateOnCallBack { public: static T* Create() diff --git a/src/framework/Policies/ObjectLifeTime.cpp b/src/framework/Policies/ObjectLifeTime.cpp index af40edc1274..0f2de5a752b 100644 --- a/src/framework/Policies/ObjectLifeTime.cpp +++ b/src/framework/Policies/ObjectLifeTime.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,25 +10,25 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <cstdlib> #include "ObjectLifeTime.h" -namespace MaNGOS +namespace Trinity { extern "C" void external_wrapper(void *p) { std::atexit( (void (*)())p ); } - void MANGOS_DLL_SPEC at_exit( void (*func)() ) + void TRINITY_DLL_SPEC at_exit( void (*func)() ) { external_wrapper((void*)func); } diff --git a/src/framework/Policies/ObjectLifeTime.h b/src/framework/Policies/ObjectLifeTime.h index c47daaca339..bfdda4491f3 100644 --- a/src/framework/Policies/ObjectLifeTime.h +++ b/src/framework/Policies/ObjectLifeTime.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,28 +10,28 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_OBJECTLIFETIME_H -#define MANGOS_OBJECTLIFETIME_H +#ifndef TRINITY_OBJECTLIFETIME_H +#define TRINITY_OBJECTLIFETIME_H #include <stdexcept> #include "Platform/Define.h" typedef void (* Destroyer)(void); -namespace MaNGOS +namespace Trinity { - void MANGOS_DLL_SPEC at_exit( void (*func)() ); + void TRINITY_DLL_SPEC at_exit( void (*func)() ); template <class T> - class MANGOS_DLL_DECL ObjectLifeTime + class TRINITY_DLL_DECL ObjectLifeTime { public: inline static void ScheduleCall(void (*destroyer)() ) diff --git a/src/framework/Policies/Singleton.h b/src/framework/Policies/Singleton.h index b70c5486dff..5c78a267398 100644 --- a/src/framework/Policies/Singleton.h +++ b/src/framework/Policies/Singleton.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SINGLETON_H -#define MANGOS_SINGLETON_H +#ifndef TRINITY_SINGLETON_H +#define TRINITY_SINGLETON_H /** * @brief class Singleton @@ -27,16 +29,16 @@ #include "ThreadingModel.h" #include "ObjectLifeTime.h" -namespace MaNGOS +namespace Trinity { template < typename T, - class ThreadingModel = MaNGOS::SingleThreaded<T>, - class CreatePolicy = MaNGOS::OperatorNew<T>, - class LifeTimePolicy = MaNGOS::ObjectLifeTime<T> + class ThreadingModel = Trinity::SingleThreaded<T>, + class CreatePolicy = Trinity::OperatorNew<T>, + class LifeTimePolicy = Trinity::ObjectLifeTime<T> > - class MANGOS_DLL_DECL Singleton + class TRINITY_DLL_DECL Singleton { public: static T& Instance(); diff --git a/src/framework/Policies/SingletonImp.h b/src/framework/Policies/SingletonImp.h index ce0a4403472..6634332f052 100644 --- a/src/framework/Policies/SingletonImp.h +++ b/src/framework/Policies/SingletonImp.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SINGLETONIMPL_H -#define MANGOS_SINGLETONIMPL_H +#ifndef TRINITY_SINGLETONIMPL_H +#define TRINITY_SINGLETONIMPL_H #include "Singleton.h" @@ -32,7 +34,7 @@ class CreatePolicy, class LifeTimePolicy > T& -MaNGOS::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy >::Instance() +Trinity::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy >::Instance() { if( !si_instance ) { @@ -61,7 +63,7 @@ class CreatePolicy, class LifeTimePolicy > void -MaNGOS::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy>::DestroySingleton() +Trinity::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy>::DestroySingleton() { CreatePolicy::Destroy(si_instance); si_instance = NULL; @@ -69,22 +71,22 @@ MaNGOS::Singleton<T, ThreadingModel, CreatePolicy, LifeTimePolicy>::DestroySingl } #define INSTANTIATE_SINGLETON_1(TYPE) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, MaNGOS::SingleThreaded<TYPE>, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, MaNGOS::SingleThreaded<TYPE>, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, MaNGOS::SingleThreaded<TYPE>, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, Trinity::SingleThreaded<TYPE>, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >; \ + template<> TYPE* Trinity::Singleton<TYPE, Trinity::SingleThreaded<TYPE>, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, Trinity::SingleThreaded<TYPE>, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_destroyed = false #define INSTANTIATE_SINGLETON_2(TYPE, THREADINGMODEL) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, THREADINGMODEL, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, THREADINGMODEL, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, THREADINGMODEL, MaNGOS::OperatorNew<TYPE>, MaNGOS::ObjectLifeTime<TYPE> >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, THREADINGMODEL, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >; \ + template<> TYPE* Trinity::Singleton<TYPE, THREADINGMODEL, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, THREADINGMODEL, Trinity::OperatorNew<TYPE>, Trinity::ObjectLifeTime<TYPE> >::si_destroyed = false #define INSTANTIATE_SINGLETON_3(TYPE, THREADINGMODEL, CREATIONPOLICY ) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, MaNGOS::ObjectLifeTime<TYPE> >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, MaNGOS::ObjectLifeTime<TYPE> >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, MaNGOS::ObjectLifeType<TYPE> >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, Trinity::ObjectLifeTime<TYPE> >; \ + template<> TYPE* Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, Trinity::ObjectLifeTime<TYPE> >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, Trinity::ObjectLifeType<TYPE> >::si_destroyed = false #define INSTANTIATE_SINGLETON_4(TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME) \ - template class MANGOS_DLL_DECL MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >; \ - template<> TYPE* MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_instance = 0; \ - template<> bool MaNGOS::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_destroyed = false + template class TRINITY_DLL_DECL Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >; \ + template<> TYPE* Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_instance = 0; \ + template<> bool Trinity::Singleton<TYPE, THREADINGMODEL, CREATIONPOLICY, OBJECTLIFETIME >::si_destroyed = false #endif diff --git a/src/framework/Policies/ThreadingModel.h b/src/framework/Policies/ThreadingModel.h index 8175b3f82af..53a6939c52e 100644 --- a/src/framework/Policies/ThreadingModel.h +++ b/src/framework/Policies/ThreadingModel.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_THREADINGMODEL_H -#define MANGOS_THREADINGMODEL_H +#ifndef TRINITY_THREADINGMODEL_H +#define TRINITY_THREADINGMODEL_H /** * @class ThreadingModel<T> @@ -26,11 +28,11 @@ #include "Platform/Define.h" -namespace MaNGOS +namespace Trinity { inline void Guard(void *) {} - template<typename MUTEX> class MANGOS_DLL_DECL GeneralLock + template<typename MUTEX> class TRINITY_DLL_DECL GeneralLock { public: GeneralLock(MUTEX &m) : i_mutex(m) @@ -49,7 +51,7 @@ namespace MaNGOS }; template <class T> - class MANGOS_DLL_DECL SingleThreaded + class TRINITY_DLL_DECL SingleThreaded { public: @@ -67,7 +69,7 @@ namespace MaNGOS // object level lockable template<class T, class MUTEX> - class MANGOS_DLL_DECL ObjectLevelLockable + class TRINITY_DLL_DECL ObjectLevelLockable { public: ObjectLevelLockable() : i_mtx() {} @@ -96,7 +98,7 @@ namespace MaNGOS }; template<class T, class MUTEX> - class MANGOS_DLL_DECL ClassLevelLockable + class TRINITY_DLL_DECL ClassLevelLockable { public: class Lock; @@ -120,8 +122,8 @@ namespace MaNGOS } -template<class T, class MUTEX> MUTEX MaNGOS::ClassLevelLockable<T, MUTEX>::si_mtx; +template<class T, class MUTEX> MUTEX Trinity::ClassLevelLockable<T, MUTEX>::si_mtx; #define INSTANTIATE_CLASS_MUTEX(CTYPE,MUTEX) \ - template class MANGOS_DLL_DECL MaNGOS::ClassLevelLockable<CTYPE, MUTEX > + template class TRINITY_DLL_DECL Trinity::ClassLevelLockable<CTYPE, MUTEX > #endif diff --git a/src/framework/Utilities/ByteConverter.h b/src/framework/Utilities/ByteConverter.h index fade287ed0a..17bc7b7a586 100644 --- a/src/framework/Utilities/ByteConverter.h +++ b/src/framework/Utilities/ByteConverter.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_BYTECONVERTER_H -#define MANGOS_BYTECONVERTER_H +#ifndef TRINITY_BYTECONVERTER_H +#define TRINITY_BYTECONVERTER_H /** ByteConverter reverse your byte order. This is use for cross platform where they have different endians. @@ -44,7 +46,7 @@ namespace ByteConverter } } -#if MANGOS_ENDIAN == MANGOS_BIGENDIAN +#if TRINITY_ENDIAN == TRINITY_BIGENDIAN template<typename T> inline void EndianConvert(T& val) { ByteConverter::apply<T>(&val); } #else template<typename T> inline void EndianConvert(T&) { } diff --git a/src/framework/Utilities/Callback.h b/src/framework/Utilities/Callback.h index d794821a892..d268901d9dc 100644 --- a/src/framework/Utilities/Callback.h +++ b/src/framework/Utilities/Callback.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CALLBACK_H -#define MANGOS_CALLBACK_H +#ifndef TRINITY_CALLBACK_H +#define TRINITY_CALLBACK_H /// ------------ BASE CLASSES ------------ -namespace MaNGOS +namespace Trinity { template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void > class _Callback @@ -193,7 +195,7 @@ namespace MaNGOS /// --------- GENERIC CALLBACKS ---------- -namespace MaNGOS +namespace Trinity { class ICallback { @@ -269,7 +271,7 @@ namespace MaNGOS class QueryResult; -namespace MaNGOS +namespace Trinity { class IQueryCallback { diff --git a/src/framework/Utilities/CountedReference/Reference.h b/src/framework/Utilities/CountedReference/Reference.h index 581c6399a1b..d511a2b14ed 100644 --- a/src/framework/Utilities/CountedReference/Reference.h +++ b/src/framework/Utilities/CountedReference/Reference.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_REFERENCE_H -#define MANGOS_REFERENCE_H +#ifndef TRINITY_REFERENCE_H +#define TRINITY_REFERENCE_H /** * Referencer<T> @@ -38,9 +40,9 @@ template < typename T, -class THREADING_MODEL = MaNGOS::SingleThreaded<T> +class THREADING_MODEL = Trinity::SingleThreaded<T> > -class MANGOS_DLL_DECL Referencer +class TRINITY_DLL_DECL Referencer { typedef typename THREADING_MODEL::Lock Lock; typedef ReferenceHolder<T, THREADING_MODEL> ReferenceeHolder; diff --git a/src/framework/Utilities/CountedReference/ReferenceHolder.h b/src/framework/Utilities/CountedReference/ReferenceHolder.h index 5387b14107a..60505f058a4 100644 --- a/src/framework/Utilities/CountedReference/ReferenceHolder.h +++ b/src/framework/Utilities/CountedReference/ReferenceHolder.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_REFERENCEHOLDER_H -#define MANGOS_REFERENCEHOLDER_H +#ifndef TRINITY_REFERENCEHOLDER_H +#define TRINITY_REFERENCEHOLDER_H /** ReferenceHolder holds the actualy referenced obejct as well the refence count. The ReferenecHolder implements as a policy base object and diff --git a/src/framework/Utilities/CountedReference/ReferenceImpl.h b/src/framework/Utilities/CountedReference/ReferenceImpl.h index dffd05c52c4..096eb9cd413 100644 --- a/src/framework/Utilities/CountedReference/ReferenceImpl.h +++ b/src/framework/Utilities/CountedReference/ReferenceImpl.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_REFERENCEIMPL_H -#define MANGOS_REFERENCEIMPL_H +#ifndef TRINITY_REFERENCEIMPL_H +#define TRINITY_REFERENCEIMPL_H #include "Reference.h" diff --git a/src/framework/Utilities/EventProcessor.cpp b/src/framework/Utilities/EventProcessor.cpp index 55581ff7f8c..e1aedc68cd2 100644 --- a/src/framework/Utilities/EventProcessor.cpp +++ b/src/framework/Utilities/EventProcessor.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "EventProcessor.h" diff --git a/src/framework/Utilities/EventProcessor.h b/src/framework/Utilities/EventProcessor.h index d0a94ce08ae..c0be64857b3 100644 --- a/src/framework/Utilities/EventProcessor.h +++ b/src/framework/Utilities/EventProcessor.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __EVENTPROCESSOR_H diff --git a/src/framework/Utilities/HashMap.h b/src/framework/Utilities/HashMap.h index 2f887bd1943..dbfb9be9cd7 100644 --- a/src/framework/Utilities/HashMap.h +++ b/src/framework/Utilities/HashMap.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_HASHMAP_H -#define MANGOS_HASHMAP_H +#ifndef TRINITY_HASHMAP_H +#define TRINITY_HASHMAP_H #include "Platform/CompilerDefs.h" #include "Platform/Define.h" diff --git a/src/framework/Utilities/LinkedList.h b/src/framework/Utilities/LinkedList.h index 3686c12c34c..34816845a52 100644 --- a/src/framework/Utilities/LinkedList.h +++ b/src/framework/Utilities/LinkedList.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _LINKEDLIST diff --git a/src/framework/Utilities/LinkedReference/RefManager.h b/src/framework/Utilities/LinkedReference/RefManager.h index 4e71ec7f2ed..c04d67bc239 100644 --- a/src/framework/Utilities/LinkedReference/RefManager.h +++ b/src/framework/Utilities/LinkedReference/RefManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _REFMANAGER_H diff --git a/src/framework/Utilities/LinkedReference/Reference.h b/src/framework/Utilities/LinkedReference/Reference.h index 682bfd82162..26414020458 100644 --- a/src/framework/Utilities/LinkedReference/Reference.h +++ b/src/framework/Utilities/LinkedReference/Reference.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _REFERENCE_H diff --git a/src/framework/Utilities/TypeList.h b/src/framework/Utilities/TypeList.h index 074f5eb2483..c7c8f118214 100644 --- a/src/framework/Utilities/TypeList.h +++ b/src/framework/Utilities/TypeList.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TYPELIST_H -#define MANGOS_TYPELIST_H +#ifndef TRINITY_TYPELIST_H +#define TRINITY_TYPELIST_H /* @struct TypeList diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index 158e1b96a17..b9bd00bb2cb 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "AccountMgr.h" diff --git a/src/game/AccountMgr.h b/src/game/AccountMgr.h index ed04773a8d3..20424094367 100644 --- a/src/game/AccountMgr.h +++ b/src/game/AccountMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ACCMGR_H @@ -52,5 +54,5 @@ class AccountMgr static bool normilizeString(std::string& utf8str); }; -#define accmgr MaNGOS::Singleton<AccountMgr>::Instance() +#define accmgr Trinity::Singleton<AccountMgr>::Instance() #endif diff --git a/src/game/AddonHandler.cpp b/src/game/AddonHandler.cpp index a03ea0359ad..fb2c6e062b6 100644 --- a/src/game/AddonHandler.cpp +++ b/src/game/AddonHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "AddonHandler.h" diff --git a/src/game/AddonHandler.h b/src/game/AddonHandler.h index 2e2db5011b2..08ac41a9e97 100644 --- a/src/game/AddonHandler.h +++ b/src/game/AddonHandler.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __ADDONHANDLER_H @@ -33,5 +35,5 @@ class AddonHandler //built addon packet bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target); }; -#define sAddOnHandler MaNGOS::Singleton<AddonHandler>::Instance() +#define sAddOnHandler Trinity::Singleton<AddonHandler>::Instance() #endif diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp index 6cdbddeb3ed..e8db450136f 100644 --- a/src/game/AggressorAI.cpp +++ b/src/game/AggressorAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "AggressorAI.h" diff --git a/src/game/AggressorAI.h b/src/game/AggressorAI.h index b90b12182b2..a7954753775 100644 --- a/src/game/AggressorAI.h +++ b/src/game/AggressorAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,23 +10,23 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_AGGRESSORAI_H -#define MANGOS_AGGRESSORAI_H +#ifndef TRINITY_AGGRESSORAI_H +#define TRINITY_AGGRESSORAI_H #include "CreatureAI.h" #include "Timer.h" class Creature; -class MANGOS_DLL_DECL AggressorAI : public CreatureAI +class TRINITY_DLL_DECL AggressorAI : public CreatureAI { enum AggressorState { diff --git a/src/game/AnimalRandomMovementGenerator.h b/src/game/AnimalRandomMovementGenerator.h index a40eb65eb07..760cbed467c 100644 --- a/src/game/AnimalRandomMovementGenerator.h +++ b/src/game/AnimalRandomMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_ANIMAL_RANDOMMOVEMENTGENERATOR_H -#define MANGOS_ANIMAL_RANDOMMOVEMENTGENERATOR_H +#ifndef TRINITY_ANIMAL_RANDOMMOVEMENTGENERATOR_H +#define TRINITY_ANIMAL_RANDOMMOVEMENTGENERATOR_H /** AnimalRandomMovementGenerator follows the research on * quantifying scale-dependant effects of animal movement diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 21ed6c66b31..be91d2045ed 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "WorldPacket.h" diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index fb9b9be98e7..f4de5555bef 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_ARENATEAM_H -#define MANGOSSERVER_ARENATEAM_H +#ifndef TRINITYCORE_ARENATEAM_H +#define TRINITYCORE_ARENATEAM_H enum ArenaTeamCommandTypes { diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index 96f3a3ccee2..fc0210a8fb1 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "WorldSession.h" diff --git a/src/game/AuctionHouse.cpp b/src/game/AuctionHouse.cpp index b6eda29ac26..20ce0cf90f4 100644 --- a/src/game/AuctionHouse.cpp +++ b/src/game/AuctionHouse.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "WorldPacket.h" @@ -26,7 +28,6 @@ #include "UpdateMask.h" #include "AuctionHouseObject.h" #include "Util.h" -#include "IRCClient.h" //please DO NOT use iterator++, because it is slower than ++iterator!!! //post-incrementation is always slower than pre-incrementation ! @@ -314,9 +315,6 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) pl->SaveInventoryAndGoldToDB(); CharacterDatabase.CommitTransaction(); - if((sIRC.BOTMASK & 1024) != 0) - sIRC.AHFunc(it->GetEntry(), it->GetProto()->Name1, pl->GetName(), location); - SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK); } diff --git a/src/game/AuctionHouseObject.h b/src/game/AuctionHouseObject.h index 504c41c62e5..75c79ede76e 100644 --- a/src/game/AuctionHouseObject.h +++ b/src/game/AuctionHouseObject.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUCTION_HOUSE_H diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index a529d075dcf..ec9b12a65be 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/Bag.h b/src/game/Bag.h index cc7ca52b338..2e0b4c73384 100644 --- a/src/game/Bag.h +++ b/src/game/Bag.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_BAG_H -#define MANGOS_BAG_H +#ifndef TRINITY_BAG_H +#define TRINITY_BAG_H // Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2 #define MAX_BAG_SIZE 36 // 2.0.12 diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 72366764af7..241082b8064 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" @@ -432,9 +434,9 @@ void BattleGround::EndBattleGround(uint32 winner) if(winner == ALLIANCE) { if(isBattleGround()) - winmsg = GetMangosString(LANG_BG_A_WINS); + winmsg = GetTrinityString(LANG_BG_A_WINS); else - winmsg = GetMangosString(LANG_ARENA_GOLD_WINS); + winmsg = GetTrinityString(LANG_ARENA_GOLD_WINS); PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound @@ -443,9 +445,9 @@ void BattleGround::EndBattleGround(uint32 winner) else if(winner == HORDE) { if(isBattleGround()) - winmsg = GetMangosString(LANG_BG_H_WINS); + winmsg = GetTrinityString(LANG_BG_H_WINS); else - winmsg = GetMangosString(LANG_ARENA_GREEN_WINS); + winmsg = GetTrinityString(LANG_ARENA_GREEN_WINS); PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound @@ -678,7 +680,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count) subject = il->Name[loc_idx]; // text - std::string textFormat = plr->GetSession()->GetMangosString(LANG_BG_MARK_BY_MAIL); + std::string textFormat = plr->GetSession()->GetTrinityString(LANG_BG_MARK_BY_MAIL); char textBuf[300]; snprintf(textBuf,300,textFormat.c_str(),GetName(),GetName()); uint32 itemTextId = objmgr.CreateItemText( textBuf ); @@ -1349,7 +1351,7 @@ void BattleGround::SendMessageToAll(char const* text) void BattleGround::SendMessageToAll(int32 entry) { - char const* text = GetMangosString(entry); + char const* text = GetTrinityString(entry); WorldPacket data; ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, text, NULL); SendPacketToAll(&data); @@ -1365,10 +1367,10 @@ void BattleGround::EndNow() } // Battleground messages are localized using the dbc lang, they are not client language dependent -const char *BattleGround::GetMangosString(int32 entry) +const char *BattleGround::GetTrinityString(int32 entry) { // FIXME: now we have different DBC locales and need localized message for each target client - return objmgr.GetMangosStringForDBCLocale(entry); + return objmgr.GetTrinityStringForDBCLocale(entry); } /* diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 0b54a521320..a06042653f8 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUND_H @@ -446,7 +448,7 @@ class BattleGround void DoorOpen(uint32 type); void DoorClose(uint32 type); - const char *GetMangosString(int32 entry); + const char *GetTrinityString(int32 entry); virtual bool HandlePlayerUnderMap(Player * plr) {return false;} diff --git a/src/game/BattleGroundAA.cpp b/src/game/BattleGroundAA.cpp index 6929ef29681..d65340be14e 100644 --- a/src/game/BattleGroundAA.cpp +++ b/src/game/BattleGroundAA.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Player.h" diff --git a/src/game/BattleGroundAA.h b/src/game/BattleGroundAA.h index 3db494430ee..940cc5a9f1e 100644 --- a/src/game/BattleGroundAA.h +++ b/src/game/BattleGroundAA.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDAA_H #define __BATTLEGROUNDAA_H diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 5c065bc644c..74d97a64695 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" @@ -82,19 +84,19 @@ void BattleGroundAB::Update(time_t diff) else if( GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04) ) { m_Events |= 0x04; - SendMessageToAll(GetMangosString(LANG_BG_AB_ONEMINTOSTART)); + SendMessageToAll(GetTrinityString(LANG_BG_AB_ONEMINTOSTART)); } // After 1,5 minute, warning is signalled else if( GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08) ) { m_Events |= 0x08; - SendMessageToAll(GetMangosString(LANG_BG_AB_HALFMINTOSTART)); + SendMessageToAll(GetTrinityString(LANG_BG_AB_HALFMINTOSTART)); } // After 2 minutes, gates OPEN ! x) else if( GetStartDelayTime() < 0 && !(m_Events & 0x10) ) { m_Events |= 0x10; - SendMessageToAll(GetMangosString(LANG_BG_AB_STARTED)); + SendMessageToAll(GetTrinityString(LANG_BG_AB_STARTED)); // spawn neutral banners for (int banner = BG_AB_OBJECT_BANNER_NEUTRAL, i = 0; i < 5; banner += 8, ++i) @@ -108,13 +110,9 @@ void BattleGroundAB::Update(time_t diff) DoorOpen(BG_AB_OBJECT_GATE_A); DoorOpen(BG_AB_OBJECT_GATE_H); + PlaySoundToAll(SOUND_BG_START); if(sWorld.getConfig(CONFIG_BG_START_MUSIC)) - { - PlaySoundToAll(SOUND_BG_START); - PlaySoundToAll(SOUND_BG_START_L70ETC); //MUSIC - } - else - PlaySoundToAll(SOUND_BG_START); + PlaySoundToAll(SOUND_BG_START_L70ETC); //MUSIC SetStatus(STATUS_IN_PROGRESS); for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) @@ -162,7 +160,7 @@ void BattleGroundAB::Update(time_t diff) // Message to chatlog char buf[256]; uint8 type = (teamIndex == 0) ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE; - sprintf(buf, GetMangosString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetMangosString(LANG_BG_AB_ALLY) : GetMangosString(LANG_BG_AB_HORDE), _GetNodeName(node)); + sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE), _GetNodeName(node)); WorldPacket data; ChatHandler::FillMessageData(&data, NULL, type, LANG_UNIVERSAL, NULL, 0, buf, NULL); SendPacketToAll(&data); @@ -201,9 +199,9 @@ void BattleGroundAB::Update(time_t diff) if( !m_IsInformedNearVictory && m_TeamScores[team] > 1800 ) { if( team == BG_TEAM_ALLIANCE ) - SendMessageToAll(GetMangosString(LANG_BG_AB_A_NEAR_VICTORY)); + SendMessageToAll(GetTrinityString(LANG_BG_AB_A_NEAR_VICTORY)); else - SendMessageToAll(GetMangosString(LANG_BG_AB_H_NEAR_VICTORY)); + SendMessageToAll(GetTrinityString(LANG_BG_AB_H_NEAR_VICTORY)); PlaySoundToAll(SOUND_NEAR_VICTORY); m_IsInformedNearVictory = true; } @@ -314,15 +312,15 @@ const char* BattleGroundAB::_GetNodeName(uint8 node) switch (node) { case BG_AB_NODE_STABLES: - return GetMangosString(LANG_BG_AB_NODE_STABLES); + return GetTrinityString(LANG_BG_AB_NODE_STABLES); case BG_AB_NODE_BLACKSMITH: - return GetMangosString(LANG_BG_AB_NODE_BLACKSMITH); + return GetTrinityString(LANG_BG_AB_NODE_BLACKSMITH); case BG_AB_NODE_FARM: - return GetMangosString(LANG_BG_AB_NODE_FARM); + return GetTrinityString(LANG_BG_AB_NODE_FARM); case BG_AB_NODE_LUMBER_MILL: - return GetMangosString(LANG_BG_AB_NODE_LUMBER_MILL); + return GetTrinityString(LANG_BG_AB_NODE_LUMBER_MILL); case BG_AB_NODE_GOLD_MINE: - return GetMangosString(LANG_BG_AB_NODE_GOLD_MINE); + return GetTrinityString(LANG_BG_AB_NODE_GOLD_MINE); default: ASSERT(0); } @@ -477,7 +475,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - sprintf(buf, GetMangosString(LANG_BG_AB_NODE_CLAIMED), _GetNodeName(node), (teamIndex == 0) ? GetMangosString(LANG_BG_AB_ALLY) : GetMangosString(LANG_BG_AB_HORDE)); + sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_CLAIMED), _GetNodeName(node), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE)); sound = SOUND_NODE_CLAIMED; } // If node is contested @@ -495,7 +493,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - sprintf(buf, GetMangosString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node)); + sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node)); } // If contested, change back to occupied else @@ -510,7 +508,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE); - sprintf(buf, GetMangosString(LANG_BG_AB_NODE_DEFENDED), _GetNodeName(node)); + sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_DEFENDED), _GetNodeName(node)); } sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE; } @@ -527,7 +525,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ _SendNodeUpdate(node); _NodeDeOccupied(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - sprintf(buf, GetMangosString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node)); + sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node)); sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE; } WorldPacket data; @@ -536,7 +534,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ // If node is occupied again, send "X has taken the Y" msg. if( m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED ) { - sprintf(buf, GetMangosString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetMangosString(LANG_BG_AB_ALLY) : GetMangosString(LANG_BG_AB_HORDE), _GetNodeName(node)); + sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE), _GetNodeName(node)); ChatHandler::FillMessageData(&data, NULL, type, LANG_UNIVERSAL, NULL, 0, buf, NULL); SendPacketToAll(&data); } diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index 289d26f98fd..ba47211bc91 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDAB_H #define __BATTLEGROUNDAB_H diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 78b585be190..9a1947a7b58 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" diff --git a/src/game/BattleGroundAV.h b/src/game/BattleGroundAV.h index 441c310fda9..38b139a6255 100644 --- a/src/game/BattleGroundAV.h +++ b/src/game/BattleGroundAV.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDAV_H diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index d74a0af72e3..eec13f1aad0 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h index 0d5141a9dc0..2a2ac3ef81f 100644 --- a/src/game/BattleGroundBE.h +++ b/src/game/BattleGroundBE.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDBE_H #define __BATTLEGROUNDBE_H diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index ac27df99355..003204306f4 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" @@ -74,13 +76,13 @@ void BattleGroundEY::Update(time_t diff) else if(GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04)) { m_Events |= 0x04; - SendMessageToAll(GetMangosString(LANG_BG_EY_ONE_MINUTE)); + SendMessageToAll(GetTrinityString(LANG_BG_EY_ONE_MINUTE)); } // After 1,5 minute, warning is signalled else if(GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08)) { m_Events |= 0x08; - SendMessageToAll(GetMangosString(LANG_BG_EY_HALF_MINUTE)); + SendMessageToAll(GetTrinityString(LANG_BG_EY_HALF_MINUTE)); } // After 2 minutes, gates OPEN ! x) else if(GetStartDelayTime() < 0 && !(m_Events & 0x10)) @@ -98,15 +100,11 @@ void BattleGroundEY::Update(time_t diff) SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + buff + i * 3, RESPAWN_IMMEDIATELY); } - SendMessageToAll(GetMangosString(LANG_BG_EY_BEGIN)); + SendMessageToAll(GetTrinityString(LANG_BG_EY_BEGIN)); + PlaySoundToAll(SOUND_BG_START); if(sWorld.getConfig(CONFIG_BG_START_MUSIC)) - { - PlaySoundToAll(SOUND_BG_START); PlaySoundToAll(SOUND_BG_START_L70ETC); //MUSIC - } - else - PlaySoundToAll(SOUND_BG_START); SetStatus(STATUS_IN_PROGRESS); for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) @@ -555,7 +553,7 @@ void BattleGroundEY::RespawnFlag(bool send_message) if(send_message) { - SendMessageToAll(GetMangosString(LANG_BG_EY_RESETED_FLAG)); + SendMessageToAll(GetTrinityString(LANG_BG_EY_RESETED_FLAG)); PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound... } @@ -615,12 +613,12 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) Source->CastSpell(Source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true); if(Source->GetTeam() == ALLIANCE) { - message = GetMangosString(LANG_BG_EY_DROPPED_FLAG); + message = GetTrinityString(LANG_BG_EY_DROPPED_FLAG); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; } else { - message = GetMangosString(LANG_BG_EY_DROPPED_FLAG); + message = GetTrinityString(LANG_BG_EY_DROPPED_FLAG); type = CHAT_MSG_BG_SYSTEM_HORDE; } //this does not work correctly :( (it should remove flag carrier name) @@ -639,7 +637,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target const char *message; uint8 type = 0; - message = GetMangosString(LANG_BG_EY_HAS_TAKEN_FLAG); + message = GetTrinityString(LANG_BG_EY_HAS_TAKEN_FLAG); if(Source->GetTeam() == ALLIANCE) { @@ -686,7 +684,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point) { m_TeamPointsCount[BG_TEAM_ALLIANCE]--; message_type = CHAT_MSG_BG_SYSTEM_ALLIANCE; - message = GetMangosString(m_LoosingPointTypes[Point].MessageIdAlliance); + message = GetTrinityString(m_LoosingPointTypes[Point].MessageIdAlliance); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance, RESPAWN_ONE_DAY); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance + 1, RESPAWN_ONE_DAY); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance + 2, RESPAWN_ONE_DAY); @@ -695,7 +693,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point) { m_TeamPointsCount[BG_TEAM_HORDE]--; message_type = CHAT_MSG_BG_SYSTEM_HORDE; - message = GetMangosString(m_LoosingPointTypes[Point].MessageIdHorde); + message = GetTrinityString(m_LoosingPointTypes[Point].MessageIdHorde); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde, RESPAWN_ONE_DAY); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY); SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY); @@ -735,7 +733,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) { m_TeamPointsCount[BG_TEAM_ALLIANCE]++; type = CHAT_MSG_BG_SYSTEM_ALLIANCE; - message = GetMangosString(m_CapturingPointTypes[Point].MessageIdAlliance); + message = GetTrinityString(m_CapturingPointTypes[Point].MessageIdAlliance); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY); @@ -744,7 +742,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) { m_TeamPointsCount[BG_TEAM_HORDE]++; type = CHAT_MSG_BG_SYSTEM_HORDE; - message = GetMangosString(m_CapturingPointTypes[Point].MessageIdHorde); + message = GetTrinityString(m_CapturingPointTypes[Point].MessageIdHorde); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY); @@ -789,14 +787,14 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType { PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); team_id = BG_TEAM_ALLIANCE; - message = GetMangosString(LANG_BG_EY_CAPTURED_FLAG_A); + message = GetTrinityString(LANG_BG_EY_CAPTURED_FLAG_A); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; } else { PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); team_id = BG_TEAM_HORDE; - message = GetMangosString(LANG_BG_EY_CAPTURED_FLAG_H); + message = GetTrinityString(LANG_BG_EY_CAPTURED_FLAG_H); type = CHAT_MSG_BG_SYSTEM_HORDE; } diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 661f107682d..3566a4fe3f1 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDEY_H diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 8de2cd23426..e89e0904b1c 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -150,7 +152,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_TOO_MANY: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_TOO_LARGE), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_TOO_LARGE), NULL); SendPacket(&data); } return; @@ -158,7 +160,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_OFFLINE_MEMBER: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_OFFLINE_MEMBER), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_OFFLINE_MEMBER), NULL); SendPacket(&data); } return; @@ -166,7 +168,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_MIXED_FACTION: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MIXED_FACTION), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MIXED_FACTION), NULL); SendPacket(&data); } return; @@ -174,7 +176,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_MIXED_LEVELS: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MIXED_LEVELS), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MIXED_LEVELS), NULL); SendPacket(&data); } return; @@ -182,7 +184,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MEMBER_ALREADY_IN_QUEUE), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MEMBER_ALREADY_IN_QUEUE), NULL); SendPacket(&data); } return; @@ -190,7 +192,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_DESERTER: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MEMBER_DESERTER), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MEMBER_DESERTER), NULL); SendPacket(&data); } return; @@ -198,7 +200,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) case BG_JOIN_ERR_ALL_QUEUES_USED: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MEMBER_NO_FREE_QUEUE_SLOTS), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MEMBER_NO_FREE_QUEUE_SLOTS), NULL); SendPacket(&data); } return; @@ -774,7 +776,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_TOO_MANY: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_ARENA_GROUP_TOO_LARGE), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_ARENA_GROUP_TOO_LARGE), NULL); SendPacket(&data); } return; @@ -782,7 +784,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_NOT_ENOUGH: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_ARENA_NOT_ENOUGH_PLAYERS), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_ARENA_NOT_ENOUGH_PLAYERS), NULL); SendPacket(&data); } return; @@ -790,7 +792,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_MIXED_ARENATEAM: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_ARENA_YOUR_TEAM_ONLY), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_ARENA_YOUR_TEAM_ONLY), NULL); SendPacket(&data); } return; @@ -798,7 +800,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_OFFLINE_MEMBER: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_OFFLINE_MEMBER), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_OFFLINE_MEMBER), NULL); SendPacket(&data); } return; @@ -806,7 +808,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_MIXED_FACTION: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MIXED_FACTION), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MIXED_FACTION), NULL); SendPacket(&data); } return; @@ -814,7 +816,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_MIXED_LEVELS: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MIXED_LEVELS), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MIXED_LEVELS), NULL); SendPacket(&data); } return; @@ -822,7 +824,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MEMBER_ALREADY_IN_QUEUE), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MEMBER_ALREADY_IN_QUEUE), NULL); SendPacket(&data); } return; @@ -830,7 +832,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_GROUP_DESERTER: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MEMBER_DESERTER), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MEMBER_DESERTER), NULL); SendPacket(&data); } return; @@ -838,7 +840,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) case BG_JOIN_ERR_ALL_QUEUES_USED: { WorldPacket data; - ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetMangosString(LANG_BG_GROUP_MEMBER_NO_FREE_QUEUE_SLOTS), NULL); + ChatHandler::FillMessageData(&data, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_UNIVERSAL, NULL, 0, GetTrinityString(LANG_BG_GROUP_MEMBER_NO_FREE_QUEUE_SLOTS), NULL); SendPacket(&data); } return; diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index c21a79535a3..23f240721bb 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 166d53c074e..1f0b2affeb5 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDMGR_H @@ -246,5 +248,5 @@ class BattleGroundMgr bool m_ArenaTesting; }; -#define sBattleGroundMgr MaNGOS::Singleton<BattleGroundMgr>::Instance() +#define sBattleGroundMgr Trinity::Singleton<BattleGroundMgr>::Instance() #endif diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index 3f275bfaa74..77a0ffc227d 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h index 663453b6305..31075b987c7 100644 --- a/src/game/BattleGroundNA.h +++ b/src/game/BattleGroundNA.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDNA_H #define __BATTLEGROUNDNA_H diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index 4805296d348..49e27431e2d 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h index 75b568d7b61..0eb8cebb7cc 100644 --- a/src/game/BattleGroundRL.h +++ b/src/game/BattleGroundRL.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDRL_H #define __BATTLEGROUNDRL_H diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 6a64261b081..a07c78d0281 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Object.h" @@ -71,13 +73,13 @@ void BattleGroundWS::Update(time_t diff) else if(GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04)) { m_Events |= 0x04; - SendMessageToAll(GetMangosString(LANG_BG_WS_ONE_MINUTE)); + SendMessageToAll(GetTrinityString(LANG_BG_WS_ONE_MINUTE)); } // After 1,5 minute, warning is signalled else if(GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08)) { m_Events |= 0x08; - SendMessageToAll(GetMangosString(LANG_BG_WS_HALF_MINUTE)); + SendMessageToAll(GetTrinityString(LANG_BG_WS_HALF_MINUTE)); } // After 2 minutes, gates OPEN ! x) else if(GetStartDelayTime() < 0 && !(m_Events & 0x10)) @@ -96,15 +98,11 @@ void BattleGroundWS::Update(time_t diff) for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; i++) SpawnBGObject(i, RESPAWN_IMMEDIATELY); - SendMessageToAll(GetMangosString(LANG_BG_WS_BEGIN)); + SendMessageToAll(GetTrinityString(LANG_BG_WS_BEGIN)); + PlaySoundToAll(SOUND_BG_START); if(sWorld.getConfig(CONFIG_BG_START_MUSIC)) - { - PlaySoundToAll(SOUND_BG_START); PlaySoundToAll(SOUND_BG_START_L70ETC); //MUSIC - Custom config - } - else - PlaySoundToAll(SOUND_BG_START); SetStatus(STATUS_IN_PROGRESS); for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) @@ -184,7 +182,7 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured) //when map_update will be allowed for battlegrounds this code will be useless SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(GetMangosString(LANG_BG_WS_F_PLACED)); + SendMessageToAll(GetTrinityString(LANG_BG_WS_F_PLACED)); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound... } } @@ -198,12 +196,12 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) if(team == ALLIANCE) { SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(GetMangosString(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED)); + SendMessageToAll(GetTrinityString(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED)); } else { SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(GetMangosString(LANG_BG_WS_HORDE_FLAG_RESPAWNED)); + SendMessageToAll(GetTrinityString(LANG_BG_WS_HORDE_FLAG_RESPAWNED)); } PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); @@ -238,7 +236,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); - message = GetMangosString(LANG_BG_WS_CAPTURED_HF); + message = GetTrinityString(LANG_BG_WS_CAPTURED_HF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); @@ -255,7 +253,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); - message = GetMangosString(LANG_BG_WS_CAPTURED_AF); + message = GetTrinityString(LANG_BG_WS_CAPTURED_AF); type = CHAT_MSG_BG_SYSTEM_HORDE; if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) AddPoint(HORDE, 1); @@ -339,7 +337,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) SetHordeFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; - message = GetMangosString(LANG_BG_WS_DROPPED_HF); + message = GetTrinityString(LANG_BG_WS_DROPPED_HF); type = CHAT_MSG_BG_SYSTEM_HORDE; Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); set = true; @@ -354,7 +352,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) SetAllianceFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; - message = GetMangosString(LANG_BG_WS_DROPPED_AF); + message = GetTrinityString(LANG_BG_WS_DROPPED_AF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); set = true; @@ -391,7 +389,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE && this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { - message = GetMangosString(LANG_BG_WS_PICKEDUP_AF); + message = GetTrinityString(LANG_BG_WS_PICKEDUP_AF); type = CHAT_MSG_BG_SYSTEM_HORDE; PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); @@ -407,7 +405,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE && this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { - message = GetMangosString(LANG_BG_WS_PICKEDUP_HF); + message = GetTrinityString(LANG_BG_WS_PICKEDUP_HF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); @@ -424,7 +422,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target { if(Source->GetTeam() == ALLIANCE) { - message = GetMangosString(LANG_BG_WS_RETURNED_AF); + message = GetTrinityString(LANG_BG_WS_RETURNED_AF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN); RespawnFlag(ALLIANCE, false); @@ -434,7 +432,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } else { - message = GetMangosString(LANG_BG_WS_PICKEDUP_AF); + message = GetTrinityString(LANG_BG_WS_PICKEDUP_AF); type = CHAT_MSG_BG_SYSTEM_HORDE; PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); @@ -453,7 +451,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target { if(Source->GetTeam() == HORDE) { - message = GetMangosString(LANG_BG_WS_RETURNED_HF); + message = GetTrinityString(LANG_BG_WS_RETURNED_HF); type = CHAT_MSG_BG_SYSTEM_HORDE; UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN); RespawnFlag(HORDE, false); @@ -463,7 +461,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } else { - message = GetMangosString(LANG_BG_WS_PICKEDUP_HF); + message = GetTrinityString(LANG_BG_WS_PICKEDUP_HF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index d9f2b7f6142..3c142fe63c7 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BATTLEGROUNDWS_H diff --git a/src/game/Cell.h b/src/game/Cell.h index 873debabb14..a8c49d3fbf5 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CELL_H -#define MANGOS_CELL_H +#ifndef TRINITY_CELL_H +#define TRINITY_CELL_H #include "GameSystem/TypeContainer.h" #include "GameSystem/TypeContainerVisitor.h" @@ -42,7 +44,7 @@ enum District template<class T> struct CellLock; -struct MANGOS_DLL_DECL Cell +struct TRINITY_DLL_DECL Cell { Cell() { data.All = 0; } Cell(const Cell &cell) { data.All = cell.data.All; } @@ -143,7 +145,7 @@ struct MANGOS_DLL_DECL Cell }; template<class T> -struct MANGOS_DLL_DECL CellLock +struct TRINITY_DLL_DECL CellLock { const Cell& i_cell; const CellPair &i_cellPair; diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h index 72c41e4b3c4..efafedd1132 100644 --- a/src/game/CellImpl.h +++ b/src/game/CellImpl.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CELLIMPL_H -#define MANGOS_CELLIMPL_H +#ifndef TRINITY_CELLIMPL_H +#define TRINITY_CELLIMPL_H #include "Cell.h" #include "Map.h" diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index a6a97a61656..946ac7137c9 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,19 +10,18 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Channel.h" #include "ObjectMgr.h" #include "World.h" #include "SocialMgr.h" -#include "IRCClient.h" Channel::Channel(std::string name, uint32 channel_id) : m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0) @@ -113,8 +114,6 @@ void Channel::Join(uint64 p, const char *pass) MakeYouJoined(&data); SendToOne(&data, p); - sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_JOIN); - JoinNotify(p); } @@ -155,8 +154,6 @@ void Channel::Leave(uint64 p, bool send) LeaveNotify(p); - sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_LEAVE); - if(changeowner) { uint64 newowner = !players.empty() ? players.begin()->second.player : 0; diff --git a/src/game/Channel.h b/src/game/Channel.h index 342992411b6..da018fece3e 100644 --- a/src/game/Channel.h +++ b/src/game/Channel.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CHANNEL_H diff --git a/src/game/ChannelHandler.cpp b/src/game/ChannelHandler.cpp index 4c8bdd1c516..b77885fc5ce 100644 --- a/src/game/ChannelHandler.cpp +++ b/src/game/ChannelHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ObjectMgr.h" // for normalizePlayerName diff --git a/src/game/ChannelMgr.h b/src/game/ChannelMgr.h index eb15f08a39e..97e1dad323c 100644 --- a/src/game/ChannelMgr.h +++ b/src/game/ChannelMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_CHANNELMGR_H -#define MANGOSSERVER_CHANNELMGR_H +#ifndef TRINITYCORE_CHANNELMGR_H +#define TRINITYCORE_CHANNELMGR_H #include "Channel.h" #include "Policies/Singleton.h" @@ -90,12 +92,12 @@ inline ChannelMgr* channelMgr(uint32 team) { if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) //For Test,No Seprate Faction - return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); + return &Trinity::Singleton<AllianceChannelMgr>::Instance(); if(team==ALLIANCE) - return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); + return &Trinity::Singleton<AllianceChannelMgr>::Instance(); if(team==HORDE) - return &MaNGOS::Singleton<HordeChannelMgr>::Instance(); + return &Trinity::Singleton<HordeChannelMgr>::Instance(); return NULL; } #endif diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 1797b4cc7a1..d86bf7734a0 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -732,62 +734,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) if(sWorld.IsShutdowning()) sWorld.ShutdownMsg(true,pCurrChar); - if(sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when logging in - pCurrChar->UpdateSkillsToMaxSkillsForLevel(); - - //ImpConfig - Check if player has logged in before - QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM has_logged_in_before WHERE guid = %u",pCurrChar->GetGUIDLow()); - if(!result) - { - sLog.outBasic("Character '%s' logging in for first time, applying skills and stuff",pCurrChar->GetName()); - CharacterDatabase.PExecute("INSERT INTO has_logged_in_before VALUES (%u)",pCurrChar->GetGUIDLow()); - - //Reputations if "StartAllReputation" is enabled, -- TODO: Fix this in a better way - if(sWorld.getConfig(CONFIG_START_ALL_REP)) - { - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(942),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(935),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(936),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(1011),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(970),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(967),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(989),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(932),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(934),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(1038),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(1077),42999); - - // Factions depending on team, like cities and some more stuff - switch(pCurrChar->GetTeam()) - { - case ALLIANCE: - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(72),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(47),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(69),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(930),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(730),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(978),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(54),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(946),42999); - break; - case HORDE: - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(76),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(68),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(81),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(911),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(729),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(941),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(530),42999); - pCurrChar->SetFactionReputation(sFactionStore.LookupEntry(947),42999); - break; - } - } - } - else - sLog.outBasic("Character '%s' has logged in before",pCurrChar->GetName()); - - if(sWorld.getConfig(CONFIG_START_ALL_TAXI)) - pCurrChar->SetTaxiCheater(true); + if(sWorld.getConfig(CONFIG_START_ALL_TAXI)) + pCurrChar->SetTaxiCheater(true); if(pCurrChar->isGameMaster()) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 4f97c4c9ab3..27e692a29f7 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -108,6 +110,8 @@ ChatCommand * ChatHandler::getCommandTable() { "anim", SEC_GAMEMASTER, &ChatHandler::HandleAnimCommand, "", NULL }, { "lootrecipient", SEC_GAMEMASTER, &ChatHandler::HandleGetLootRecipient, "", NULL }, { "arena", SEC_ADMINISTRATOR, &ChatHandler::HandleDebugArenaCommand, "", NULL }, + { "threatlist", SEC_ADMINISTRATOR, &ChatHandler::HandleDebugThreatList, "", NULL }, + { "hostilrefs", SEC_ADMINISTRATOR, &ChatHandler::HandleDebugHostilRefList, "", NULL }, { NULL, 0, NULL, "", NULL } }; @@ -165,7 +169,7 @@ ChatCommand * ChatHandler::getCommandTable() { "gameobject_scripts", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL }, { "item_enchantment_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL }, { "item_loot_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL }, - { "mangos_string", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadMangosStringCommand, "", NULL }, + { "trinity_string", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL }, { "npc_gossip", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, { "npc_trainer", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL }, { "npc_vendor", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, @@ -467,7 +471,6 @@ ChatCommand * ChatHandler::getCommandTable() { "movegens", SEC_ADMINISTRATOR, &ChatHandler::HandleMovegensCommand, "", NULL }, { "cometome", SEC_ADMINISTRATOR, &ChatHandler::HandleComeToMeCommand, "", NULL }, { "damage", SEC_ADMINISTRATOR, &ChatHandler::HandleDamageCommand, "", NULL }, - { "ircpm", SEC_PLAYER, &ChatHandler::HandleIRCpmCommand, "", NULL }, { "combatstop", SEC_GAMEMASTER, &ChatHandler::HandleCombatStopCommand, "", NULL }, { "flusharenapoints", SEC_ADMINISTRATOR, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, @@ -515,9 +518,9 @@ ChatCommand * ChatHandler::getCommandTable() return commandTable; } -const char *ChatHandler::GetMangosString(int32 entry) +const char *ChatHandler::GetTrinityString(int32 entry) { - return m_session->GetMangosString(entry); + return m_session->GetTrinityString(entry); } bool ChatHandler::hasStringAbbr(const char* name, const char* part) @@ -581,12 +584,12 @@ void ChatHandler::SendGlobalSysMessage(const char *str) void ChatHandler::SendSysMessage(int32 entry) { - SendSysMessage(GetMangosString(entry)); + SendSysMessage(GetTrinityString(entry)); } void ChatHandler::PSendSysMessage(int32 entry, ...) { - const char *format = GetMangosString(entry); + const char *format = GetTrinityString(entry); va_list ap; char str [1024]; va_start(ap, entry); @@ -1028,14 +1031,14 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid if(!obj && objmgr.GetGOData(lowguid)) // guid is DB guid of object { // search near player then - CellPair p(MaNGOS::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*pl,lowguid); - MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(obj,go_check); + Trinity::GameObjectWithDbGUIDCheck go_check(*pl,lowguid); + Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(obj,go_check); - TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(pl->GetMapId(), pl)); } diff --git a/src/game/Chat.h b/src/game/Chat.h index 7e635a10d2f..369043306c2 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_CHAT_H -#define MANGOSSERVER_CHAT_H +#ifndef TRINITYCORE_CHAT_H +#define TRINITYCORE_CHAT_H #include "SharedDefines.h" @@ -59,7 +61,7 @@ class ChatHandler static char* LineFromMessage(char*& pos) { char* start = strtok(pos,"\n"); pos = NULL; return start; } - const char *GetMangosString(int32 entry); + const char *GetTrinityString(int32 entry); void SendSysMessage( const char *str); void SendSysMessage( int32 entry); @@ -109,8 +111,6 @@ class ChatHandler bool HandleGroupTeleCommand(const char* args); bool HandleDrunkCommand(const char* args); - bool HandleIRCpmCommand(const char* args); - bool HandleEventActiveListCommand(const char* args); bool HandleEventStartCommand(const char* args); bool HandleEventStopCommand(const char* args); @@ -170,7 +170,7 @@ class ChatHandler bool HandleReloadLootTemplatesReferenceCommand(const char* args); bool HandleReloadLootTemplatesQuestMailCommand(const char* args); bool HandleReloadLootTemplatesSkinningCommand(const char* args); - bool HandleReloadMangosStringCommand(const char* args); + bool HandleReloadTrinityStringCommand(const char* args); bool HandleReloadNpcGossipCommand(const char* args); bool HandleReloadNpcTrainerCommand(const char* args); bool HandleReloadNpcVendorCommand(const char* args); @@ -390,6 +390,8 @@ class ChatHandler bool HandleGetItemState(const char * args); bool HandleGetLootRecipient(const char * args); bool HandleDebugArenaCommand(const char * args); + bool HandleDebugThreatList(const char * args); + bool HandleDebugHostilRefList(const char * args); Player* getSelectedPlayer(); Creature* getSelectedCreature(); diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index 8ccf6788388..3eee53d1123 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -34,7 +36,6 @@ #include "Player.h" #include "SpellAuras.h" #include "Language.h" -#include "IRCClient.h" #include "Util.h" void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) @@ -129,7 +130,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if (!_player->CanSpeak()) { std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); - SendNotification(GetMangosString(LANG_WAIT_BEFORE_SPEAKING),timeStr.c_str()); + SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING),timeStr.c_str()); return; } @@ -428,8 +429,6 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if(msg.empty()) break; - sIRC.Send_WoW_IRC(_player, channel, msg); - if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { if(Channel *chn = cMgr->GetChannel(channel,_player)) @@ -447,7 +446,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if(!_player->isAFK()) { if(msg.empty()) - msg = GetMangosString(LANG_PLAYER_AFK_DEFAULT); + msg = GetTrinityString(LANG_PLAYER_AFK_DEFAULT); _player->afkMsg = msg; } _player->ToggleAFK(); @@ -466,7 +465,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if(!_player->isDND()) { if(msg.empty()) - msg = GetMangosString(LANG_PLAYER_DND_DEFAULT); + msg = GetTrinityString(LANG_PLAYER_DND_DEFAULT); _player->dndMsg = msg; } _player->ToggleDND(); @@ -500,7 +499,7 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data ) if (!GetPlayer()->CanSpeak()) { std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); - SendNotification(GetMangosString(LANG_WAIT_BEFORE_SPEAKING),timeStr.c_str()); + SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING),timeStr.c_str()); return; } diff --git a/src/game/CombatHandler.cpp b/src/game/CombatHandler.cpp index 047c639e44e..cd492df7e57 100644 --- a/src/game/CombatHandler.cpp +++ b/src/game/CombatHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index 7618519d5ee..01b1b90c29c 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Creature.h" @@ -49,8 +51,8 @@ ConfusedMovementGenerator<T>::Initialize(T &unit) i_waypoints[idx][1] = y + wanderY; // prevent invalid coordinates generation - MaNGOS::NormalizeMapCoord(i_waypoints[idx][0]); - MaNGOS::NormalizeMapCoord(i_waypoints[idx][1]); + Trinity::NormalizeMapCoord(i_waypoints[idx][0]); + Trinity::NormalizeMapCoord(i_waypoints[idx][1]); bool is_water = map->IsInWater(i_waypoints[idx][0],i_waypoints[idx][1],z); // if generated wrong path just ignore diff --git a/src/game/ConfusedMovementGenerator.h b/src/game/ConfusedMovementGenerator.h index 78955297395..95b45f169ad 100644 --- a/src/game/ConfusedMovementGenerator.h +++ b/src/game/ConfusedMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_RANDOMMOTIONGENERATOR_H -#define MANGOS_RANDOMMOTIONGENERATOR_H +#ifndef TRINITY_RANDOMMOTIONGENERATOR_H +#define TRINITY_RANDOMMOTIONGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" @@ -26,7 +28,7 @@ #define MAX_CONF_WAYPOINTS 24 template<class T> -class MANGOS_DLL_SPEC ConfusedMovementGenerator +class TRINITY_DLL_SPEC ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> > { public: diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 785c6b4f784..8f6e23ac55c 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -90,7 +92,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float SetFloatValue( CORPSE_FIELD_FACING, ang ); SetUInt64Value( CORPSE_FIELD_OWNER, owner->GetGUID() ); - m_grid = MaNGOS::ComputeGridPair(GetPositionX(), GetPositionY()); + m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); return true; } @@ -200,7 +202,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) return false; } - m_grid = MaNGOS::ComputeGridPair(GetPositionX(), GetPositionY()); + m_grid = Trinity::ComputeGridPair(GetPositionX(), GetPositionY()); return true; } diff --git a/src/game/Corpse.h b/src/game/Corpse.h index f99523779a7..317d9ed6bad 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_CORPSE_H -#define MANGOSSERVER_CORPSE_H +#ifndef TRINITYCORE_CORPSE_H +#define TRINITYCORE_CORPSE_H #include "Object.h" #include "Database/DatabaseEnv.h" diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 4532c4e8514..f20316bd0f3 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -42,7 +44,8 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" - +#include "OutdoorPvPMgr.h" +#include "GameEvent.h" // apply implementation of the singletons #include "Policies/SingletonImp.h" @@ -252,7 +255,10 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) else SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_A); - SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag); + if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) + SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag | gameeventmgr.GetNPCFlag(this)); + else + SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag); SetAttackTime(BASE_ATTACK, GetCreatureInfo()->baseattacktime); SetAttackTime(OFF_ATTACK, GetCreatureInfo()->baseattacktime); @@ -741,6 +747,10 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) case GOSSIP_OPTION_TABARDDESIGNER: case GOSSIP_OPTION_AUCTIONEER: break; // no checks + case GOSSIP_OPTION_OUTDOORPVP: + if ( !sOutdoorPvPMgr.CanTalkTo(pPlayer,this,(*gso)) ) + cantalking = false; + break; default: sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetGUIDLow(),GetEntry(),gso->Action); break; @@ -776,6 +786,9 @@ void Creature::sendPreparedGossip(Player* player) GossipMenu& gossipmenu = player->PlayerTalkClass->GetGossipMenu(); + if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) // if world event npc then + gameeventmgr.HandleWorldEventGossip(player, this); // update world state with progress + // in case empty gossip menu open quest menu if any if (gossipmenu.Empty() && GetNpcTextId() == 0) { @@ -817,6 +830,9 @@ void Creature::OnGossipSelect(Player* player, uint32 option) player->PlayerTalkClass->CloseGossip(); player->PlayerTalkClass->SendTalking( textid ); break; + case GOSSIP_OPTION_OUTDOORPVP: + sOutdoorPvPMgr.HandleGossipOption(player, GetGUID(), option); + break; case GOSSIP_OPTION_SPIRITHEALER: if( player->isDead() ) CastSpell(this,17251,true,NULL,NULL,player->GetGUID()); @@ -964,6 +980,11 @@ uint32 Creature::GetGossipTextId(uint32 action, uint32 zoneid) uint32 Creature::GetNpcTextId() { + // don't cache / use cache in case it's a world event announcer + if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) + if(uint32 textid = gameeventmgr.GetNpcTextId(m_DBTableGuid)) + return textid; + if (!m_DBTableGuid) return DEFAULT_GOSSIP_MESSAGE; @@ -983,6 +1004,12 @@ GossipOption const* Creature::GetGossipOption( uint32 id ) const return NULL; } +void Creature::ResetGossipOptions() +{ + m_gossipOptionLoaded = false; + m_goptions.clear(); +} + void Creature::LoadGossipOptions() { if(m_gossipOptionLoaded) @@ -1671,15 +1698,15 @@ void Creature::DoFleeToGetAssistance(float radius) // Optional parameter Creature* pCreature = NULL; - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius); - MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck> searcher(pCreature, u_check); + Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius); + Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(pCreature, u_check); - TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); + TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *(GetMap())); @@ -1710,15 +1737,15 @@ void Creature::CallAssistence() std::list<Creature*> assistList; { - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); - MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck> searcher(assistList, u_check); + Trinity::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); + Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck> searcher(assistList, u_check); - TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); diff --git a/src/game/Creature.h b/src/game/Creature.h index 372692ec24a..550d9b9fff3 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_CREATURE_H -#define MANGOSSERVER_CREATURE_H +#ifndef TRINITYCORE_CREATURE_H +#define TRINITYCORE_CREATURE_H #include "Common.h" #include "Unit.h" @@ -53,7 +55,8 @@ enum Gossip_Option GOSSIP_OPTION_STABLEPET = 14, //UNIT_NPC_FLAG_STABLE = 8192, GOSSIP_OPTION_ARMORER = 15, //UNIT_NPC_FLAG_ARMORER = 16384, GOSSIP_OPTION_UNLEARNTALENTS = 16, //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) - GOSSIP_OPTION_UNLEARNPETSKILLS = 17 //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) + GOSSIP_OPTION_UNLEARNPETSKILLS = 17, //UNIT_NPC_FLAG_TRAINER (bonus option for GOSSIP_OPTION_TRAINER) + GOSSIP_OPTION_OUTDOORPVP = 18 //added by code (option for outdoor pvp creatures) }; enum Gossip_Guard @@ -121,6 +124,7 @@ enum CreatureFlagsExtra CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP + CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging) }; // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform @@ -361,7 +365,7 @@ typedef std::map<uint32,time_t> CreatureSpellCooldowns; #define MAX_VENDOR_ITEMS 255 // Limitation in item count field size in SMSG_LIST_INVENTORY -class MANGOS_DLL_SPEC Creature : public Unit +class TRINITY_DLL_SPEC Creature : public Unit { CreatureAI *i_AI; @@ -474,6 +478,7 @@ class MANGOS_DLL_SPEC Creature : public Unit uint32 GetGossipTextId(uint32 action, uint32 zoneid); uint32 GetNpcTextId(); void LoadGossipOptions(); + void ResetGossipOptions(); GossipOption const* GetGossipOption( uint32 id ) const; void addGossipOption(GossipOption const& gso) { m_goptions.push_back(gso); } diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 06b3d447327..d9bf190bc11 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "CreatureAI.h" diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 540a2e408b7..f3dcb66c39d 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CREATUREAI_H -#define MANGOS_CREATUREAI_H +#ifndef TRINITY_CREATUREAI_H +#define TRINITY_CREATUREAI_H #include "Common.h" #include "Platform/Define.h" @@ -65,7 +67,7 @@ enum SelectAggroTarget SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top }; -class MANGOS_DLL_SPEC CreatureAI +class TRINITY_DLL_SPEC CreatureAI { public: diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h index 65ac4708238..478178641d2 100644 --- a/src/game/CreatureAIImpl.h +++ b/src/game/CreatureAIImpl.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CREATUREAIIMPL_H #define CREATUREAIIMPL_H diff --git a/src/game/CreatureAIRegistry.cpp b/src/game/CreatureAIRegistry.cpp index 3a5e3dcfc91..d7480e53f9a 100644 --- a/src/game/CreatureAIRegistry.cpp +++ b/src/game/CreatureAIRegistry.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "CreatureAIRegistry.h" @@ -23,6 +25,7 @@ #include "GuardAI.h" #include "PetAI.h" #include "TotemAI.h" +#include "OutdoorPvPObjectiveAI.h" #include "RandomMovementGenerator.h" #include "CreatureAIImpl.h" #include "MovementGeneratorImpl.h" @@ -40,6 +43,7 @@ namespace AIRegistry (new CreatureAIFactory<GuardAI>("GuardAI"))->RegisterSelf(); (new CreatureAIFactory<PetAI>("PetAI"))->RegisterSelf(); (new CreatureAIFactory<TotemAI>("TotemAI"))->RegisterSelf(); + (new CreatureAIFactory<OutdoorPvPObjectiveAI>("OutdoorPvPObjectiveAI"))->RegisterSelf(); (new MovementGeneratorFactory<RandomMovementGenerator<Creature> >(RANDOM_MOTION_TYPE))->RegisterSelf(); (new MovementGeneratorFactory<WaypointMovementGenerator<Creature> >(WAYPOINT_MOTION_TYPE))->RegisterSelf(); diff --git a/src/game/CreatureAIRegistry.h b/src/game/CreatureAIRegistry.h index a254b6718b2..8c864987875 100644 --- a/src/game/CreatureAIRegistry.h +++ b/src/game/CreatureAIRegistry.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CREATUREAIREGISTRY_H -#define MANGOS_CREATUREAIREGISTRY_H +#ifndef TRINITY_CREATUREAIREGISTRY_H +#define TRINITY_CREATUREAIREGISTRY_H namespace AIRegistry { diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index b59ee35c1d8..ab902b2f2fe 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Creature.h" diff --git a/src/game/CreatureAISelector.h b/src/game/CreatureAISelector.h index 328850dbc3d..ca69ee1fe29 100644 --- a/src/game/CreatureAISelector.h +++ b/src/game/CreatureAISelector.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_CREATUREAISELECTOR_H -#define MANGOS_CREATUREAISELECTOR_H +#ifndef TRINITY_CREATUREAISELECTOR_H +#define TRINITY_CREATUREAISELECTOR_H class CreatureAI; class Creature; diff --git a/src/game/DestinationHolder.cpp b/src/game/DestinationHolder.cpp index 2c427ad7702..1e0cb06fc4b 100644 --- a/src/game/DestinationHolder.cpp +++ b/src/game/DestinationHolder.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DestinationHolder.h" diff --git a/src/game/DestinationHolder.h b/src/game/DestinationHolder.h index 93705bb67cb..b41bcd3347d 100644 --- a/src/game/DestinationHolder.h +++ b/src/game/DestinationHolder.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_DESTINATION_HOLDER_H -#define MANGOS_DESTINATION_HOLDER_H +#ifndef TRINITY_DESTINATION_HOLDER_H +#define TRINITY_DESTINATION_HOLDER_H #include "Platform/Define.h" #include "Timer.h" @@ -27,7 +29,7 @@ class WorldObject; #define TRAVELLER_UPDATE_INTERVAL 300 template<typename TRAVELLER> -class MANGOS_DLL_DECL DestinationHolder +class TRINITY_DLL_DECL DestinationHolder { TimeTrackerSmall i_tracker; uint32 i_totalTravelTime; diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h index 8f5efa54b0c..02b2cba2b95 100644 --- a/src/game/DestinationHolderImp.h +++ b/src/game/DestinationHolderImp.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_DESTINATIONHOLDERIMP_H -#define MANGOS_DESTINATIONHOLDERIMP_H +#ifndef TRINITY_DESTINATIONHOLDERIMP_H +#define TRINITY_DESTINATIONHOLDERIMP_H #include "Creature.h" #include "MapManager.h" diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp index 1019c68d908..8f05db3619a 100644 --- a/src/game/DuelHandler.cpp +++ b/src/game/DuelHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index d01a6f84a4d..698cf3e6481 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -111,15 +113,15 @@ void DynamicObject::Update(uint32 p_time) deleteThis = true; // TODO: make a timer and update this in larger intervals - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::DynamicObjectUpdater notifier(*this,caster); + Trinity::DynamicObjectUpdater notifier(*this,caster); - TypeContainerVisitor<MaNGOS::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this)); diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h index 279a763d4ce..db37ef78b1d 100644 --- a/src/game/DynamicObject.h +++ b/src/game/DynamicObject.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_DYNAMICOBJECT_H -#define MANGOSSERVER_DYNAMICOBJECT_H +#ifndef TRINITYCORE_DYNAMICOBJECT_H +#define TRINITYCORE_DYNAMICOBJECT_H #include "Object.h" diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index 1f5d72c5ff8..a71d30078f4 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Creature.h" @@ -140,8 +142,8 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) } temp_x = x + distance * cos(angle); temp_y = y + distance * sin(angle); - MaNGOS::NormalizeMapCoord(temp_x); - MaNGOS::NormalizeMapCoord(temp_y); + Trinity::NormalizeMapCoord(temp_x); + Trinity::NormalizeMapCoord(temp_y); if( owner.IsWithinLOS(temp_x,temp_y,z)) { bool is_water_now = _map->IsInWater(x,y,z); diff --git a/src/game/FleeingMovementGenerator.h b/src/game/FleeingMovementGenerator.h index f0b48e27b23..ccff7959369 100644 --- a/src/game/FleeingMovementGenerator.h +++ b/src/game/FleeingMovementGenerator.h @@ -1,5 +1,7 @@ /* -* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> +* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> +* +* Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 +* 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 +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_FLEEINGMOVEMENTGENERATOR_H -#define MANGOS_FLEEINGMOVEMENTGENERATOR_H +#ifndef TRINITY_FLEEINGMOVEMENTGENERATOR_H +#define TRINITY_FLEEINGMOVEMENTGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" @@ -25,7 +27,7 @@ #include "MapManager.h" template<class T> -class MANGOS_DLL_SPEC FleeingMovementGenerator +class TRINITY_DLL_SPEC FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> > { public: diff --git a/src/game/FollowerRefManager.h b/src/game/FollowerRefManager.h index 460a3612ded..3bf34452043 100644 --- a/src/game/FollowerRefManager.h +++ b/src/game/FollowerRefManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FOLLOWERREFMANAGER diff --git a/src/game/FollowerReference.cpp b/src/game/FollowerReference.cpp index 2ebea8187f5..7750a2cb770 100644 --- a/src/game/FollowerReference.cpp +++ b/src/game/FollowerReference.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Unit.h" diff --git a/src/game/FollowerReference.h b/src/game/FollowerReference.h index 3a79d8cedb0..42ea1d0cd09 100644 --- a/src/game/FollowerReference.h +++ b/src/game/FollowerReference.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FOLLOWERREFERENCE_H @@ -24,7 +26,7 @@ class TargetedMovementGeneratorBase; class Unit; -class MANGOS_DLL_SPEC FollowerReference : public Reference<Unit, TargetedMovementGeneratorBase> +class TRINITY_DLL_SPEC FollowerReference : public Reference<Unit, TargetedMovementGeneratorBase> { protected: void targetObjectBuildLink(); diff --git a/src/game/Formulas.h b/src/game/Formulas.h index a7ef3200e73..d7ddebe6ada 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_FORMULAS_H -#define MANGOS_FORMULAS_H +#ifndef TRINITY_FORMULAS_H +#define TRINITY_FORMULAS_H #include "World.h" -namespace MaNGOS +namespace Trinity { namespace XP { diff --git a/src/game/GameEvent.cpp b/src/game/GameEvent.cpp index 5380acf6ace..9dd617d6462 100644 --- a/src/game/GameEvent.cpp +++ b/src/game/GameEvent.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "GameEvent.h" @@ -24,14 +26,34 @@ #include "Log.h" #include "MapManager.h" #include "Policies/SingletonImp.h" -#include "IRCClient.h" +#include "GossipDef.h" +#include "Player.h" INSTANTIATE_SINGLETON_1(GameEvent); bool GameEvent::CheckOneGameEvent(uint16 entry) const { - // Get the event information time_t currenttime = time(NULL); + // if the state is conditions or nextphase, then the event should be active + if (mGameEvent[entry].state == GAMEEVENT_WORLD_CONDITIONS || mGameEvent[entry].state == GAMEEVENT_WORLD_NEXTPHASE) + return true; + // finished world events are inactive + else if (mGameEvent[entry].state == GAMEEVENT_WORLD_FINISHED) + return false; + // if inactive world event, check the prerequisite events + else if (mGameEvent[entry].state == GAMEEVENT_WORLD_INACTIVE) + { + for(std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr) + { + if( (mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one + mGameEvent[*itr].nextstart > currenttime) // if not in nextphase state for long enough, can't start this one + return false; + } + // all prerequisite events are met + // but if there are no prerequisites, this can be only activated through gm command + return !(mGameEvent[entry].prerequisite_events.empty()); + } + // Get the event information if( mGameEvent[entry].start < currenttime && currenttime < mGameEvent[entry].end && ((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)) < (mGameEvent[entry].length * MINUTE) ) return true; @@ -43,6 +65,14 @@ uint32 GameEvent::NextCheck(uint16 entry) const { time_t currenttime = time(NULL); + // for NEXTPHASE state world events, return the delay to start the next event, so the followup event will be checked correctly + if ((mGameEvent[entry].state == GAMEEVENT_WORLD_NEXTPHASE || mGameEvent[entry].state == GAMEEVENT_WORLD_FINISHED) && mGameEvent[entry].nextstart >= currenttime) + return (mGameEvent[entry].nextstart - currenttime); + + // for CONDITIONS state world events, return the length of the wait period, so if the conditions are met, this check will be called again to set the timer as NEXTPHASE event + if (mGameEvent[entry].state == GAMEEVENT_WORLD_CONDITIONS) + return mGameEvent[entry].length ? mGameEvent[entry].length * 60 : max_ge_check_delay; + // outdated event: we return max if (currenttime > mGameEvent[entry].end) return max_ge_check_delay; @@ -65,28 +95,75 @@ uint32 GameEvent::NextCheck(uint16 entry) const return delay; } -void GameEvent::StartEvent( uint16 event_id, bool overwrite ) +bool GameEvent::StartEvent( uint16 event_id, bool overwrite ) { - AddActiveEvent(event_id); - ApplyNewEvent(event_id); - if(overwrite) + if(mGameEvent[event_id].state == GAMEEVENT_NORMAL) { - mGameEvent[event_id].start = time(NULL); - if(mGameEvent[event_id].end <= mGameEvent[event_id].start) - mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length; + AddActiveEvent(event_id); + ApplyNewEvent(event_id); + if(overwrite) + { + mGameEvent[event_id].start = time(NULL); + if(mGameEvent[event_id].end <= mGameEvent[event_id].start) + mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length; + } + return false; + } + else + { + if( mGameEvent[event_id].state == GAMEEVENT_WORLD_INACTIVE ) + // set to conditions phase + mGameEvent[event_id].state = GAMEEVENT_WORLD_CONDITIONS; + + // add to active events + AddActiveEvent(event_id); + // add spawns + ApplyNewEvent(event_id); + + // check if can go to next state + bool conditions_met = CheckOneGameEventConditions(event_id); + // save to db + SaveWorldEventStateToDB(event_id); + // force game event update to set the update timer if conditions were met from a command + // this update is needed to possibly start events dependent on the started one + // or to scedule another update where the next event will be started + if(overwrite && conditions_met) + sWorld.ForceGameEventUpdate(); + + return conditions_met; } } void GameEvent::StopEvent( uint16 event_id, bool overwrite ) { + bool serverwide_evt = mGameEvent[event_id].state != GAMEEVENT_NORMAL; + RemoveActiveEvent(event_id); UnApplyEvent(event_id); - if(overwrite) + + if(overwrite && !serverwide_evt) { mGameEvent[event_id].start = time(NULL) - mGameEvent[event_id].length * MINUTE; if(mGameEvent[event_id].end <= mGameEvent[event_id].start) mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length; } + else if(serverwide_evt) + { + // if finished world event, then only gm command can stop it + if(overwrite || mGameEvent[event_id].state != GAMEEVENT_WORLD_FINISHED) + { + // reset conditions + mGameEvent[event_id].nextstart = 0; + mGameEvent[event_id].state = GAMEEVENT_WORLD_INACTIVE; + std::map<uint32 /*condition id*/, GameEventFinishCondition>::iterator itr; + for(itr = mGameEvent[event_id].conditions.begin(); itr != mGameEvent[event_id].conditions.end(); ++itr) + itr->second.done = 0; + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("DELETE FROM game_event_save WHERE event_id = '%u'",event_id); + CharacterDatabase.PExecute("DELETE FROM game_event_condition_save WHERE event_id = '%u'",event_id); + CharacterDatabase.CommitTransaction(); + } + } } void GameEvent::LoadFromDB() @@ -108,7 +185,7 @@ void GameEvent::LoadFromDB() mGameEvent.resize(max_event_id+1); } - QueryResult *result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,description FROM game_event"); + QueryResult *result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,description,world_event FROM game_event"); if( !result ) { mGameEvent.clear(); @@ -141,21 +218,125 @@ void GameEvent::LoadFromDB() pGameEvent.end = time_t(endtime); pGameEvent.occurence = fields[3].GetUInt32(); pGameEvent.length = fields[4].GetUInt32(); + pGameEvent.description = fields[5].GetCppString(); + pGameEvent.state = (GameEventState)(fields[6].GetUInt8()); + pGameEvent.nextstart = 0; - if(pGameEvent.length==0) // length>0 is validity check + if(pGameEvent.length==0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check { - sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.",event_id); + sLog.outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.",event_id); continue; } - pGameEvent.description = fields[5].GetCppString(); - } while( result->NextRow() ); sLog.outString(); sLog.outString( ">> Loaded %u game events", count ); delete result; + // load game event saves + // 0 1 2 + result = CharacterDatabase.Query("SELECT event_id, state, UNIX_TIMESTAMP(next_start) FROM game_event_save"); + + count = 0; + if( !result ) + { + barGoLink bar2(1); + bar2.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u game event saves in game events", count ); + } + else + { + + barGoLink bar2( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar2.step(); + + uint16 event_id = fields[0].GetUInt16(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_save` game event id (%i) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + if(mGameEvent[event_id].state != GAMEEVENT_NORMAL) + { + mGameEvent[event_id].state = (GameEventState)(fields[1].GetUInt8()); + mGameEvent[event_id].nextstart = time_t(fields[2].GetUInt64()); + } + else + { + sLog.outErrorDb("game_event_save includes event save for non-worldevent id %u",event_id); + continue; + } + + ++count; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u game event saves in game events", count ); + delete result; + } + + // load game event links (prerequisites) + result = WorldDatabase.Query("SELECT event_id, prerequisite_event FROM game_event_prerequisite"); + if( !result ) + { + barGoLink bar2(1); + bar2.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u game event prerequisites in game events", count ); + } + else + { + + barGoLink bar2( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar2.step(); + + uint16 event_id = fields[0].GetUInt16(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + + if(mGameEvent[event_id].state != GAMEEVENT_NORMAL) + { + uint16 prerequisite_event = fields[1].GetUInt16(); + if(prerequisite_event >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`",prerequisite_event); + continue; + } + mGameEvent[event_id].prerequisite_events.insert(prerequisite_event); + } + else + { + sLog.outErrorDb("game_event_prerequisiste includes event entry for non-worldevent id %u",event_id); + continue; + } + + ++count; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u game event prerequisites in game events", count ); + delete result; + } + mGameEventCreatureGuids.resize(mGameEvent.size()*2-1); // 1 2 result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.event " @@ -307,7 +488,7 @@ void GameEvent::LoadFromDB() delete result; } - mGameEventQuests.resize(mGameEvent.size()); + mGameEventCreatureQuests.resize(mGameEvent.size()); // 0 1 2 result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_creature_quest"); @@ -333,14 +514,14 @@ void GameEvent::LoadFromDB() uint32 quest = fields[1].GetUInt32(); uint16 event_id = fields[2].GetUInt16(); - if(event_id >= mGameEventQuests.size()) + if(event_id >= mGameEventCreatureQuests.size()) { sLog.outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id); continue; } ++count; - QuestRelList& questlist = mGameEventQuests[event_id]; + QuestRelList& questlist = mGameEventCreatureQuests[event_id]; questlist.push_back(QuestRelation(id, quest)); } while( result->NextRow() ); @@ -349,6 +530,370 @@ void GameEvent::LoadFromDB() delete result; } + + mGameEventGameObjectQuests.resize(mGameEvent.size()); + // 0 1 2 + result = WorldDatabase.Query("SELECT id, quest, event FROM game_event_gameobject_quest"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u go quests additions in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint32 id = fields[0].GetUInt32(); + uint32 quest = fields[1].GetUInt32(); + uint16 event_id = fields[2].GetUInt16(); + + if(event_id >= mGameEventGameObjectQuests.size()) + { + sLog.outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + ++count; + QuestRelList& questlist = mGameEventGameObjectQuests[event_id]; + questlist.push_back(QuestRelation(id, quest)); + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u quests additions in game events", count ); + + delete result; + } + + // Load quest to (event,condition) mapping + // 0 1 2 3 + result = WorldDatabase.Query("SELECT quest, event_id, condition_id, num FROM game_event_quest_condition"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u quest event conditions in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint32 quest = fields[0].GetUInt32(); + uint16 event_id = fields[1].GetUInt16(); + uint32 condition = fields[2].GetUInt32(); + float num = fields[3].GetFloat(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + ++count; + mQuestToEventConditions[quest].event_id = event_id; + mQuestToEventConditions[quest].condition = condition; + mQuestToEventConditions[quest].num = num; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u quest event conditions in game events", count ); + + delete result; + } + + // load conditions of the events + // 0 1 2 3 4 + result = WorldDatabase.Query("SELECT event_id, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u conditions in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint16 event_id = fields[0].GetUInt16(); + uint32 condition = fields[1].GetUInt32(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + mGameEvent[event_id].conditions[condition].reqNum = fields[2].GetFloat(); + mGameEvent[event_id].conditions[condition].done = 0; + mGameEvent[event_id].conditions[condition].max_world_state = fields[3].GetUInt32(); + mGameEvent[event_id].conditions[condition].done_world_state = fields[4].GetUInt32(); + + ++count; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u conditions in game events", count ); + + delete result; + } + + // load condition saves + // 0 1 2 + result = CharacterDatabase.Query("SELECT event_id, condition_id, done FROM game_event_condition_save"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u condition saves in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint16 event_id = fields[0].GetUInt16(); + uint32 condition = fields[1].GetUInt32(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + std::map<uint32, GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.find(condition); + if(itr != mGameEvent[event_id].conditions.end()) + { + itr->second.done = fields[2].GetFloat(); + } + else + { + sLog.outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u",event_id, condition); + continue; + } + + ++count; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u condition saves in game events", count ); + + delete result; + } + + mGameEventNPCFlags.resize(mGameEvent.size()); + // load game event npcflag + // 0 1 2 + result = WorldDatabase.Query("SELECT guid, event_id, npcflag FROM game_event_npcflag"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u npcflags in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint32 guid = fields[0].GetUInt32(); + uint16 event_id = fields[1].GetUInt16(); + uint32 npcflag = fields[2].GetUInt32(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + mGameEventNPCFlags[event_id].push_back(GuidNPCFlagPair(guid,npcflag)); + + ++count; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u npcflags in game events", count ); + + delete result; + } + + mGameEventVendors.resize(mGameEvent.size()); + // 0 1 2 3 4 5 + result = WorldDatabase.Query("SELECT event, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u vendor additions in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint16 event_id = fields[0].GetUInt16(); + + if(event_id >= mGameEventVendors.size()) + { + sLog.outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + NPCVendorList& vendors = mGameEventVendors[event_id]; + NPCVendorEntry newEntry; + uint32 guid = fields[1].GetUInt32(); + newEntry.item = fields[2].GetUInt32(); + newEntry.maxcount = fields[3].GetUInt32(); + newEntry.incrtime = fields[4].GetUInt32(); + newEntry.ExtendedCost = fields[5].GetUInt32(); + // get the event npc flag for checking if the npc will be vendor during the event or not + uint32 event_npc_flag = 0; + NPCFlagList& flist = mGameEventNPCFlags[event_id]; + for(NPCFlagList::const_iterator itr = flist.begin(); itr != flist.end(); ++itr) + { + if(itr->first == guid) + { + event_npc_flag = itr->second; + break; + } + } + // get creature entry + newEntry.entry = 0; + + if( CreatureData const* data = objmgr.GetCreatureData(guid) ) + newEntry.entry = data->id; + + // check validity with event's npcflag + if(!objmgr.IsVendorItemValid(newEntry.entry, newEntry.item, newEntry.maxcount, newEntry.incrtime, newEntry.ExtendedCost, NULL, NULL, event_npc_flag)) + continue; + ++count; + vendors.push_back(newEntry); + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u vendor additions in game events", count ); + + delete result; + } + + // load game event npc gossip ids + // 0 1 2 + result = WorldDatabase.Query("SELECT guid, event_id, textid FROM game_event_npc_gossip"); + + count = 0; + if( !result ) + { + barGoLink bar3(1); + bar3.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u npc gossip textids in game events", count ); + } + else + { + + barGoLink bar3( result->GetRowCount() ); + do + { + Field *fields = result->Fetch(); + + bar3.step(); + uint32 guid = fields[0].GetUInt32(); + uint16 event_id = fields[1].GetUInt16(); + uint32 textid = fields[2].GetUInt32(); + + if(event_id >= mGameEvent.size()) + { + sLog.outErrorDb("`game_event_npc_gossip` game event id (%u) is out of range compared to max event id in `game_event`",event_id); + continue; + } + + mNPCGossipIds[guid]=EventNPCGossipIdPair(event_id, textid); + + ++count; + + } while( result->NextRow() ); + sLog.outString(); + sLog.outString( ">> Loaded %u npc gossip textids in game events", count ); + + delete result; + } +} + +uint32 GameEvent::GetNPCFlag(Creature * cr) +{ + uint32 mask = 0; + uint32 guid = cr->GetDBTableGUIDLow(); + + for(ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr) + { + for(NPCFlagList::iterator itr = mGameEventNPCFlags[*e_itr].begin(); + itr != mGameEventNPCFlags[*e_itr].end(); + ++ itr) + if(itr->first == guid) + mask |= itr->second; + } + + return mask; +} + +uint32 GameEvent::GetNpcTextId(uint32 guid) +{ + GuidEventNpcGossipIdMap::iterator itr = mNPCGossipIds.find(guid); + if(itr != mNPCGossipIds.end()) + if(IsActiveEvent(itr->second.first)) + return itr->second.second; + return 0; } uint32 GameEvent::Initialize() // return the next event delay in ms @@ -362,22 +907,45 @@ uint32 GameEvent::Initialize() // return the next e uint32 GameEvent::Update() // return the next event delay in ms { + time_t currenttime = time(NULL); uint32 nextEventDelay = max_ge_check_delay; // 1 day uint32 calcDelay; + std::set<uint16> activate, deactivate; for (uint16 itr = 1; itr < mGameEvent.size(); itr++) { + // must do the activating first, and after that the deactivating + // so first queue it //sLog.outErrorDb("Checking event %u",itr); if (CheckOneGameEvent(itr)) { + // if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so + if (mGameEvent[itr].state == GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[itr].nextstart <= currenttime) + { + // set this event to finished, null the nextstart time + mGameEvent[itr].state = GAMEEVENT_WORLD_FINISHED; + mGameEvent[itr].nextstart = 0; + // save the state of this gameevent + SaveWorldEventStateToDB(itr); + // queue for deactivation + if(IsActiveEvent(itr)) + deactivate.insert(itr); + // go to next event, this no longer needs an event update timer + continue; + } + else if (mGameEvent[itr].state == GAMEEVENT_WORLD_CONDITIONS && CheckOneGameEventConditions(itr)) + // changed, save to DB the gameevent state, will be updated in next update cycle + SaveWorldEventStateToDB(itr); + //sLog.outDebug("GameEvent %u is active",itr->first); + // queue for activation if (!IsActiveEvent(itr)) - StartEvent(itr); + activate.insert(itr); } else { //sLog.outDebug("GameEvent %u is not active",itr->first); if (IsActiveEvent(itr)) - StopEvent(itr); + deactivate.insert(itr); else { if (!isSystemInit) @@ -392,6 +960,17 @@ uint32 GameEvent::Update() // return the next e if (calcDelay < nextEventDelay) nextEventDelay = calcDelay; } + // now activate the queue + // a now activated event can contain a spawn of a to-be-deactivated one + // following the activate - deactivate order, deactivating the first event later will leave the spawn in (wont disappear then reappear clientside) + for(std::set<uint16>::iterator itr = activate.begin(); itr != activate.end(); ++itr) + // start the event + // returns true the started event completed + // in that case, initiate next update in 1 second + if(StartEvent(*itr)) + nextEventDelay = 0; + for(std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr) + StopEvent(*itr); sLog.outBasic("Next game event check in %u seconds.", nextEventDelay + 1); return (nextEventDelay + 1) * 1000; // Add 1 second to be sure event has started/stopped at next call } @@ -408,6 +987,10 @@ void GameEvent::UnApplyEvent(uint16 event_id) ChangeEquipOrModel(event_id, false); // Remove quests that are events only to non event npc UpdateEventQuests(event_id, false); + // update npcflags in this event + UpdateEventNPCFlags(event_id); + // remove vendor items + UpdateEventNPCVendor(event_id, false); } void GameEvent::ApplyNewEvent(uint16 event_id) @@ -423,13 +1006,6 @@ void GameEvent::ApplyNewEvent(uint16 event_id) sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); - if((sIRC.BOTMASK & 256) != 0) - { - std::string ircchan = "#"; - ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); - sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Game Event \00304,08\037/!\\\037\017 %s", "%s", mGameEvent[event_id].description.c_str()), true); - } - // spawn positive event tagget objects GameEventSpawn(event_id); // un-spawn negative event tagged objects @@ -439,6 +1015,47 @@ void GameEvent::ApplyNewEvent(uint16 event_id) ChangeEquipOrModel(event_id, true); // Add quests that are events only to non event npc UpdateEventQuests(event_id, true); + // update npcflags in this event + UpdateEventNPCFlags(event_id); + // add vendor items + UpdateEventNPCVendor(event_id, true); +} + +void GameEvent::UpdateEventNPCFlags(uint16 event_id) +{ + // go through the creatures whose npcflags are changed in the event + for(NPCFlagList::iterator itr = mGameEventNPCFlags[event_id].begin(); itr != mGameEventNPCFlags[event_id].end(); ++itr) + { + // get the creature data from the low guid to get the entry, to be able to find out the whole guid + if( CreatureData const* data = objmgr.GetCreatureData(itr->first) ) + { + Creature * cr = HashMapHolder<Creature>::Find(MAKE_NEW_GUID(itr->first,data->id,HIGHGUID_UNIT)); + // if we found the creature, modify its npcflag + if(cr) + { + uint32 npcflag = GetNPCFlag(cr); + if(const CreatureInfo * ci = cr->GetCreatureInfo()) + npcflag |= ci->npcflag; + cr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag); + // reset gossip options, since the flag change might have added / removed some + cr->ResetGossipOptions(); + // update to world + cr->SendUpdateObjectToAllExcept(NULL); + } + // if we didn't find it, then the npcflag will be updated when the creature is loaded + } + } +} + +void GameEvent::UpdateEventNPCVendor(uint16 event_id, bool activate) +{ + for(NPCVendorList::iterator itr = mGameEventVendors[event_id].begin(); itr != mGameEventVendors[event_id].end(); ++itr) + { + if(activate) + objmgr.AddVendorItem(itr->entry, itr->item, itr->maxcount, itr->incrtime, itr->ExtendedCost, false); + else + objmgr.RemoveVendorItem(itr->entry, itr->item, false); + } } void GameEvent::GameEventSpawn(int16 event_id) @@ -525,6 +1142,9 @@ void GameEvent::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();itr != mGameEventCreatureGuids[internal_event_id].end();++itr) { + // check if it's needed by another event, if so, don't remove + if( event_id > 0 && hasCreatureActiveEventExcept(*itr,event_id) ) + continue; // Remove the creature from grid if( CreatureData const* data = objmgr.GetCreatureData(*itr) ) { @@ -546,6 +1166,9 @@ void GameEvent::GameEventUnspawn(int16 event_id) for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();itr != mGameEventGameobjectGuids[internal_event_id].end();++itr) { + // check if it's needed by another event, if so, don't remove + if( event_id >0 && hasGameObjectActiveEventExcept(*itr,event_id) ) + continue; // Remove the gameobject from grid if(GameObjectData const* data = objmgr.GetGOData(*itr)) { @@ -636,33 +1259,219 @@ void GameEvent::ChangeEquipOrModel(int16 event_id, bool activate) } } +bool GameEvent::hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id) +{ + for(ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr) + { + if((*e_itr) != event_id) + for(QuestRelList::iterator itr = mGameEventCreatureQuests[*e_itr].begin(); + itr != mGameEventCreatureQuests[*e_itr].end(); + ++ itr) + if(itr->second == quest_id) + return true; + } + return false; +} + +bool GameEvent::hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id) +{ + for(ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr) + { + if((*e_itr) != event_id) + for(QuestRelList::iterator itr = mGameEventGameObjectQuests[*e_itr].begin(); + itr != mGameEventGameObjectQuests[*e_itr].end(); + ++ itr) + if(itr->second == quest_id) + return true; + } + return false; +} +bool GameEvent::hasCreatureActiveEventExcept(uint32 creature_id, uint16 event_id) +{ + for(ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr) + { + if((*e_itr) != event_id) + { + int32 internal_event_id = mGameEvent.size() + (*e_itr) - 1; + for(GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); + itr != mGameEventCreatureGuids[internal_event_id].end(); + ++ itr) + if(*itr == creature_id) + return true; + } + } + return false; +} +bool GameEvent::hasGameObjectActiveEventExcept(uint32 go_id, uint16 event_id) +{ + for(ActiveEvents::iterator e_itr = m_ActiveEvents.begin(); e_itr != m_ActiveEvents.end(); ++e_itr) + { + if((*e_itr) != event_id) + { + int32 internal_event_id = mGameEvent.size() + (*e_itr) - 1; + for(GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); + itr != mGameEventGameobjectGuids[internal_event_id].end(); + ++ itr) + if(*itr == go_id) + return true; + } + } + return false; +} + void GameEvent::UpdateEventQuests(uint16 event_id, bool Activate) { QuestRelList::iterator itr; - for (itr = mGameEventQuests[event_id].begin();itr != mGameEventQuests[event_id].end();++itr) + for (itr = mGameEventCreatureQuests[event_id].begin();itr != mGameEventCreatureQuests[event_id].end();++itr) { QuestRelations &CreatureQuestMap = objmgr.mCreatureQuestRelations; if (Activate) // Add the pair(id,quest) to the multimap CreatureQuestMap.insert(QuestRelations::value_type(itr->first, itr->second)); else - { // Remove the pair(id,quest) from the multimap - QuestRelations::iterator qitr = CreatureQuestMap.find(itr->first); - if (qitr == CreatureQuestMap.end()) - continue; - QuestRelations::iterator lastElement = CreatureQuestMap.upper_bound(itr->first); - for ( ;qitr != lastElement;++qitr) + { + if(!hasCreatureQuestActiveEventExcept(itr->second,event_id)) { - if (qitr->second == itr->second) + // Remove the pair(id,quest) from the multimap + QuestRelations::iterator qitr = CreatureQuestMap.find(itr->first); + if (qitr == CreatureQuestMap.end()) + continue; + QuestRelations::iterator lastElement = CreatureQuestMap.upper_bound(itr->first); + for ( ;qitr != lastElement;++qitr) { - CreatureQuestMap.erase(qitr); // iterator is now no more valid - break; // but we can exit loop since the element is found + if (qitr->second == itr->second) + { + CreatureQuestMap.erase(qitr); // iterator is now no more valid + break; // but we can exit loop since the element is found + } } } } } -} + for (itr = mGameEventGameObjectQuests[event_id].begin();itr != mGameEventGameObjectQuests[event_id].end();++itr) + { + QuestRelations &GameObjectQuestMap = objmgr.mGOQuestRelations; + if (Activate) // Add the pair(id,quest) to the multimap + GameObjectQuestMap.insert(QuestRelations::value_type(itr->first, itr->second)); + else + { + if(!hasGameObjectQuestActiveEventExcept(itr->second,event_id)) + { + // Remove the pair(id,quest) from the multimap + QuestRelations::iterator qitr = GameObjectQuestMap.find(itr->first); + if (qitr == GameObjectQuestMap.end()) + continue; + QuestRelations::iterator lastElement = GameObjectQuestMap.upper_bound(itr->first); + for ( ;qitr != lastElement;++qitr) + { + if (qitr->second == itr->second) + { + GameObjectQuestMap.erase(qitr); // iterator is now no more valid + break; // but we can exit loop since the element is found + } + } + } + } + }} GameEvent::GameEvent() { isSystemInit = false; } + +void GameEvent::HandleQuestComplete(uint32 quest_id) +{ + // translate the quest to event and condition + QuestIdToEventConditionMap::iterator itr = mQuestToEventConditions.find(quest_id); + // quest is registered + if(itr != mQuestToEventConditions.end()) + { + uint16 event_id = itr->second.event_id; + uint32 condition = itr->second.condition; + float num = itr->second.num; + + // the event is not active, so return, don't increase condition finishes + if(!IsActiveEvent(event_id)) + return; + // not in correct phase, return + if(mGameEvent[event_id].state != GAMEEVENT_WORLD_CONDITIONS) + return; + std::map<uint32,GameEventFinishCondition>::iterator citr = mGameEvent[event_id].conditions.find(condition); + // condition is registered + if(citr != mGameEvent[event_id].conditions.end()) + { + // increase the done count, only if less then the req + if(citr->second.done < citr->second.reqNum) + { + citr->second.done += num; + // check max limit + if(citr->second.done > citr->second.reqNum) + citr->second.done = citr->second.reqNum; + // save the change to db + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("DELETE FROM game_event_condition_save WHERE event_id = '%u' AND condition_id = '%u'",event_id,condition); + CharacterDatabase.PExecute("INSERT INTO game_event_condition_save (event_id, condition_id, done) VALUES (%u,%u,%f)",event_id,condition,citr->second.done); + CharacterDatabase.CommitTransaction(); + // check if all conditions are met, if so, update the event state + if(CheckOneGameEventConditions(event_id)) + { + // changed, save to DB the gameevent state + SaveWorldEventStateToDB(event_id); + // force update events to set timer + sWorld.ForceGameEventUpdate(); + } + } + } + } +} + +bool GameEvent::CheckOneGameEventConditions(uint16 event_id) +{ + for(std::map<uint32,GameEventFinishCondition>::iterator itr = mGameEvent[event_id].conditions.begin(); itr != mGameEvent[event_id].conditions.end(); ++itr) + if(itr->second.done < itr->second.reqNum) + // return false if a condition doesn't match + return false; + // set the phase + mGameEvent[event_id].state = GAMEEVENT_WORLD_NEXTPHASE; + // set the followup events' start time + if(!mGameEvent[event_id].nextstart) + { + time_t currenttime = time(NULL); + mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60; + } + return true; +} + +void GameEvent::SaveWorldEventStateToDB(uint16 event_id) +{ + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("DELETE FROM game_event_save WHERE event_id = '%u'",event_id); + if(mGameEvent[event_id].nextstart) + CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u',FROM_UNIXTIME('"I64FMTD"'))",event_id,mGameEvent[event_id].state,mGameEvent[event_id].nextstart); + else + CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u','0000-00-00 00:00:00')",event_id,mGameEvent[event_id].state); + CharacterDatabase.CommitTransaction(); +} + +void GameEvent::HandleWorldEventGossip(Player *plr, Creature *c) +{ + // this function is used to send world state update before sending gossip menu + // find the npc's gossip id (if set) in an active game event + // if present, send the event's world states + GuidEventNpcGossipIdMap::iterator itr = mNPCGossipIds.find(c->GetDBTableGUIDLow()); + if(itr != mNPCGossipIds.end()) + if(IsActiveEvent(itr->second.first)) + // send world state updates to the player about the progress + SendWorldStateUpdate(plr, itr->second.first); +} + +void GameEvent::SendWorldStateUpdate(Player * plr, uint16 event_id) +{ + std::map<uint32,GameEventFinishCondition>::iterator itr; + for(itr = mGameEvent[event_id].conditions.begin(); itr !=mGameEvent[event_id].conditions.end(); ++itr) + { + if(itr->second.done_world_state) + plr->SendUpdateWorldState(itr->second.done_world_state, itr->second.done); + if(itr->second.max_world_state) + plr->SendUpdateWorldState(itr->second.max_world_state, itr->second.reqNum); + } +} diff --git a/src/game/GameEvent.h b/src/game/GameEvent.h index 535422eb407..c49c50ba6cb 100644 --- a/src/game/GameEvent.h +++ b/src/game/GameEvent.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GAMEEVENT_H -#define MANGOS_GAMEEVENT_H +#ifndef TRINITY_GAMEEVENT_H +#define TRINITY_GAMEEVENT_H #include "Platform/Define.h" #include "Creature.h" @@ -25,16 +27,44 @@ #define max_ge_check_delay 86400 // 1 day in seconds +enum GameEventState +{ + GAMEEVENT_NORMAL = 0, // standard game events + GAMEEVENT_WORLD_INACTIVE, // not yet started + GAMEEVENT_WORLD_CONDITIONS, // condition matching phase + GAMEEVENT_WORLD_NEXTPHASE, // conditions are met, now 'lenght' timer to start next event + GAMEEVENT_WORLD_FINISHED // next events are started, unapply this one +}; + +struct GameEventFinishCondition +{ + float reqNum; // required number // use float, since some events use percent + float done; // done number + uint32 max_world_state; // max resource count world state update id + uint32 done_world_state; // done resource count world state update id +}; + +struct GameEventQuestToEventConditionNum +{ + uint16 event_id; + uint32 condition; + float num; +}; + struct GameEventData { - GameEventData() : start(1),end(0),occurence(0),length(0) {} - time_t start; - time_t end; - uint32 occurence; - uint32 length; + GameEventData() : start(1),end(0),nextstart(0),occurence(0),length(0),state(GAMEEVENT_NORMAL) {} + time_t start; // occurs after this time + time_t end; // occurs before this time + time_t nextstart; // after this time the follow-up events count this phase completed + uint32 occurence; // time between end and start + uint32 length; // length of the event (minutes) after finishing all conditions + GameEventState state; // state of the game event, these are saved into the game_event table on change! + std::map<uint32 /*condition id*/, GameEventFinishCondition> conditions; // conditions to finish + std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event std::string description; - bool isValid() const { return length > 0; } + bool isValid() const { return ((length > 0) || (state > GAMEEVENT_NORMAL)); } }; struct ModelEquip @@ -45,6 +75,16 @@ struct ModelEquip uint32 equipement_id_prev; }; +struct NPCVendorEntry +{ + uint32 entry; // creature entry + uint32 item; // item id + uint32 maxcount; // 0 for infinite + uint32 incrtime; // time for restore items amount if maxcount != 0 + uint32 ExtendedCost; +}; + +class Player; class GameEvent { public: @@ -60,9 +100,14 @@ class GameEvent uint32 Update(); bool IsActiveEvent(uint16 event_id) { return ( m_ActiveEvents.find(event_id)!=m_ActiveEvents.end()); } uint32 Initialize(); - void StartEvent(uint16 event_id, bool overwrite = false); + bool StartEvent(uint16 event_id, bool overwrite = false); void StopEvent(uint16 event_id, bool overwrite = false); + void HandleQuestComplete(uint32 quest_id); // called on world event type quest completions + void HandleWorldEventGossip(Player * plr, Creature * c); + uint32 GetNPCFlag(Creature * cr); + uint32 GetNpcTextId(uint32 guid); private: + void SendWorldStateUpdate(Player * plr, uint16 event_id); void AddActiveEvent(uint16 event_id) { m_ActiveEvents.insert(event_id); } void RemoveActiveEvent(uint16 event_id) { m_ActiveEvents.erase(event_id); } void ApplyNewEvent(uint16 event_id); @@ -71,6 +116,14 @@ class GameEvent void GameEventUnspawn(int16 event_id); void ChangeEquipOrModel(int16 event_id, bool activate); void UpdateEventQuests(uint16 event_id, bool Activate); + void UpdateEventNPCFlags(uint16 event_id); + void UpdateEventNPCVendor(uint16 event_id, bool activate); + bool CheckOneGameEventConditions(uint16 event_id); + void SaveWorldEventStateToDB(uint16 event_id); + bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id); + bool hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id); + bool hasCreatureActiveEventExcept(uint32 creature_guid, uint16 event_id); + bool hasGameObjectActiveEventExcept(uint32 go_guid, uint16 event_id); protected: typedef std::list<uint32> GuidList; typedef std::vector<GuidList> GameEventGuidMap; @@ -80,14 +133,27 @@ class GameEvent typedef std::pair<uint32, uint32> QuestRelation; typedef std::list<QuestRelation> QuestRelList; typedef std::vector<QuestRelList> GameEventQuestMap; - GameEventQuestMap mGameEventQuests; + typedef std::list<NPCVendorEntry> NPCVendorList; + typedef std::vector<NPCVendorList> GameEventNPCVendorMap; + typedef std::map<uint32 /*quest id*/, GameEventQuestToEventConditionNum> QuestIdToEventConditionMap; + typedef std::pair<uint32 /*guid*/, uint32 /*npcflag*/> GuidNPCFlagPair; + typedef std::list<GuidNPCFlagPair> NPCFlagList; + typedef std::vector<NPCFlagList> GameEventNPCFlagMap; + typedef std::pair<uint16 /*event id*/, uint32 /*gossip id*/> EventNPCGossipIdPair; + typedef std::map<uint32 /*guid*/, EventNPCGossipIdPair> GuidEventNpcGossipIdMap; + GameEventQuestMap mGameEventCreatureQuests; + GameEventQuestMap mGameEventGameObjectQuests; + GameEventNPCVendorMap mGameEventVendors; GameEventModelEquipMap mGameEventModelEquip; GameEventGuidMap mGameEventCreatureGuids; GameEventGuidMap mGameEventGameobjectGuids; GameEventDataMap mGameEvent; + QuestIdToEventConditionMap mQuestToEventConditions; + GameEventNPCFlagMap mGameEventNPCFlags; + GuidEventNpcGossipIdMap mNPCGossipIds; ActiveEvents m_ActiveEvents; bool isSystemInit; }; -#define gameeventmgr MaNGOS::Singleton<GameEvent>::Instance() +#define gameeventmgr Trinity::Singleton<GameEvent>::Instance() #endif diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 586f4f0bf66..ab9d9e315ef 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -35,6 +37,7 @@ #include "CellImpl.h" #include "InstanceData.h" #include "BattleGround.h" +#include "OutdoorPvPMgr.h" #include "Util.h" GameObject::GameObject() : WorldObject() @@ -89,7 +92,7 @@ void GameObject::RemoveFromWorld() Object::RemoveFromWorld(); } -bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state) +bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit) { Relocate(x,y,z,ang); SetMapId(map->GetId()); @@ -142,6 +145,8 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, float x, float SetGoAnimProgress(animprogress); + SetUInt32Value (GAMEOBJECT_ARTKIT, ArtKit); + // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22) if (goinfo->type == GAMEOBJECT_TYPE_SPELLCASTER) m_charges = goinfo->spellcaster.charges; @@ -295,7 +300,7 @@ void GameObject::Update(uint32 /*p_time*/) bool NeedDespawn = (goInfo->trap.charges != 0); - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; @@ -303,18 +308,18 @@ void GameObject::Update(uint32 /*p_time*/) // search unfriendly creature if(owner && NeedDespawn) // hunter trap { - MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius); - MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> checker(ok, u_check); + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius); + Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> checker(ok, u_check); CellLock<GridReadGuard> cell_lock(cell, p); - TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); + TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); // or unfriendly player/pet if(!ok) { - TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); + TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); } } @@ -324,12 +329,12 @@ void GameObject::Update(uint32 /*p_time*/) // affect only players Player* p_ok = NULL; - MaNGOS::AnyPlayerInObjectRangeCheck p_check(this, radius); - MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(p_ok, p_check); + Trinity::AnyPlayerInObjectRangeCheck p_check(this, radius); + Trinity::PlayerSearcher<Trinity::AnyPlayerInObjectRangeCheck> checker(p_ok, p_check); CellLock<GridReadGuard> cell_lock(cell, p); - TypeContainerVisitor<MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); + TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); ok = p_ok; } @@ -518,6 +523,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask) data.animprogress = GetGoAnimProgress(); data.go_state = GetGoState(); data.spawnMask = spawnMask; + data.ArtKit = GetUInt32Value (GAMEOBJECT_ARTKIT); // updated in DB std::ostringstream ss; @@ -568,11 +574,12 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) uint32 animprogress = data->animprogress; uint32 go_state = data->go_state; + uint32 ArtKit = data->ArtKit; m_DBTableGuid = guid; if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!Create(guid,entry, map, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state) ) + if (!Create(guid,entry, map, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, ArtKit) ) return false; switch(GetGOInfo()->type) @@ -778,14 +785,14 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target) GameObject* trapGO = NULL; { // using original GO distance - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,range); - MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO,go_check); + Trinity::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,range); + Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO,go_check); - TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); } @@ -800,15 +807,15 @@ GameObject* GameObject::LookupFishingHoleAround(float range) { GameObject* ok = NULL; - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::NearestGameObjectFishingHole u_check(*this, range); - MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole> checker(ok, u_check); + Trinity::NearestGameObjectFishingHole u_check(*this, range); + Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole> checker(ok, u_check); CellLock<GridReadGuard> cell_lock(cell, p); - TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker); cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); return ok; @@ -829,6 +836,14 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore) } +void GameObject::SetGoArtKit(uint32 kit) +{ + SetUInt32Value(GAMEOBJECT_ARTKIT, kit); + GameObjectData *data = const_cast<GameObjectData*>(objmgr.GetGOData(m_DBTableGuid)); + if(data) + data->ArtKit = kit; +} + void GameObject::SwitchDoorOrButton(bool activate) { if(activate) @@ -1233,7 +1248,10 @@ void GameObject::Use(Unit* user) SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId ); if(!spellInfo) { - sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType()); + if(user->GetTypeId()!=TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this)) + sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType()); + else + sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); return; } diff --git a/src/game/GameObject.h b/src/game/GameObject.h index ddc47fdac67..bfd265a9818 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_GAMEOBJECT_H -#define MANGOSSERVER_GAMEOBJECT_H +#ifndef TRINITYCORE_GAMEOBJECT_H +#define TRINITYCORE_GAMEOBJECT_H #include "Common.h" #include "SharedDefines.h" @@ -381,6 +383,7 @@ struct GameObjectData uint32 animprogress; uint32 go_state; uint8 spawnMask; + uint32 ArtKit; }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform @@ -407,7 +410,7 @@ class Unit; // 5 sec for bobber catch #define FISHING_BOBBER_READY_TIME 5 -class MANGOS_DLL_SPEC GameObject : public WorldObject +class TRINITY_DLL_SPEC GameObject : public WorldObject { public: explicit GameObject(); @@ -416,7 +419,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void AddToWorld(); void RemoveFromWorld(); - bool Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state); + bool Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit = 0); void Update(uint32 p_time); static GameObject* GetGameObject(WorldObject& object, uint64 guid); GameObjectInfo const* GetGOInfo() const; @@ -502,7 +505,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject uint32 GetGoState() const { return GetUInt32Value(GAMEOBJECT_STATE); } void SetGoState(uint32 state) { SetUInt32Value(GAMEOBJECT_STATE, state); } uint32 GetGoArtKit() const { return GetUInt32Value(GAMEOBJECT_ARTKIT); } - void SetGoArtKit(uint32 artkit) { SetUInt32Value(GAMEOBJECT_ARTKIT, artkit); } + void SetGoArtKit(uint32 artkit); uint32 GetGoAnimProgress() const { return GetUInt32Value(GAMEOBJECT_ANIMPROGRESS); } void SetGoAnimProgress(uint32 animprogress) { SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, animprogress); } diff --git a/src/game/GlobalEvents.cpp b/src/game/GlobalEvents.cpp index 5bac79ad102..fcf7d99f8f3 100644 --- a/src/game/GlobalEvents.cpp +++ b/src/game/GlobalEvents.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file diff --git a/src/game/GlobalEvents.h b/src/game/GlobalEvents.h index aacf72d730a..26133c35580 100644 --- a/src/game/GlobalEvents.h +++ b/src/game/GlobalEvents.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup world diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index ae4e618fa1e..1c6fb1f9398 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "QuestDef.h" diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index 10a08987d40..30417affb67 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_GOSSIP_H -#define MANGOSSERVER_GOSSIP_H +#ifndef TRINITYCORE_GOSSIP_H +#define TRINITYCORE_GOSSIP_H #include "Common.h" #include "QuestDef.h" @@ -95,7 +97,7 @@ struct QuestMenuItem typedef std::vector<QuestMenuItem> QuestMenuItemList; -class MANGOS_DLL_SPEC GossipMenu +class TRINITY_DLL_SPEC GossipMenu { public: GossipMenu(); @@ -163,7 +165,7 @@ class QuestMenu QuestMenuItemList m_qItems; }; -class MANGOS_DLL_SPEC PlayerMenu +class TRINITY_DLL_SPEC PlayerMenu { private: GossipMenu mGossipMenu; diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h index d6287fa495c..430af916cc6 100644 --- a/src/game/GridDefines.h +++ b/src/game/GridDefines.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GRIDDEFINES_H -#define MANGOS_GRIDDEFINES_H +#ifndef TRINITY_GRIDDEFINES_H +#define TRINITY_GRIDDEFINES_H #include "Common.h" #include "GameSystem/NGrid.h" @@ -71,7 +73,7 @@ typedef TypeMapContainer<AllGridObjectTypes> GridTypeMapContainer; typedef TypeMapContainer<AllWorldObjectTypes> WorldTypeMapContainer; template<const unsigned int LIMIT> -struct MANGOS_DLL_DECL CoordPair +struct TRINITY_DLL_DECL CoordPair { CoordPair(uint32 x=0, uint32 y=0) : x_coord(x), y_coord(y) {} CoordPair(const CoordPair<LIMIT> &obj) : x_coord(obj.x_coord), y_coord(obj.y_coord) {} @@ -115,7 +117,7 @@ struct MANGOS_DLL_DECL CoordPair typedef CoordPair<MAX_NUMBER_OF_GRIDS> GridPair; typedef CoordPair<TOTAL_NUMBER_OF_CELLS_PER_MAP> CellPair; -namespace MaNGOS +namespace Trinity { template<class RET_TYPE, int CENTER_VAL> inline RET_TYPE Compute(float x, float y, float center_offset, float size) diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index 5348b7f61b0..b4804f74a5b 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "GridNotifiers.h" @@ -26,10 +28,10 @@ #include "Transports.h" #include "ObjectAccessor.h" -using namespace MaNGOS; +using namespace Trinity; void -MaNGOS::PlayerNotifier::Visit(PlayerMapType &m) +Trinity::PlayerNotifier::Visit(PlayerMapType &m) { for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) { @@ -91,7 +93,7 @@ VisibleNotifier::Notify() { i_player.m_clientGUIDs.erase(*itr); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) sLog.outDebug("Object %u (Type: %u) is out of range (no in active cells set) now for player %u",GUID_LOPART(*itr),GuidHigh2TypeId(GUID_HIPART(*itr)),i_player.GetGUIDLow()); #endif diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index dd4d8a63f81..3759f93efc7 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GRIDNOTIFIERS_H -#define MANGOS_GRIDNOTIFIERS_H +#ifndef TRINITY_GRIDNOTIFIERS_H +#define TRINITY_GRIDNOTIFIERS_H #include "ObjectGridLoader.h" #include "ByteBuffer.h" @@ -34,10 +36,10 @@ class Player; //class Map; -namespace MaNGOS +namespace Trinity { - struct MANGOS_DLL_DECL PlayerNotifier + struct TRINITY_DLL_DECL PlayerNotifier { explicit PlayerNotifier(Player &pl) : i_player(pl) {} void Visit(PlayerMapType &); @@ -45,7 +47,7 @@ namespace MaNGOS Player &i_player; }; - struct MANGOS_DLL_DECL VisibleNotifier + struct TRINITY_DLL_DECL VisibleNotifier { Player &i_player; UpdateData i_data; @@ -59,7 +61,7 @@ namespace MaNGOS void Notify(void); }; - struct MANGOS_DLL_DECL VisibleChangesNotifier + struct TRINITY_DLL_DECL VisibleChangesNotifier { WorldObject &i_object; @@ -68,7 +70,7 @@ namespace MaNGOS void Visit(PlayerMapType &); }; - struct MANGOS_DLL_DECL GridUpdater + struct TRINITY_DLL_DECL GridUpdater { GridType &i_grid; uint32 i_timeDiff; @@ -87,7 +89,7 @@ namespace MaNGOS void Visit(CorpseMapType &m) { updateObjects<Corpse>(m); } }; - struct MANGOS_DLL_DECL MessageDeliverer + struct TRINITY_DLL_DECL MessageDeliverer { Player &i_player; WorldPacket *i_message; @@ -97,7 +99,7 @@ namespace MaNGOS template<class SKIP> void Visit(GridRefManager<SKIP> &) {} }; - struct MANGOS_DLL_DECL ObjectMessageDeliverer + struct TRINITY_DLL_DECL ObjectMessageDeliverer { WorldPacket *i_message; explicit ObjectMessageDeliverer(WorldPacket *msg) : i_message(msg) {} @@ -105,7 +107,7 @@ namespace MaNGOS template<class SKIP> void Visit(GridRefManager<SKIP> &) {} }; - struct MANGOS_DLL_DECL MessageDistDeliverer + struct TRINITY_DLL_DECL MessageDistDeliverer { Player &i_player; WorldPacket *i_message; @@ -117,7 +119,7 @@ namespace MaNGOS template<class SKIP> void Visit(GridRefManager<SKIP> &) {} }; - struct MANGOS_DLL_DECL ObjectMessageDistDeliverer + struct TRINITY_DLL_DECL ObjectMessageDistDeliverer { WorldObject &i_object; WorldPacket *i_message; @@ -127,7 +129,7 @@ namespace MaNGOS template<class SKIP> void Visit(GridRefManager<SKIP> &) {} }; - struct MANGOS_DLL_DECL ObjectUpdater + struct TRINITY_DLL_DECL ObjectUpdater { uint32 i_timeDiff; explicit ObjectUpdater(const uint32 &diff) : i_timeDiff(diff) {} @@ -138,7 +140,7 @@ namespace MaNGOS }; template<class T> - struct MANGOS_DLL_DECL ObjectAccessorNotifier + struct TRINITY_DLL_DECL ObjectAccessorNotifier { T *& i_object; @@ -164,7 +166,7 @@ namespace MaNGOS template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {} }; - struct MANGOS_DLL_DECL PlayerRelocationNotifier + struct TRINITY_DLL_DECL PlayerRelocationNotifier { Player &i_player; PlayerRelocationNotifier(Player &pl) : i_player(pl) {} @@ -173,7 +175,7 @@ namespace MaNGOS void Visit(CreatureMapType &); }; - struct MANGOS_DLL_DECL CreatureRelocationNotifier + struct TRINITY_DLL_DECL CreatureRelocationNotifier { Creature &i_creature; CreatureRelocationNotifier(Creature &c) : i_creature(c) {} @@ -183,7 +185,7 @@ namespace MaNGOS #endif }; - struct MANGOS_DLL_DECL DynamicObjectUpdater + struct TRINITY_DLL_DECL DynamicObjectUpdater { DynamicObject &i_dynobject; Unit* i_check; @@ -209,7 +211,7 @@ namespace MaNGOS // WorldObject searchers & workers template<class Check> - struct MANGOS_DLL_DECL WorldObjectSearcher + struct TRINITY_DLL_DECL WorldObjectSearcher { WorldObject* &i_object; Check &i_check; @@ -226,7 +228,7 @@ namespace MaNGOS }; template<class Check> - struct MANGOS_DLL_DECL WorldObjectListSearcher + struct TRINITY_DLL_DECL WorldObjectListSearcher { std::list<WorldObject*> &i_objects; Check& i_check; @@ -243,7 +245,7 @@ namespace MaNGOS }; template<class Do> - struct MANGOS_DLL_DECL WorldObjectWorker + struct TRINITY_DLL_DECL WorldObjectWorker { Do const& i_do; @@ -284,7 +286,7 @@ namespace MaNGOS // Gameobject searchers template<class Check> - struct MANGOS_DLL_DECL GameObjectSearcher + struct TRINITY_DLL_DECL GameObjectSearcher { GameObject* &i_object; Check &i_check; @@ -298,7 +300,7 @@ namespace MaNGOS // Last accepted by Check GO if any (Check can change requirements at each call) template<class Check> - struct MANGOS_DLL_DECL GameObjectLastSearcher + struct TRINITY_DLL_DECL GameObjectLastSearcher { GameObject* &i_object; Check& i_check; @@ -311,7 +313,7 @@ namespace MaNGOS }; template<class Check> - struct MANGOS_DLL_DECL GameObjectListSearcher + struct TRINITY_DLL_DECL GameObjectListSearcher { std::list<GameObject*> &i_objects; Check& i_check; @@ -327,7 +329,7 @@ namespace MaNGOS // First accepted by Check Unit if any template<class Check> - struct MANGOS_DLL_DECL UnitSearcher + struct TRINITY_DLL_DECL UnitSearcher { Unit* &i_object; Check & i_check; @@ -342,7 +344,7 @@ namespace MaNGOS // Last accepted by Check Unit if any (Check can change requirements at each call) template<class Check> - struct MANGOS_DLL_DECL UnitLastSearcher + struct TRINITY_DLL_DECL UnitLastSearcher { Unit* &i_object; Check & i_check; @@ -357,7 +359,7 @@ namespace MaNGOS // All accepted by Check units if any template<class Check> - struct MANGOS_DLL_DECL UnitListSearcher + struct TRINITY_DLL_DECL UnitListSearcher { std::list<Unit*> &i_objects; Check& i_check; @@ -373,7 +375,7 @@ namespace MaNGOS // Creature searchers template<class Check> - struct MANGOS_DLL_DECL CreatureSearcher + struct TRINITY_DLL_DECL CreatureSearcher { Creature* &i_object; Check & i_check; @@ -387,7 +389,7 @@ namespace MaNGOS // Last accepted by Check Creature if any (Check can change requirements at each call) template<class Check> - struct MANGOS_DLL_DECL CreatureLastSearcher + struct TRINITY_DLL_DECL CreatureLastSearcher { Creature* &i_object; Check & i_check; @@ -400,7 +402,7 @@ namespace MaNGOS }; template<class Check> - struct MANGOS_DLL_DECL CreatureListSearcher + struct TRINITY_DLL_DECL CreatureListSearcher { std::list<Creature*> &i_objects; Check& i_check; @@ -415,7 +417,7 @@ namespace MaNGOS // Player searchers template<class Check> - struct MANGOS_DLL_DECL PlayerSearcher + struct TRINITY_DLL_DECL PlayerSearcher { Player* &i_object; Check & i_check; @@ -428,7 +430,7 @@ namespace MaNGOS }; template<class Do> - struct MANGOS_DLL_DECL PlayerWorker + struct TRINITY_DLL_DECL PlayerWorker { Do& i_do; diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 9dd422a3ad3..f66d599b132 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GRIDNOTIFIERSIMPL_H -#define MANGOS_GRIDNOTIFIERSIMPL_H +#ifndef TRINITY_GRIDNOTIFIERSIMPL_H +#define TRINITY_GRIDNOTIFIERSIMPL_H #include "GridNotifiers.h" #include "WorldPacket.h" @@ -29,7 +31,7 @@ template<class T> inline void -MaNGOS::VisibleNotifier::Visit(GridRefManager<T> &m) +Trinity::VisibleNotifier::Visit(GridRefManager<T> &m) { for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) { @@ -39,7 +41,7 @@ MaNGOS::VisibleNotifier::Visit(GridRefManager<T> &m) } inline void -MaNGOS::ObjectUpdater::Visit(CreatureMapType &m) +Trinity::ObjectUpdater::Visit(CreatureMapType &m) { for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) if(!iter->getSource()->isSpiritService()) @@ -47,7 +49,7 @@ MaNGOS::ObjectUpdater::Visit(CreatureMapType &m) } inline void -MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m) +Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m) { for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) { @@ -93,7 +95,7 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) } inline void -MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) +Trinity::PlayerRelocationNotifier::Visit(CreatureMapType &m) { if(!i_player.isAlive() || i_player.isInFlight()) return; @@ -105,7 +107,7 @@ MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) template<> inline void -MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) +Trinity::CreatureRelocationNotifier::Visit(PlayerMapType &m) { if(!i_creature.isAlive()) return; @@ -117,7 +119,7 @@ MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) template<> inline void -MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m) +Trinity::CreatureRelocationNotifier::Visit(CreatureMapType &m) { if(!i_creature.isAlive()) return; @@ -130,7 +132,7 @@ MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m) } } -inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) +inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target) { if(!target->isAlive() || target->isInFlight() ) return; @@ -180,7 +182,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) template<> inline void -MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m) +Trinity::DynamicObjectUpdater::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) VisitHelper(itr->getSource()); @@ -188,7 +190,7 @@ MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m) template<> inline void -MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m) +Trinity::DynamicObjectUpdater::Visit(PlayerMapType &m) { for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) VisitHelper(itr->getSource()); @@ -199,7 +201,7 @@ MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m) // WorldObject searchers & workers template<class Check> -void MaNGOS::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m) +void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m) { // already found if(i_object) @@ -216,7 +218,7 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m) } template<class Check> -void MaNGOS::WorldObjectSearcher<Check>::Visit(PlayerMapType &m) +void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m) { // already found if(i_object) @@ -233,7 +235,7 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(PlayerMapType &m) } template<class Check> -void MaNGOS::WorldObjectSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m) { // already found if(i_object) @@ -250,7 +252,7 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::WorldObjectSearcher<Check>::Visit(CorpseMapType &m) +void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m) { // already found if(i_object) @@ -267,7 +269,7 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(CorpseMapType &m) } template<class Check> -void MaNGOS::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m) +void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m) { // already found if(i_object) @@ -284,7 +286,7 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m) } template<class Check> -void MaNGOS::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m) +void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m) { for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -292,7 +294,7 @@ void MaNGOS::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m) } template<class Check> -void MaNGOS::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -300,7 +302,7 @@ void MaNGOS::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m) +void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m) { for(CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -308,7 +310,7 @@ void MaNGOS::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m) } template<class Check> -void MaNGOS::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m) +void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m) { for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -316,7 +318,7 @@ void MaNGOS::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m) } template<class Check> -void MaNGOS::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m) +void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m) { for(DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -326,7 +328,7 @@ void MaNGOS::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m) // Gameobject searchers template<class Check> -void MaNGOS::GameObjectSearcher<Check>::Visit(GameObjectMapType &m) +void Trinity::GameObjectSearcher<Check>::Visit(GameObjectMapType &m) { // already found if(i_object) @@ -343,7 +345,7 @@ void MaNGOS::GameObjectSearcher<Check>::Visit(GameObjectMapType &m) } template<class Check> -void MaNGOS::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m) +void Trinity::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m) { for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) { @@ -353,7 +355,7 @@ void MaNGOS::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m) } template<class Check> -void MaNGOS::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m) +void Trinity::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m) { for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -363,7 +365,7 @@ void MaNGOS::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m) // Unit searchers template<class Check> -void MaNGOS::UnitSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::UnitSearcher<Check>::Visit(CreatureMapType &m) { // already found if(i_object) @@ -380,7 +382,7 @@ void MaNGOS::UnitSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::UnitSearcher<Check>::Visit(PlayerMapType &m) +void Trinity::UnitSearcher<Check>::Visit(PlayerMapType &m) { // already found if(i_object) @@ -397,7 +399,7 @@ void MaNGOS::UnitSearcher<Check>::Visit(PlayerMapType &m) } template<class Check> -void MaNGOS::UnitLastSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::UnitLastSearcher<Check>::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) { @@ -407,7 +409,7 @@ void MaNGOS::UnitLastSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::UnitLastSearcher<Check>::Visit(PlayerMapType &m) +void Trinity::UnitLastSearcher<Check>::Visit(PlayerMapType &m) { for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) { @@ -417,7 +419,7 @@ void MaNGOS::UnitLastSearcher<Check>::Visit(PlayerMapType &m) } template<class Check> -void MaNGOS::UnitListSearcher<Check>::Visit(PlayerMapType &m) +void Trinity::UnitListSearcher<Check>::Visit(PlayerMapType &m) { for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -425,7 +427,7 @@ void MaNGOS::UnitListSearcher<Check>::Visit(PlayerMapType &m) } template<class Check> -void MaNGOS::UnitListSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::UnitListSearcher<Check>::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -435,7 +437,7 @@ void MaNGOS::UnitListSearcher<Check>::Visit(CreatureMapType &m) // Creature searchers template<class Check> -void MaNGOS::CreatureSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::CreatureSearcher<Check>::Visit(CreatureMapType &m) { // already found if(i_object) @@ -452,7 +454,7 @@ void MaNGOS::CreatureSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::CreatureLastSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::CreatureLastSearcher<Check>::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) { @@ -462,7 +464,7 @@ void MaNGOS::CreatureLastSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::CreatureListSearcher<Check>::Visit(CreatureMapType &m) +void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m) { for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if(i_check(itr->getSource())) @@ -470,7 +472,7 @@ void MaNGOS::CreatureListSearcher<Check>::Visit(CreatureMapType &m) } template<class Check> -void MaNGOS::PlayerSearcher<Check>::Visit(PlayerMapType &m) +void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m) { // already found if(i_object) @@ -486,4 +488,4 @@ void MaNGOS::PlayerSearcher<Check>::Visit(PlayerMapType &m) } } -#endif // MANGOS_GRIDNOTIFIERSIMPL_H +#endif // TRINITY_GRIDNOTIFIERSIMPL_H diff --git a/src/game/GridStates.cpp b/src/game/GridStates.cpp index 0c4557fb131..c1680f0a600 100644 --- a/src/game/GridStates.cpp +++ b/src/game/GridStates.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "GridStates.h" diff --git a/src/game/GridStates.h b/src/game/GridStates.h index 8a4e716ece4..fb278347bc3 100644 --- a/src/game/GridStates.h +++ b/src/game/GridStates.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,23 +10,23 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GRIDSTATES_H -#define MANGOS_GRIDSTATES_H +#ifndef TRINITY_GRIDSTATES_H +#define TRINITY_GRIDSTATES_H #include "Map.h" -class MANGOS_DLL_DECL GridState +class TRINITY_DLL_DECL GridState { public: -#ifdef MANGOS_DEBUG +#ifdef TRINITY_DEBUG #define MAGIC_TESTVAL 0xFBE823BA GridState() { i_Magic = MAGIC_TESTVAL; } bool checkMagic() @@ -42,28 +44,28 @@ class MANGOS_DLL_DECL GridState virtual void Update(Map &, NGridType&, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const = 0; }; -class MANGOS_DLL_DECL InvalidState : public GridState +class TRINITY_DLL_DECL InvalidState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; -class MANGOS_DLL_DECL ActiveState : public GridState +class TRINITY_DLL_DECL ActiveState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; -class MANGOS_DLL_DECL IdleState : public GridState +class TRINITY_DLL_DECL IdleState : public GridState { public: void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const; }; -class MANGOS_DLL_DECL RemovalState : public GridState +class TRINITY_DLL_DECL RemovalState : public GridState { public: diff --git a/src/game/Group.cpp b/src/game/Group.cpp index d98a45ff4be..c7d79120bbc 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/Group.h b/src/game/Group.h index 202f5ab4b20..b09a89934f3 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_GROUP_H -#define MANGOSSERVER_GROUP_H +#ifndef TRINITYCORE_GROUP_H +#define TRINITYCORE_GROUP_H #include "GroupReference.h" #include "GroupRefManager.h" @@ -127,7 +129,7 @@ struct InstanceGroupBind /** request member stats checken **/ /** todo: uninvite people that not accepted invite **/ -class MANGOS_DLL_SPEC Group +class TRINITY_DLL_SPEC Group { public: struct MemberSlot diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index f2c05e14f5f..d162397f185 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/GroupRefManager.h b/src/game/GroupRefManager.h index da849214416..4dd23a37414 100644 --- a/src/game/GroupRefManager.h +++ b/src/game/GroupRefManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GROUPREFMANAGER diff --git a/src/game/GroupReference.cpp b/src/game/GroupReference.cpp index 33aff764e92..652807e3701 100644 --- a/src/game/GroupReference.cpp +++ b/src/game/GroupReference.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Player.h" diff --git a/src/game/GroupReference.h b/src/game/GroupReference.h index 1e4453b020a..c49dadddc31 100644 --- a/src/game/GroupReference.h +++ b/src/game/GroupReference.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _GROUPREFERENCE_H @@ -24,7 +26,7 @@ class Group; class Player; -class MANGOS_DLL_SPEC GroupReference : public Reference<Group, Player> +class TRINITY_DLL_SPEC GroupReference : public Reference<Group, Player> { protected: uint8 iSubGroup; diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp index be5616205a2..74daf804901 100644 --- a/src/game/GuardAI.cpp +++ b/src/game/GuardAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "GuardAI.h" diff --git a/src/game/GuardAI.h b/src/game/GuardAI.h index f11dad6870e..3dea421a627 100644 --- a/src/game/GuardAI.h +++ b/src/game/GuardAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,23 +10,23 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_GUARDAI_H -#define MANGOS_GUARDAI_H +#ifndef TRINITY_GUARDAI_H +#define TRINITY_GUARDAI_H #include "CreatureAI.h" #include "Timer.h" class Creature; -class MANGOS_DLL_DECL GuardAI : public CreatureAI +class TRINITY_DLL_DECL GuardAI : public CreatureAI { enum GuardState { diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 90d8a6b93cf..cec6507eb7c 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Database/DatabaseEnv.h" diff --git a/src/game/Guild.h b/src/game/Guild.h index 182e1f45e6e..3f4f5fa32f0 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_GUILD_H -#define MANGOSSERVER_GUILD_H +#ifndef TRINITYCORE_GUILD_H +#define TRINITYCORE_GUILD_H #define WITHDRAW_MONEY_UNLIMITED 0xFFFFFFFF #define WITHDRAW_SLOT_UNLIMITED 0xFFFFFFFF diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index a82a45fde40..4d96b4efae0 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/HateMatrix.h b/src/game/HateMatrix.h index fc0cbcee625..68c5da3bebb 100644 --- a/src/game/HateMatrix.h +++ b/src/game/HateMatrix.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,23 +10,23 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_HATEMATRIX_H -#define MANGOS_HATEMATRIX_H +#ifndef TRINITY_HATEMATRIX_H +#define TRINITY_HATEMATRIX_H #include "Utilities/HashMap.h" #include <cassert> class Unit; -struct MANGOS_DLL_DECL HateMatrix +struct TRINITY_DLL_DECL HateMatrix { typedef hash_map<Unit *, uint32> HateMatrixMapType; diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index 399d437707a..d21dc1b9711 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "HomeMovementGenerator.h" diff --git a/src/game/HomeMovementGenerator.h b/src/game/HomeMovementGenerator.h index aa7dc27a1b1..0ca0b51d155 100644 --- a/src/game/HomeMovementGenerator.h +++ b/src/game/HomeMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_HOMEMOVEMENTGENERATOR_H -#define MANGOS_HOMEMOVEMENTGENERATOR_H +#ifndef TRINITY_HOMEMOVEMENTGENERATOR_H +#define TRINITY_HOMEMOVEMENTGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" @@ -26,10 +28,10 @@ class Creature; template < class T > -class MANGOS_DLL_SPEC HomeMovementGenerator; +class TRINITY_DLL_SPEC HomeMovementGenerator; template <> -class MANGOS_DLL_SPEC HomeMovementGenerator<Creature> +class TRINITY_DLL_SPEC HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> > { public: diff --git a/src/game/HostilRefManager.cpp b/src/game/HostilRefManager.cpp index 5ce8ec4d556..e93f0020f32 100644 --- a/src/game/HostilRefManager.cpp +++ b/src/game/HostilRefManager.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "HostilRefManager.h" diff --git a/src/game/HostilRefManager.h b/src/game/HostilRefManager.h index b4e4707e9fe..1bd3f2407fa 100644 --- a/src/game/HostilRefManager.h +++ b/src/game/HostilRefManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _HOSTILEREFMANAGER diff --git a/src/game/IRCClient.cpp b/src/game/IRCClient.cpp deleted file mode 100644 index 0cd6e7d5dcf..00000000000 --- a/src/game/IRCClient.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*
- * MangChat By |Death| And Cybrax
- *
- * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
- * Of The GNU General Public License
- * Written and Developed by Cybrax. cybraxvd@gmail.com
- * |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
- * With Help And Support From The MaNGOS Project Community.
- * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
- */
-#include "IRCClient.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "MapManager.h"
-
-#include "Policies/SingletonImp.h"
-INSTANTIATE_SINGLETON_1( IRCClient );
-
-#ifdef WIN32
- #define Delay(x) Sleep(x)
-#else
- #define Delay(x) sleep(x / 1000)
-#endif
-// IRCClient Constructor
-IRCClient::IRCClient()
-{
- for(int i = 0;i > 5;i++)
- sIRC.Script_Lock[i] = false;
-}
-// IRCClient Destructor
-IRCClient::~IRCClient(){}
-
-// ZThread Entry This function is called when the thread is created in Master.cpp (mangosd)
-void IRCClient::run()
-{
- sIRC.iLog.WriteLog(" %s : IRC bot started.", sIRC.iLog.GetLogDateTimeStr().c_str());
-
- // before we begin we wait a few
- // mangos is still starting up.
- ZThread::Thread::sleep(500);
- int cCount = 0;
- // Clean Up MySQL Tables
- sLog.outString("Cleaning up IRC_Inchan table...");
- WorldDatabase.PExecute("DELETE FROM `IRC_Inchan`");
- sIRC._Max_Script_Inst = 0;
- // Create a loop to keep the thread running untill active is set to false
- while(sIRC.Active && !World::m_stopEvent)
- {
- // Initialize socket library
- if(this->InitSock())
- {
- // Connect To The IRC Server
- sLog.outString("IRC: Connecting to %s Try # %d ******", sIRC._Host.c_str(), cCount);
- if(this->Connect(sIRC._Host.c_str(), sIRC._Port))
- {
- // On connection success reset the connection counter
- cCount = 0;
- sLog.outString("IRC connected and logging in");
- // Login to the IRC server
- if(this->Login(sIRC._Nick, sIRC._User, sIRC._Pass))
- {
- sLog.outString("IRC logged in and running");
- // While we are connected to the irc server keep listening for data on the socket
- while(sIRC.Connected && !World::m_stopEvent){ sIRC.SockRecv(); }
- }
- sLog.outString("Connection to IRC server lost!");
- }
- // When an error occures or connection lost cleanup
- Disconnect();
- // Increase the connection counter
- cCount++;
- // if MAX_CONNECT_ATTEMPT is reached stop trying
- if(sIRC._MCA != 0 && cCount == sIRC._MCA)
- sIRC.Active = false;
- // If we need to reattempt a connection wait WAIT_CONNECT_TIME milli seconds before we try again
- if(sIRC.Active)
- ZThread::Thread::sleep(sIRC._wct);
- }
- else
- {
- // Socket could not initialize cancel
- sIRC.Active = false;
- sLog.outError("IRC: Could not initialize socket");
- }
- }
- // we need to keep the thread alive or mangos will crash
- // when sending chat or join/leave channels.
- // even when we are not connected the functions must still
- // be availlable where chat is sent to so we keep it running
- while(!World::m_stopEvent){};
-}
diff --git a/src/game/IRCClient.h b/src/game/IRCClient.h deleted file mode 100644 index 31e7b9fbba9..00000000000 --- a/src/game/IRCClient.h +++ /dev/null @@ -1,230 +0,0 @@ -#ifndef _IRC_CLIENT_H
-#define _IRC_CLIENT_H
-
-#include "Policies/Singleton.h"
-#include "Player.h"
-#include "IRCLog.h"
-#include "IRCCmd.h"
-
-using namespace std;
-// The maximum ammount of channels used
-// in the channel array you can have as much channels as you
-// want, but it is important to always have at least equal or more
-// channels then you specify in your mangosd.conf
-#define MAX_CONF_CHANNELS 10
-#define MAX_CHAT_LINES 10
-// time we need to wait before we try another connecton attempt
-// Default is 30 seconds
-#define MAX_SCRIPT_INST 10
-// CLINES is used for the default chatlines
-// By using the GetChatLine function its easier and faster
-// to receieve the line you need.
-enum CLINES
-{
- IRC_WOW = 0,
- WOW_IRC = 1,
- JOIN_WOW = 2,
- JOIN_IRC = 3,
- LEAVE_WOW = 4,
- LEAVE_IRC = 5,
- CHANGE_NICK = 6
-}; // Chatlines
-// CACTION is used by the Handle_WoW_Channel function
-// this function is called in channel.h when a player
-// joins or leave a channel inside the client.
-enum CACTION
-{
- CHANNEL_JOIN,
- CHANNEL_LEAVE,
-};
-
-enum script_Names
-{
- MCS_Players_Online = 0,
-};
-
-// IRCClient main class
-class IRCClient : public ZThread::Runnable
-{
- public:
- // IRCClient Constructor
- IRCClient();
- // IRCClient Destructor
- ~IRCClient();
- // ZThread Entry
- void run();
- public:
- // AH Function
- void AHFunc(uint64 itmid, std::string itmnme, std::string plname, uint32 faction);
- // IRCClient active
- bool Active;
- // Connected to IRC
- bool Connected;
- // Socket indentifier
- int SOCKET;
- fd_set sfdset;
- // Send data to IRC, in addition the endline is added \n
- bool SendIRC(std::string data);
- // This function is called in ChatHandler.cpp and processes the chat from game to IRC
- void Send_WoW_IRC(Player *plr, std::string Channel, std::string Msg);
- // Sends a message to all players on the specified channel
- void Send_WoW_Channel(const char *channel, std::string chat);
- // Send a system message to all players
- void Send_WoW_System(std::string Message);
- // Send a message to the specified IRC channel
- void Send_IRC_Channel(std::string sChannel, std::string sMsg, bool NoPrefix = false, std::string nType = "PRIVMSG");
- // Sends a message to all IRC Channels
- void Send_IRC_Channels(std::string sMsg);
- std::string MakeMsg(std::string msg, std::string var, std::string val)
- {
- std::size_t start = msg.find(var);
- if (start != std::string::npos)
- msg.replace(start, var.length(), val);
- return msg;
- }
- void Send_WoW_Player(string sPlayer, string sMsg);
- void Send_WoW_Player(Player *plr, string sMsg);
-
- // This function is called in Channel.cpp and processes Join/leave messages
- void Handle_WoW_Channel(std::string Channel, Player *plr, int nAction);
- void ResetIRC();
- public:
- void AutoJoinChannel(Player *plr);
-
- public:
- bool Script_Lock[5];
- bool _AmiOp;
-
- public:
- string _Mver;
- // IRC Server host
- string _Host;
- // IRC Server Port
- int _Port;
- // IRC Username
- string _User;
- // IRC Password
- string _Pass;
- // IRC Nickname
- string _Nick;
- // Authentication type
- int _Auth;
- string _Auth_Nick;
- // IRC Connect code
- string _ICC;
- // IRC Default channel
- string _defchan;
- // IRC Leave Default channel
- int _ldefc;
- // Wait Connect Time
- int _wct;
- // BotMask Options
- int Botmask;
- // Status Channel
- int Status;
- // Announce Channel
- int anchn;
- int autoanc;
- // IRC Channel count
- int _chan_count;
- // IRC Channel list
- // Array to store our IRC channels
- // each element will corrospond
- // with _wow_chan array below.
- std::string _irc_chan[MAX_CONF_CHANNELS];
- // Game Channel list
- std::string _wow_chan[MAX_CONF_CHANNELS];
- // AutoJoin Options
- int ajoin;
- string ajchan;
- // Online Command Max Results
- int onlrslt;
- // Channel OnJoin/Restart/Kick Messages
- string JoinMsg;
- string RstMsg;
- string kikmsg;
- // Misc Options
- string ojGM1;
- string ojGM2;
- string ojGM3;
- string ojGM4;
- string ojGM5;
- string logfile;
- int games;
- int gmlog;
- // IRC Commands Security Level
- int CACCT;
- int CBAN;
- int CCHAN;
- int CCHAR;
- int CFUN;
- int CHELP;
- int CINCHAN;
- int CINFO;
- int CITEM;
- int CJAIL;
- int CKICK;
- int _KILL;
- int CLEVEL;
- int CLOOKUP;
- int CMONEY;
- int CMUTE;
- int CONLINE;
- int CPM;
- int CRESTART;
- int CREVIVE;
- int CSAVEALL;
- int CSHUTDOWN;
- int CSPELL;
- int CSYSMSG;
- int CTELE;
- int CTOP;
- int CWHO;
- // BotMask
- int BOTMASK;
- // Max connect attempt
- int _MCA;
- // Auto rejoin when kicked from irc
- int _autojoinkick;
- // IRC Command prefix
- string _cmd_prefx;
- int _op_gm;
- int _op_gm_lev;
- // Array that contains our chatlines from the conf file
- // To increase this value change the MAX_CHAT_LINE define above
- // Make sure the number of elements must match your items
- // (remeber this starts at 0 so 0..9 is 10 items)
- // and that you load the line in the LoadConfig function.
- string ILINES[MAX_CHAT_LINES];
- string GetChatLine(int nItem);
-
- int _Max_Script_Inst;
- // MAX_SCRIPT_INST
-
- IRCLog iLog;
-
-public:
- // Load MangChat configuration file
- bool LoadConfig(char const* cfgfile);
- void SetCfg(char const* cfgfile);
- char const* CfgFile;
-
-private:
- // Returns default chatline based on enum CLINES
- // Initialize socket library
- bool InitSock();
- // Connect to IRC Server
- bool Connect(const char *cHost, int nPort);
- // Login to IRC Server
- bool Login(std::string sNick, std::string sUser, std::string sPass);
- // Send raw data to IRC
- bool SendData(const char *data);
- // Disconnect from IRC and cleanup socket
- void Disconnect();
- // Processes the data receieved from IRC
- void Handle_IRC(std::string sData);
- // Receieves data from the socket.
- void SockRecv();
-};
-#endif
-#define sIRC MaNGOS::Singleton<IRCClient>::Instance()
diff --git a/src/game/IRCCmd.cpp b/src/game/IRCCmd.cpp deleted file mode 100644 index 62e5e565d75..00000000000 --- a/src/game/IRCCmd.cpp +++ /dev/null @@ -1,827 +0,0 @@ -/*
- * MangChat By |Death| And Cybrax
- *
- * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
- * Of The GNU General Public License
- * Written and Developed by Cybrax. cybraxvd@gmail.com
- * |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
- * With Help And Support From The MaNGOS Project Community.
- * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
- */
-#include "IRCCmd.h"
-#include "IRCClient.h"
-#include "Database/DatabaseEnv.h"
-#include "ObjectMgr.h"
-#include "MapManager.h"
-// Constructor
-IRCCmd::IRCCmd(){}
-// Destructor
-IRCCmd::~IRCCmd(){}
-
-std::string IRCCmd::MakeUpper(std::string Channel)
-{
- std::string tmpchan = Channel;
- std::transform(tmpchan.begin(), tmpchan.end(), tmpchan.begin(), towupper);
- return tmpchan;
-}
-bool IRCCmd::ParamsValid(_CDATA *CD, int pCnt)
-{
- CD->PCOUNT = pCnt;
- if(CD->PARAMS.size() == 0)
- return false;
- return ValidParams(CD->PARAMS, pCnt);
-}
-
-int IRCCmd::ParamsValid(_CDATA *CD, int pCnt, int rLev)
-{
- //CD->PCOUNT = pCnt;
- if(!CanUse(CD->USER, rLev))
- return E_AUTH;
- else if(pCnt == 0)
- return E_OK;
- else if(CD->PARAMS.size() == 0)
- return E_SIZE;
- else if(!ValidParams(CD->PARAMS, pCnt))
- return E_SIZE;
- return E_OK;
-}
-
-// This function checks if chat from irc is a command or not
-// return true on yes and false on no
-bool IRCCmd::IsValid(std::string USER, std::string FROM, std::string CHAT, std::string TYPE)
-{
- // If the first line of our chat is the command prefix we have a command
- if(CHAT.substr(0, 1) == sIRC._cmd_prefx && CHAT.size() > 1 )
- {
- _CDATA CDATA;
- bool cValid = false;
- bool AuthValid = true;
- bool dontlog = true;
- std::string* _PARAMS = getArray(CHAT, 2);
- CDATA.USER = USER;
- CDATA.FROM = FROM;
- CDATA.TYPE = TYPE;
- CDATA.PCOUNT = 0;
- CDATA.CMD = MakeUpper(_PARAMS[0].substr(1, _PARAMS[0].size() - 1));
- CDATA.PARAMS = _PARAMS[1];
- if(CDATA.CMD == "LOGIN")
- {
- if(FROM == sIRC._Nick)
- {
- if(ParamsValid(&CDATA, 2))
- Handle_Login(&CDATA);
- else
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"login <Player> <Password> )", true, "ERROR");
- }
- else
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Please Send A PM To Login!", true, "ERROR");
- if(GetLevel(USER) >= sIRC.gmlog)
- dontlog = false;
- cValid = true;
- }
- else if(CDATA.CMD == "LOGOUT")
- {
- if(FROM == sIRC._Nick)
- {
- Handle_Logout(&CDATA);
- }
- else
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Please Send A PM To Logout!", true, "ERROR");
- cValid = true;
- }
- else if(CDATA.CMD == "ACCT")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CACCT))
- {
- case E_OK:
- Account_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"acct <Player> <(un)lock/mail/pass/rename> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "BAN")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CBAN))
- {
- case E_OK:
- Ban_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"ban <Player> <acct/ip> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "CHAN")
- {
- switch(ParamsValid(&CDATA, 1, sIRC.CCHAN))
- {
- case E_OK:
- Chan_Control(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"chan <op> <IRC User> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "CHAR")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CCHAR))
- {
- case E_OK:
- Char_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"char <Player> <mailcheat/taxicheat/maxskill/setskill> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "FUN")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CFUN))
- {
- case E_OK:
- Fun_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"fun <Player> <Sound/Say> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "HELP")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CHELP))
- {
- case E_OK:
- Help_IRC(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"help <Command> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "INCHAN")
- {
- switch(ParamsValid(&CDATA, 1, sIRC.CINCHAN))
- {
- case E_OK:
- Inchan_Server(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"inchan <Channel> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "INFO")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CINFO))
- {
- case E_OK:
- Info_Server(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"info )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "ITEM")
- {
- CDATA.PCOUNT = 3;
- switch(ParamsValid(&CDATA, 2, sIRC.CITEM))
- {
- case E_OK:
- Item_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"item <Player> <add> <ItemID/[ItemName]> <Amount> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "JAIL")
- {
- CDATA.PCOUNT = 3;
- switch(ParamsValid(&CDATA, 1, sIRC.CJAIL))
- {
- case E_OK:
- Jail_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"jail <Player> <release/Reason>)", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "KICK")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 1, sIRC.CKICK))
- {
- case E_OK:
- Kick_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"kick <Player> <Reason> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "KILL")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 1, sIRC._KILL))
- {
- case E_OK:
- Kill_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"kill <Player> <Reason> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "LEVEL")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 2, sIRC.CLEVEL))
- {
- case E_OK:
- Level_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"level <Player> <NewLevel> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "LOOKUP")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 2, sIRC.CLOOKUP))
- {
- case E_OK:
- Lookup_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"lookup <acct/char/creature/faction/go/item/quest/skill/spell/tele> <ID/Name> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "MONEY")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 2, sIRC.CMONEY))
- {
- case E_OK:
- Money_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"money <Player> <(-)Money> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "MUTE")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CMUTE))
- {
- case E_OK:
- Mute_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"mute <Player> <release/TimeInMins> <Reason> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "ONLINE")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CONLINE))
- {
- case E_OK:
- Online_Players(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"online )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "PM")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CPM))
- {
- case E_OK:
- PM_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"pm <Player> <Message> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "RELOAD")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CRESTART))
- {
- case E_OK:
- sIRC.Send_IRC_Channels("Reloading MangChat Config Options. (Command Disabled)");
- //sIRC.LoadConfig();
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "RESTART")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CRESTART))
- {
- case E_OK:
- sIRC.Send_IRC_Channels(sIRC.RstMsg);
- sIRC.ResetIRC();
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "REVIVE")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 1, sIRC.CREVIVE))
- {
- case E_OK:
- Revive_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"revive <Player> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "SAVEALL")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CSAVEALL))
- {
- case E_OK:
- Saveall_Player(&CDATA);
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "SHUTDOWN")
- {
- switch(ParamsValid(&CDATA, 1, sIRC.CSHUTDOWN))
- {
- case E_OK:
- Shutdown_Mangos(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"shutdown <TimeInSeconds> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "SPELL")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CSPELL))
- {
- case E_OK:
- Spell_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"spell <Player> <Cast/Learn/UnLearn> <SpellID> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "SYSMSG")
- {
- CDATA.PCOUNT = 2;
- switch(ParamsValid(&CDATA, 2, sIRC.CSYSMSG))
- {
- case E_OK:
- Sysmsg_Server(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"sysmsg <a/e/n/add/del/list> <Message> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "TELE")
- {
- switch(ParamsValid(&CDATA, 2, sIRC.CTELE))
- {
- case E_OK:
- Tele_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"tele <Player> <l/c/r/to> <Loc.Name/MAPID X Y Z/Recall/Player> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "TOP")
- {
- CDATA.PCOUNT = 1;
- switch(ParamsValid(&CDATA, 1, sIRC.CTOP))
- {
- case E_OK:
- Top_Player(&CDATA);
- break;
- case E_SIZE:
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"top <accttime/chartime/money> <limit> )", true, "ERROR");
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- else if(CDATA.CMD == "WHO")
- {
- switch(ParamsValid(&CDATA, 0, sIRC.CWHO))
- {
- case E_OK:
- Who_Logged(&CDATA);
- break;
- case E_AUTH:
- AuthValid = false;
- break;
- }
- cValid = true;
- }
- if(!AuthValid && IsLoggedIn(USER))
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Access Denied! Your Security Level Is Too Low To Use This Command!", true, "ERROR");
- if(cValid == false && (sIRC.BOTMASK & 4) != 0)
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Unknown Command!", true, "ERROR");
- if(cValid && dontlog)
- {
- sIRC.iLog.WriteLog(" %s : [ %s(%d) ] Used Command: [ %s ] With Parameters: [ %s ]", sIRC.iLog.GetLogDateTimeStr().c_str(), CDATA.USER.c_str(), GetLevel(USER), CDATA.CMD.c_str(), CDATA.PARAMS.c_str());
- }
- return cValid;
- }
- return false;
-}
-
-bool IRCCmd::CanUse(std::string USER, int nLevel)
-{
- if(IsLoggedIn(USER))
- {
- if(GetLevel(USER) >= nLevel)
- return true;
- else
- return false;
- }
- else if(nLevel == 0)
- {
- return true;
- }
- else
- sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : You Are Not Logged In!", true, "ERROR");
- return false;
-}
-
-std::string IRCCmd::ChanOrPM(_CDATA *CD)
-{
- if(CD->FROM == sIRC._Nick)
- return CD->USER;
- else
- return CD->FROM;
-}
-
-Player *IRCCmd::GetPlayer(std::string WHO)
-{
- normalizePlayerName(WHO);
- return ObjectAccessor::Instance().FindPlayerByName(WHO.c_str());
-}
-
-_client *IRCCmd::GetClient(std::string cname)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->Name == cname)
- return (*i);
- }
- return (NULL);
-}
-
-bool IRCCmd::IsLoggedIn(std::string USER)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->Name == USER)
- return true;
- }
- return false;
-}
-
-bool IRCCmd::AcctIsLoggedIn(std::string USER)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if(MakeUpper((*i)->UName) == MakeUpper(USER))
- return true;
- }
- return false;
-}
-
-std::string IRCCmd::AcctIsBanned(std::string ACCT)
-{
- uint32 acctid = objmgr.GetAccountByAccountName(ACCT);
- std::string banned = "NOTBANNED";
- QueryResult *result = loginDatabase.PQuery("SELECT banreason FROM ip_banned WHERE ip=(SELECT last_ip FROM account WHERE id = '%i')", acctid);
- if(result)
- {
- banned = (*result)[0].GetCppString();
- delete result;
- return "IP Banned. Reason:" + banned;
- }
- QueryResult *result2 = loginDatabase.PQuery("SELECT banreason FROM account_banned WHERE id='%i'", acctid);
- if(result2)
- {
- banned = (*result2)[0].GetCppString();
- delete result2;
- return "Account Banned. Reason:" + banned;
- }
- return banned;
-}
-
-int IRCCmd::GetLevel(std::string sName)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->Name == sName)
- return (*i)->GMLevel;
- }
- return 0;
-}
-
-int IRCCmd::AcctLevel(std::string plnme)
-{
- uint64 guid = objmgr.GetPlayerGUIDByName(plnme);
- uint32 account_id = 0;
- uint32 security = 0;
- account_id = objmgr.GetPlayerAccountIdByGUID(guid);
- security = objmgr.GetSecurityByAccount(account_id);
- return security;
-}
-
-std::string IRCCmd::GetAccName(std::string sName)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->Name == sName)
- return (*i)->UName;
- }
- return "";
-}
-
-std::string IRCCmd::GetNameFromAcct(std::string sName)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->UName == sName)
- return (*i)->Name;
- }
- return "";
-}
-
-int IRCCmd::GetAcctIDFromName(std::string sName)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->Name == sName)
- {
- uint32 acct_id = 0;
- acct_id = objmgr.GetAccountByAccountName((*i)->UName.c_str());
- return acct_id;
- }
- }
- return 0;
-}
-
-std::string IRCCmd::GetAcctNameFromID(uint32 acctid)
-{
- QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%d'", acctid);
- if(result)
- {
- std::string name = (*result)[0].GetCppString();
- delete result;
- return name;
- }
-
- return "";
-}
-
-std::string IRCCmd::GetIPFromPlayer(std::string player)
-{
- QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", player.c_str());
- if(result)
- {
- std::string acctid = (*result)[0].GetCppString();
- delete result;
- QueryResult *result2 = loginDatabase.PQuery("SELECT last_ip FROM account WHERE id = '%s'", acctid.c_str());
- if(result2)
- {
- std::string ip = (*result2)[0].GetCppString();
- delete result2;
- return ip;
- }
- }
-
- return "";
-}
-
-std::string IRCCmd::SecToDay(std::string secons)
-{
- unsigned int seconds = atoi(secons.c_str());
- unsigned int days = seconds / 86400;
- unsigned int hours = seconds / 3600 % 24;
- unsigned int mins = seconds / 60 % 60;
- char tottime[1000];
- sprintf(tottime, "%iDays:%iHours:%iMinutes", days, hours, mins);
-
- return tottime;
-}
-
-bool IRCCmd::ValidParams(std::string PARAMS, int nCount)
-{
- if(nCount == 1 && PARAMS.size() == 0)
- return false;
- int pcount = 0;
- size_t p = -1;
- for(int i = 0;i < nCount;i++)
- {
- p = PARAMS.find(" ", p + 1);
- if(p == -1)
- break;
- else
- pcount++;
- }
- nCount--;
- if(pcount >= nCount)
- return true;
- else
- return false;
-}
-
-std::string* IRCCmd::getArray(std::string PARAMS, int nCount)
-{
- std::string *array = new std::string[nCount];
- if(PARAMS.size() > 0)
- {
- int pcnt = 0;
- size_t ps = 0;
- size_t pc = -1;
- for(int i = 0;i < nCount;i++)
- {
- pc = PARAMS.find(" ", pc + 1);
- if(i + 1 == nCount && nCount != 1)
- {
- if(ps > 0 && pc > 0)
- array[i] = PARAMS.substr(ps, PARAMS.size() - ps);
- }
- else
- array[i] = PARAMS.substr(ps, pc - ps);
- ps = pc + 1;
- }
- }
- return array;
-}
-
-std::string IRCCmd::MakeMsg(const char *sLine, ... )
-{
- va_list ap;
- char tmpoutp[1024];
- va_start(ap, sLine);
- vsnprintf(tmpoutp, 1024, sLine, ap );
- va_end(ap);
- std::string outp = tmpoutp;
- return outp;
-}
-
-void IRCClient::AHFunc(uint64 itmid, std::string itmnme, std::string plname, uint32 faction)
-{
- IRCCmd Command;
- Player* plr = Command.GetPlayer(plname);
- if(plr)
- {
- std::string itemname = itmnme;
-
- char temp [7];
- sprintf(temp, "%u", itmid);
- std::string itemid = temp;
-
- std::string wowname = "";
- std::string ircname = "";
- switch (plr->GetTeam())
- {
- case 67:wowname="|cffff0000"+plname+"|r";ircname="\0034"+plname;break; //horde
- case 469:wowname="|cff1589FF"+plname+"|r";ircname="\00312"+plname;break; //alliance
- }
-
- std::string wowfact = "|cffFF8040[Auction House]:|r";
- std::string ircfact = "\00304,08\037/!\\\037\017\00307 Auction House \00304,08\037/!\\\037\017";
- switch(faction)
- {
- //neutral
- case 7:wowfact="|cffff8040[Neutral Auction House]:|r";ircfact="\00304,08\037/!\\\037\017\00307 Neutral Auction House \00304,08\037/!\\\037\017";break;
- //horde
- case 6:wowfact="|cffff0000[Horde Auction House]:|r";ircfact="\00304,08\037/!\\\037\017\00304 Horde Auction House \00304,08\037/!\\\037\017";break;
- //alliance
- case 2:wowfact="|cff1589FF[Alliance Auction House]:|r";ircfact="\00304,08\037/!\\\037\017\00312 Alliance Auction House \00304,08\037/!\\\037\017";break;
- }
- std::string wowstr = Command.MakeMsg("%s A New Item Has Been Added |cffffffff|Hitem:%s:0:0:0:0:0:0:0|h[%s]|h|r. By: %s",wowfact.c_str(), itemid.c_str(), itemname.c_str(), wowname.c_str());
- std::string ircstr = Command.MakeMsg("%s A New Item Has Been Added [%s]. By: %s", ircfact.c_str(), itemname.c_str(), ircname.c_str());
-
- sIRC.Send_WoW_Channel(sIRC._wow_chan[sIRC.Status].c_str(), wowstr.c_str());
- sIRC.Send_IRC_Channel(sIRC._irc_chan[sIRC.Status].c_str(), ircstr.c_str());
- }
-}
diff --git a/src/game/IRCCmd.h b/src/game/IRCCmd.h deleted file mode 100644 index f2b442c6173..00000000000 --- a/src/game/IRCCmd.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef _IRC_CMD_H
-#define _IRC_CMD_H
-
-#define MAX_CLIENTS 50
-#include "Common.h"
-#include "Player.h"
-#include "ObjectAccessor.h"
-
-struct ChannelUser
-{
- int UserType;
- std::string Name;
- std::string UName;
- int UserLevel;
-};
-
-struct _client
-{
- bool LoggedIn;
- std::string Name;
- std::string UName;
- int GMLevel;
-};
-struct _CDATA
-{
- std::string CMD;
- std::string USER;
- std::string FROM;
- std::string PARAMS;
- std::string TYPE;
- int PCOUNT;
-};
-enum APVERR
-{
- E_OK,
- E_SIZE,
- E_AUTH,
- E_IVALID,
-};
-enum ESOUNDS
-{
- S_ENTERWORLD = 602,
- S_QUESTFAILED = 847,
- S_INVITE = 880,
- S_LEVELUP = 888,
- S_COINSOUND = 895,
- S_WHISPER = 3081,
- S_STEALTH = 3325,
-};
-class IRCCmd
-{
- public:
- IRCCmd();
- ~IRCCmd();
-
- void Handle_Logout(_CDATA *CD);
- bool IsLoggedIn(std::string USER);
- bool IsValid(std::string USER, std::string FROM, std::string CHAT, std::string TYPE);
- bool AcctIsLoggedIn(std::string USER);
- _client *GetClient(std::string cname);
-
- public:
- static std::string MakeMsg(const char *sLine, ... );
- static std::string ChanOrPM(_CDATA *CD);
- int AcctLevel(std::string plnme);
- int GetLevel(std::string sName);
- std::string MakeUpper(std::string Channel);
- std::string AcctIsBanned(std::string ACCT);
- std::list<_client*> _CLIENTS;
- Player* GetPlayer(std::string WHO);
-
- private:
- // MangChat Commands
- void Handle_Login(_CDATA *CD);
- void Account_Player(_CDATA *CD);
- void Ban_Player(_CDATA *CD);
- void Chan_Control(_CDATA *CD);
- void Char_Player(_CDATA *CD);
- void Fun_Player(_CDATA *CD);
- void Help_IRC(_CDATA *CD);
- void Item_Player(_CDATA *CD);
- void Inchan_Server(_CDATA *CD);
- void Info_Server(_CDATA *CD);
- void Jail_Player(_CDATA *CD);
- void Kick_Player(_CDATA *CD);
- void Kill_Player(_CDATA *CD);
- void Level_Player(_CDATA *CD);
- void Lookup_Player(_CDATA *CD);
- void Money_Player(_CDATA *CD);
- void Mute_Player(_CDATA *CD);
- void Online_Players(_CDATA *CD);
- void PM_Player(_CDATA *CD);
- void Revive_Player(_CDATA *CD);
- void Saveall_Player(_CDATA *CD);
- void Shutdown_Mangos(_CDATA *CD);
- void Spell_Player(_CDATA *CD);
- void Sysmsg_Server(_CDATA *CD);
- void Tele_Player(_CDATA *CD);
- void Top_Player(_CDATA *CD);
- void Who_Logged(_CDATA *CD);
- bool CanUse(std::string USER, int nLevel);
- bool ValidParams(std::string PARAMS, int nCount = 1);
- bool ParamsValid(_CDATA *CD, int pCnt);
- int ParamsValid(_CDATA *CD, int pCnt, int rLev);
- std::string GetAccName(std::string sName);
- std::string GetNameFromAcct(std::string sName);
- std::string GetAcctNameFromID(uint32 acctid);
- std::string GetIPFromPlayer(std::string player);
- std::string SecToDay(std::string secons);
- int GetAcctIDFromName(std::string sName);
- std::string* getArray(std::string PARAMS, int nCount = 1);
-};
-inline void MakeLower(std::string& str)
-{
- std::transform( str.begin(), str.end(), str.begin(), ::tolower );
-}
-#endif
diff --git a/src/game/IRCCmde.cpp b/src/game/IRCCmde.cpp deleted file mode 100644 index ec1ccfae808..00000000000 --- a/src/game/IRCCmde.cpp +++ /dev/null @@ -1,1884 +0,0 @@ -/*
- * MangChat By |Death| And Cybrax
- *
- * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
- * Of The GNU General Public License
- * Written and Developed by Cybrax. cybraxvd@gmail.com
- * |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
- * With Help And Support From The MaNGOS Project Community.
- * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
- */
-#include "IRCCmd.h"
-#include "IRCClient.h"
-#include "MCS_OnlinePlayers.h"
-#include "WorldPacket.h"
-#include "Database/DatabaseEnv.h"
-#include "Chat.h"
-#include "MapManager.h"
-#include "World.h"
-#include "Guild.h"
-#include "ObjectMgr.h"
-#include "Language.h"
-#include "SpellAuras.h"
-#include "SystemConfig.h"
-#include "Config/ConfigEnv.h"
-
-#define Send_Player(p, m) sIRC.Send_WoW_Player(p, m)
-#define Send_IRCA(c, m, b, t) sIRC.Send_IRC_Channel(c, m, b, t)
-
-#ifdef WIN32
-#define Delay(x) Sleep(x)
-#else
-#define Delay(x) sleep(x / 1000)
-#endif
-
-void IRCCmd::Handle_Login(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 2);
- std::string isbanned = AcctIsBanned(_PARAMS[0]);
- if(isbanned == "NOTBANNED")
- {
- if(!IsLoggedIn(CD->USER))
- {
- if(!AcctIsLoggedIn(_PARAMS[0].c_str()))
- {
- QueryResult *result = loginDatabase.PQuery("SELECT `gmlevel` FROM `account` WHERE `username`='%s' AND `sha_pass_hash`=SHA1(CONCAT(UPPER(`username`),':',UPPER('%s')));", _PARAMS[0].c_str(), _PARAMS[1].c_str());
- if (result)
- {
- Field *fields = result->Fetch();
- int GMLevel = fields[0].GetInt16();
- if(GMLevel >= 0)
- {
- _client *NewClient = new _client();
- NewClient->Name = CD->USER;
- NewClient->UName = MakeUpper(_PARAMS[0]);
- NewClient->GMLevel = fields[0].GetInt16();
- _CLIENTS.push_back(NewClient);
- Send_IRCA(CD->USER, MakeMsg("You Are Now Logged In As %s, Welcome To MangChat Admin Mode.", _PARAMS[0].c_str()), true, CD->TYPE);
-
- if(sIRC._op_gm == 1 && GMLevel >= sIRC._op_gm_lev)
- {
- for(int i=1;i < sIRC._chan_count + 1;i++)
- sIRC.SendIRC("MODE #"+sIRC._irc_chan[i]+" +o "+CD->USER );
- }
- }
- }else
- Send_IRCA(CD->USER, "\0034[ERROR] : Sorry, Your Username Or Password Is Incorrect. Please Try Again. ", true, "ERROR");
- }else
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : %s Is Already Logged In With This Username. ", GetNameFromAcct(MakeUpper(_PARAMS[0])).c_str()), true, "ERROR");
- }else
- Send_IRCA(CD->USER, "\0034[ERROR] : You Are Already Logged In As "+ _PARAMS[0] +"!", true, "ERROR");
- }else
- Send_IRCA(CD->USER, "\0034[ERROR] : Sorry You Are "+isbanned+". You Cannot Log In To MangChat "+CD->USER.c_str()+"!", true, "ERROR");
-}
-
-void IRCCmd::Handle_Logout(_CDATA *CD)
-{
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- if((*i)->Name == CD->USER)
- {
- _CLIENTS.erase(i);
- delete (*i);
- Send_IRCA(CD->USER, "You Are Now Logged Out!", true, CD->TYPE);
- return;
- }
- }
- Send_IRCA(CD->USER, "\0034[ERROR] : You Are Not Logged In!", true, "ERROR");
-}
-
-void IRCCmd::Account_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 3);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- normalizePlayerName(_PARAMS[0]);
- uint64 guid = objmgr.GetPlayerGUIDByName(_PARAMS[0]);
- uint32 account_id = 0;
- account_id = objmgr.GetPlayerAccountIdByGUID(guid);
- if(account_id)
- {
- if(account_id == GetAcctIDFromName(CD->USER) || GetLevel(CD->USER) >= sIRC._op_gm_lev)
- {
- Player* plr = objmgr.GetPlayer(guid);
- if(_PARAMS[1] == "lock")
- {
- loginDatabase.PExecute( "UPDATE `account` SET `locked` = '1' WHERE `id` = '%d'",account_id);
- if(plr) Send_Player(plr, MakeMsg("Your Account Has Been Locked To Your Current IP By: %s", CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+GetAcctNameFromID(account_id)+"] : Account Has Been Locked To Their Current IP Address.", true, CD->TYPE);
- }
- else if(_PARAMS[1] == "unlock")
- {
- loginDatabase.PExecute( "UPDATE `account` SET `locked` = '0' WHERE `id` = '%d'",account_id);
- if(plr) Send_Player(plr, MakeMsg("Your Account Has Been UnLocked From The Associated IP By: %s", CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+GetAcctNameFromID(account_id)+"] : Account Has Been UnLocked From The Associated IP Address.", true, CD->TYPE);
- }
- else if(_PARAMS[1] == "mail")
- {
- loginDatabase.PExecute( "UPDATE `account` SET `email` = '%s' WHERE `id` = '%d'",_PARAMS[2].c_str() ,account_id);
- if (plr) Send_Player(plr, MakeMsg("%s Has Changed Your EMail Adress To: %s", CD->USER.c_str(), _PARAMS[2].c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+GetAcctNameFromID(account_id)+"] : EMail Address Successfully Changed To: "+_PARAMS[2], true, CD->TYPE);
- }
- else if(_PARAMS[1] == "pass")
- {
- loginDatabase.PExecute( "UPDATE `account` SET `sha_pass_hash` = SHA1(CONCAT(UPPER(`username`),':',UPPER('%s'))) WHERE `id` = '%d'",_PARAMS[2].c_str() ,account_id);
- if (plr) Send_Player(plr, MakeMsg("%s Has Changed Your Password To: %s", CD->USER.c_str(), _PARAMS[2].c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+GetAcctNameFromID(account_id)+"] : Password Successfully Changed To: "+_PARAMS[2], true, CD->TYPE);
- }
- else if(_PARAMS[1] == "rename")
- {
- if(plr)
- {
- plr->SetAtLoginFlag(AT_LOGIN_RENAME);
- Send_Player(plr, MakeMsg("%s Has Requested You Change This Characters Name, Rename Will Be Forced On Next Login!", CD->USER.c_str()));
- }
- CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '1' WHERE `guid` = '%u'", guid);
- Send_IRCA(ChanOrPM(CD), "\00313["+GetAcctNameFromID(account_id)+"] : Has Been Forced To Change Their Characters Name, Rename Will Be Forced On Next Login!", true, CD->TYPE);
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : You Are Not A GM, You May Only Change Settings In Your Own Account.", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Such Player Exists, So Account Cannot Be Looked Up.", true, "ERROR");
-}
-
-void IRCCmd::Ban_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 3);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- if(_PARAMS[1] == "ip")
- {
- std::string ip = GetIPFromPlayer(_PARAMS[0]);
- if(_PARAMS[2] == "")
- _PARAMS[2] = "No Reason";
- if(ip != "")
- {
- loginDatabase.PExecute( "INSERT IGNORE INTO `ip_banned` VALUES ('%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), '%s', '%s')", ip.c_str(), CD->USER.c_str(), _PARAMS[2].c_str());
- if (Player* plr = GetPlayer(_PARAMS[0]))
- plr->GetSession()->KickPlayer();
- Send_IRCA(ChanOrPM(CD), MakeMsg("\00313[%s] : Has Had Their IP Address Banned. [%s] Reason: %s",_PARAMS[0].c_str() ,ip.c_str() , _PARAMS[2].c_str()), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : I Cannot Locate An IP Address For The Character Name Given.", true, "ERROR");
- }
- if(_PARAMS[1] == "acct")
- {
- uint64 guid = objmgr.GetPlayerGUIDByName(_PARAMS[0].c_str());
- uint32 acctid = objmgr.GetPlayerAccountIdByGUID(guid);
- if(_PARAMS[2] == "")
- _PARAMS[2] = "No Reason";
- if(acctid)
- {
- loginDatabase.PExecute( "INSERT INTO `account_banned` VALUES ('%u', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), '%s', '%s', 1)", acctid, CD->USER.c_str(), _PARAMS[2].c_str());
- if (Player* plr = GetPlayer(_PARAMS[0]))
- plr->GetSession()->KickPlayer();
- Send_IRCA(ChanOrPM(CD), MakeMsg("\00313[%s] : Has Had Their Account Banned. Reason: %s",_PARAMS[0].c_str(), _PARAMS[2].c_str()), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : I Cannot Locate An Account For The Character Name Given.", true, "ERROR");
- }
- if(_PARAMS[1] == "unban")
- {
- std::string unbani = _PARAMS[0];
- if(atoi(unbani.c_str()) > 0)
- {
- loginDatabase.PExecute( "DELETE FROM ip_banned WHERE ip = '%s'", _PARAMS[0].c_str());
- Send_IRCA(ChanOrPM(CD), MakeMsg("\00313[%s] : Has Been Removed From The IP Ban List.", _PARAMS[0].c_str()), true, CD->TYPE);
- }
- else
- {
- QueryResult *result = loginDatabase.PQuery("SELECT id FROM `account` WHERE username = '%s'", _PARAMS[0].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string id = fields[0].GetCppString();
-
- loginDatabase.PExecute( "DELETE FROM account_banned WHERE id = %s", id.c_str());
- delete result;
- Send_IRCA(ChanOrPM(CD), MakeMsg("\00313[%s] : Has Been Removed From The Account Ban List.", _PARAMS[0].c_str()), true, CD->TYPE);
-
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : I Cannot Locate An Account Or IP Address For The Paramaters Given.", true, "ERROR");
- }
- }
-}
-
-void IRCCmd::Chan_Control(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 2);
- if(CD->FROM == sIRC._Nick)
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : You Cannot Use This Command Through A PM Yet.", true, "ERROR");
- return;
- }
- if(_PARAMS[0] == "op")
- {
- if(_PARAMS[1].length() > 1)
- sIRC.SendIRC("MODE "+CD->FROM+" +o "+_PARAMS[1] );
- else
- sIRC.SendIRC("MODE "+CD->FROM+" +o "+CD->USER );
- }
- if(_PARAMS[0] == "deop")
- {
- if(_PARAMS[1].length() > 1)
- sIRC.SendIRC("MODE "+CD->FROM+" -o "+_PARAMS[1] );
- else
- sIRC.SendIRC("MODE "+CD->FROM+" -o "+CD->USER );
- }
- if(_PARAMS[0] == "voice")
- {
- if(_PARAMS[1].length() > 1)
- sIRC.SendIRC("MODE "+CD->FROM+" +v "+_PARAMS[1] );
- else
- sIRC.SendIRC("MODE "+CD->FROM+" +v "+CD->USER );
- }
- if(_PARAMS[0] == "devoice")
- {
- if(_PARAMS[1].length() > 1)
- sIRC.SendIRC("MODE "+CD->FROM+" -v "+_PARAMS[1] );
- else
- sIRC.SendIRC("MODE "+CD->FROM+" -v "+CD->USER );
- }
-}
-
-void IRCCmd::Char_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 5);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- normalizePlayerName(_PARAMS[0]);
- uint64 guid = objmgr.GetPlayerGUIDByName(_PARAMS[0]);
- Player* plr = objmgr.GetPlayer(guid);
- if(plr)
- {
- if(_PARAMS[1] == "mapcheat")
- {
- bool explore = false;
- if (_PARAMS[2] != "0")
- explore = true;
- for (uint8 i=0; i<64; i++)
- {
- if (_PARAMS[2] != "0")
- plr->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF);
- else
- plr->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0);
- }
- if(explore)
- {
- Send_Player(plr, MakeMsg("All Your Zones Have Been Set To Explored By: %s", CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Now Explored All Zones.", true, CD->TYPE);
- }
- else
- {
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Now Had All Zones Set To Un-Explored.", true, CD->TYPE);
- Send_Player(plr, MakeMsg("All Your Zones Have Been Set To Un-Explored By: %s", CD->USER.c_str()));
- }
- }
- if(_PARAMS[1] == "taxicheat")
- {
- if (_PARAMS[2] != "0")
- {
- plr->SetTaxiCheater(true);
- Send_Player(plr, MakeMsg("Taxi Node Cheat Has Been Enabled By: %s", CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Taxi Node Cheat Has Been Enabled.", true, CD->TYPE);
- }
- else
- {
- plr->SetTaxiCheater(false);
- Send_Player(plr, MakeMsg("Taxi Node Cheat Has Been Disabled By: %s", CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Taxi Node Cheat Has Been Disabled.", true, CD->TYPE);
- }
- }
- if(_PARAMS[1] == "maxskill")
- {
- plr->UpdateSkillsToMaxSkillsForLevel();
- Send_Player(plr, MakeMsg("Your Skills Have Been Maxed Out By: %s", CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Skills Have Been Maxed Out.", true, CD->TYPE);
- }
- if(_PARAMS[1] == "setskill")
- {
- std::string* _PARAMSA = getArray(_PARAMS[2], 4);
- uint32 skill = atoi(_PARAMS[2].c_str());
- uint32 level = atol(_PARAMS[3].c_str());
- int32 max = _PARAMS[4].c_str() ? atol (_PARAMS[4].c_str()) : plr->GetPureMaxSkillValue(skill);
- SkillLineEntry const* skilllookup = sSkillLineStore.LookupEntry(skill);
- //if skillid entered is not a number and greater then 0 then the command is being used wrong
- if(skill >= 0)
- {
- //does the skill even exist
- if(skilllookup)
- {
- //does player have the skill yet
- if(plr->GetSkillValue(skill))
- {
- plr->SetSkill(skill,level,max);
- Send_Player(plr, MakeMsg("Skill: %s Has Been Set To Level: %i Max: %i By: %s",skilllookup->name[0], level, max, CD->USER.c_str()));
- Send_IRCA(ChanOrPM(CD), MakeMsg("\00313[%s] : Has Had Skill: %s Set To Level: %d Max: %d",_PARAMS[0].c_str() , skilllookup->name[0], level, max), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Player Does Not Have The %s Skill Yet.", skilllookup->name[0]), true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : That Skill ID Does Not Exist.", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : The Skill ID Entered Is Invalid.", true, "ERROR");
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Character With That Name Exists.", true, "ERROR");
-}
-
-void IRCCmd::Fun_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 3);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- if (Player* plr = GetPlayer(_PARAMS[0]))
- {
- if(_PARAMS[1] == "say")
- {
- plr->Say(_PARAMS[2], LANG_UNIVERSAL);
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Was Forced To Say: "+_PARAMS[2]+".", true, CD->TYPE);
- }
- if(_PARAMS[1] == "sound")
- {
- uint32 sndid = atoi(_PARAMS[2].c_str());
- plr->SendPlaySound(sndid ,true);
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Just Heard Sound ID: "+_PARAMS[2]+".", true, CD->TYPE);
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Player Not Online!", true, "ERROR");
-}
-
-void IRCCmd::Help_IRC(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 1);
- QueryResult *result = WorldDatabase.PQuery("SELECT `Command`, `Description`, `gmlevel` FROM `IRC_Commands`");
- if(result)
- {
- if(IsLoggedIn(CD->USER))
- {
- if(_PARAMS[0] == "")
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT * FROM `IRC_Commands` WHERE `gmlevel` <= %u ORDER BY `Command`", GetLevel(CD->USER));
- if(result)
- {
- std::string output = "\002MangChat IRC Commands:\017 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- Field *fields = result->Fetch();
- output += fields[0].GetCppString() + ", ";
- result->NextRow();
- }
- delete result;
- Send_IRCA(CD->USER, output, true, CD->TYPE.c_str());
- }
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT `Description`, `gmlevel` FROM `IRC_Commands` WHERE `Command` = '%s'", _PARAMS[0].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- if(fields[1].GetUInt32() > GetLevel(CD->USER))
- {
- Send_IRCA(CD->USER, "You Do Not Have Access To That Command, So No Help Is Available.", true, CD->TYPE.c_str());
- return;
- }
- if(result)
- {
- std::string cmdhlp = fields[0].GetCppString();
- delete result;
- Send_IRCA(CD->USER, cmdhlp, true, CD->TYPE.c_str());
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Such Command Exists, Please Check The Spelling And Try Again.", true, "ERROR");
- }
- }
- else if(!IsLoggedIn(CD->USER))
- {
- if(_PARAMS[0] == "")
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT * FROM `IRC_Commands` WHERE `gmlevel` = 0 ORDER BY `Command`");
- if(result)
- {
- std::string output = "\002MangChat IRC Commands:\017 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- Field *fields = result->Fetch();
- output += fields[0].GetCppString() + ", ";
- result->NextRow();
- }
- delete result;
- Send_IRCA(CD->USER, output, true, CD->TYPE.c_str());
- Send_IRCA(CD->USER, "You Are Currently Not Logged In, Please Login To See A Complete List Of Commands Available To You.", true, CD->TYPE.c_str());
- }
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT `Description`, `gmlevel` FROM `IRC_Commands` WHERE `Command` = '%s'", _PARAMS[0].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- if(fields[1].GetUInt32() > 0)
- {
- Send_IRCA(CD->USER, "You Do Not Have Access To That Command, So No Help Is Available.", true, CD->TYPE.c_str());
- return;
- }
- std::string cmdhlp = fields[0].GetCppString();
- delete result;
- Send_IRCA(CD->USER, cmdhlp, true, CD->TYPE.c_str());
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Such Command Exists, Please Check The Spelling And Try Again.", true, "ERROR");
- }
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Database Error! Please Make Sure You Used IRC_Commands.sql, You Must Have A Table In Your World Database (IRC_Commands)!", true, "ERROR");
-}
-
-void IRCCmd::Inchan_Server(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 1);
- if(_PARAMS[0] == "")
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"inchan <ChannelName> )", true, "ERROR");
- return;
- }
- QueryResult *result = WorldDatabase.PQuery("SELECT * FROM `IRC_Inchan` WHERE `channel` = '%s' ORDER BY `name`", _PARAMS[0].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string output = "\002Players In The [ "+fields[2].GetCppString()+" ] Channel:\017 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- output += fields[1].GetCppString() + ", ";
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), output, true, CD->TYPE);
- }
- else
- Send_IRCA(ChanOrPM(CD), "No Players Are Currently In [ "+_PARAMS[0]+" ] Channel!", true, CD->TYPE.c_str());
-}
-
-void IRCCmd::Info_Server(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 1);
- char clientsNum [50];
- sprintf(clientsNum, "%u", sWorld.GetActiveSessionCount());
- char maxClientsNum [50];
- sprintf(maxClientsNum, "%u", sWorld.GetMaxActiveSessionCount());
- std::string str = secsToTimeString(sWorld.GetUptime());
- std::string svnrev = _FULLVERSION;
- Send_IRCA(ChanOrPM(CD), "\x2 Number of players online:\x3\x31\x30 " + (std::string)clientsNum + "\xF |\x2 Max since last restart:\x3\x31\x30 "+(std::string)maxClientsNum+"\xF |\x2 Uptime:\x3\x31\x30 "+str, true, CD->TYPE);
- Send_IRCA(ChanOrPM(CD), "\x2 Trinity Core SVN revision:\x3\x31\x30 "+svnrev, true, CD->TYPE);
-}
-
-void IRCCmd::Item_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 3);
-
- normalizePlayerName(_PARAMS[0]);
- Player *chr = GetPlayer(_PARAMS[0].c_str());
- if(_PARAMS[1] == "add")
- {
- std::string s_param = _PARAMS[2];
-
- char *args = (char*)s_param.c_str();
- uint32 itemId = 0;
- if(args[0]=='[')
- {
- char* citemName = citemName = strtok((char*)args, "]");
- if(citemName && citemName[0])
- {
- std::string itemName = citemName+1;
- WorldDatabase.escape_string(itemName);
- QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str());
- if (!result)
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Item Not Found!", true, "ERROR");
- return;
- }
- itemId = result->Fetch()->GetUInt16();
- delete result;
- }
- else
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"item <Player> <add> [Exact Item Name] <Amount> )", true, "ERROR");
- return;
- }
- }
- else
- {
- std::string itemName = s_param;
- WorldDatabase.escape_string(itemName);
- QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str());
- if (result)
- {
- itemId = result->Fetch()->GetUInt16();
- }
- delete result;
-
- char* cId = strtok(args, " ");
- if(!cId)
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"item <Player> <add> <ItemID> <Amount> )", true, "ERROR");
- return;
- }
- itemId = atol(cId);
- }
- char* ccount = strtok(NULL, " ");
- int32 count = 1;
- if (ccount) { count = atol(ccount); }
- Player* plTarget = chr;
- if(!plTarget)
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Not Online!", true, "ERROR");
- return;
- }
- ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId);
- //Subtract
- if (count < 0)
- {
- plTarget->DestroyItemCount(itemId, -count, true, false);
- char itemid2[255];
- sprintf(itemid2,"%d",itemId);
- std::string itake = " \00313["+ _PARAMS[0] +"] : Has Had Item " +itemid2+ " Taken From Them!";
- Send_IRCA(ChanOrPM(CD), itake, true, CD->TYPE);
- return;
- }
- //Adding items
- uint32 noSpaceForCount = 0;
-
- // check space and find places
- ItemPosCountVec dest;
- uint8 msg = plTarget->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount );
- if( msg == EQUIP_ERR_INVENTORY_FULL ) // convert to possibel store amount
- count -= noSpaceForCount;
- else if( msg != EQUIP_ERR_OK ) // other error, can't add
- {
- char s_countForStore[255];
- sprintf(s_countForStore,"%d",count);
- std::string ierror = " \00313["+ _PARAMS[0] +"] : Could Not Create All Items! " +s_countForStore+ " Item(s) Were Not Created!";
- Send_IRCA(ChanOrPM(CD), ierror, true, CD->TYPE);
- return;
- }
- Item* item = plTarget->StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
- if(count > 0 && item)
- {
- plTarget->SendNewItem(item,count,true,false);
- QueryResult *result = WorldDatabase.PQuery("SELECT name FROM item_template WHERE entry = %d", itemId);
- char* dbitemname = NULL;
- if (result)
- {
- dbitemname = (char*)result->Fetch()->GetString();
- }
- std::string iinfo = " \00313[" + _PARAMS[0] + "] : Has Been Given Item "+dbitemname+". From: "+CD->USER.c_str()+".";
- Send_IRCA(ChanOrPM(CD), iinfo, true, CD->TYPE);
- delete result;
- }
- if(noSpaceForCount > 0)
- {
- char s_countForStore[255];
- sprintf(s_countForStore,"%d",noSpaceForCount);
- std::string ierror = " \00313["+ _PARAMS[0] +"] : Could Not Create All Items! " +s_countForStore+ " Item(s) Were Not Created!";
- Send_IRCA(ChanOrPM(CD), ierror, true, CD->TYPE);
- return;
- }
- }
- else
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"item <Player> <add> <ItemID> <Amount> )", true, "ERROR");
- return;
- }
-}
-
-void IRCCmd::Jail_Player(_CDATA *CD)
-{
- if(ValidParams(CD->PARAMS, 1))
- {
- std::string* _PARAMS = getArray(CD->PARAMS, 2);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- if (Player *plr = GetPlayer(_PARAMS[0]))
- {
- std::string sReason = "";
- if(_PARAMS[1] == "release")
- {
- float rposx, rposy, rposz, rposo = 0;
- uint32 rmapid = 0;
- CharacterDatabase.escape_string(_PARAMS[0]);
- QueryResult *result = CharacterDatabase.PQuery( "SELECT `map`, `position_x`, `position_y`, `position_z` FROM `character_homebind` WHERE `guid` = '" I64FMTD "'", plr->GetGUID() );
- if(result)
- {
- Field *fields = result->Fetch();
- rmapid = fields[0].GetUInt16();
- rposx = fields[1].GetFloat();
- rposy = fields[2].GetFloat();
- rposz = fields[3].GetFloat();
- delete result;
- plr->SetMovement(MOVE_UNROOT);
- plr->TeleportTo(rmapid, rposx, rposy, rposz, rposo);
- plr->RemoveAurasDueToSpell(42201);
- plr->RemoveAurasDueToSpell(23775);
- plr->RemoveAurasDueToSpell(9454);
- Send_Player(plr, MakeMsg("You Have Been Released By: %s.", CD->USER.c_str()));
- sReason = " \00313["+_PARAMS[0]+"] : Has Been Released By: "+CD->USER+".";
- Send_IRCA(ChanOrPM(CD), sReason, true, CD->TYPE);
- }
- }
- else
- {
- if(_PARAMS[1] == "")
- _PARAMS[1] = "No Reason Given.";
- plr->TeleportTo(13, 0, 0, 0, 0);
- plr->SetMovement(MOVE_ROOT);
- plr->CastSpell(plr, 42201, true);
- plr->CastSpell(plr, 23775, true);
- plr->CastSpell(plr, 9454, true);
- Send_Player(plr, MakeMsg("You Have Been Jailed By: %s. Reason: %s.", CD->USER.c_str(), _PARAMS[1].c_str()));
- sReason = " \00313["+_PARAMS[0]+"] : Has Been Jailed By: "+CD->USER+". Reason: "+_PARAMS[1]+".";
- Send_IRCA(ChanOrPM(CD), sReason, true, CD->TYPE);
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Not Online!", true, "ERROR");
- }
-}
-
-void IRCCmd::Kick_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, CD->PCOUNT);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- if(_PARAMS[1] == "")
- _PARAMS[1] = "No Reason Given.";
- if (Player* plr = GetPlayer(_PARAMS[0]))
- {
- plr->GetSession()->KickPlayer();
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Been Kicked By: "+CD->USER+". Reason: "+_PARAMS[1]+".", true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Not Online!", true, "ERROR");
-}
-
-void IRCCmd::Kill_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, CD->PCOUNT);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- if (Player* plr = GetPlayer(_PARAMS[0]))
- {
- if(plr->isAlive())
- {
- plr->DealDamage(plr, plr->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- plr->SaveToDB();
- if(_PARAMS[1] == "")
- _PARAMS[1] = "No Reason Given.";
- Send_IRCA(ChanOrPM(CD), MakeMsg("\00313[%s] : Has Been Killed By: %s.", _PARAMS[0].c_str(), CD->USER.c_str()) + + + " Reason: "+_PARAMS[1]+".", true, CD->TYPE);
- Send_Player(plr, MakeMsg("You Have Been Killed By: %s. Reason: %s.", CD->USER.c_str(), _PARAMS[1].c_str()));
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Already Dead!", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Not Online!", true, "ERROR");
-}
-
-void IRCCmd::Lookup_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, CD->PCOUNT);
- if(_PARAMS[0] == "acct")
- {
- uint32 acctid = atoi(_PARAMS[1].c_str());
- if(objmgr.GetAccountByAccountName(_PARAMS[1]))
- acctid = objmgr.GetAccountByAccountName(_PARAMS[1]);
- if(acctid > 0)
- {
- std::string DateTime = "%a, %b %d, %Y - %h:%i%p";
- QueryResult *result = loginDatabase.PQuery("SELECT id, username, gmlevel, last_ip, (SELECT banreason FROM account_banned WHERE id = %d LIMIT 1) as banned, (SELECT banreason FROM ip_banned WHERE ip = last_ip) as bannedip, DATE_FORMAT(last_login, '%s') FROM `account` WHERE id = %d", acctid, DateTime.c_str(), acctid, acctid);
- if(result)
- {
- Field *fields = result->Fetch();
-
- uint32 id = fields[0].GetUInt32();
- std::string usrname = fields[1].GetCppString();
- uint32 gm = fields[2].GetUInt32();
- std::string lastip = fields[3].GetCppString();
- std::string banreason = fields[4].GetCppString();
- std::string banreasonip = fields[5].GetCppString();
- std::string lastlogin = fields[6].GetCppString();
- delete result;
-
- QueryResult *chars = CharacterDatabase.PQuery("SELECT guid, name, (SELECT SUM(totaltime) FROM characters WHERE account = %d) AS tottime FROM characters WHERE account = %u", id, id);
- std::string characters = "None";
- std::string totaccttime = "Never Logged In";
- if(chars)
- {
- characters = "";
- Field *fields = chars->Fetch();
- totaccttime = SecToDay(fields[2].GetCppString());
- for (uint64 i=0; i < chars->GetRowCount(); i++)
- {
- std::string guid = fields[0].GetCppString();
- std::string charname = fields[1].GetCppString();
- characters.append(charname+"("+guid+"), ");
- chars->NextRow();
- }
- delete chars;
- }
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Username:\x3\x31\x30 %s \xF|\x2 AccountID:\x3\x31\x30 %d \xF|\x2 GM Level:\x3\x31\x30 %d \xF|\x2 Last IP:\x3\x31\x30 %s \xF|\x2 Last Login:\x3\x31\x30 %s", usrname.c_str(), id, gm, lastip.c_str(), lastlogin.c_str()), true, CD->TYPE);
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Total Play Time:\x3\x31\x30 %s \xF|\x2 Characters:\x3\x31\x30 %s ", totaccttime.c_str(), characters.c_str()), true, CD->TYPE);
- if(banreason.length() > 1)
- Send_IRCA(ChanOrPM(CD), MakeMsg("\0034This User Has An Account Ban. Ban Reason: %s", banreason.c_str()), true, CD->TYPE);
- if(banreasonip.length() > 1)
- Send_IRCA(ChanOrPM(CD), MakeMsg("\0034This User Has An IP Ban. Ban Reason: %s", banreasonip.c_str()), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Account ID." ,true, "ERROR");
- }
- else
- {
- QueryResult *result = loginDatabase.PQuery("SELECT id, username FROM `account` WHERE username LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string accts = "\002Account Search Results:\x3\x31\x30 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string acctid = fields[0].GetCppString();
- std::string acctname = fields[1].GetCppString();
- accts.append(acctname+"("+acctid+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), accts, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Username. I Cant Find Any Users With Those Search Terms." ,true, "ERROR");
- }
- }
- if(_PARAMS[0] == "char")
- {
- uint32 plguid = atoi(_PARAMS[1].c_str());
- if(objmgr.GetPlayerGUIDByName(_PARAMS[1].c_str()))
- plguid = objmgr.GetPlayerGUIDByName(_PARAMS[1].c_str());
- if(plguid > 0)
- {
- QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, online, SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ' , 35), ' ' , -1) AS level, SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ' , 238), ' ' , -1) AS guildid, SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ' , 239), ' ' , -1) AS guildrank, SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ' , 927), ' ' , -1) AS xp, SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ' , 928), ' ' , -1) AS maxxp, SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ' , 1462), ' ' , -1) AS gold, SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ' , 1454), ' ' , -1) AS hk, SEC_TO_TIME(totaltime) AS tottime FROM characters WHERE guid =%i", plguid);
- uint32 latency = 0;
- Player *chr = objmgr.GetPlayer(plguid);
- if(chr)
- {
- latency = chr->GetSession()->GetLatency();
- }
- char templatency [100];
- sprintf(templatency, "%ums", latency);
- if(result)
- {
- Field *fields = result->Fetch();
- std::string pguid = fields[0].GetCppString();
- std::string pacct = fields[1].GetCppString();
- std::string pname = fields[2].GetCppString();
- uint32 praceid = fields[3].GetUInt32();
- uint32 pclassid = fields[4].GetUInt32();
- std::string ponline = (fields[5].GetInt32() == 1 ? "\x3\x30\x33Online" : "\x3\x30\x34Offline\xF");
- std::string plevel = fields[6].GetCppString();
- uint32 pguildid = fields[7].GetUInt32();
- uint32 pguildrank = fields[8].GetUInt32();
- std::string pxp = fields[9].GetCppString();
- std::string pmaxxp = fields[10].GetCppString();
- unsigned int money = fields[11].GetInt32();
- std::string hk = fields[12].GetCppString();
- std::string totaltim = SecToDay(fields[13].GetCppString());
- delete result;
- std::string sqlquery = "SELECT `gmlevel` FROM `account` WHERE `id` = '" + pacct + "';";
- QueryResult *result = loginDatabase.Query(sqlquery.c_str());
- Field *fields2 = result->Fetch();
- std::string pgmlvl = fields2[0].GetCppString();
- delete result;
- std::string guildinfo = "";
- if (pguildid != 0)
- {
- Guild* guild = objmgr.GetGuildById(pguildid);
- if (guild)
- {
- guildinfo = " " + guild->GetRankName(pguildrank) + " Of " + guild->GetName();
- }
- }
- else guildinfo = " None";
- ChrRacesEntry const* prace = sChrRacesStore.LookupEntry(praceid);
- ChrClassesEntry const* pclass = sChrClassesStore.LookupEntry(pclassid);
-
- if (atoi(plevel.c_str()) < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
- plevel += " (" + pxp + "/" + pmaxxp + ")";
- unsigned int gold = money / 10000;
- unsigned int silv = (money % 10000) / 100;
- unsigned int cop = (money % 10000) % 100;
- char tempgold [100];
- sprintf(tempgold, "\x2\x3\x30\x37%ug \x3\x31\x34%us \x3\x30\x35%uc\xF", gold, silv, cop);
- if (ponline == "\x3\x30\x33Online")
- {
- Player * plr = ObjectAccessor::Instance().FindPlayerByName(pname.c_str());
- if (plr)
- {
- AreaTableEntry const* area = GetAreaEntryByAreaID(plr->GetAreaId());
- ponline += " in " + (std::string) area->area_name[sWorld.GetDefaultDbcLocale()];
- if (area->zone != 0)
- {
- AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
- ponline += " (" + (std::string)zone->area_name[sWorld.GetDefaultDbcLocale()] + ")";
- }
- }
- }
- std::string pinfo = "\x2 About Player:\x3\x31\x30 " +pname+ "\xF |\x2 GM Level:\x3\x31\x30 " +pgmlvl+ "\xF |\x2 AcctID:\x3\x31\x30 " +pacct+ "\xF |\x2 CharID:\x3\x31\x30 " +pguid+ " \xF |\x2 Played Time:\x2\x3\x31\x30 " +totaltim+" \xF |\x2 Latency:\x2\x3\x31\x30 "+templatency;
- std::string pinfo2 = "\x2 Race:\x2\x3\x31\x30 " + (std::string)prace->name[sWorld.GetDefaultDbcLocale()] + "\xF |\x2 Class:\x2\x3\x31\x30 " + (std::string)pclass->name[sWorld.GetDefaultDbcLocale()] + "\xF |\x2 Level:\x2\x3\x31\x30 " + plevel + "\xF |\x2 Money:\x2 " + tempgold + "\xF |\x2 Guild Info:\x2\x3\x31\x30 "+guildinfo+"\xF |\x2 Status:\x2 " + ponline;
- // pinfo3 = " :" + " \x2Honor Kills:\x2\x3\x31\x30 " + hk;
- Send_IRCA(ChanOrPM(CD),pinfo , true, CD->TYPE);
- Send_IRCA(ChanOrPM(CD),pinfo2 , true, CD->TYPE);
- // Send_IRCA(ChanOrPM(CD),pinfo3 , true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Character ID. (GUID)" ,true, "ERROR");
- }
- else
- {
- QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, name FROM characters WHERE name LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string items = "\x2 Character Search Results:\x3\x31\x30 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string guid = fields[0].GetCppString();
- std::string account = fields[1].GetCppString();
- std::string name = fields[2].GetCppString();
- MakeUpper(name);
- items.append(name+"(Account:"+account+" - GUID:"+guid+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), items, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Character. I Cant Find Any Characters With Those Search Terms." ,true, "ERROR");
- }
- }
- if(_PARAMS[0] == "creature")
- {
- std::string creature = _PARAMS[1];
- if(atoi(creature.c_str()) > 0)
- {
- WorldDatabase.escape_string(_PARAMS[1]);
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, modelid_A, name, (minlevel*maxlevel/2) as level, faction_A, armor, (SELECT count(*) FROM creature WHERE id = '%s') as spawns FROM creature_template WHERE entry = '%s';", _PARAMS[1].c_str(), _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
-
- uint32 entry = fields[0].GetUInt32();
- uint32 modelid = fields[1].GetUInt32();
- std::string name = fields[2].GetCppString();
- uint32 level = fields[3].GetUInt32();
- uint32 faction = fields[4].GetUInt32();
- uint32 armor = fields[5].GetUInt32();
- uint32 spawns = fields[6].GetUInt32();
- delete result;
-
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Name:\x3\x31\x30 %s \xF|\x2 CreatureID:\x3\x31\x30 %d \xF|\x2 DisplayID:\x3\x31\x30 %d \xF|\x2 Spawns:\x3\x31\x30 %d", name.c_str(), entry, modelid, spawns), true, CD->TYPE);
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Level:\x3\x31\x30 %d \xF|\x2 Faction:\x3\x31\x30 %d \xF|\x2 Armor:\x3\x31\x30 %d", level, faction, armor), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Creature ID." ,true, "ERROR");
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, name FROM creature_template WHERE name LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string items = "\002Creature Search Results:\x3\x31\x30 ";
- //Send_IRCA(ChanOrPM(CD), "", true, CD->TYPE);
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string CreatureID = fields[0].GetCppString();
- std::string Name = fields[1].GetCppString();
- items.append(Name+"("+CreatureID+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), items, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Creature. I Cant Find Any Creatures With Those Search Terms." ,true, "ERROR");
- }
- }
- if(_PARAMS[0] == "faction")
- {
- std::string faction = _PARAMS[1];
- if(atoi(faction.c_str()) > 0)
- {
- FactionEntry const *factionEntry = sFactionStore.LookupEntry(atoi(faction.c_str()));
- if(factionEntry)
- {
- std::string name = factionEntry->name[sWorld.GetDefaultDbcLocale()];
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2 Faction:\x3\x31\x30 %s \xF|\x2 FactionID:\x3\x31\x30 %s",name.c_str(), faction.c_str()), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown FactionID." ,true, "ERROR");
-
- }
- else
- {
- uint32 counter = 0;
- std::string factions = "\002Faction Search Results:\x3\x31\x30 ";
- for (uint32 id = 0; id < sFactionStore.GetNumRows(); id++)
- {
- FactionEntry const *factionEntry = sFactionStore.LookupEntry(id);
- if(factionEntry)
- {
- MakeLower( _PARAMS[1] );
- std::string name = factionEntry->name[sWorld.GetDefaultDbcLocale()];
- MakeLower( name );
- if (name.find(_PARAMS[1]) != std::string::npos && counter < 10)
- {
- char factionid[100];
- sprintf(factionid, "%d", id);
- factions.append(name+"("+factionid+")\xF | \x3\x31\x30\x2");
- ++counter;
- }
- }
- }
- if(counter == 0)
- factions.append("No Factions Found.");
- Send_IRCA(ChanOrPM(CD), factions, true, CD->TYPE);
- }
- }
- if(_PARAMS[0] == "go")
- {
- std::string gobject = _PARAMS[1];
- if(atoi(gobject.c_str()) > 0)
- {
- WorldDatabase.escape_string(_PARAMS[1]);
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, type, displayId, name, faction, (SELECT count(*) FROM gameobject WHERE id = '%s') as spawns FROM gameobject_template WHERE entry = '%s';", _PARAMS[1].c_str(), _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
-
- uint32 entry = fields[0].GetUInt32();
- uint32 type = fields[1].GetUInt32();
- uint32 modelid = fields[2].GetUInt32();
- std::string name = fields[3].GetCppString();
- uint32 faction = fields[4].GetUInt32();
- uint32 spawns = fields[5].GetUInt32();
- delete result;
-
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2GO Name:\x3\x31\x30 %s \xF|\x2 GameobjectID:\x3\x31\x30 %d \xF|\x2 DisplayID:\x3\x31\x30 %d \xF|\x2 Spawns:\x3\x31\x30 %d", name.c_str(), entry, modelid, spawns), true, CD->TYPE);
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Type:\x3\x31\x30 %d \xF|\x2 Faction:\x3\x31\x30 %d", type, faction), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Creature ID." ,true, "ERROR");
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, name FROM gameobject_template WHERE name LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string gos = "\002Gameobject Search Results:\x3\x31\x30 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string GOID = fields[0].GetCppString();
- std::string GoName = fields[1].GetCppString();
- gos.append(GoName+"("+GOID+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), gos, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Game Object. I Cant Find Any Game Object's With Those Search Terms." ,true, "ERROR");
- }
- }
- if(_PARAMS[0] == "item")
- {
- std::string item = _PARAMS[1];
- if(atoi(item.c_str()) > 0)
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, name, displayid, (SELECT count(*) FROM creature_loot_template WHERE item = '%s') as loot FROM `item_template` WHERE entry = %s", _PARAMS[1].c_str(), _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- QueryResult *result2 = CharacterDatabase.PQuery("SELECT count(*) FROM `character_inventory` WHERE item_template = %s", _PARAMS[1].c_str());
- Field *fields2 = result2->Fetch();
- uint32 charcnt = fields2[0].GetUInt32();
- delete result2;
-
- uint32 ItemID = fields[0].GetUInt32();
- std::string ItmName = fields[1].GetCppString();
- uint32 DisplayID = fields[2].GetUInt32();
- uint32 loots = 0;
- loots = fields[3].GetUInt32();
- delete result;
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Item:\x3\x31\x30 %s \xF|\x2 ItemID:\x3\x31\x30 %d \xF|\x2 DisplayID:\x3\x31\x30 %d \xF|\x2 Owned By:\x3\x31\x30 %d players \xF|\x2 Dropped By:\x3\x31\x30 %d creatures", ItmName.c_str(), ItemID, DisplayID, charcnt, loots), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown ItemID." ,true, "ERROR");
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, name FROM `item_template` WHERE name LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string items = "\002Item Search Results:\x3\x31\x30 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string ItemID = fields[0].GetCppString();
- std::string ItemName = fields[1].GetCppString();
- items.append(ItemName+"("+ItemID+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), items, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Item. I Cant Find Any Items With Those Search Terms." ,true, "ERROR");
- }
- }
- if(_PARAMS[0] == "quest")
- {
- std::string quest = _PARAMS[1];
- if(atoi(quest.c_str()) > 0)
- {
- WorldDatabase.escape_string(_PARAMS[1]);
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, Title FROM quest_template WHERE entry = '%s';", _PARAMS[1].c_str(), _PARAMS[1].c_str());
- if(result)
- {
- QueryResult *result2 = CharacterDatabase.PQuery("SELECT count(*) FROM character_queststatus WHERE quest = '%s' AND status = '1';", _PARAMS[1].c_str());
- Field *fields2 = result2->Fetch();
- uint32 status = fields2[0].GetUInt32();
- delete result2;
-
- Field *fields = result->Fetch();
- uint32 entry = fields[0].GetUInt32();
- std::string name = fields[1].GetCppString();
- delete result;
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Quest Name:\x3\x31\x30 %s \xF|\x2 QuestID:\x3\x31\x30 %d \xF|\x2 Completed:\x3\x31\x30 %d times", name.c_str(), entry, status), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Quest ID." ,true, "ERROR");
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT entry, Title FROM quest_template WHERE Title LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string quests = "\002Quest Search Results:\x3\x31\x30 ";
- //Send_IRCA(ChanOrPM(CD), "", true, CD->TYPE);
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string QuestID = fields[0].GetCppString();
- std::string QuestName = fields[1].GetCppString();
- quests.append(QuestName+"("+QuestID+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), quests, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Quest. I Cant Find Any Quest's With Those Search Terms." ,true, "ERROR");
- }
- }
- if(_PARAMS[0] == "skill")
- {
- std::string skill = _PARAMS[1];
- if(atoi(skill.c_str()) > 0)
- {
- SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(atoi(skill.c_str()));
- if(skillInfo)
- {
- std::string name = skillInfo->name[sWorld.GetDefaultDbcLocale()];
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Skill:\x3\x31\x30 %s \xF|\x2 SkillID:\x3\x31\x30 %s",name.c_str(), skill.c_str()), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown SkillID." ,true, "ERROR");
-
- }
- else
- {
- uint32 counter = 0;
- std::string skills = "\002Skill Search Results:\x3\x31\x30 ";
- for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++)
- {
- SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(id);
- if(skillInfo)
- {
- MakeLower( _PARAMS[1] );
- std::string name = skillInfo->name[sWorld.GetDefaultDbcLocale()];
- MakeLower( name );
- if (name.find(_PARAMS[1]) != std::string::npos && counter < 10)
- {
- char skillid[100];
- sprintf(skillid, "%d", id);
- skills.append(name+"("+skillid+")\xF | \x3\x31\x30\x2");
- ++counter;
- }
- }
- }
- if(counter == 0)
- skills.append("No Skills Found.");
- Send_IRCA(ChanOrPM(CD), skills, true, CD->TYPE);
- }
- }
- if(_PARAMS[0] == "spell")
- {
- std::string spell = _PARAMS[1];
- if(atoi(spell.c_str()) > 0)
- {
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(atoi(spell.c_str()));
- if(spellInfo)
- {
- std::string name = spellInfo->SpellName[sWorld.GetDefaultDbcLocale()];
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Spell:\x3\x31\x30 %s \xF|\x2 SpellID:\x3\x31\x30 %s",name.c_str(), spell.c_str()), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown SpellID." ,true, "ERROR");
-
- }
- else
- {
- uint32 counter = 0;
- std::string spells = "\002Spell Search Results:\x3\x31\x30 ";
- for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
- {
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(id);
- if(spellInfo)
- {
- MakeLower( _PARAMS[1] );
- std::string name = spellInfo->SpellName[sWorld.GetDefaultDbcLocale()];
- MakeLower( name );
- if (name.find(_PARAMS[1]) != std::string::npos && counter < 10)
- {
- char itemid[100];
- sprintf(itemid, "%d", id);
- spells.append(name+"("+itemid+")\xF | \x3\x31\x30\x2");
- ++counter;
- }
- }
- }
- if(counter == 0)
- spells.append("No Spells Found.");
- Send_IRCA(ChanOrPM(CD), spells, true, CD->TYPE);
- }
- }
- if(_PARAMS[0] == "tele")
- {
- std::string tele = _PARAMS[1];
- if(atoi(tele.c_str()) > 0)
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT * FROM `game_tele` WHERE id = %s", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
-
- uint32 teleid = fields[0].GetUInt32();
- uint32 pos_x = fields[1].GetUInt32();
- uint32 pos_y = fields[2].GetUInt32();
- uint32 pos_z = fields[3].GetUInt32();
- uint32 oriet = fields[4].GetUInt32();
- uint32 map = fields[5].GetUInt32();
- std::string telname = fields[6].GetCppString();
- delete result;
-
- Send_IRCA(ChanOrPM(CD), MakeMsg("\x2Tele Name:\x3\x31\x30 %s \xF|\x2 TeleID:\x3\x31\x30 %d \xF|\x2 Coordinates:\x3\x31\x30 [X: %d, Y: %d, Z: %d, MAP: %d, Orientation: %d]", telname.c_str(), teleid, pos_x, pos_y, pos_z, map, oriet), true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Teleport Location ID." ,true, "ERROR");
- }
- else
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT id, name FROM `game_tele` WHERE name LIKE '%%%s%%' LIMIT 10", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- std::string teles = "\002Tele Location Search Results:\x3\x31\x30 ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string TeleID = fields[0].GetCppString();
- std::string TeleName = fields[1].GetCppString();
- teles.append(TeleName+"("+TeleID+")\xF | \x3\x31\x30\x2");
- result->NextRow();
- }
- Send_IRCA(ChanOrPM(CD), teles, true, CD->TYPE);
- delete result;
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Unknown Item. I Cant Find Any Items With Those Search Terms." ,true, "ERROR");
- }
- }
-}
-
-void IRCCmd::Level_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, CD->PCOUNT);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- std::string player = _PARAMS[0];
- normalizePlayerName(player);
- uint64 guid = objmgr.GetPlayerGUIDByName(player.c_str());
- std::string s_newlevel = _PARAMS[1];
- uint8 i_newlvl = atoi(s_newlevel.c_str());
- if(!guid)
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Player Not Found!", true, "ERROR");
- return;
- } else if ( i_newlvl < 1 || i_newlvl > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) )
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Level Must Be Between 1 And %i!",sConfig.GetIntDefault("MaxPlayerLevel", 70)), true, "ERROR");
- return;
- } else
- {
- Player *chr = objmgr.GetPlayer(guid);
- int32 i_oldlvl = chr ? chr->getLevel() : Player::GetUInt32ValueFromDB(UNIT_FIELD_LEVEL,guid);
- if(chr)
- {
- chr->GiveLevel(i_newlvl);
- chr->InitTalentForLevel();
- chr->SetUInt32Value(PLAYER_XP,0);
- WorldPacket data;
- ChatHandler CH(chr->GetSession());
- if(i_oldlvl == i_newlvl)
- CH.FillSystemMessageData(&data, "Your level progress has been reset.");
- else
- if(i_oldlvl < i_newlvl)
- CH.FillSystemMessageData(&data, fmtstring("You have been leveled up (%i)",i_newlvl-i_oldlvl));
- else
- if(i_oldlvl > i_newlvl)
- CH.FillSystemMessageData(&data, fmtstring("You have been leveled down (%i)",i_newlvl-i_oldlvl));
- chr->GetSession()->SendPacket( &data );
- }
- else
- {
- Tokens values;
- Player::LoadValuesArrayFromDB(values,guid);
- Player::SetUInt32ValueInArray(values,UNIT_FIELD_LEVEL,i_newlvl);
- Player::SetUInt32ValueInArray(values,PLAYER_XP,0);
- Player::SaveValuesArrayInDB(values,guid);
- }
- }
- Send_IRCA(ChanOrPM(CD), "\00313[" + _PARAMS[0]+ "] : Has Been Leveled To " + _PARAMS[1] + ". By: "+CD->USER+".", true, CD->TYPE);
-}
-
-void IRCCmd::Money_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 2);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- std::string player = _PARAMS[0];
- normalizePlayerName(player);
- uint64 guid = objmgr.GetPlayerGUIDByName(player.c_str());
- Player *chr = objmgr.GetPlayer(guid);
-
- std::string s_money = _PARAMS[1];
- int32 money = atoi(s_money.c_str());
- unsigned int gold = money / 10000;
- unsigned int silv = (money % 10000) / 100;
- unsigned int cop = (money % 10000) % 100;
- char tempgold [100];
- sprintf(tempgold, "\x2\x3\x30\x37%ug \x3\x31\x34%us \x3\x30\x35%uc\xF", gold, silv, cop);
- if(!guid)
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Player Not Found!", true, "ERROR");
- return;
- }
- else
- {
- Player *chr = objmgr.GetPlayer(guid);
- uint32 moneyuser = 0;
- if(chr)
- moneyuser = chr->GetMoney();
- else {
- CharacterDatabase.escape_string(player);
- std::string sqlquery = "SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ' , 1462), ' ' , -1) AS `gold` FROM `characters` WHERE `name` = '"+player+"';";
- QueryResult *result = CharacterDatabase.Query(sqlquery.c_str());
- Field *fields = result->Fetch();
- moneyuser = fields[0].GetInt32();
- delete result;
- }
- int32 addmoney = money;
- int32 newmoney = moneyuser + addmoney;
- char s_newmoney[255];
- sprintf(s_newmoney,"%d",newmoney);
- if(addmoney < 0)
- {
- sLog.outDetail("USER1: %i, ADD: %i, DIF: %i\\n", moneyuser, addmoney, newmoney);
- if(newmoney <= 0 )
- {
- Send_IRCA(ChanOrPM(CD), "\00313["+player+"] : Has Had All Money Taken By: "+CD->USER.c_str()+".", true, CD->TYPE);
- if(chr)
- {
- chr->SetMoney(0);
- Send_Player(chr, MakeMsg("You Have Been Liquidated By: %s. Total Money Is Now 0.", CD->USER.c_str()));
- }
- else
- CharacterDatabase.PExecute("UPDATE `characters` SET data=concat(substring_index(data,' ',1462-1),' ','%u',' ', right(data,length(data)-length(substring_index(data,' ',1462))-1) ) where guid='%u'",newmoney, guid );
- }
- else
- {
- Send_IRCA(ChanOrPM(CD), "\00313["+player+"] : Has Had ("+s_money+"\00313) Taken From Them By: "+CD->USER.c_str()+".", true, CD->TYPE);
- if(chr)
- {
- chr->SetMoney( newmoney );
- Send_Player(chr, MakeMsg("You Have Had %s Copper Taken From You By: %s.", _PARAMS[1].c_str(), CD->USER.c_str()));
- }
- else
- CharacterDatabase.PExecute("UPDATE `characters` SET data=concat(substring_index(data,' ',1462-1),' ','%u',' ', right(data,length(data)-length(substring_index(data,' ',1462))-1) ) where guid='%u'",newmoney, guid );
- }
- }
- else
- {
- Send_IRCA(ChanOrPM(CD), "\00313["+player+"] : Has Been Given ("+tempgold+"\00313) From: "+CD->USER.c_str()+".", true, CD->TYPE);
- if(chr)
- {
- chr->ModifyMoney( addmoney );
- Send_Player(chr, MakeMsg("You Have Been Given %s Copper. From: %s.", _PARAMS[1].c_str(), CD->USER.c_str()));
- }
- else
- CharacterDatabase.PExecute("UPDATE `characters` SET data=concat(substring_index(data,' ',1462-1),' ','%u',' ', right(data,length(data)-length(substring_index(data,' ',1462))-1) ) where guid='%u'",newmoney, guid );
- }
- }
-}
-
-void IRCCmd::Mute_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 3);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- normalizePlayerName(_PARAMS[0]);
- uint64 guid = objmgr.GetPlayerGUIDByName(_PARAMS[0]);
- if(guid)
- {
- if(_PARAMS[1] == "release")
- {
- Player* plr = objmgr.GetPlayer(guid);
- uint32 account_id = 0;
- account_id = objmgr.GetPlayerAccountIdByGUID(guid);
- loginDatabase.PExecute("UPDATE `account` SET `mutetime` = '0' WHERE `id` = '%u'", account_id );
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Been UnMuted By: "+CD->USER+"." , true, CD->TYPE);
- if(plr)
- {
- plr->GetSession()->m_muteTime = 0;
- Send_Player(plr, MakeMsg("You Have Been UnMuted By: %s.", CD->USER.c_str()));
- }
- }
- else
- {
- if(_PARAMS[2] == "")
- _PARAMS[2] = "No Reason Given";
- Player* plr = objmgr.GetPlayer(guid);
- time_t mutetime = time(NULL) + atoi(_PARAMS[1].c_str())*60;
- uint32 account_id = 0;
- account_id = objmgr.GetPlayerAccountIdByGUID(guid);
- if(plr) plr->GetSession()->m_muteTime = mutetime;
- loginDatabase.PExecute("UPDATE `account` SET `mutetime` = " I64FMTD " WHERE `id` = '%u'",uint64(mutetime), account_id );
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Been Muted By: "+CD->USER+". For: "+_PARAMS[1]+" Minutes. Reason: "+_PARAMS[2] , true, CD->TYPE);
- if(plr) Send_Player(plr, MakeMsg("You Have Been Muted By: %s. For: %s Minutes. Reason: %s", CD->USER.c_str(), _PARAMS[1].c_str(), _PARAMS[2].c_str()));
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Player Does Not Exist!", true, "ERROR");
-}
-
-void IRCCmd::Online_Players(_CDATA *CD)
-{
- sIRC.Script_Lock[MCS_Players_Online] = true;
- ZThread::Thread script(new mcs_OnlinePlayers(CD));
-}
-
-void IRCCmd::PM_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 2);
- if (Player* plr = GetPlayer(_PARAMS[0]))
- {
- if(plr->isAcceptWhispers())
- {
- std::string sMsg = MakeMsg("|cffFE87FD[<IRC>%s] Whispers: %s|r", CD->USER.c_str(), _PARAMS[1].c_str());
- WorldPacket data(SMSG_MESSAGECHAT, 200);
- data << (uint8)CHAT_MSG_SYSTEM;
- data << (uint32)LANG_UNIVERSAL;
- data << (uint64)plr->GetGUID();
- data << (uint32)0;
- data << (uint64)plr->GetGUID();
- data << (uint32)(sMsg.length()+1);
- data << sMsg;
- data << (uint8)0;
- plr->GetSession()->SendPacket(&data);
- plr->SendPlaySound(3081, true);
- Send_IRCA(ChanOrPM(CD), "\00313To ["+_PARAMS[0]+"] : "+_PARAMS[1]+".", true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Is Not Accepting Private Messages!", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Player not online!", true, "ERROR");
-}
-
-void IRCCmd::Revive_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, CD->PCOUNT);
- if (Player* plr = GetPlayer(_PARAMS[0]))
- {
- if(plr->isDead())
- {
- plr->ResurrectPlayer(0.5f);
- plr->SpawnCorpseBones();
- plr->SaveToDB();
- sIRC.Send_IRC_Channel(ChanOrPM(CD), " \00313["+_PARAMS[0]+"] : Has Been Revived By: " + CD->USER, true, CD->TYPE);
- Send_Player(plr, MakeMsg("You Have Been Revived By: %s.", CD->USER.c_str()));
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Not Dead!", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : "+_PARAMS[0]+" Is Not Online!", true, "ERROR");
-}
-
-void IRCCmd::Saveall_Player(_CDATA *CD)
-{
- ObjectAccessor::Instance().SaveAllPlayers();
- Send_IRCA(ChanOrPM(CD), "\00313["+CD->USER+"] : Has Saved All Players!", true, CD->TYPE);
-}
-
-void IRCCmd::Shutdown_Mangos(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 1);
- if(_PARAMS[0] == "cancel")
- {
- sWorld.ShutdownCancel();
- Send_IRCA(ChanOrPM(CD), "\0034Server Shutdown Has Been Cancelled.", true, CD->TYPE);
- }
-
- int32 i_time = atoi(_PARAMS[0].c_str());
- if (i_time <= 0 && _PARAMS[0]!="0")
- {
- Send_IRCA(ChanOrPM(CD), "\00313["+CD->USER+"] : Please Enter A Number! And No Negative Numbers! "+_PARAMS[0]+" Seconds!?", true, CD->TYPE);
- return;
- }
- if (i_time > 1) Send_IRCA(ChanOrPM(CD), "\00313["+CD->USER+"] : Has Requested Server To Be Shut Down In "+_PARAMS[0]+" Seconds!", true, CD->TYPE);
- sWorld.ShutdownServ(i_time);
- Delay(i_time*1000);
- Send_IRCA(ChanOrPM(CD), "\0034Server Will Now Shut Down.. Good Bye!", true, CD->TYPE);
- sIRC.Active = false;
- sIRC.ResetIRC();
-}
-
-void IRCCmd::Spell_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 3);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- uint32 spell = atoi(_PARAMS[2].c_str());
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell);
- if (Player* plr = GetPlayer(_PARAMS[0]))
- {
- if(spellInfo)
- {
- std::string name = spellInfo->SpellName[sWorld.GetDefaultDbcLocale()];
- if(_PARAMS[1] == "cast")
- {
- plr->CastSpell(plr, spell, true);
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Had Spell "+name+" Casted On Them.", true, CD->TYPE);
- }
- if(_PARAMS[1] == "learn")
- {
- plr->learnSpell(spell);
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Learned Spell "+name+".", true, CD->TYPE);
- }
- if(_PARAMS[1] == "unlearn")
- {
- plr->removeSpell(spell);
- Send_IRCA(ChanOrPM(CD), "\00313["+_PARAMS[0]+"] : Has Unlearned Spell "+name+".", true, CD->TYPE);
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Incorrect Spell ID!", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Player Not Online!", true, "ERROR");
-}
-
-void IRCCmd::Sysmsg_Server(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, CD->PCOUNT);
- std::string ircchan = "#";
- ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
- if(_PARAMS[0] == "a")
- {
- //std::string str = "|cffff0000[System Message]:|r" + _PARAMS[1];
- std::string ancmsg = MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s",_PARAMS[1].c_str());
- sWorld.SendWorldText(LANG_SYSTEMMESSAGE, _PARAMS[1].c_str());
- sIRC.Send_IRC_Channel(ircchan, ancmsg, true);
- }
- else if (_PARAMS[0] == "e")
- {
- std::string str = "|cffff0000[Server Event]:|r " + _PARAMS[1];
- std::string notstr = "[Server Event]: " + _PARAMS[1];
- std::string notmsg = MakeMsg("\00304,08\037/!\\\037\017\00304 Server Event \00304,08\037/!\\\037\017 %s",_PARAMS[1].c_str());
- WorldPacket data(SMSG_NOTIFICATION, (notstr.size()+1));
- data << notstr;
- WorldPacket data2(SMSG_PLAY_SOUND,32);
- data2 << (uint32)1400;
- sWorld.SendGlobalMessage(&data2);
- sWorld.SendGlobalMessage(&data);
- sWorld.SendWorldText(LANG_EVENTMESSAGE, _PARAMS[1].c_str());
- sIRC.Send_IRC_Channel(ircchan, notmsg, true);
- }
- else if (_PARAMS[0] == "n")
- {
- std::string str = "Global notify: " + _PARAMS[1];
- std::string notmsg = MakeMsg("\00304,08\037/!\\\037\017\00304 Global Notify \00304,08\037/!\\\037\017 %s",_PARAMS[1].c_str());
- WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
- data << str;
- sWorld.SendGlobalMessage(&data);
- sIRC.Send_IRC_Channel(ircchan, notmsg, true);
- }
- else if (_PARAMS[0] == "add")
- {
- sIRC.Send_IRC_Channel(ircchan, "This command is currently borken.", true);
- // Commented for now -- timer broken
- //WorldDatabase.PExecute( "INSERT INTO IRC_AutoAnnounce (message, addedby) VALUES ('%s', '%s')", _PARAMS[1].c_str(), CD->USER.c_str());
- //std::string str = "|cffff0000[Automatic]:|r" + _PARAMS[1];
- //std::string ancmsg = MakeMsg("\00304,08\037/!\\\037\017\00304 Automatic System Message \00304,08\037/!\\\037\017 %s",_PARAMS[1].c_str());
- //sWorld.SendWorldText(LANG_AUTO_ANN, _PARAMS[1].c_str());
- //sIRC.Send_IRC_Channel(ircchan, ancmsg, true);
- }
- else if (_PARAMS[0] == "del")
- {
- WorldDatabase.PExecute( "DELETE FROM IRC_AutoAnnounce WHERE id = %s", _PARAMS[1].c_str());
- Send_IRCA(ChanOrPM(CD), MakeMsg("Deleted Automatic Announcement Message ID: %s", _PARAMS[1].c_str()), true, CD->TYPE);
- }
- else if (_PARAMS[0] == "list")
- {
- QueryResult *result = WorldDatabase.PQuery("SELECT * FROM IRC_AutoAnnounce LIMIT 5;", _PARAMS[1].c_str());
- if(result)
- {
- Field *fields = result->Fetch();
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string id = fields[0].GetCppString();
- std::string message = fields[1].GetCppString();
- std::string addedby = fields[2].GetCppString();
- Send_IRCA(ChanOrPM(CD), MakeMsg("ID: %s - Added By: %s - Message: %s", id.c_str(), addedby.c_str(), message.c_str()), true, CD->TYPE);
- result->NextRow();
- }
- delete result;
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Auto Announce Messages Are In The Database.", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Please Use (a-Announce)(n-Notify)(e-Event) As Second Parameter!", true, "ERROR");
-}
-
-void IRCCmd::Tele_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 4);
- if(AcctLevel(_PARAMS[0]) > GetLevel(CD->USER) && (sIRC.BOTMASK & 512)!= 0)
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : Nice Try, This Player Has A Higher GM Level Than You! [ %i ]", AcctLevel(_PARAMS[0])), true, "ERROR");
- return;
- }
- bool DoTeleport = false;
- float pX, pY, pZ, pO = 0;
- uint32 mapid = 0;
- std::string rMsg = " \0034[ERROR] : Teleport Failed!";
- std::string wMsg = "Invalid Tele Location";
- Player* plr = GetPlayer(_PARAMS[0]);
- if(plr)
- {
- if(plr->isInFlight() || plr->isInCombat())
- {
- Send_IRCA(CD->USER, MakeMsg("\0034[ERROR] : %s Is Busy And Cannot Be Teleported! They Could Be In Combat, Or Flying.",_PARAMS[0].c_str()), true, "ERROR");
- return;
- }
- }
- if(_PARAMS[1] == "l" || _PARAMS[1].size() > 2)
- {
- if(_PARAMS[1].size() > 1)
- _PARAMS[2] = _PARAMS[1];
- WorldDatabase.escape_string(_PARAMS[2]);
- QueryResult *result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation, map FROM game_tele WHERE name='%s';", _PARAMS[2].c_str());
- if (result)
- {
- Field *fields = result->Fetch();
- pX = fields[0].GetFloat();
- pY = fields[1].GetFloat();
- pZ = fields[2].GetFloat();
- pO = fields[3].GetFloat();
- mapid = fields[4].GetUInt16();
- delete result;
- rMsg = MakeMsg(" \00313[%s] : Teleported To %s! By: %s.",
- _PARAMS[0].c_str(),
- _PARAMS[2].c_str(),
- CD->USER.c_str());
- wMsg = MakeMsg("You Have Been Teleported To %s By: %s.",
- _PARAMS[2].c_str(),
- CD->USER.c_str());
- DoTeleport = true;
- }
- else
- {
- WorldDatabase.escape_string(_PARAMS[2]);
- QueryResult *result = WorldDatabase.PQuery("SELECT name FROM game_tele WHERE name LIKE '%%%s%%' LIMIT 7;", _PARAMS[2].c_str());
- if (result)
- {
- std::string telename = "<> ";
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- Field *fields = result->Fetch();
- telename.append(fields[0].GetCppString());
- result->NextRow();
- telename.append(" <> ");
- }
- delete result;
- Send_IRCA(CD->USER, "I Cannot Find Location: "+_PARAMS[2]+" . Perhaps One Of These Will Work For You.", true, "ERROR");
- Send_IRCA(CD->USER, telename, true, "ERROR");
- return;
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Location Not Found! Nothing Even Close Found!", true, "ERROR");
- return;
- }
- }
- else if(_PARAMS[1] == "c")
- {
- std::string* _PARAMSA = getArray(_PARAMS[2], 4);
- pX = atof(_PARAMSA[1].c_str());
- pY = atof(_PARAMSA[2].c_str());
- pZ = atof(_PARAMSA[3].c_str());
- mapid = atoi(_PARAMSA[0].c_str());
- rMsg = MakeMsg(" \00313[%s] : Teleported To Map: %s. Position: X(%s) Y(%s) Z(%s)! By: %s.",
- _PARAMS[0].c_str(),
- _PARAMSA[0].c_str(),
- _PARAMSA[1].c_str(),
- _PARAMSA[2].c_str(),
- _PARAMSA[3].c_str(),
- CD->USER.c_str());
- wMsg = MakeMsg("You Have Been Teleported To Map: %s. Position: X(%s) Y(%s) Z(%s)! By: %s.",
- _PARAMSA[0].c_str(),
- _PARAMSA[1].c_str(),
- _PARAMSA[2].c_str(),
- _PARAMSA[3].c_str(),
- CD->USER.c_str());
- DoTeleport = true;
- }
- else if(_PARAMS[1] == "r")
- {
- if(plr)
- {
- pX = plr->m_recallX;
- pY = plr->m_recallY;
- pZ = plr->m_recallZ;
- pO = plr->m_recallO;
- mapid = plr->m_recallMap;
- rMsg = MakeMsg(" \00313[%s] : Has Been Recalled To Their Previous Location.",
- _PARAMS[0].c_str());
- wMsg = MakeMsg("You Have Been Recalled To Your Previous Location. By: %s",
- CD->USER.c_str());
- DoTeleport = true;
- }
- else
- {
- Send_IRCA(CD->USER, MakeMsg("\00313[%s] : Cannot Be Recalled, They Are Not Online.", _PARAMS[0].c_str()), true, "ERROR");
- return;
- }
-
- }
- else if(_PARAMS[1] == "to")
- {
- Player* plr2 = GetPlayer(_PARAMS[2]);
- if(plr2)
- {
- plr2->GetContactPoint(plr, pX, pY, pZ);
- mapid = plr2->GetMapId();
- }
- else
- {
- if(uint64 guid = objmgr.GetPlayerGUIDByName(_PARAMS[2].c_str()))
- {
- bool in_flight;
- Player::LoadPositionFromDB(mapid, pX, pY, pZ, pO, in_flight, guid);
- }
- else
- {
- Send_IRCA(CD->USER, "\0034[ERROR] : Second Player Not Found!", true, "ERROR");
- return;
- }
- }
- rMsg = MakeMsg(" \00313[%s] : Teleported To Player: [%s] By: %s.",
- _PARAMS[0].c_str(),
- _PARAMS[2].c_str(),
- CD->USER.c_str());
- wMsg = MakeMsg("You Are Being Teleported To: %s. By: %s.",
- _PARAMS[2].c_str(),
- CD->USER.c_str());
- DoTeleport = true;
- }
- if(DoTeleport)
- {
- if(MapManager::IsValidMapCoord(mapid, pX ,pY))
- {
- //if player is online teleport them in real time, if not set the DB to our coordinates.
- if(plr)
- {
- plr->SaveRecallPosition();
- plr->TeleportTo(mapid, pX, pY, pZ, pO);
- sIRC.Send_IRC_Channel(ChanOrPM(CD), rMsg, true, CD->TYPE);
- Send_Player(plr, wMsg);
- }
- else
- {
- uint64 guid = objmgr.GetPlayerGUIDByName(_PARAMS[0]);
- Player::SavePositionInDB(mapid,pX,pY,pZ,pO,MapManager::Instance().GetZoneId(mapid,pX,pY),guid);
- sIRC.Send_IRC_Channel(ChanOrPM(CD), rMsg + " \0034*Offline Tele.* ", true, CD->TYPE);
- }
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Invalid Location!", true, "ERROR");
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : Invalid Paramaters, Please Try Again [ "+sIRC._cmd_prefx+"help tele ] For More Information. ", true, "ERROR");
-}
-
-void IRCCmd::Top_Player(_CDATA *CD)
-{
- std::string* _PARAMS = getArray(CD->PARAMS, 2);
- uint32 limitr = 10;
- if(atoi(_PARAMS[1].c_str()) > 0 && GetLevel(CD->USER) >= sIRC._op_gm_lev)
- limitr = atoi(_PARAMS[1].c_str());
- if(_PARAMS[0] == "accttime")
- {
- QueryResult *result = CharacterDatabase.PQuery("SELECT account, name, (SUM(totaltime)) AS combinetime FROM characters GROUP BY account ORDER BY combinetime DESC LIMIT 0, %d ", limitr);
- if(result)
- {
- Field *fields = result->Fetch();
- std::string tptime = MakeMsg("\x2 Top%d Accounts By Played Time:\x3\x31\x30 ", limitr);
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- uint32 account = fields[0].GetUInt32();
- std::string PlName = GetAcctNameFromID(account);
- std::string Time = SecToDay(fields[2].GetCppString());
- uint32 rank = i+1;
- tptime.append(MakeMsg("[%u]%s %s \xF| \x3\x31\x30\x2", rank, PlName.c_str(), Time.c_str()));
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), tptime, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Accounts Returned." ,true, "ERROR");
- }
- if(_PARAMS[0] == "chartime")
- {
- QueryResult *result = CharacterDatabase.PQuery("SELECT name, totaltime FROM characters ORDER BY totaltime DESC LIMIT 0, %d ", limitr);
- if(result)
- {
- Field *fields = result->Fetch();
- std::string tptime = MakeMsg("\x2 Top%d Characters By Played Time:\x3\x31\x30 ", limitr);
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string Name = fields[0].GetCppString();
- std::string Time = SecToDay(fields[1].GetCppString());
- uint32 rank = i+1;
- tptime.append(MakeMsg("[%u]%s %s \xF| \x3\x31\x30\x2", rank, Name.c_str(), Time.c_str()));
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), tptime, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Characters Returned." ,true, "ERROR");
- }
- if(_PARAMS[0] == "money")
- {
- QueryResult *result = CharacterDatabase.PQuery("SELECT name, CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 1462), ' ', -1) AS UNSIGNED) AS money FROM characters ORDER BY money DESC LIMIT 0, %d ", limitr);
- if(result)
- {
- Field *fields = result->Fetch();
- std::string tptime = MakeMsg("\x2 Top%d Characters By Money:\x3\x31\x30 ", limitr);
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string Name = fields[0].GetCppString();
- unsigned int money = fields[1].GetInt32();
-
- uint32 rank = i+1;
-
- unsigned int gold = money / 10000;
- unsigned int silv = (money % 10000) / 100;
- unsigned int cop = (money % 10000) % 100;
- char tempgold [100];
- sprintf(tempgold, "\x2\x3\x30\x37%ug \x3\x31\x34%us \x3\x30\x35%uc\xF", gold, silv, cop);
-
- tptime.append(MakeMsg("[%u]%s %s \xF| \x3\x31\x30\x2", rank, Name.c_str(), tempgold));
- result->NextRow();
- }
- delete result;
- Send_IRCA(ChanOrPM(CD), tptime, true, CD->TYPE);
- }
- else
- Send_IRCA(CD->USER, "\0034[ERROR] : No Characters Returned." ,true, "ERROR");
- }
-
-}
-
-void IRCCmd::Who_Logged(_CDATA *CD)
-{
- std::string OPS = "";
- for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
- {
- OPS.append(MakeMsg(" \002[GM:%d IRC: %s - WoW: %s]\002 ", (*i)->GMLevel, (*i)->Name.c_str(), (*i)->UName.c_str()));
- }
- Send_IRCA(ChanOrPM(CD), OPS, true, CD->TYPE);
-}
diff --git a/src/game/IRCConf.cpp b/src/game/IRCConf.cpp deleted file mode 100644 index e3878c7fdcc..00000000000 --- a/src/game/IRCConf.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/*
- * MangChat By |Death| And Cybrax
- *
- * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
- * Of The GNU General Public License
- * Written and Developed by Cybrax. cybraxvd@gmail.com
- * |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
- * With Help And Support From The MaNGOS Project Community.
- * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
- */
-#include "IRCClient.h"
-#include "IRCCmd.h"
-#include "../shared/Config/Config.h"
-#include "IRCConf.h"
-Config MCConfig;
-void IRCClient::SetCfg(char const* cfgfile)
-{
- sIRC.CfgFile = cfgfile;
-}
-bool IRCClient::LoadConfig(char const* cfgfile)
-{
- if (!MCConfig.SetSource(cfgfile))
- sLog.outString("*** MangChat: Unable to open configuration file, All default options are being used.");
- else sLog.outString("*** MangChat: Found the configuration file, %s", cfgfile);
-
- int ConfCnt = 0;
- sIRC._chan_count = 0;
- if(MCConfig.GetIntDefault("irc.active", 0) == 1)
- sIRC.Active = true;
- else
- sIRC.Active = false;
- sIRC._Host = MCConfig.GetStringDefault("irc.host", "irc.rizon.net");
- if(sIRC._Host.size() > 0)
- ConfCnt++;
- sIRC._Mver = MCConfig.GetStringDefault("irc.mver", "Version 1.6.5");
- sIRC._Port = MCConfig.GetIntDefault("irc.port", 6667);
- sIRC._User = MCConfig.GetStringDefault("irc.user", "TC");
- sIRC._Pass = MCConfig.GetStringDefault("irc.pass", "");
- sIRC._Nick = MCConfig.GetStringDefault("irc.nick", "TrinityCoreBot");
- sIRC._Auth = MCConfig.GetIntDefault("irc.auth", 0);
- sIRC._Auth_Nick = MCConfig.GetStringDefault("irc.auth.nick", "TrinityCoreBot");
- sIRC._ICC = MCConfig.GetStringDefault("irc.icc", "001");
- sIRC._defchan = MCConfig.GetStringDefault("irc.defchan", "lobby");
- sIRC._ldefc = MCConfig.GetIntDefault("irc.ldef", 0);
- sIRC._wct = MCConfig.GetIntDefault("irc.wct", 30000);
- sIRC.ajoin = MCConfig.GetIntDefault("irc.ajoin", 1);
- sIRC.ajchan = MCConfig.GetStringDefault("irc.ajchan", "World");
- sIRC.onlrslt = MCConfig.GetIntDefault("irc.online.result", 10);
- sIRC.BOTMASK = MCConfig.GetIntDefault("Botmask", 0);
- sIRC.logfile = MCConfig.GetStringDefault("irc.logfile.prefix", "irc_");
- for(int i = 1; i < MAX_CONF_CHANNELS;i++)
- {
- std::ostringstream ss;
- ss << i;
- std::string ci = "irc.chan_" + ss.str();
- std::string t_chan = MCConfig.GetStringDefault(ci.c_str(), "");
- if(t_chan.size() > 0)
- {
- sIRC._chan_count++;
- sIRC._irc_chan[sIRC._chan_count] = t_chan;
- ci = "wow.chan_" + ss.str();
- sIRC._wow_chan[sIRC._chan_count] = MCConfig.GetStringDefault(ci.c_str(), t_chan.c_str());
- }
- }
- sIRC.JoinMsg = MCConfig.GetStringDefault("irc.joinmsg", "Trinity Core running. Command trigger is $Trigger.");
- sIRC.RstMsg = MCConfig.GetStringDefault("irc.rstmsg", "Trinity Core is restarting...");
- sIRC.kikmsg = MCConfig.GetStringDefault("irc.kickmsg", "Do not kick me.");
- // IRC LINES
- sIRC.ILINES[WOW_IRC] = MCConfig.GetStringDefault("chat.wow_irc", "\003<WoW>[\002$Name($Level)\002\003] $Msg");
- sIRC.ILINES[IRC_WOW] = MCConfig.GetStringDefault("chat.irc_wow", "\003<IRC>[$Name]: $Msg");
- sIRC.ILINES[JOIN_WOW] = MCConfig.GetStringDefault("chat.join_wow", "\00312>>\00304 $Name \003Joined The Channel!");
- sIRC.ILINES[JOIN_IRC] = MCConfig.GetStringDefault("chat.join_irc", "\003[$Name]: Has Joined IRC!");
- sIRC.ILINES[LEAVE_WOW] = MCConfig.GetStringDefault("chat.leave_wow", "\00312<<\00304 $Name \003Left The Channel!");
- sIRC.ILINES[LEAVE_IRC] = MCConfig.GetStringDefault("chat.leave_irc", "\003[$Name]: Has Left IRC!");
- sIRC.ILINES[CHANGE_NICK] = MCConfig.GetStringDefault("chat.change_nick", "\003<> $Name Is Now Known As $NewName!");
- // MangChat Options
- sIRC._MCA = MCConfig.GetIntDefault("irc.maxattempt", 10);
- sIRC._autojoinkick = MCConfig.GetIntDefault("irc.autojoin_kick", 1);
- sIRC._cmd_prefx = MCConfig.GetStringDefault("irc.command_prefix", "-");
-
- sIRC._op_gm = MCConfig.GetIntDefault("irc.op_gm_login", 0);
- sIRC._op_gm_lev = MCConfig.GetIntDefault("irc.op_gm_level", 3);
-
- // Misc Options
- sIRC.games = MCConfig.GetIntDefault("irc.fun.games", 0);
- sIRC.gmlog = MCConfig.GetIntDefault("irc.gmlog", 1);
- sIRC.BOTMASK = MCConfig.GetIntDefault("BotMask", 0);
- sIRC.Status = MCConfig.GetIntDefault("irc.StatusChannel", 1);
- sIRC.anchn = MCConfig.GetIntDefault("irc.AnnounceChannel", 1);
- sIRC.autoanc = MCConfig.GetIntDefault("irc.auto.announce", 30);
- sIRC.ojGM1 = MCConfig.GetStringDefault("irc.gm1", "[Moderator]");
- sIRC.ojGM2 = MCConfig.GetStringDefault("irc.gm2", "[Game Master]");
- sIRC.ojGM3 = MCConfig.GetStringDefault("irc.gm3", "[BugTracker]");
- sIRC.ojGM4 = MCConfig.GetStringDefault("irc.gm4", "[DevTeam Admin]");
- sIRC.ojGM5 = MCConfig.GetStringDefault("irc.gm5", "[Root Admin]");
- // REQUIRED GM LEVEL
- QueryResult *result = WorldDatabase.PQuery("SELECT `Command`, `gmlevel` FROM `IRC_Commands` ORDER BY `Command`");
- if(result)
- {
- Field *fields = result->Fetch();
- for (uint64 i=0; i < result->GetRowCount(); i++)
- {
- std::string command = fields[0].GetCppString();
- uint32 gmlvl = fields[1].GetUInt32();
- if(command == "acct") sIRC.CACCT = gmlvl;
- if(command == "ban") sIRC.CBAN = gmlvl;
- if(command == "char") sIRC.CCHAN = gmlvl;
- if(command == "char") sIRC.CCHAR = gmlvl;
- if(command == "fun") sIRC.CFUN = gmlvl;
- if(command == "help") sIRC.CHELP = gmlvl;
- if(command == "inchan") sIRC.CINCHAN = gmlvl;
- if(command == "info") sIRC.CINFO = gmlvl;
- if(command == "item") sIRC.CITEM = gmlvl;
- if(command == "jail") sIRC.CJAIL = gmlvl;
- if(command == "kick") sIRC.CKICK = gmlvl;
- if(command == "kill") sIRC._KILL = gmlvl;
- if(command == "level") sIRC.CLEVEL = gmlvl;
- if(command == "lookup") sIRC.CLOOKUP = gmlvl;
- if(command == "money") sIRC.CMONEY = gmlvl;
- if(command == "mute") sIRC.CMUTE = gmlvl;
- if(command == "online") sIRC.CONLINE = gmlvl;
- if(command == "pm") sIRC.CPM = gmlvl;
- if(command == "restart") sIRC.CRESTART = gmlvl;
- if(command == "revive") sIRC.CREVIVE = gmlvl;
- if(command == "saveall") sIRC.CSAVEALL = gmlvl;
- if(command == "shutdown") sIRC.CSHUTDOWN = gmlvl;
- if(command == "spell") sIRC.CSPELL = gmlvl;
- if(command == "sysmsg") sIRC.CSYSMSG = gmlvl;
- if(command == "tele") sIRC.CTELE = gmlvl;
- if(command == "top") sIRC.CTOP = gmlvl;
- if(command == "who") sIRC.CWHO = gmlvl;
- result->NextRow();
- }
- delete result;
- }
- else
- {
- sIRC.CACCT = 3;
- sIRC.CBAN = 3;
- sIRC.CCHAN = 3;
- sIRC.CCHAR = 3;
- sIRC.CFUN = 3;
- sIRC.CHELP = 3;
- sIRC.CINCHAN = 3;
- sIRC.CINFO = 3;
- sIRC.CITEM = 3;
- sIRC.CJAIL = 3;
- sIRC.CKICK = 3;
- sIRC._KILL = 3;
- sIRC.CLEVEL = 3;
- sIRC.CLOOKUP = 3;
- sIRC.CMONEY = 3;
- sIRC.CMUTE = 3;
- sIRC.CONLINE = 3;
- sIRC.CPM = 3;
- sIRC.CRESTART = 3;
- sIRC.CREVIVE = 3;
- sIRC.CSAVEALL = 3;
- sIRC.CSHUTDOWN = 3;
- sIRC.CSPELL = 3;
- sIRC.CSYSMSG = 3;
- sIRC.CTELE = 3;
- sIRC.CTOP = 3;
- sIRC.CWHO = 3;
- }
- return true;
-}
-
-std::string IRCClient::GetChatLine(int nItem)
-{
- return sIRC.ILINES[nItem];
-}
diff --git a/src/game/IRCConf.h b/src/game/IRCConf.h deleted file mode 100644 index 9fa646d79d5..00000000000 --- a/src/game/IRCConf.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef MC_CONFIG_H
-#define MC_CONFIG_H
-
-#include "../framework/Platform/CompilerDefs.h"
-
-// Format is YYYYMMDDRR where RR is the change in the conf file
-// for that day.
-#define MANGCHAT_CONF_VERSION 2008011901
-
-#if PLATFORM == PLATFORM_WINDOWS
- #define _MANGCHAT_CONFIG "trinitycore.conf"
-#else
- #define _MANGCHAT_CONFIG "@sysconfdir@/trinitycore.conf"
-#endif
-
-#endif
diff --git a/src/game/IRCConf.h.in b/src/game/IRCConf.h.in deleted file mode 100644 index 9fa646d79d5..00000000000 --- a/src/game/IRCConf.h.in +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef MC_CONFIG_H
-#define MC_CONFIG_H
-
-#include "../framework/Platform/CompilerDefs.h"
-
-// Format is YYYYMMDDRR where RR is the change in the conf file
-// for that day.
-#define MANGCHAT_CONF_VERSION 2008011901
-
-#if PLATFORM == PLATFORM_WINDOWS
- #define _MANGCHAT_CONFIG "trinitycore.conf"
-#else
- #define _MANGCHAT_CONFIG "@sysconfdir@/trinitycore.conf"
-#endif
-
-#endif
diff --git a/src/game/IRCFunc.h b/src/game/IRCFunc.h deleted file mode 100644 index 4dca2847727..00000000000 --- a/src/game/IRCFunc.h +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef _IRC_CLIENT_FUNC
-#define _IRC_CLIENT_FUNC
-
-std::string GetUser(std::string szU)
-{
- int pos = szU.find("!");
- return szU.substr(0, pos);
-}
-// Delink will remove anything considered "non chat" from a string
-// Linked items (items that players can click on to see a description)
-// contain extra characters wich the client filter out, this function
-// makes sure people on irc do not see those characters.
-std::string Delink(std::string msg)
-{
- std::size_t pos;
- while((pos = msg.find("|Hitem")) != std::string::npos)
- {
- std::size_t find1 = msg.find("|h", pos);
- std::size_t find2 = msg.find("|h", find1 + 2);
- msg.replace(pos, find1 - pos + 2, "\x2");
- msg.replace(msg.find("|h", pos), 2, "\x2");
- }
- while((pos = msg.find("|Henchant")) != std::string::npos)
- {
- std::size_t find1 = msg.find("|h", pos);
- std::size_t find2 = msg.find("|h", find1 + 2);
- msg.replace(pos, find1 - pos + 2, "\x2");
- msg.replace(msg.find("|h", pos), 2, "\x2");
- //msg.replace(find2, 2, "\x2");
- }
- return msg;
-}
-
-// This function converts the characters used by the client to identify colour to IRC format.
-std::string WoWcol2IRC(std::string msg)
-{
- std::size_t pos;
- char IRCCol[9][4] = { "\xF", "\xF", "\x3\x31\x34", "\x3\x30\x33", "\x3\x31\x32", "\x3\x30\x36", "\x3\x30\x37", "\x3\x30\x34", "\x3\x30\x37"};
- char WoWCol[9][12] = { "|r", "|cffffffff", "|cff9d9d9d", "|cff1eff00", "|cff0070dd", "|cffa335ee", "|cffff8000", "|cffe6cc80", "|cffffd000"};
- for (int i=0; i<=8; i++)
- {
- while ((pos = msg.find(WoWCol[i])) != std::string::npos)
- {
- if (i == 0)
- msg.replace(pos, 2, IRCCol[i]);
- else
- msg.replace(pos, 10, IRCCol[i]);
- }
- }
- return msg;
-}
-
-// This function converts the characters used by IRC to identify colour to a format the client can understand.
-std::string IRCcol2WoW(std::string msg)
-{
- std::size_t pos;
- char IRCCol[16][4] = { "\x3\x30", "\x3\x31", "\x3\x32", "\x3\x33", "\x3\x34", "\x3\x35", "\x3\x36", "\x3\x37", "\x3\x38", "\x3\x39", "\x3\x31\x30", "\x3\x31\x31", "\x3\x31\x32", "\x3\x31\x33", "\x3\x31\x34", "\x3\x31\x35"};
- char IRCCol2[10][4] = { "\x3\x30\x30", "\x3\x30\x31", "\x3\x30\x32", "\x3\x30\x33", "\x3\x30\x34", "\x3\x30\x35", "\x3\x30\x36", "\x3\x30\x37", "\x3\x30\x38", "\x3\x30\x39"};
- char WoWcol[16][12] = { "|cffffffff", "|cff000000", "|cff00007f", "|cff009300", "|cffff0000", "|cff7f0000", "|cff9c009c", "|cfffc9300", "|cffffff00", "|cff00fc00", "|cff009393", "|cff00ffff", "|cff0000fc", "|cffff00ff", "|cff7f7f7f", "|cffd2d2d2"};
- for (int i=15; i>=0; i--)
- {
- if (i<10)
- {
- while ((pos = msg.find(IRCCol2[i])) != std::string::npos)
- {
- msg.replace(pos, 3, WoWcol[i]);
- }
- while ((pos = msg.find(IRCCol[i])) != std::string::npos)
- {
- msg.replace(pos, 2, WoWcol[i]);
- }
-
- }
- else
- {
- while ((pos = msg.find(IRCCol[i])) != std::string::npos)
- {
- msg.replace(pos, 3, WoWcol[i]);
- }
- }
-
- // Remove Bold, Reverse, Underline from IRC
- char Checker[3][3] = {"\x2","\x16","\x1F"}; // This is the Hex part not Dec. In Decimal its (2,22,31)
- for(int I=0; I < 3; I++)
- {
- while ((pos = msg.find(Checker[I])) != std::string::npos)
- {
- msg.replace(pos, 1, "");
- }
- }
- // Finished Removing !
-
- }
-
- while ((pos = msg.find("\x3")) != std::string::npos)
- {
- msg.replace(pos, 1, "|r");
- }
- while ((pos = msg.find("\xF")) != std::string::npos)
- {
- msg.replace(pos, 1, "|r");
- }
-
- return msg;
-}
-
-// This function compares 2 strings
-int nocase_cmp(const string & s1, const string& s2)
-{
- string::const_iterator it1=s1.begin();
- string::const_iterator it2=s2.begin();
-
- //stop when either string's end has been reached
- while ( (it1!=s1.end()) && (it2!=s2.end()) )
- {
- if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
- // return -1 to indicate smaller than, 1 otherwise
- return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
- //proceed to the next character in each string
- ++it1;
- ++it2;
- }
- size_t size1=s1.size(), size2=s2.size(); // cache lengths
- //return -1,0 or 1 according to strings' lengths
- if (size1==size2)
- return 0;
- return (size1<size2) ? -1 : 1;
-}
-
-std::string MakeMsgA(const char *sLine, ... )
-{
- va_list ap;
- char tmpoutp[1024];
- va_start(ap, sLine);
- vsnprintf(tmpoutp, 1024, sLine, ap );
- va_end(ap);
- std::string outp = tmpoutp;
- return outp;
-}
-
-std::string MakeMsgP(int CLINE, std::string Msg, Player *plr)
-{
- // std::string ChatTag = "";
- // switch (plr->GetTeam())
- // {
- // case 67:ChatTag.append("4");break; //horde
- // case 469:ChatTag.append("12");break; //alliance
- // }
- std::string sMsg = sIRC.MakeMsg(sIRC.GetChatLine(CLINE), "$Msg", Msg);
- // sMsg = ChatTag + MakeMsg(sMsg, "$Name", plr->GetName());
- if (plr->GetTeam() == 67)
- sMsg = sIRC.MakeMsg(sMsg, "$Name", MakeMsgA("\0034%s\003", plr->GetName()));
- else if (plr->GetTeam() == 469)
- sMsg = sIRC.MakeMsg(sMsg, "$Name", MakeMsgA("\00312%s\003", plr->GetName()));
- if(plr->isAFK())
- sMsg = sIRC.MakeMsg(sMsg, "$Tag", "<AFK>");
- else if(plr->isDND())
- sMsg = sIRC.MakeMsg(sMsg, "$Tag", "<DND>");
- else
- sMsg = sIRC.MakeMsg(sMsg, "$Tag", "");
- sMsg = sIRC.MakeMsg(sMsg, "$Level", MakeMsgA("%d", plr->getLevel()));
- sMsg = Delink(sMsg);
- sMsg = WoWcol2IRC(sMsg);
- return sMsg;
-}
-
-/*
-std::string MakeMsg(std::string msg, std::string var, int val)
-{
- std::ostringstream ss;
- ss << val;
-
- std::string nval = ss.str();
- std::size_t start = msg.find(var);
- if (start != std::string::npos)
- msg.replace(start, var.length(), val);
- return msg;
-}
-*/
-/*
-std::string MakeMsg(const char *sLine, ... )
-{
- va_list ap;
- char tmpoutp[1024];
- va_start(ap, sLine);
- vsnprintf(tmpoutp, 1024, sLine, ap );
- va_end(ap);
- std::string outp = tmpoutp;
- return outp;
-}
-*/
-
-// This function checks if a channel exists in out configuration
-// Mangchat supports as many channels as you like
-// However the default has been set to 10
-// if you wish to increase this you must edit the:
-// MAX_CONF_CHANNELS variable in IRCClient.h
-bool Channel_Valid(std::string Channel)
-{
- for(int i=1;i < sIRC._chan_count + 1;i++)
- {
- if(nocase_cmp(sIRC._wow_chan[i], Channel)==0)
- return true;
- }
- return false;
-}
-
-std::string GetWoWChannel(std::string Channel)
-{
- for(int i=1;i < sIRC._chan_count + 1;i++)
- {
- if("#" + sIRC._irc_chan[i] == Channel)
- return sIRC._wow_chan[i];
- }
- return "";
-}
-
-std::string GetIRCChannel(std::string Channel)
-{
- for(int i=1;i < sIRC._chan_count + 1;i++)
- {
- if(sIRC._wow_chan[i] == Channel)
- return sIRC._irc_chan[i];
- }
- return "";
-}
-
-std::string* getArray(std::string PARAMS, int nCount, std::string )
-{
- std::string *array = new std::string[nCount];
- if(PARAMS.size() > 0)
- {
- int pcnt = 0;
- size_t ps = 0;
- size_t pc = -1;
- for(int i = 0;i < nCount;i++)
- {
- pc = PARAMS.find(" ", pc + 1);
- if(i + 1 == nCount && nCount != 1)
- {
- if(ps > 0 && pc > 0)
- array[i] = PARAMS.substr(ps, PARAMS.size() - ps);
- }
- else
- array[i] = PARAMS.substr(ps, pc - ps);
- ps = pc + 1;
- }
- }
- return array;
-}
-#endif
diff --git a/src/game/IRCIO.cpp b/src/game/IRCIO.cpp deleted file mode 100644 index c8c0213ed0d..00000000000 --- a/src/game/IRCIO.cpp +++ /dev/null @@ -1,436 +0,0 @@ -#include "IRCClient.h"
-#include "IRCCmd.h"
-#include "IRCFunc.h"
-#include "ObjectAccessor.h"
-#include "ObjectMgr.h"
-#include "WorldPacket.h"
-#include "ChannelMgr.h"
-#include "Config/ConfigEnv.h"
-#include "Channel.h"
-#include "World.h"
-
-IRCCmd Command;
-void IRCClient::Handle_IRC(std::string sData)
-{
- sLog.outDebug(sData.c_str());
- // If first 5 chars are ERROR then something is wrong
- // either link is being closed, nickserv ghost command, etc...
- if(sData.substr(0, 5) == "ERROR")
- {
- Disconnect();
- return;
- }
- if(sData.substr(0, 4) == "PING")
- {
- // if the first 4 characters contain PING
- // the server is checking if we are still alive
- // sen back PONG back plus whatever the server send with it
- SendIRC("PONG " + sData.substr(4, sData.size() - 4));
- }
- else
- {
- // if the first line contains : its an irc message
- // such as private messages channel join etc.
- if(sData.substr(0, 1) == ":")
- {
- // find the spaces in the receieved line
- size_t p1 = sData.find(" ");
- size_t p2 = sData.find(" ", p1 + 1);
- // because the irc protocol uses simple spaces
- // to seperate data we can easy pick them out
- // since we know the position of the spaces
- std::string USR = sData.substr(1, p1 - 1);
- std::string CMD = sData.substr(p1 + 1, p2 - p1 - 1);
- // trasform the commands to lowercase to make sure they always match
- std::transform(CMD.begin(), CMD.end(), CMD.begin(), towlower);
- // Extract the username from the first part
- std::string szUser = GetUser(USR);
- // if we receieved the internet connect code
- // we know for sure that were in and we can
- // authenticate ourself.
- if(CMD == sIRC._ICC)
- {
- // _Auth is defined in mangosd.conf (irc.auth)
- // 0 do not authenticate
- // 1 use nickserv
- // 2 use quakenet
- // aditionally you can provide you own authentication method here
- switch(sIRC._Auth)
- {
- case 1:
- SendIRC("PRIVMSG nickserv :IDENTIFY " + sIRC._Pass);
- break;
- case 2:
- SendIRC("PRIVMSG nickserv :IDENTIFY " + sIRC._Auth_Nick + " " + sIRC._Pass);
- break;
- case 3:
- SendIRC("PRIVMSG Q@CServe.quakenet.org :AUTH " + sIRC._Nick + " " + sIRC._Pass);
- break;
- case 4:
- SendIRC("PRIVMSG Q@CServe.quakenet.org :AUTH " + sIRC._Auth_Nick + " " + sIRC._Pass);
- break;
- }
- // if we join a default channel leave this now.
- if(sIRC._ldefc==1)
- SendIRC("PART #" + sIRC._defchan);
- // Loop thru the channel array and send a command to join them on IRC.
- for(int i=1;i < sIRC._chan_count + 1;i++)
- {
- SendIRC("JOIN #" + sIRC._irc_chan[i]);
- }
- }
- // someone joined the channel this could be the bot or another user
- if(CMD == "join")
- {
- size_t p = sData.find(":", p1);
- std::string CHAN = sData.substr(p + 1, sData.size() - p - 2);
- // if the user is us it means we join the channel
- if ((szUser == sIRC._Nick) )
- {
- // its us that joined the channel
- Send_IRC_Channel(CHAN, MakeMsg(MakeMsg(sIRC.JoinMsg, "$Ver", sIRC._Mver.c_str()), "$Trigger", sIRC._cmd_prefx.c_str()), true);
- }
- else
- {
- // if the user is not us its someone else that joins
- // so we construct a message and send this to the clients.
- // MangChat now uses Send_WoW_Channel to send to the client
- // this makes MangChat handle the packets instead of previously the world.
- if((sIRC.BOTMASK & 2) != 0)
- Send_WoW_Channel(GetWoWChannel(CHAN).c_str(), IRCcol2WoW(MakeMsg(MakeMsg(GetChatLine(JOIN_IRC), "$Name", szUser), "$Channel", GetWoWChannel(CHAN))));
- }
- }
- // someone on irc left or quit the channel
- if(CMD == "part" || CMD == "quit")
- {
- size_t p3 = sData.find(" ", p2 + 1);
- std::string CHAN = sData.substr(p2 + 1, p3 - p2 - 1);
- // Logout IRC Nick From MangChat If User Leaves Or Quits IRC.
- if(Command.IsLoggedIn(szUser))
- {
- _CDATA CDATA;
- CDATA.USER = szUser;
- Command.Handle_Logout(&CDATA);
- }
- // Construct a message and inform the clients on the same channel.
- if((sIRC.BOTMASK & 2) != 0)
- Send_WoW_Channel(GetWoWChannel(CHAN).c_str(), IRCcol2WoW(MakeMsg(MakeMsg(GetChatLine(LEAVE_IRC), "$Name", szUser), "$Channel", GetWoWChannel(CHAN))));
- }
- // someone changed their nick
- if (CMD == "nick" && (sIRC.BOTMASK & 128) != 0)
- {
- MakeMsg(MakeMsg(GetChatLine(CHANGE_NICK), "$Name", szUser), "$NewName", sData.substr(sData.find(":", p2) + 1));
- // If the user is logged in and changes their nick
- // then we want to either log them out or update
- // their nick in the bot. I chose to update the bots user list.
- if(Command.IsLoggedIn(szUser))
- {
- std::string NewNick = sData.substr(sData.find(":", p2) + 1);
- // On freenode I noticed the server sends an extra character
- // at the end of the string, so we need to erase the last
- // character of the string. if you have a problem with getting
- // the last letter of your nick erased, then remove the - 1.
- NewNick.erase(NewNick.length() - 1, 1);
-
- for(std::list<_client*>::iterator i=Command._CLIENTS.begin(); i!=Command._CLIENTS.end();i++)
- {
- if((*i)->Name == szUser)
- {
- (*i)->Name = NewNick;
- sIRC.Send_IRC_Channel(NewNick.c_str(), "I Noticed You Changed Your Nick, I Have Updated My Internal Database Accordingly.", true, "NOTICE");
-
- // Figure why not output to the logfile, makes tracing problems easier.
- sIRC.iLog.WriteLog(" %s : %s Changed Nick To: %s", sIRC.iLog.GetLogDateTimeStr().c_str(), szUser.c_str(), NewNick.c_str());
- }
- }
- }
-
- }
- // someone was kicked from irc
- if (CMD == "kick")
- {
- // extract the details
- size_t p3 = sData.find(" ", p2 + 1);
- size_t p4 = sData.find(" ", p3 + 1);
- size_t p5 = sData.find(":", p4);
- std::string CHAN = sData.substr(p2 + 1, p3 - p2 - 1);
- std::string WHO = sData.substr(p3 + 1, p4 - p3 - 1);
- std::string BY = sData.substr(p4 + 1, sData.size() - p4 - 1);
- // if the one kicked was us
- if(WHO == sIRC._Nick)
- {
- // and autojoin is enabled
- // return to the channel
- if(sIRC._autojoinkick == 1)
- {
- SendIRC("JOIN " + CHAN);
- Send_IRC_Channel(CHAN, sIRC.kikmsg, true);
- }
- }
- else
- {
- // if it is not us who was kicked we need to inform the clients someone
- // was removed from the channel
- // construct a message and send it to the players.
- Send_WoW_Channel(GetWoWChannel(CHAN).c_str(), "<IRC>[" + WHO + "]: Was Kicked From " + CHAN + " By: " + szUser);
- }
- }
- // a private chat message was receieved.
- if(CMD == "privmsg" || CMD == "notice")
- {
- // extract the values
- size_t p = sData.find(" ", p2 + 1);
- std::string FROM = sData.substr(p2 + 1, p - p2 - 1);
- std::string CHAT = sData.substr(p + 2, sData.size() - p - 3);
- // if this is our username it means we recieved a PM
- if(FROM == sIRC._Nick)
- {
- if(CHAT.find("\001VERSION\001") < CHAT.size())
- {
- Send_IRC_Channel(szUser, MakeMsg("\001VERSION MangChat %s ©2008 |Death|\001", "%s" , sIRC._Mver.c_str()), true, "PRIVMSG");
- }
- // a pm is required for certain commands
- // such as login. to validate the command
- // we send it to the command class wich handles
- // evrything else.
- Command.IsValid(szUser, FROM, CHAT, CMD);
- }
- else
- {
- // if our name is not in it, it means we receieved chat on one of the channels
- // magchat is in. the first thing we do is check if it is a command or not
- if(!Command.IsValid(szUser, FROM, CHAT, CMD))
- {
- Send_WoW_Channel(GetWoWChannel(FROM).c_str(), IRCcol2WoW(MakeMsg(MakeMsg(GetChatLine(IRC_WOW), "$Name", szUser), "$Msg", CHAT)));
- }
- // if we indeed receieved a command we do not want to display this to the players
- // so only incanse the isvalid command returns false it will be sent to all player.
- // the isvalid function will automaitcly process the command on true.
- }
- }
- if(CMD == "mode")
- {
- // extract the mode details
- size_t p3 = sData.find(" ", p2 + 1);
- size_t p4 = sData.find(" ", p3 + 1);
- size_t p5 = sData.find(" ", p4 + 1);
- std::string CHAN = sData.substr(p2 + 1, p3 - p2 - 1);
- std::string MODE = sData.substr(p3 + 1, p4 - p3 - 1);
- std::string NICK = sData.substr(p4 + 1, p5 - p4 - 1);
- bool _AmiOp;
- _AmiOp = false;
- //A mode was changed on us
- if(NICK.c_str() == sIRC._Nick)
- _AmiOp = true;
-
- }
- }
- }
-}
-
-// This function is called in Channel.h
-// based on nAction it will inform the people on
-// irc when someone leaves one of the game channels.
-// nAction is based on the struct CACTION
-void IRCClient::Handle_WoW_Channel(std::string Channel, Player *plr, int nAction)
-{
- // make sure that we are connected
- if(sIRC.Connected && (sIRC.BOTMASK & 1)!= 0)
- {
- if(Channel_Valid(Channel))
- {
- std::string GMRank = "";
- std::string pname = plr->GetName();
- bool DoGMAnnounce = false;
- if (plr->GetSession()->GetSecurity() > 0 && (sIRC.BOTMASK & 8)!= 0)
- DoGMAnnounce = true;
- if (plr->isGameMaster() && (sIRC.BOTMASK & 16)!= 0)
- DoGMAnnounce = true;
- if(DoGMAnnounce)
- {
- switch(plr->GetSession()->GetSecurity()) //switch case to determine what rank the "gm" is
- {
- case 0: GMRank = "";break;
- case 1: GMRank = "\0037"+sIRC.ojGM1;break;
- case 2: GMRank = "\0037"+sIRC.ojGM2;break;
- case 3: GMRank = "\0037"+sIRC.ojGM3;break;
- case 4: GMRank = "\0037"+sIRC.ojGM4;break;
- case 5: GMRank = "\0037"+sIRC.ojGM5;break;
- }
- }
- std::string ChatTag = "";
- switch (plr->GetTeam())
- {
- case 67:ChatTag.append("\0034");break; //horde
- case 469:ChatTag.append("\00312");break; //alliance
- }
- std::string query = "INSERT INTO `IRC_Inchan` VALUES (%d,'"+pname+"','"+Channel+"')";
- std::string lchan = "DELETE FROM `IRC_Inchan` WHERE `guid` = %d AND `channel` = '"+Channel+"'";
- switch(nAction)
- {
- case CHANNEL_JOIN:
- Send_IRC_Channel(GetIRCChannel(Channel), MakeMsg(MakeMsg(MakeMsg(GetChatLine(JOIN_WOW), "$Name", ChatTag + plr->GetName()), "$Channel", Channel), "$GM", GMRank));
- WorldDatabase.PExecute(lchan.c_str(), plr->GetGUID());
- WorldDatabase.PExecute(query.c_str(), plr->GetGUID());
- break;
- case CHANNEL_LEAVE:
- Send_IRC_Channel(GetIRCChannel(Channel), MakeMsg(MakeMsg(MakeMsg(GetChatLine(LEAVE_WOW), "$Name", ChatTag + plr->GetName()), "$Channel", Channel), "$GM", GMRank));
- WorldDatabase.PExecute(lchan.c_str(), plr->GetGUID());
- break;
- }
- }
- }
-}
-
-// This function sends chat to a irc channel or user
-// to prevent the # beeing appended to send a msg to a user
-// set the NoPrefix to true
-void IRCClient::Send_IRC_Channel(std::string sChannel, std::string sMsg, bool NoPrefix, std::string nType)
-{
- std::string mType = "PRIVMSG";
- if(Command.MakeUpper(nType.c_str()) == "NOTICE")
- mType = "NOTICE";
- if(Command.MakeUpper(nType.c_str()) == "ERROR" && (sIRC.BOTMASK & 32)!= 0)
- mType = "NOTICE";
- if(sIRC.Connected)
- {
- if(NoPrefix)
- SendIRC(mType + " " + sChannel + " :" + sMsg);
- else
- SendIRC(mType + " #" + sChannel + " :" + sMsg);
- }
-}
-
-// This function sends a message to all irc channels
-// that mangchat has in its configuration
-void IRCClient::Send_IRC_Channels(std::string sMsg)
-{
- for(int i=1;i < sIRC._chan_count + 1;i++)
- Send_IRC_Channel(sIRC._irc_chan[i], sMsg);
-}
-
-// This function is called in ChatHandler.cpp, any channel chat from wow will come
-// to this function, validates the channel and constructs a message that is send to IRC
-void IRCClient::Send_WoW_IRC(Player *plr, std::string Channel, std::string Msg)
-{
- // Check if the channel exist in our configuration
- if(Channel_Valid(Channel) && Msg.substr(0, 1) != ".")
- Send_IRC_Channel(GetIRCChannel(Channel), MakeMsgP(WOW_IRC, Msg, plr));
-}
-
-void IRCClient::Send_WoW_Player(std::string sPlayer, std::string sMsg)
-{
- normalizePlayerName(sPlayer);
- if (Player* plr = ObjectAccessor::Instance().FindPlayerByName(sPlayer.c_str()))
- Send_WoW_Player(plr, sMsg);
-}
-
-void IRCClient::Send_WoW_Player(Player *plr, string sMsg)
-{
- WorldPacket data(SMSG_MESSAGECHAT, 200);
- data << (uint8)CHAT_MSG_SYSTEM;
- data << (uint32)LANG_UNIVERSAL;
- data << (uint64)plr->GetGUID();
- data << (uint32)0;
- data << (uint64)plr->GetGUID();
- data << (uint32)(sMsg.length()+1);
- data << sMsg;
- data << (uint8)0;
- plr->GetSession()->SendPacket(&data);
-}
-
-// This function will construct and send a packet to all players
-// on the given channel ingame. (previuosly found in world.cpp)
-// it loops thru all sessions and checks if they are on the channel
-// if so construct a packet and send it.
-void IRCClient::Send_WoW_Channel(const char *channel, std::string chat)
-{
- if(!(strlen(channel) > 0))
- return;
-
- #ifdef USE_UTF8
- std::string chat2 = chat;
- if(ConvertUTF8(chat2.c_str(), chat2))
- chat = chat2;
- #endif
-
- HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
- for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
- {
- if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
- {
- if(ChannelMgr* cMgr = channelMgr(itr->second->GetSession()->GetPlayer()->GetTeam()))
- {
- if(Channel *chn = cMgr->GetChannel(channel, itr->second->GetSession()->GetPlayer()))
- {
- WorldPacket data;
- data.Initialize(SMSG_MESSAGECHAT);
- data << (uint8)CHAT_MSG_CHANNEL;
- data << (uint32)LANG_UNIVERSAL;
- data << (uint64)0;
- data << (uint32)0;
- data << channel;
- data << (uint64)0;
- data << (uint32) (strlen(chat.c_str()) + 1);
- data << IRCcol2WoW(chat.c_str());
- data << (uint8)0;
- itr->second->GetSession()->SendPacket(&data);
- }
- }
- }
- }
-}
-
-void IRCClient::Send_WoW_System(std::string Message)
-{
- HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
- for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
- {
- if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
- {
- WorldPacket data;
- data.Initialize(CHAT_MSG_SYSTEM);
- data << (uint8)CHAT_MSG_SYSTEM;
- data << (uint32)LANG_UNIVERSAL;
- data << (uint64)0;
- data << (uint32)0;
- data << (uint64)0;
- data << (uint32) (strlen(Message.c_str()) + 1);
- data << Message.c_str();
- data << (uint8)0;
- itr->second->GetSession()->SendPacket(&data);
- }
- }
-}
-void IRCClient::ResetIRC()
-{
- SendData("QUIT");
- Disconnect();
-}
-
-#define CHAT_INVITE_NOTICE 0x18
-
-// this function should be called on player login Player::AddToWorld
-void IRCClient::AutoJoinChannel(Player *plr)
-{
- //this will work if at least 1 player is logged in regrdless if he is on the channel or not
- // the first person that login empty server is the one with bad luck and wont be invited,
- // if at least 1 player is online the player will be inited to the chanel
-
- std::string m_name = sIRC.ajchan;
- WorldPacket data;
- data.Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
- data << uint8(CHAT_INVITE_NOTICE);
- data << m_name.c_str();
-
- HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
- for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
- {
- if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
- {
- data << uint64(itr->second->GetGUID());
- break;
- }
- }
- plr->GetSession()->SendPacket(&data);
-}
diff --git a/src/game/IRCLog.cpp b/src/game/IRCLog.cpp deleted file mode 100644 index 07bde4a6326..00000000000 --- a/src/game/IRCLog.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "IRCLog.h"
-#include "Config/ConfigEnv.h"
-#include "IRCClient.h"
-#include <stdarg.h>
-
-IRCLog::IRCLog()
-{
- std::string logsDir = sConfig.GetStringDefault("LogsDir","");
- std::string ircLogName = logsDir + "/IRC_";
- std::string ircLogTimestamp = GetLogDateStr();
- ircLogName += ircLogTimestamp +".log";
- ircLogfile.open (ircLogName.c_str(), std::ios::app);
-}
-
-IRCLog::~IRCLog()
-{
- ircLogfile.close();
-}
-// Was added because using the time for logs is very annoying... one log per day.. much cleaner looking..
-std::string IRCLog::GetLogDateStr() const
-{
- time_t t = time(NULL);
- tm* aTm = localtime(&t);
- // YYYY year
- // MM month (2 digits 01-12)
- // DD day (2 digits 01-31)
- // HH hour (2 digits 00-23)
- // MM minutes (2 digits 00-59)
- // SS seconds (2 digits 00-59)
- char buf[20];
- snprintf(buf,20,"%04d-%02d-%02d",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday);
- return std::string(buf);
-}
-
-std::string IRCLog::GetLogDateTimeStr() const
-{
- time_t t = time(NULL);
- tm* aTm = localtime(&t);
- // YYYY year
- // MM month (2 digits 01-12)
- // DD day (2 digits 01-31)
- // HH hour (2 digits 00-23)
- // MM minutes (2 digits 00-59)
- // SS seconds (2 digits 00-59)
- char buf[30];
- snprintf(buf,30,"[ %04d-%02d-%02d ] [ %02d:%02d:%02d ]",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
- return std::string(buf);
-}
-
-void IRCLog::WriteLog(const char *what, ...)
-{
- va_list ap;
- char tmpoutp[1024];
- va_start(ap, what);
- vsnprintf(tmpoutp, 1024, what, ap );
- va_end(ap);
- ircLogfile << tmpoutp;
- ircLogfile << "\n";
- ircLogfile.flush();
-}
diff --git a/src/game/IRCLog.h b/src/game/IRCLog.h deleted file mode 100644 index fd35a0aaa79..00000000000 --- a/src/game/IRCLog.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _IRC_LOG_H
-#define _IRC_LOG_H
-
-#include "Common.h"
-#include <fstream>
-
-class IRCLog
-{
- public:
- IRCLog();
- ~IRCLog();
-
- public:
- void WriteLog(const char *what, ...);
- std::string GetLogDateStr() const;
- std::string GetLogDateTimeStr() const;
- private:
- std::ofstream ircLogfile;
-};
-
-
-#endif
diff --git a/src/game/IRCSock.cpp b/src/game/IRCSock.cpp deleted file mode 100644 index cf76161cc02..00000000000 --- a/src/game/IRCSock.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "IRCClient.h"
-#define MAXDATASIZE 512
-#include <fcntl.h>
-
-#include <stdio.h>
-#include <sys/types.h>
-
-
-#define _UNICODE
-
-#ifdef _MBCS
-#undef _MBCS
-#endif
-
-bool IRCClient::InitSock()
-{
- #ifdef _WIN32
- WSADATA wsaData; //WSAData
- if(WSAStartup(MAKEWORD(2,0),&wsaData) != 0)
- {
- sLog.outError("IRC Error: Winsock Initialization Error");
- return false;
- }
- #endif
- if ((sIRC.SOCKET = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
- {
- sLog.outError("IRC Error: Socket Error");
- return false;
- }
- int on = 1;
- if ( setsockopt ( sIRC.SOCKET, SOL_SOCKET, SO_REUSEADDR, ( const char* ) &on, sizeof ( on ) ) == -1 )
- {
- sLog.outError("IRC Error: Invalid Socket");
- return false;
- }
- #ifdef _WIN32
- u_long iMode = 0;
- ioctlsocket(sIRC.SOCKET, FIONBIO, &iMode);
- #else
- fcntl(sIRC.SOCKET, F_SETFL, O_NONBLOCK); // set to non-blocking
- fcntl(sIRC.SOCKET, F_SETFL, O_ASYNC); // set to asynchronous I/O
- #endif
- return true;
-}
-
-bool IRCClient::Connect(const char *cHost, int nPort)
-{
- sIRC.Connected = false;
- struct hostent *he;
- if ((he=gethostbyname(cHost)) == NULL)
- {
- sLog.outError("IRCLIENT: Could not resolve host: %s", cHost);
- return false;
- }
- struct sockaddr_in their_addr;
- their_addr.sin_family = AF_INET;
- their_addr.sin_port = htons(nPort);
- their_addr.sin_addr = *((struct in_addr *)he->h_addr);
- memset(&(their_addr.sin_zero), '\0', 8);
- if (::connect(sIRC.SOCKET, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1)
- {
- sLog.outError("IRCLIENT: Cannot connect to %s", cHost);
- return false;
- }
- //FD_ZERO(&sIRC.sfdset);
- //FD_SET(sIRC.SOCKET,&sIRC.sfdset);
- sIRC.Connected = true;
- return true;
-}
-
-bool IRCClient::Login(std::string sNick, std::string sUser, std::string sPass)
-{
- char hostname[128];
- gethostname(hostname, sizeof(hostname));
- if(SendIRC("HELLO"))
- if(SendIRC("PASS " + sPass))
- if(SendIRC("NICK " + sNick))
- if(SendIRC("USER " + sUser + " " + (std::string)hostname + " MangChat :MangChat "+sIRC._Mver.c_str()))
- return true;
- return false;
-}
-
-bool IRCClient::SendData(const char *data)
-{
- if(sIRC.Connected)
- {
- if (send(sIRC.SOCKET, data, strlen(data), 0) == -1)
- {
- sLog.outError("IRC Error: Socket Receieve ** \n");
- //Disconnect();
- return false;
- }
- }
- return true;
-}
-
-bool IRCClient::SendIRC(std::string data)
-{
- std::string RealData = data + "\n";
- return SendData(RealData.c_str());
-}
-
-void IRCClient::Disconnect()
-{
- if(sIRC.SOCKET)
- {
- #ifdef _WIN32
- closesocket(sIRC.SOCKET);
- //WSACleanup();
- #else
- close(sIRC.SOCKET);
- #endif
- }
-}
-
-void IRCClient::SockRecv()
-{
-// wchar_t bufferdata;
-
- char szBuffer[MAXDATASIZE];
-
- memset(szBuffer, 0, MAXDATASIZE );
-
- int nBytesRecv = ::recv(sIRC.SOCKET, szBuffer, MAXDATASIZE - 1, 0 );
- if ( nBytesRecv == -1 )
- {
- sLog.outError("Connection lost.");
- sIRC.Connected = false;
- }
- else
- {
- if (-1 == nBytesRecv)
- {
- sLog.outError("Error occurred while receiving from socket.");
- }
- else
- {
- std::string reply;
- std::istringstream iss(szBuffer);
- while(getline(iss, reply))
- {
- Handle_IRC(reply);
- }
- }
- }
-}
diff --git a/src/game/IdleMovementGenerator.cpp b/src/game/IdleMovementGenerator.cpp index 3932bd63f1f..13f37ed6334 100644 --- a/src/game/IdleMovementGenerator.cpp +++ b/src/game/IdleMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "IdleMovementGenerator.h" diff --git a/src/game/IdleMovementGenerator.h b/src/game/IdleMovementGenerator.h index cd1c8a20ac7..78ad33cfb52 100644 --- a/src/game/IdleMovementGenerator.h +++ b/src/game/IdleMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_IDLEMOVEMENTGENERATOR_H -#define MANGOS_IDLEMOVEMENTGENERATOR_H +#ifndef TRINITY_IDLEMOVEMENTGENERATOR_H +#define TRINITY_IDLEMOVEMENTGENERATOR_H #include "MovementGenerator.h" -class MANGOS_DLL_SPEC IdleMovementGenerator : public MovementGenerator +class TRINITY_DLL_SPEC IdleMovementGenerator : public MovementGenerator { public: @@ -34,7 +36,7 @@ class MANGOS_DLL_SPEC IdleMovementGenerator : public MovementGenerator extern IdleMovementGenerator si_idleMovement; -class MANGOS_DLL_SPEC DistractMovementGenerator : public MovementGenerator +class TRINITY_DLL_SPEC DistractMovementGenerator : public MovementGenerator { public: explicit DistractMovementGenerator(uint32 timer) : m_timer(timer) {} diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp index 78c7bea2584..49d3959cbbe 100644 --- a/src/game/InstanceData.cpp +++ b/src/game/InstanceData.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "InstanceData.h" diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h index 518fa8661fd..86b2fc0e713 100644 --- a/src/game/InstanceData.h +++ b/src/game/InstanceData.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_INSTANCE_DATA_H -#define MANGOS_INSTANCE_DATA_H +#ifndef TRINITY_INSTANCE_DATA_H +#define TRINITY_INSTANCE_DATA_H #include "Common.h" @@ -27,7 +29,7 @@ class Player; class GameObject; class Creature; -class MANGOS_DLL_SPEC InstanceData +class TRINITY_DLL_SPEC InstanceData { public: diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index aedf7015b3a..e9c37f725dd 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -1,5 +1,8 @@ /* - * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * * 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 @@ -8,12 +11,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "InstanceSaveMgr.h" diff --git a/src/game/InstanceSaveMgr.h b/src/game/InstanceSaveMgr.h index 961e915eb11..9fa542c3571 100644 --- a/src/game/InstanceSaveMgr.h +++ b/src/game/InstanceSaveMgr.h @@ -1,5 +1,8 @@ /* - * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * * 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 @@ -8,12 +11,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __InstanceSaveMgr_H @@ -110,7 +113,7 @@ class InstanceSave bool m_canReset; }; -class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton<InstanceSaveManager, MaNGOS::ClassLevelLockable<InstanceSaveManager, ZThread::Mutex> > +class TRINITY_DLL_DECL InstanceSaveManager : public Trinity::Singleton<InstanceSaveManager, Trinity::ClassLevelLockable<InstanceSaveManager, ZThread::Mutex> > { friend class InstanceSave; public: @@ -168,5 +171,5 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton<InstanceSav ResetTimeQueue m_resetTimeQueue; }; -#define sInstanceSaveManager MaNGOS::Singleton<InstanceSaveManager>::Instance() +#define sInstanceSaveManager Trinity::Singleton<InstanceSaveManager>::Instance() #endif diff --git a/src/game/Item.cpp b/src/game/Item.cpp index b7e5d010773..2ca1e84d6c4 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/Item.h b/src/game/Item.h index 7379edd03f8..6a3862c72f4 100644 --- a/src/game/Item.h +++ b/src/game/Item.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_ITEM_H -#define MANGOSSERVER_ITEM_H +#ifndef TRINITYCORE_ITEM_H +#define TRINITYCORE_ITEM_H #include "Common.h" #include "Object.h" @@ -191,7 +193,7 @@ enum ItemUpdateState bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto); -class MANGOS_DLL_SPEC Item : public Object +class TRINITY_DLL_SPEC Item : public Object { public: static Item* CreateItem( uint32 item, uint32 count, Player const* player = NULL ); diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp index 9fd2e961745..0459eaa2fc9 100644 --- a/src/game/ItemEnchantmentMgr.cpp +++ b/src/game/ItemEnchantmentMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdlib.h> diff --git a/src/game/ItemEnchantmentMgr.h b/src/game/ItemEnchantmentMgr.h index 95c93cf39df..1d6fade8329 100644 --- a/src/game/ItemEnchantmentMgr.h +++ b/src/game/ItemEnchantmentMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ITEM_ENCHANTMENT_MGR_H diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 9cd6c2f6265..5ae00efe260 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -468,7 +470,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) recv_data >> vendorguid >> itemguid >> _count; - // prevent possible overflow, as mangos uses uint32 for item count + // prevent possible overflow, as Trinity uses uint32 for item count uint32 count = _count; if(!itemguid) diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 2325d229859..3481b1bf432 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ITEMPROTOTYPE_H diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index df87b51de89..306bfc77b0c 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "WorldSession.h" diff --git a/src/game/Language.h b/src/game/Language.h index d1b96855dad..9e7af05511c 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,18 +10,18 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __MANGOS_LANGUAGE_H -#define __MANGOS_LANGUAGE_H +#ifndef __TRINITY_LANGUAGE_H +#define __TRINITY_LANGUAGE_H -enum MangosStrings +enum TrinityStrings { // for chat commands LANG_SELECT_CHAR_OR_CREATURE = 1, @@ -659,6 +661,69 @@ enum MangosStrings // FREE IDS 1000-9999 // Use for not-in-svn patches 10000-10999 + // opvp hp + LANG_OPVP_HP_CAPTURE_OVERLOOK_H = 10001, + LANG_OPVP_HP_CAPTURE_OVERLOOK_A = 10002, + LANG_OPVP_HP_CAPTURE_STADIUM_H = 10003, + LANG_OPVP_HP_CAPTURE_STADIUM_A = 10004, + LANG_OPVP_HP_CAPTURE_BROKENHILL_H = 10005, + LANG_OPVP_HP_CAPTURE_BROKENHILL_A = 10006, + LANG_OPVP_HP_LOOSE_OVERLOOK_H = 10007, + LANG_OPVP_HP_LOOSE_OVERLOOK_A = 10008, + LANG_OPVP_HP_LOOSE_STADIUM_H = 10009, + LANG_OPVP_HP_LOOSE_STADIUM_A = 10010, + LANG_OPVP_HP_LOOSE_BROKENHILL_H = 10011, + LANG_OPVP_HP_LOOSE_BROKENHILL_A = 10012, + // opvp zm + LANG_OPVP_ZM_CAPTURE_WEST_H = 10013, + LANG_OPVP_ZM_CAPTURE_WEST_A = 10014, + LANG_OPVP_ZM_CAPTURE_EAST_H = 10015, + LANG_OPVP_ZM_CAPTURE_EAST_A = 10016, + LANG_OPVP_ZM_CAPTURE_GY_H = 10017, + LANG_OPVP_ZM_CAPTURE_GY_A = 10018, + LANG_OPVP_ZM_LOOSE_WEST_H = 10019, + LANG_OPVP_ZM_LOOSE_WEST_A = 10020, + LANG_OPVP_ZM_LOOSE_EAST_H = 10021, + LANG_OPVP_ZM_LOOSE_EAST_A = 10022, + LANG_OPVP_ZM_LOOSE_GY_H = 10023, + LANG_OPVP_ZM_LOOSE_GY_A = 10024, + // opvp na + LANG_OPVP_NA_CAPTURE_H = 10025, + LANG_OPVP_NA_CAPTURE_A = 10026, + LANG_OPVP_NA_LOOSE_H = 10027, + LANG_OPVP_NA_LOOSE_A = 10028, + // opvp tf + LANG_OPVP_TF_CAPTURE_H = 10029, + LANG_OPVP_TF_CAPTURE_A = 10030, + LANG_OPVP_TF_LOOSE_H = 10031, + LANG_OPVP_TF_LOOSE_A = 10032, + // opvp ep + LANG_OPVP_EP_CAPTURE_NPT_H = 10033, + LANG_OPVP_EP_CAPTURE_NPT_A = 10034, + LANG_OPVP_EP_CAPTURE_EWT_H = 10035, + LANG_OPVP_EP_CAPTURE_EWT_A = 10036, + LANG_OPVP_EP_CAPTURE_CGT_H = 10037, + LANG_OPVP_EP_CAPTURE_CGT_A = 10038, + LANG_OPVP_EP_CAPTURE_PWT_H = 10039, + LANG_OPVP_EP_CAPTURE_PWT_A = 10040, + LANG_OPVP_EP_LOOSE_NPT_H = 10041, + LANG_OPVP_EP_LOOSE_NPT_A = 10042, + LANG_OPVP_EP_LOOSE_EWT_H = 10043, + LANG_OPVP_EP_LOOSE_EWT_A = 10044, + LANG_OPVP_EP_LOOSE_CGT_H = 10045, + LANG_OPVP_EP_LOOSE_CGT_A = 10046, + LANG_OPVP_EP_LOOSE_PWT_H = 10047, + LANG_OPVP_EP_LOOSE_PWT_A = 10048, + // opvp si + LANG_OPVP_SI_CAPTURE_H = 10049, + LANG_OPVP_SI_CAPTURE_A = 10050, + // opvp gossips + LANG_OPVP_EP_FLIGHT_NPT = 10051, + LANG_OPVP_EP_FLIGHT_EWT = 10052, + LANG_OPVP_EP_FLIGHT_CGT = 10053, + LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054, + LANG_OPVP_ZM_GOSSIP_HORDE = 10055, + // Use for custom patches 11000-11999 // NOT RESERVED IDS 12000- diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 5130b158360..d5d8be4af6d 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 9fae126c5b0..aeac3989301 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -31,7 +33,6 @@ #include "Language.h" #include "CellImpl.h" #include "InstanceSaveMgr.h" -#include "IRCClient.h" #include "Util.h" #ifdef _DEBUG_VMAPS #include "VMapFactory.h" @@ -123,7 +124,7 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args) if(!*args) return false; //char str[1024]; - //sprintf(str, GetMangosString(LANG_ANNOUNCE_COLOR), m_session->GetPlayer()->GetName(), args); + //sprintf(str, GetTrinityString(LANG_ANNOUNCE_COLOR), m_session->GetPlayer()->GetName(), args); sWorld.SendWorldText(LANG_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args); return true; } @@ -136,13 +137,6 @@ bool ChatHandler::HandleAnnounceCommand(const char* args) sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args); - if((sIRC.BOTMASK & 256) != 0) - { - std::string ircchan = "#"; - ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); - sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s", "%s", args), true); - } - return true; } @@ -152,20 +146,13 @@ bool ChatHandler::HandleNotifyCommand(const char* args) if(!*args) return false; - std::string str = GetMangosString(LANG_GLOBAL_NOTIFY); + std::string str = GetTrinityString(LANG_GLOBAL_NOTIFY); str += args; WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); data << str; sWorld.SendGlobalMessage(&data); - if((sIRC.BOTMASK & 256) != 0) - { - std::string ircchan = "#"; - ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); - sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Global Notify \00304,08\037/!\\\037\017 %s", "%s", args), true); - } - return true; } @@ -249,7 +236,7 @@ bool ChatHandler::HandleVisibleCommand(const char* args) { if (!*args) { - PSendSysMessage(LANG_YOU_ARE, m_session->GetPlayer()->isGMVisible() ? GetMangosString(LANG_VISIBLE) : GetMangosString(LANG_INVISIBLE)); + PSendSysMessage(LANG_YOU_ARE, m_session->GetPlayer()->isGMVisible() ? GetTrinityString(LANG_VISIBLE) : GetTrinityString(LANG_INVISIBLE)); return true; } @@ -301,7 +288,7 @@ bool ChatHandler::HandleGPSCommand(const char* args) return false; } } - CellPair cell_val = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); Cell cell(cell_val); uint32 zone_id = obj->GetZoneId(); @@ -320,7 +307,7 @@ bool ChatHandler::HandleGPSCommand(const char* args) float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); - GridPair p = MaNGOS::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY()); + GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY()); int gx=63-p.x_coord; int gy=63-p.y_coord; @@ -340,7 +327,7 @@ bool ChatHandler::HandleGPSCommand(const char* args) m_session->GetPlayer()->GetName(), (obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(), (obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry()) ); - sLog.outDebug(GetMangosString(LANG_MAP_POSITION), + sLog.outDebug(GetTrinityString(LANG_MAP_POSITION), obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ), zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ), area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ), @@ -430,7 +417,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args) } else if (uint64 guid = objmgr.GetPlayerGUIDByName(name)) { - PSendSysMessage(LANG_SUMMONING, name.c_str(),GetMangosString(LANG_OFFLINE)); + PSendSysMessage(LANG_SUMMONING, name.c_str(),GetTrinityString(LANG_OFFLINE)); // in point where GM stay Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(), @@ -802,7 +789,7 @@ bool ChatHandler::HandleModifyEnergyCommand(const char* args) chr->SetMaxPower(POWER_ENERGY,energym ); chr->SetPower(POWER_ENERGY, energy ); - sLog.outDetail(GetMangosString(LANG_CURRENT_ENERGY),chr->GetMaxPower(POWER_ENERGY)); + sLog.outDetail(GetTrinityString(LANG_CURRENT_ENERGY),chr->GetMaxPower(POWER_ENERGY)); return true; } @@ -843,8 +830,7 @@ bool ChatHandler::HandleModifyRageCommand(const char* args) } PSendSysMessage(LANG_YOU_CHANGE_RAGE, chr->GetName(), rage/10, ragem/10); - // Special case: I use GetMangosString here to get local of destination char ;) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_RAGE_CHANGED), m_session->GetPlayer()->GetName(), rage/10, ragem/10); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_RAGE_CHANGED), m_session->GetPlayer()->GetName(), rage/10, ragem/10); chr->SetMaxPower(POWER_RAGE,ragem ); chr->SetPower(POWER_RAGE, rage ); @@ -1032,7 +1018,7 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args) if(chr != m_session->GetPlayer()) // to send localized data to target - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_TAXIS_ADDED), m_session->GetPlayer()->GetName()); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_TAXIS_ADDED), m_session->GetPlayer()->GetName()); return true; } @@ -1042,7 +1028,7 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args) PSendSysMessage(LANG_YOU_REMOVE_TAXIS, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_TAXIS_REMOVED), m_session->GetPlayer()->GetName()); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_TAXIS_REMOVED), m_session->GetPlayer()->GetName()); return true; } @@ -1085,7 +1071,7 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args) PSendSysMessage(LANG_YOU_CHANGE_ASPEED, ASpeed, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_ASPEED_CHANGED), m_session->GetPlayer()->GetName(), ASpeed); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_ASPEED_CHANGED), m_session->GetPlayer()->GetName(), ASpeed); chr->SetSpeed(MOVE_WALK, ASpeed,true); chr->SetSpeed(MOVE_RUN, ASpeed,true); @@ -1128,7 +1114,7 @@ bool ChatHandler::HandleModifySpeedCommand(const char* args) PSendSysMessage(LANG_YOU_CHANGE_SPEED, Speed, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_SPEED_CHANGED), m_session->GetPlayer()->GetName(), Speed); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_SPEED_CHANGED), m_session->GetPlayer()->GetName(), Speed); chr->SetSpeed(MOVE_RUN,Speed,true); @@ -1168,7 +1154,7 @@ bool ChatHandler::HandleModifySwimCommand(const char* args) PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, Swim, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_SWIM_SPEED_CHANGED), m_session->GetPlayer()->GetName(), Swim); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_SWIM_SPEED_CHANGED), m_session->GetPlayer()->GetName(), Swim); chr->SetSpeed(MOVE_SWIM,Swim,true); @@ -1208,7 +1194,7 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args) PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, BSpeed, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_BACK_SPEED_CHANGED), m_session->GetPlayer()->GetName(), BSpeed); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_BACK_SPEED_CHANGED), m_session->GetPlayer()->GetName(), BSpeed); chr->SetSpeed(MOVE_WALKBACK,BSpeed,true); @@ -1241,7 +1227,7 @@ bool ChatHandler::HandleModifyFlyCommand(const char* args) PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_FLY_SPEED_CHANGED), m_session->GetPlayer()->GetName(), FSpeed); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_FLY_SPEED_CHANGED), m_session->GetPlayer()->GetName(), FSpeed); chr->SetSpeed(MOVE_FLY,FSpeed,true); @@ -1273,7 +1259,7 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args) PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_SIZE_CHANGED), m_session->GetPlayer()->GetName(), Scale); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_SIZE_CHANGED), m_session->GetPlayer()->GetName(), Scale); chr->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale); @@ -1517,7 +1503,7 @@ bool ChatHandler::HandleModifyMountCommand(const char* args) PSendSysMessage(LANG_YOU_GIVE_MOUNT, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_MOUNT_GIVED), m_session->GetPlayer()->GetName()); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_MOUNT_GIVED), m_session->GetPlayer()->GetName()); chr->SetUInt32Value( UNIT_FIELD_FLAGS , 0x001000 ); chr->Mount(mId); @@ -1560,13 +1546,13 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) { int32 newmoney = moneyuser + addmoney; - sLog.outDetail(GetMangosString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); + sLog.outDetail(GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); if(newmoney <= 0 ) { PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_ALL_MONEY_GONE), m_session->GetPlayer()->GetName()); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_ALL_MONEY_GONE), m_session->GetPlayer()->GetName()); chr->SetMoney(0); } @@ -1574,7 +1560,7 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) { PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_MONEY_TAKEN), m_session->GetPlayer()->GetName(), abs(addmoney)); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_MONEY_TAKEN), m_session->GetPlayer()->GetName(), abs(addmoney)); chr->SetMoney( newmoney ); } } @@ -1582,11 +1568,11 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args) { PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, chr->GetName()); if(chr != m_session->GetPlayer()) - ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetMangosString(LANG_YOURS_MONEY_GIVEN), m_session->GetPlayer()->GetName(), addmoney); + ChatHandler(chr).PSendSysMessage(ChatHandler(chr).GetTrinityString(LANG_YOURS_MONEY_GIVEN), m_session->GetPlayer()->GetName(), addmoney); chr->ModifyMoney( addmoney ); } - sLog.outDetail(GetMangosString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney() ); + sLog.outDetail(GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney() ); return true; } @@ -1817,7 +1803,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args) { if(!*args) { - PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); + PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF)); return true; } @@ -2103,7 +2089,7 @@ bool ChatHandler::HandleNameTeleCommand(const char * args) } else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str())) { - PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str()); + PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetTrinityString(LANG_OFFLINE), tele->name.c_str()); Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y),guid); } else @@ -2375,25 +2361,6 @@ bool ChatHandler::HandleGoXYZCommand(const char* args) return true; } -bool ChatHandler::HandleIRCpmCommand(const char* args) -{ - std::string Msg = args; - if (Msg.find(" ") == std::string::npos) - return false; - std::string To = Msg.substr(0, Msg.find(" ")); - Msg = Msg.substr(Msg.find(" ") + 1); - std::size_t pos; - while((pos = To.find("||")) != std::string::npos) - { - std::size_t find1 = To.find("||", pos); - To.replace(pos, find1 - pos + 2, "|"); - } - sIRC.SendIRC("PRIVMSG "+To+" : <WoW>["+m_session->GetPlayerName()+"] : " + Msg); - //Msg = "|cffCC4ACCTo [" + To + "]: " + Msg + "|r"; - sIRC.Send_WoW_Player(m_session->GetPlayer(), "|cffCC4ACCTo ["+To+"]: "+Msg); - return true; -} - //teleport at coordinates bool ChatHandler::HandleGoZoneXYCommand(const char* args) { diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 2580e8ad321..485555e09f2 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -616,25 +618,25 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args) if (repItr != target->m_factions.end()) { ReputationRank rank = target->GetReputationRank(factionEntry); - std::string rankName = GetMangosString(ReputationRankStrIndex[rank]); + std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]); ss << " " << rankName << "|h|r (" << target->GetReputation(factionEntry) << ")"; if(repItr->second.Flags & FACTION_FLAG_VISIBLE) - ss << GetMangosString(LANG_FACTION_VISIBLE); + ss << GetTrinityString(LANG_FACTION_VISIBLE); if(repItr->second.Flags & FACTION_FLAG_AT_WAR) - ss << GetMangosString(LANG_FACTION_ATWAR); + ss << GetTrinityString(LANG_FACTION_ATWAR); if(repItr->second.Flags & FACTION_FLAG_PEACE_FORCED) - ss << GetMangosString(LANG_FACTION_PEACE_FORCED); + ss << GetTrinityString(LANG_FACTION_PEACE_FORCED); if(repItr->second.Flags & FACTION_FLAG_HIDDEN) - ss << GetMangosString(LANG_FACTION_HIDDEN); + ss << GetTrinityString(LANG_FACTION_HIDDEN); if(repItr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED) - ss << GetMangosString(LANG_FACTION_INVISIBLE_FORCED); + ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); if(repItr->second.Flags & FACTION_FLAG_INACTIVE) - ss << GetMangosString(LANG_FACTION_INACTIVE); + ss << GetTrinityString(LANG_FACTION_INACTIVE); } else - ss << GetMangosString(LANG_FACTION_NOREPUTATION); + ss << GetTrinityString(LANG_FACTION_NOREPUTATION); SendSysMessage(ss.str().c_str()); counter++; @@ -685,7 +687,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args) amount = -42000; for (; r < MAX_REPUTATION_RANK; ++r) { - std::string rank = GetMangosString(ReputationRankStrIndex[r]); + std::string rank = GetTrinityString(ReputationRankStrIndex[r]); if(rank.empty()) continue; @@ -1796,10 +1798,10 @@ bool ChatHandler::HandlePInfoCommand(const char* args) level = plr.getLevel(); } - std::string username = GetMangosString(LANG_ERROR); - std::string last_ip = GetMangosString(LANG_ERROR); + std::string username = GetTrinityString(LANG_ERROR); + std::string last_ip = GetTrinityString(LANG_ERROR); uint32 security = 0; - std::string last_login = GetMangosString(LANG_ERROR); + std::string last_login = GetTrinityString(LANG_ERROR); QueryResult* result = loginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'",accId); if(result) @@ -1821,7 +1823,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) delete result; } - PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), name.c_str(), GUID_LOPART(targetGUID), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency); + PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), name.c_str(), GUID_LOPART(targetGUID), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency); std::string timeStr = secsToTimeString(total_player_time,true,true); uint32 gold = money /GOLD; @@ -1848,22 +1850,22 @@ bool ChatHandler::HandlePInfoCommand(const char* args) else FactionName = "#Not found#"; ReputationRank rank = target->GetReputationRank(factionEntry); - std::string rankName = GetMangosString(ReputationRankStrIndex[rank]); + std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]); std::ostringstream ss; ss << itr->second.ID << ": |cffffffff|Hfaction:" << itr->second.ID << "|h[" << FactionName << "]|h|r " << rankName << "|h|r (" << target->GetReputation(factionEntry) << ")"; if(itr->second.Flags & FACTION_FLAG_VISIBLE) - ss << GetMangosString(LANG_FACTION_VISIBLE); + ss << GetTrinityString(LANG_FACTION_VISIBLE); if(itr->second.Flags & FACTION_FLAG_AT_WAR) - ss << GetMangosString(LANG_FACTION_ATWAR); + ss << GetTrinityString(LANG_FACTION_ATWAR); if(itr->second.Flags & FACTION_FLAG_PEACE_FORCED) - ss << GetMangosString(LANG_FACTION_PEACE_FORCED); + ss << GetTrinityString(LANG_FACTION_PEACE_FORCED); if(itr->second.Flags & FACTION_FLAG_HIDDEN) - ss << GetMangosString(LANG_FACTION_HIDDEN); + ss << GetTrinityString(LANG_FACTION_HIDDEN); if(itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED) - ss << GetMangosString(LANG_FACTION_INVISIBLE_FORCED); + ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); if(itr->second.Flags & FACTION_FLAG_INACTIVE) - ss << GetMangosString(LANG_FACTION_INACTIVE); + ss << GetTrinityString(LANG_FACTION_INACTIVE); SendSysMessage(ss.str().c_str()); } @@ -1876,7 +1878,7 @@ void ChatHandler::ShowTicket(uint64 guid, char const* text, char const* time) { std::string name; if(!objmgr.GetPlayerNameByGUID(guid,name)) - name = GetMangosString(LANG_UNKNOWN); + name = GetTrinityString(LANG_UNKNOWN); PSendSysMessage(LANG_COMMAND_TICKETVIEW, name.c_str(),time,text); } @@ -1899,7 +1901,7 @@ bool ChatHandler::HandleTicketCommand(const char* args) else count = 0; - PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, m_session->GetPlayer()->isAcceptTickets() ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); + PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, m_session->GetPlayer()->isAcceptTickets() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF)); return true; } @@ -3478,7 +3480,7 @@ bool ChatHandler::HandleGameObjectCommand(const char* args) return false; } - sLog.outDebug(GetMangosString(LANG_GAMEOBJECT_CURRENT), goI->name, db_lowGUID, x, y, z, o); + sLog.outDebug(GetTrinityString(LANG_GAMEOBJECT_CURRENT), goI->name, db_lowGUID, x, y, z, o); map->Add(pGameObj); @@ -3587,7 +3589,7 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) if (Utf8FitTo(descr, wnamepart)) { - char const* active = activeEvents.find(id) != activeEvents.end() ? GetMangosString(LANG_ACTIVE) : ""; + char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : ""; PSendSysMessage(LANG_EVENT_ENTRY_LIST,id,id,descr.c_str(),active ); ++counter; } @@ -3606,7 +3608,7 @@ bool ChatHandler::HandleEventActiveListCommand(const char* args) GameEvent::GameEventDataMap const& events = gameeventmgr.GetEventMap(); GameEvent::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); - char const* active = GetMangosString(LANG_ACTIVE); + char const* active = GetTrinityString(LANG_ACTIVE); for(GameEvent::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr ) { @@ -3654,7 +3656,7 @@ bool ChatHandler::HandleEventInfoCommand(const char* args) GameEvent::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); bool active = activeEvents.find(event_id) != activeEvents.end(); - char const* activeStr = active ? GetMangosString(LANG_ACTIVE) : ""; + char const* activeStr = active ? GetTrinityString(LANG_ACTIVE) : ""; std::string startTimeStr = TimeToTimestampStr(eventData.start); std::string endTimeStr = TimeToTimestampStr(eventData.end); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 2a8071d6708..67520f63849 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -73,7 +75,7 @@ bool ChatHandler::HandleReloadAllCommand(const char*) HandleReloadCommandCommand(""); HandleReloadReservedNameCommand(""); - HandleReloadMangosStringCommand(""); + HandleReloadTrinityStringCommand(""); HandleReloadGameTeleCommand(""); return true; } @@ -324,11 +326,11 @@ bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*) return true; } -bool ChatHandler::HandleReloadMangosStringCommand(const char*) +bool ChatHandler::HandleReloadTrinityStringCommand(const char*) { - sLog.outString( "Re-Loading mangos_string Table!" ); - objmgr.LoadMangosStrings(); - SendGlobalSysMessage("DB table `mangos_string` reloaded."); + sLog.outString( "Re-Loading trinity_string Table!" ); + objmgr.LoadTrinityStrings(); + SendGlobalSysMessage("DB table `trinity_string` reloaded."); return true; } @@ -849,7 +851,7 @@ bool ChatHandler::HandleCooldownCommand(const char* args) if(!sSpellStore.LookupEntry(spell_id)) { - PSendSysMessage(LANG_UNKNOWN_SPELL, target==m_session->GetPlayer() ? GetMangosString(LANG_YOU) : target->GetName()); + PSendSysMessage(LANG_UNKNOWN_SPELL, target==m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : target->GetName()); SetSentErrorMessage(true); return false; } @@ -859,7 +861,7 @@ bool ChatHandler::HandleCooldownCommand(const char* args) data << uint64(target->GetGUID()); target->GetSession()->SendPacket(&data); target->RemoveSpellCooldown(spell_id); - PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target==m_session->GetPlayer() ? GetMangosString(LANG_YOU) : target->GetName()); + PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target==m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : target->GetName()); } return true; } @@ -1770,7 +1772,7 @@ bool ChatHandler::HandleAddItemCommand(const char* args) if(!plTarget) plTarget = pl; - sLog.outDetail(GetMangosString(LANG_ADDITEM), itemId, count); + sLog.outDetail(GetTrinityString(LANG_ADDITEM), itemId, count); ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId); if(!pProto) @@ -1849,7 +1851,7 @@ bool ChatHandler::HandleAddItemSetCommand(const char* args) if(!plTarget) plTarget = pl; - sLog.outDetail(GetMangosString(LANG_ADDITEMSET), itemsetId); + sLog.outDetail(GetTrinityString(LANG_ADDITEMSET), itemsetId); QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE itemset = %u",itemsetId); @@ -2447,7 +2449,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args) if(loc < MAX_LOCALE) { // send skill in "id - [namedlink locale]" format - PSendSysMessage(LANG_SKILL_LIST,id,id,name.c_str(),localeNames[loc],(target->HasSkill(id) ? m_session->GetMangosString(LANG_KNOWN) : "")); + PSendSysMessage(LANG_SKILL_LIST,id,id,name.c_str(),localeNames[loc],(target->HasSkill(id) ? m_session->GetTrinityString(LANG_KNOWN) : "")); ++counter; } @@ -2531,20 +2533,20 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) // include rank in link name if(rank) - ss << GetMangosString(LANG_SPELL_RANK) << rank; + ss << GetTrinityString(LANG_SPELL_RANK) << rank; ss << " " << localeNames[loc] << "]|h|r"; if(talent) - ss << GetMangosString(LANG_TALENT); + ss << GetTrinityString(LANG_TALENT); if(passive) - ss << GetMangosString(LANG_PASSIVE); + ss << GetTrinityString(LANG_PASSIVE); if(learn) - ss << GetMangosString(LANG_LEARN); + ss << GetTrinityString(LANG_LEARN); if(known) - ss << GetMangosString(LANG_KNOWN); + ss << GetTrinityString(LANG_KNOWN); if(active) - ss << GetMangosString(LANG_ACTIVE); + ss << GetTrinityString(LANG_ACTIVE); SendSysMessage(ss.str().c_str()); @@ -2604,14 +2606,14 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) if(status == QUEST_STATUS_COMPLETE) { if(target->GetQuestRewardStatus(qinfo->GetQuestId())) - statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED); + statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); else - statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); + statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); } else if(status == QUEST_STATUS_INCOMPLETE) - statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); + statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); - PSendSysMessage(LANG_QUEST_LIST,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),(status == QUEST_STATUS_COMPLETE ? GetMangosString(LANG_COMPLETE) : (status == QUEST_STATUS_INCOMPLETE ? GetMangosString(LANG_ACTIVE) : "") )); + PSendSysMessage(LANG_QUEST_LIST,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),(status == QUEST_STATUS_COMPLETE ? GetTrinityString(LANG_COMPLETE) : (status == QUEST_STATUS_INCOMPLETE ? GetTrinityString(LANG_ACTIVE) : "") )); ++counter; continue; } @@ -2631,14 +2633,14 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) if(status == QUEST_STATUS_COMPLETE) { if(target->GetQuestRewardStatus(qinfo->GetQuestId())) - statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED); + statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); else - statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); + statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); } else if(status == QUEST_STATUS_INCOMPLETE) - statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); + statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); - PSendSysMessage(LANG_QUEST_LIST,qinfo->GetQuestId(),qinfo->GetQuestId(), title.c_str(),(status == QUEST_STATUS_COMPLETE ? GetMangosString(LANG_COMPLETE) : (status == QUEST_STATUS_INCOMPLETE ? GetMangosString(LANG_ACTIVE) : "") )); + PSendSysMessage(LANG_QUEST_LIST,qinfo->GetQuestId(),qinfo->GetQuestId(), title.c_str(),(status == QUEST_STATUS_COMPLETE ? GetTrinityString(LANG_COMPLETE) : (status == QUEST_STATUS_INCOMPLETE ? GetTrinityString(LANG_ACTIVE) : "") )); ++counter; } } @@ -3365,14 +3367,14 @@ bool ChatHandler::HandleNearGraveCommand(const char* args) g_team = data->team; - std::string team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_NOTEAM); + std::string team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); if(g_team == 0) - team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY); + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); else if(g_team == HORDE) - team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE); + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); else if(g_team == ALLIANCE) - team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id,team_name.c_str(),player->GetZoneId()); } @@ -3381,11 +3383,11 @@ bool ChatHandler::HandleNearGraveCommand(const char* args) std::string team_name; if(g_team == 0) - team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY); + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); else if(g_team == HORDE) - team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE); + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); else if(g_team == ALLIANCE) - team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); if(g_team == ~uint32(0)) PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, player->GetZoneId()); @@ -3830,14 +3832,14 @@ bool ChatHandler::HandleSetValue(const char* args) if(isint32) { iValue = (uint32)atoi(py); - sLog.outDebug(GetMangosString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue); + sLog.outDebug(GetTrinityString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue); target->SetUInt32Value( Opcode , iValue ); PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode,iValue); } else { fValue = (float)atof(py); - sLog.outDebug(GetMangosString(LANG_SET_FLOAT), GUID_LOPART(guid), Opcode, fValue); + sLog.outDebug(GetTrinityString(LANG_SET_FLOAT), GUID_LOPART(guid), Opcode, fValue); target->SetFloatValue( Opcode , fValue ); PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode,fValue); } @@ -3881,13 +3883,13 @@ bool ChatHandler::HandleGetValue(const char* args) if(isint32) { iValue = target->GetUInt32Value( Opcode ); - sLog.outDebug(GetMangosString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue); + sLog.outDebug(GetTrinityString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue); PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue); } else { fValue = target->GetFloatValue( Opcode ); - sLog.outDebug(GetMangosString(LANG_GET_FLOAT), GUID_LOPART(guid), Opcode, fValue); + sLog.outDebug(GetTrinityString(LANG_GET_FLOAT), GUID_LOPART(guid), Opcode, fValue); PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue); } @@ -3910,7 +3912,7 @@ bool ChatHandler::HandleSet32Bit(const char* args) if (Value > 32) //uint32 = 32 bits return false; - sLog.outDebug(GetMangosString(LANG_SET_32BIT), Opcode, Value); + sLog.outDebug(GetTrinityString(LANG_SET_32BIT), Opcode, Value); m_session->GetPlayer( )->SetUInt32Value( Opcode , 2^Value ); @@ -3938,7 +3940,7 @@ bool ChatHandler::HandleMod32Value(const char* args) return false; } - sLog.outDebug(GetMangosString(LANG_CHANGE_32BIT), Opcode, Value); + sLog.outDebug(GetTrinityString(LANG_CHANGE_32BIT), Opcode, Value); int CurrentValue = (int)m_session->GetPlayer( )->GetUInt32Value( Opcode ); @@ -4018,8 +4020,8 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) return false; } - char const* talentStr = GetMangosString(LANG_TALENT); - char const* passiveStr = GetMangosString(LANG_PASSIVE); + char const* talentStr = GetTrinityString(LANG_TALENT); + char const* passiveStr = GetTrinityString(LANG_PASSIVE); Unit::AuraMap const& uAuras = unit->GetAuras(); PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size()); @@ -4789,9 +4791,9 @@ bool ChatHandler::HandleBanInfoCommand(const char* args) if(fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) ) active = true; bool permanent = (fields[1].GetUInt64() == (uint64)0); - std::string bantime = permanent?GetMangosString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true); + std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true); PSendSysMessage(LANG_BANINFO_HISTORYENTRY, - fields[0].GetString(), bantime.c_str(), active ? GetMangosString(LANG_BANINFO_YES):GetMangosString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString()); + fields[0].GetString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES):GetTrinityString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString()); }while (result->NextRow()); delete result; @@ -4808,8 +4810,8 @@ bool ChatHandler::HandleBanInfoCommand(const char* args) fields = result->Fetch(); bool permanent = (fields[6].GetUInt64()==(uint64)0); PSendSysMessage(LANG_BANINFO_IPENTRY, - fields[0].GetString(), fields[1].GetString(), permanent ? GetMangosString(LANG_BANINFO_NEVER):fields[2].GetString(), - permanent ? GetMangosString(LANG_BANINFO_INFINITE):secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetString(), fields[5].GetString()); + fields[0].GetString(), fields[1].GetString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER):fields[2].GetString(), + permanent ? GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetString(), fields[5].GetString()); delete result; } return true; @@ -4901,15 +4903,15 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/) Player* pl = m_session->GetPlayer(); - CellPair p(MaNGOS::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::RespawnDo u_do; - MaNGOS::WorldObjectWorker<MaNGOS::RespawnDo> worker(u_do); + Trinity::RespawnDo u_do; + Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(u_do); - TypeContainerVisitor<MaNGOS::WorldObjectWorker<MaNGOS::RespawnDo>, GridTypeMapContainer > obj_worker(worker); + TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, obj_worker, *MapManager::Instance().GetMap(pl->GetMapId(), pl)); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 05c0ac8a997..48f913df8e2 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index e7848ff4094..2cb1a5b292a 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "LootMgr.h" diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index fe063a447fc..098cf514ebc 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_LOOTMGR_H -#define MANGOS_LOOTMGR_H +#ifndef TRINITY_LOOTMGR_H +#define TRINITY_LOOTMGR_H #include "ItemEnchantmentMgr.h" #include "ByteBuffer.h" diff --git a/src/game/MCS_OnlinePlayers.cpp b/src/game/MCS_OnlinePlayers.cpp deleted file mode 100644 index 8f48faa6adc..00000000000 --- a/src/game/MCS_OnlinePlayers.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/*
- * MangChat By |Death| And Cybrax
- *
- * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
- * Of The GNU General Public License
- * Written and Developed by Cybrax. cybraxvd@gmail.com
- * |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
- * With Help And Support From The MaNGOS Project Community.
- * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
- */
-#include "MCS_OnlinePlayers.h"
-
-#include "MapManager.h"
-#include "ObjectMgr.h"
-#include "Config/ConfigEnv.h"
-
-mcs_OnlinePlayers::mcs_OnlinePlayers() { CD = NULL; }
-
-mcs_OnlinePlayers::mcs_OnlinePlayers(_CDATA *_CD)
-{
- //create a new instance of data struct and copy its data
- CD = new _CDATA();
- CD->CMD = _CD->CMD;
- CD->FROM = _CD->FROM;
- CD->PARAMS = _CD->PARAMS;
- CD->PCOUNT = _CD->PCOUNT;
- CD->USER = _CD->USER;
- CD->TYPE = _CD->TYPE;
-}
-
-mcs_OnlinePlayers::~mcs_OnlinePlayers()
-{
- if(CD)
- delete CD;
-}
-
-void mcs_OnlinePlayers::run()
-{
- int OnlineCount = 0;
- std::string IRCOut = "";
- HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
- for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
- {
- if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
- {
- OnlineCount++;
- Player *plr = itr->second->GetSession()->GetPlayer();
- std::string ChatTag = " ";
- switch(plr->GetSession()->GetSecurity())
- {
- case 0: ChatTag.append("");break;
- case 1: ChatTag.append("\0037"+sIRC.ojGM1);break;
- case 2: ChatTag.append("\0037"+sIRC.ojGM2);break;
- case 3: ChatTag.append("\0037"+sIRC.ojGM3);break;
- case 4: ChatTag.append("\0037"+sIRC.ojGM4);break;
- case 5: ChatTag.append("\0037"+sIRC.ojGM5);break;
- }
- if(plr->isAFK())
- ChatTag.append("\002\0037<AFK>\003\002");
- else if(plr->isDND())
- ChatTag.append("\002\0037<DND>\003\002");
- switch (plr->GetTeam())
- {
- case 67:ChatTag.append("\0034");break; //horde
- case 469:ChatTag.append("\00312");break; //alliance
- }
-
- IRCOut.append(IRCCmd::MakeMsg("%s\002%s\003\017\002(%d)\002\017", ChatTag.c_str(), plr->GetName(), plr->getLevel()));
-
- // after XX players have been added to the string
- // output to irc and reset for the next XX
- if(OnlineCount % sIRC.onlrslt == 0)
- {
- sIRC.Send_IRC_Channel(IRCCmd::ChanOrPM(CD), IRCCmd::MakeMsg("\002 %s", IRCOut.c_str()), true, CD->TYPE.c_str());
- IRCOut = "";
- ZThread::Thread::sleep(1000);
- }
- }
- }
- // Remainder in IRCOUT && Total plyersonline
- sIRC.Send_IRC_Channel(IRCCmd::ChanOrPM(CD), IRCCmd::MakeMsg("\002Players Online(%d):\017 %s", OnlineCount, IRCOut.c_str()), true, CD->TYPE);
-
- sIRC.Script_Lock[MCS_Players_Online] = false;
-}
diff --git a/src/game/MCS_OnlinePlayers.h b/src/game/MCS_OnlinePlayers.h deleted file mode 100644 index c93db9afdac..00000000000 --- a/src/game/MCS_OnlinePlayers.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _IRC_CLIENT_ONLINE
-#define _IRC_CLIENT_ONLINE
-
-#include "IRCClient.h"
-#include "IRCCmd.h"
-
-// the reason to run this command multithreaded
-// is to be able to "spread" the output over irc
-// for servers with high player count
-// in order not to freeze the mangchat core with sleep
-// a new thread is spawned it will output the player data
-// evry "10 players" and pauzes to not spam irc
-// in addition the command is locked so i cannot be used
-// while active.
-
-class mcs_OnlinePlayers : public ZThread::Runnable
-{
- public:
- mcs_OnlinePlayers();
- mcs_OnlinePlayers(_CDATA *_CD);
- ~mcs_OnlinePlayers();
- void run();
- public:
- _CDATA *CD;
-};
-
-#endif
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index a97ed9470a7..ae92feb3561 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Mail.h" @@ -450,7 +452,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data ) sender_accId = objmgr.GetPlayerAccountIdByGUID(sender_guid); if(!objmgr.GetPlayerNameByGUID(sender_guid,sender_name)) - sender_name = objmgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); + sender_name = objmgr.GetTrinityStringForDBCLocale(LANG_UNKNOWN); } sLog.outCommand("GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", GetPlayerName(),GetAccountId(),it->GetProto()->Name1,it->GetEntry(),it->GetCount(),m->COD,sender_name.c_str(),sender_accId); diff --git a/src/game/Mail.h b/src/game/Mail.h index bec54eb41f7..4269f04cff8 100644 --- a/src/game/Mail.h +++ b/src/game/Mail.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MAIL_H -#define MANGOS_MAIL_H +#ifndef TRINITY_MAIL_H +#define TRINITY_MAIL_H #include "Common.h" #include <map> diff --git a/src/game/Makefile.am b/src/game/Makefile.am index e839304ad8c..290441870e1 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -141,21 +141,6 @@ $(srcdir)/InstanceData.cpp \ $(srcdir)/InstanceData.h \ $(srcdir)/InstanceSaveMgr.cpp \ $(srcdir)/InstanceSaveMgr.h \ -$(srcdir)/IRCClient.cpp \ -$(srcdir)/IRCClient.h \ -$(srcdir)/IRCCmd.cpp \ -$(srcdir)/IRCCmd.h \ -$(srcdir)/IRCCmde.cpp \ -$(srcdir)/IRCConf.cpp \ -$(srcdir)/IRCConf.h \ -$(srcdir)/IRCConf.h \ -$(srcdir)/IRCFunc.h \ -$(srcdir)/IRCIO.cpp \ -$(srcdir)/IRCLog.cpp \ -$(srcdir)/IRCLog.h \ -$(srcdir)/IRCSock.cpp \ -$(srcdir)/MCS_OnlinePlayers.cpp \ -$(srcdir)/MCS_OnlinePlayers.h \ $(srcdir)/Item.cpp \ $(srcdir)/Item.h \ $(srcdir)/ItemEnchantmentMgr.cpp \ @@ -201,6 +186,24 @@ $(srcdir)/ObjectMgr.cpp \ $(srcdir)/ObjectMgr.h \ $(srcdir)/Opcodes.cpp \ $(srcdir)/Opcodes.h \ +$(srcdir)/OutdoorPvP.cpp \ +$(srcdir)/OutdoorPvP.h \ +$(srcdir)/OutdoorPvPEP.cpp \ +$(srcdir)/OutdoorPvPEP.h \ +$(srcdir)/OutdoorPvPHP.cpp \ +$(srcdir)/OutdoorPvPHP.h \ +$(srcdir)/OutdoorPvPMgr.cpp \ +$(srcdir)/OutdoorPvPMgr.h \ +$(srcdir)/OutdoorPvPNA.cpp \ +$(srcdir)/OutdoorPvPNA.h \ +$(srcdir)/OutdoorPvPObjectiveAI.cpp \ +$(srcdir)/OutdoorPvPObjectiveAI.h \ +$(srcdir)/OutdoorPvPSI.cpp \ +$(srcdir)/OutdoorPvPSI.h \ +$(srcdir)/OutdoorPvPTF.cpp \ +$(srcdir)/OutdoorPvPTF.h \ +$(srcdir)/OutdoorPvPZM.cpp \ +$(srcdir)/OutdoorPvPZM.h \ $(srcdir)/Path.h \ $(srcdir)/PetAI.cpp \ $(srcdir)/PetAI.h \ diff --git a/src/game/Map.cpp b/src/game/Map.cpp index df03bb96842..c27053b60b1 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Player.h" @@ -421,7 +423,7 @@ bool Map::Add(Player *player) player->SetInstanceId(this->GetInstanceId()); // update player state for other player and visa-versa - CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); Cell cell(p); EnsureGridLoadedForPlayer(cell, player, true); player->AddToWorld(); @@ -440,7 +442,7 @@ template<class T> void Map::Add(T *obj) { - CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); assert(obj); @@ -467,7 +469,7 @@ Map::Add(T *obj) void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self) { - CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { @@ -481,15 +483,15 @@ void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self) if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) return; - MaNGOS::MessageDeliverer post_man(*player, msg, to_self); - TypeContainerVisitor<MaNGOS::MessageDeliverer, WorldTypeMapContainer > message(post_man); + Trinity::MessageDeliverer post_man(*player, msg, to_self); + TypeContainerVisitor<Trinity::MessageDeliverer, WorldTypeMapContainer > message(post_man); CellLock<ReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *this); } void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg) { - CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { @@ -504,15 +506,15 @@ void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg) if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) return; - MaNGOS::ObjectMessageDeliverer post_man(msg); - TypeContainerVisitor<MaNGOS::ObjectMessageDeliverer, WorldTypeMapContainer > message(post_man); + Trinity::ObjectMessageDeliverer post_man(msg); + TypeContainerVisitor<Trinity::ObjectMessageDeliverer, WorldTypeMapContainer > message(post_man); CellLock<ReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *this); } void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, bool to_self, bool own_team_only) { - CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { @@ -526,15 +528,15 @@ void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, boo if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) return; - MaNGOS::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only); - TypeContainerVisitor<MaNGOS::MessageDistDeliverer , WorldTypeMapContainer > message(post_man); + Trinity::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only); + TypeContainerVisitor<Trinity::MessageDistDeliverer , WorldTypeMapContainer > message(post_man); CellLock<ReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *this); } void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist) { - CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { @@ -549,8 +551,8 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist) if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) return; - MaNGOS::ObjectMessageDistDeliverer post_man(*obj, msg,dist); - TypeContainerVisitor<MaNGOS::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man); + Trinity::ObjectMessageDistDeliverer post_man(*obj, msg,dist); + TypeContainerVisitor<Trinity::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man); CellLock<ReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *this); } @@ -588,7 +590,7 @@ void InstanceMap::Update(const uint32& t_diff) void Map::Remove(Player *player, bool remove) { - CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { // invalid coordinates @@ -640,7 +642,7 @@ template<class T> void Map::Remove(T *obj, bool remove) { - CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { sLog.outError("Map::Remove: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); @@ -674,8 +676,8 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati { assert(player); - CellPair old_val = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); - CellPair new_val = MaNGOS::ComputeCellPair(x, y); + CellPair old_val = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellPair new_val = Trinity::ComputeCellPair(x, y); Cell old_cell(old_val); Cell new_cell(new_val); @@ -720,13 +722,13 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang Cell old_cell = creature->GetCurrentCell(); - CellPair new_val = MaNGOS::ComputeCellPair(x, y); + CellPair new_val = Trinity::ComputeCellPair(x, y); Cell new_cell(new_val); // delay creature move for grid/cell to grid/cell moves if( old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell) ) { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u) added to moving list from grid[%u,%u]cell[%u,%u] to grid[%u,%u]cell[%u,%u].", creature->GetGUIDLow(), creature->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif @@ -760,7 +762,7 @@ void Map::MoveAllCreaturesInMoveList() i_creaturesToMove.erase(iter); // calculate cells - CellPair new_val = MaNGOS::ComputeCellPair(cm.x, cm.y); + CellPair new_val = Trinity::ComputeCellPair(cm.x, cm.y); Cell new_cell(new_val); // do move or do move to respawn or remove creature if previous all fail @@ -777,7 +779,7 @@ void Map::MoveAllCreaturesInMoveList() if(!CreatureRespawnRelocation(c)) { // ... or unload (if respawn grid also not loaded) - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u ) can't be move to unloaded respawn grid.",c->GetGUIDLow(),c->GetEntry()); #endif @@ -796,7 +798,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) // if in same cell then none do if(old_cell.DiffCell(new_cell)) { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u) moved in grid[%u,%u] from cell[%u,%u] to cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY()); #endif @@ -810,7 +812,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) } else { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u) move in same grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY()); #endif @@ -819,7 +821,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) else // in diff. grids if(loaded(GridPair(new_cell.GridX(), new_cell.GridY()))) { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u) moved from grid[%u,%u]cell[%u,%u] to grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif @@ -832,7 +834,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) } else { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u) attempt move from grid[%u,%u]cell[%u,%u] to unloaded grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif @@ -847,13 +849,13 @@ bool Map::CreatureRespawnRelocation(Creature *c) float resp_x, resp_y, resp_z, resp_o; c->GetRespawnCoord(resp_x, resp_y, resp_z, &resp_o); - CellPair resp_val = MaNGOS::ComputeCellPair(resp_x, resp_y); + CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y); Cell resp_cell(resp_val); c->CombatStop(); c->GetMotionMaster()->Clear(); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0) sLog.outDebug("Creature (GUID: %u Entry: %u) will moved from grid[%u,%u]cell[%u,%u] to respawn grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), c->GetCurrentCell().GridX(), c->GetCurrentCell().GridY(), c->GetCurrentCell().CellX(), c->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY()); #endif @@ -931,7 +933,7 @@ void Map::UnloadAll(bool pForce) float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const { - GridPair p = MaNGOS::ComputeGridPair(x, y); + GridPair p = Trinity::ComputeGridPair(x, y); // half opt method int gx=(int)(32-x/SIZE_OF_GRIDS); //grid x @@ -1028,7 +1030,7 @@ uint16 Map::GetAreaFlag(float x, float y ) const //local x,y coords float lx,ly; int gx,gy; - GridPair p = MaNGOS::ComputeGridPair(x, y); + GridPair p = Trinity::ComputeGridPair(x, y); // half opt method gx=(int)(32-x/SIZE_OF_GRIDS) ; //grid x @@ -1139,7 +1141,7 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const { Cell const& cur_cell = c->GetCurrentCell(); - CellPair xy_val = MaNGOS::ComputeCellPair(c->GetPositionX(), c->GetPositionY()); + CellPair xy_val = Trinity::ComputeCellPair(c->GetPositionX(), c->GetPositionY()); Cell xy_cell(xy_val); if(xy_cell != cur_cell) { @@ -1163,8 +1165,8 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair { cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::VisibleChangesNotifier notifier(*obj); - TypeContainerVisitor<MaNGOS::VisibleChangesNotifier, WorldTypeMapContainer > player_notifier(notifier); + Trinity::VisibleChangesNotifier notifier(*obj); + TypeContainerVisitor<Trinity::VisibleChangesNotifier, WorldTypeMapContainer > player_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, cellpair); cell_lock->Visit(cell_lock, player_notifier, *this); } @@ -1173,8 +1175,8 @@ void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair ) { cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::PlayerNotifier pl_notifier(*player); - TypeContainerVisitor<MaNGOS::PlayerNotifier, WorldTypeMapContainer > player_notifier(pl_notifier); + Trinity::PlayerNotifier pl_notifier(*player); + TypeContainerVisitor<Trinity::PlayerNotifier, WorldTypeMapContainer > player_notifier(pl_notifier); CellLock<ReadGuard> cell_lock(cell, cellpair); cell_lock->Visit(cell_lock, player_notifier, *this); @@ -1182,12 +1184,12 @@ void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair ) void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpair ) { - MaNGOS::VisibleNotifier notifier(*player); + Trinity::VisibleNotifier notifier(*player); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - TypeContainerVisitor<MaNGOS::VisibleNotifier, WorldTypeMapContainer > world_notifier(notifier); - TypeContainerVisitor<MaNGOS::VisibleNotifier, GridTypeMapContainer > grid_notifier(notifier); + TypeContainerVisitor<Trinity::VisibleNotifier, WorldTypeMapContainer > world_notifier(notifier); + TypeContainerVisitor<Trinity::VisibleNotifier, GridTypeMapContainer > grid_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, cellpair); cell_lock->Visit(cell_lock, world_notifier, *this); cell_lock->Visit(cell_lock, grid_notifier, *this); @@ -1199,11 +1201,11 @@ void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpa void Map::PlayerRelocationNotify( Player* player, Cell cell, CellPair cellpair ) { CellLock<ReadGuard> cell_lock(cell, cellpair); - MaNGOS::PlayerRelocationNotifier relocationNotifier(*player); + Trinity::PlayerRelocationNotifier relocationNotifier(*player); cell.data.Part.reserved = ALL_DISTRICT; - TypeContainerVisitor<MaNGOS::PlayerRelocationNotifier, GridTypeMapContainer > p2grid_relocation(relocationNotifier); - TypeContainerVisitor<MaNGOS::PlayerRelocationNotifier, WorldTypeMapContainer > p2world_relocation(relocationNotifier); + TypeContainerVisitor<Trinity::PlayerRelocationNotifier, GridTypeMapContainer > p2grid_relocation(relocationNotifier); + TypeContainerVisitor<Trinity::PlayerRelocationNotifier, WorldTypeMapContainer > p2world_relocation(relocationNotifier); cell_lock->Visit(cell_lock, p2grid_relocation, *this); cell_lock->Visit(cell_lock, p2world_relocation, *this); @@ -1212,12 +1214,12 @@ void Map::PlayerRelocationNotify( Player* player, Cell cell, CellPair cellpair ) void Map::CreatureRelocationNotify(Creature *creature, Cell cell, CellPair cellpair) { CellLock<ReadGuard> cell_lock(cell, cellpair); - MaNGOS::CreatureRelocationNotifier relocationNotifier(*creature); + Trinity::CreatureRelocationNotifier relocationNotifier(*creature); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); // not trigger load unloaded grids at notifier call - TypeContainerVisitor<MaNGOS::CreatureRelocationNotifier, WorldTypeMapContainer > c2world_relocation(relocationNotifier); - TypeContainerVisitor<MaNGOS::CreatureRelocationNotifier, GridTypeMapContainer > c2grid_relocation(relocationNotifier); + TypeContainerVisitor<Trinity::CreatureRelocationNotifier, WorldTypeMapContainer > c2world_relocation(relocationNotifier); + TypeContainerVisitor<Trinity::CreatureRelocationNotifier, GridTypeMapContainer > c2grid_relocation(relocationNotifier); cell_lock->Visit(cell_lock, c2world_relocation, *this); cell_lock->Visit(cell_lock, c2grid_relocation, *this); diff --git a/src/game/Map.h b/src/game/Map.h index bc723e4bca5..8da3939a914 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MAP_H -#define MANGOS_MAP_H +#ifndef TRINITY_MAP_H +#define TRINITY_MAP_H #include "Platform/Define.h" #include "Policies/ThreadingModel.h" @@ -53,19 +55,19 @@ template<class MUTEX, class LOCK_TYPE> struct RGuard { RGuard(MUTEX &l) : i_lock(l.getReadLock()) {} - MaNGOS::GeneralLock<LOCK_TYPE> i_lock; + Trinity::GeneralLock<LOCK_TYPE> i_lock; }; template<class MUTEX, class LOCK_TYPE> struct WGuard { WGuard(MUTEX &l) : i_lock(l.getWriteLock()) {} - MaNGOS::GeneralLock<LOCK_TYPE> i_lock; + Trinity::GeneralLock<LOCK_TYPE> i_lock; }; typedef RGuard<GridRWLock, ZThread::Lockable> GridReadGuard; typedef WGuard<GridRWLock, ZThread::Lockable> GridWriteGuard; -typedef MaNGOS::SingleThreaded<GridRWLock>::Lock NullGuard; +typedef Trinity::SingleThreaded<GridRWLock>::Lock NullGuard; typedef struct { @@ -122,7 +124,7 @@ typedef HM_NAMESPACE::hash_map<Creature*, CreatureMover> CreatureMoveList; #define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE #define MIN_UNLOAD_DELAY 1 // immediate unload -class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::ObjectLevelLockable<Map, ZThread::Mutex> +class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockable<Map, ZThread::Mutex> { public: Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); @@ -150,7 +152,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj inline bool IsRemovalGrid(float x, float y) const { - GridPair p = MaNGOS::ComputeGridPair(x, y); + GridPair p = Trinity::ComputeGridPair(x, y); return( !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL ); } @@ -272,7 +274,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj inline void setNGrid(NGridType* grid, uint32 x, uint32 y); protected: - typedef MaNGOS::ObjectLevelLockable<Map, ZThread::Mutex>::Lock Guard; + typedef Trinity::ObjectLevelLockable<Map, ZThread::Mutex>::Lock Guard; MapEntry const* i_mapEntry; uint8 i_spawnMode; @@ -316,7 +318,7 @@ enum InstanceResetMethod INSTANCE_RESET_RESPAWN_DELAY }; -class MANGOS_DLL_SPEC InstanceMap : public Map +class TRINITY_DLL_SPEC InstanceMap : public Map { public: typedef std::list<Player *> PlayerList; // online players only @@ -350,7 +352,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map PlayerList i_Players; }; -class MANGOS_DLL_SPEC BattleGroundMap : public Map +class TRINITY_DLL_SPEC BattleGroundMap : public Map { public: typedef std::list<Player *> PlayerList; // online players only diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index a1f2ddc39be..caea768ad0d 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "MapInstanced.h" diff --git a/src/game/MapInstanced.h b/src/game/MapInstanced.h index 58ee6b7a9bc..5999e4a1a85 100644 --- a/src/game/MapInstanced.h +++ b/src/game/MapInstanced.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,21 +10,21 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MAP_INSTANCED_H -#define MANGOS_MAP_INSTANCED_H +#ifndef TRINITY_MAP_INSTANCED_H +#define TRINITY_MAP_INSTANCED_H #include "Map.h" #include "InstanceSaveMgr.h" -class MANGOS_DLL_DECL MapInstanced : public Map +class TRINITY_DLL_DECL MapInstanced : public Map { friend class MapManager; public: diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 501661c650d..cbab5b7957c 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "MapManager.h" @@ -31,7 +33,7 @@ #include "Corpse.h" #include "ObjectMgr.h" -#define CLASS_LOCK MaNGOS::ClassLevelLockable<MapManager, ZThread::Mutex> +#define CLASS_LOCK Trinity::ClassLevelLockable<MapManager, ZThread::Mutex> INSTANTIATE_SINGLETON_2(MapManager, CLASS_LOCK); INSTANTIATE_CLASS_MUTEX(MapManager, ZThread::Mutex); @@ -82,7 +84,7 @@ void MapManager::checkAndCorrectGridStatesArray() ok = false; si_GridStates[i] = i_GridStates[i]; } - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG // inner class checking only when compiled with debug if(!si_GridStates[i]->checkMagic()) { @@ -265,7 +267,7 @@ void MapManager::DoDelayedMovesAndRemoves() bool MapManager::ExistMapAndVMap(uint32 mapid, float x,float y) { - GridPair p = MaNGOS::ComputeGridPair(x,y); + GridPair p = Trinity::ComputeGridPair(x,y); int gx=63-p.x_coord; int gy=63-p.y_coord; @@ -281,7 +283,7 @@ bool MapManager::IsValidMAP(uint32 mapid) void MapManager::LoadGrid(int mapid, float x, float y, const WorldObject* obj, bool no_unload) { - CellPair p = MaNGOS::ComputeCellPair(x,y); + CellPair p = Trinity::ComputeCellPair(x,y); Cell cell(p); GetMap(mapid, obj)->LoadGrid(cell,no_unload); } diff --git a/src/game/MapManager.h b/src/game/MapManager.h index 833f14dfc62..30ed2589eb1 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MAPMANAGER_H -#define MANGOS_MAPMANAGER_H +#ifndef TRINITY_MAPMANAGER_H +#define TRINITY_MAPMANAGER_H #include "Platform/Define.h" #include "Policies/Singleton.h" @@ -27,10 +29,10 @@ #include "GridStates.h" class Transport; -class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::ClassLevelLockable<MapManager, ZThread::Mutex> > +class TRINITY_DLL_DECL MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLockable<MapManager, ZThread::Mutex> > { - friend class MaNGOS::OperatorNew<MapManager>; + friend class Trinity::OperatorNew<MapManager>; typedef HM_NAMESPACE::hash_map<uint32, Map*> MapMapType; typedef std::pair<HM_NAMESPACE::hash_map<uint32, Map*>::iterator, bool> MapMapPair; @@ -80,17 +82,17 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS:: static bool IsValidMapCoord(uint32 mapid, float x,float y) { - return IsValidMAP(mapid) && MaNGOS::IsValidMapCoord(x,y); + return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x,y); } static bool IsValidMapCoord(uint32 mapid, float x,float y,float z) { - return IsValidMAP(mapid) && MaNGOS::IsValidMapCoord(x,y,z); + return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x,y,z); } static bool IsValidMapCoord(uint32 mapid, float x,float y,float z,float o) { - return IsValidMAP(mapid) && MaNGOS::IsValidMapCoord(x,y,z,o); + return IsValidMAP(mapid) && Trinity::IsValidMapCoord(x,y,z,o); } void DoDelayedMovesAndRemoves(); @@ -131,7 +133,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS:: return (iter == i_maps.end() ? NULL : iter->second); } - typedef MaNGOS::ClassLevelLockable<MapManager, ZThread::Mutex>::Lock Guard; + typedef Trinity::ClassLevelLockable<MapManager, ZThread::Mutex>::Lock Guard; uint32 i_gridCleanUpDelay; MapMapType i_maps; IntervalTimer i_timer; diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 96f13891938..76f6646ed5a 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -37,6 +39,7 @@ #include "ObjectAccessor.h" #include "Object.h" #include "BattleGround.h" +#include "OutdoorPvP.h" #include "SpellAuras.h" #include "Pet.h" #include "SocialMgr.h" @@ -142,7 +145,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) wstrToLower(wplayer_name); wstrToLower(wguild_name); - // client send in case not set max level value 100 but mangos support 255 max level, + // client send in case not set max level value 100 but Trinity support 255 max level, // update it to show GMs with characters after 100 level if(level_max >= 100) level_max = 255; @@ -296,7 +299,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ ) return; } - //instant logout in taverns/cities or on taxi or if its enabled in mangosd.conf + //instant logout in taverns/cities or on taxi or if its enabled in Trinityd.conf if(GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() || sWorld.getConfig(CONFIG_INSTANT_LOGOUT)) { LogoutPlayer(true); @@ -562,6 +565,11 @@ void WorldSession::HandleTogglePvP( WorldPacket & recv_data ) if(!GetPlayer()->pvpInfo.inHostileArea && GetPlayer()->IsPvP()) GetPlayer()->pvpInfo.endTimer = time(NULL); // start toggle-off } + + if(OutdoorPvP * pvp = _player->GetOutdoorPvP()) + { + pvp->HandlePlayerActivityChanged(_player); + } } void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) @@ -573,17 +581,9 @@ void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data ) sLog.outDetail("WORLD: Recvd ZONE_UPDATE: %u", newZone); - if(newZone != _player->GetZoneId()) - GetPlayer()->SendInitWorldStates(); // only if really enters to new zone, not just area change, works strange... - - // AntiCheat.GMIsland - if(sWorld.getConfig(CONFIG_KICK_FROM_GMISLAND)) - { - if(newZone == 876 && GetPlayer()->GetSession()->GetSecurity() == SEC_PLAYER) - _player->TeleportTo(13,0,0,0,0); - } - GetPlayer()->UpdateZone(newZone); + + GetPlayer()->SendInitWorldStates(true,newZone); } void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data ) @@ -648,7 +648,7 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data ) sLog.outDebug( "WORLD: Received CMSG_ADD_FRIEND" ); - std::string friendName = GetMangosString(LANG_FRIEND_IGNORE_UNKNOWN); + std::string friendName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); std::string friendNote; FriendsResult friendResult = FRIEND_NOT_FOUND; Player *pFriend = NULL; @@ -740,7 +740,7 @@ void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data ) sLog.outDebug( "WORLD: Received CMSG_ADD_IGNORE" ); - std::string IgnoreName = GetMangosString(LANG_FRIEND_IGNORE_UNKNOWN); + std::string IgnoreName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND; uint64 IgnoreGuid = 0; @@ -1020,6 +1020,12 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) return; } + if(OutdoorPvP * pvp = GetPlayer()->GetOutdoorPvP()) + { + if(pvp->HandleAreaTrigger(_player, Trigger_ID)) + return; + } + // NULL if all values default (non teleport trigger) AreaTrigger const* at = objmgr.GetAreaTrigger(Trigger_ID); if(!at) @@ -1063,13 +1069,13 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) { // TODO: all this is probably wrong if(missingItem) - SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); + SendAreaTriggerMessage(GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, objmgr.GetItemPrototype(missingItem)->Name1); else if(missingKey) GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY2); else if(missingQuest) SendAreaTriggerMessage(at->requiredFailedText.c_str()); else if(missingLevel) - SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED), missingLevel); + SendAreaTriggerMessage(GetTrinityString(LANG_LEVEL_MINREQUIRED), missingLevel); return; } } @@ -1150,7 +1156,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & /*recv_data*/ ) sLog.outDebug( "WORLD: CMSG_MOVE_TIME_SKIPPED" ); /// TODO - must be need use in mangos + must be need use in Trinity We substract server Lags to move time ( AntiLags ) for exmaple GetPlayer()->ModifyLastMoveTime( -int32(time_skipped) ); diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index c2ca16ba85d..f6189bf88b9 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "MotionMaster.h" diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h index f7a38e47618..58f7c46665d 100644 --- a/src/game/MotionMaster.h +++ b/src/game/MotionMaster.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MOTIONMASTER_H -#define MANGOS_MOTIONMASTER_H +#ifndef TRINITY_MOTIONMASTER_H +#define TRINITY_MOTIONMASTER_H #include "Common.h" #include <stack> @@ -45,7 +47,7 @@ enum MovementGeneratorType DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h }; -class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *> +class TRINITY_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *> { private: typedef std::stack<MovementGenerator *> Impl; diff --git a/src/game/MovementGenerator.cpp b/src/game/MovementGenerator.cpp index b717f6cf443..d6b69bfe38c 100644 --- a/src/game/MovementGenerator.cpp +++ b/src/game/MovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "MovementGenerator.h" diff --git a/src/game/MovementGenerator.h b/src/game/MovementGenerator.h index 982de574c19..62c7a6d425b 100644 --- a/src/game/MovementGenerator.h +++ b/src/game/MovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MOVEMENTGENERATOR_H -#define MANGOS_MOVEMENTGENERATOR_H +#ifndef TRINITY_MOVEMENTGENERATOR_H +#define TRINITY_MOVEMENTGENERATOR_H #include "Platform/Define.h" #include "Policies/Singleton.h" @@ -28,7 +30,7 @@ class Unit; -class MANGOS_DLL_SPEC MovementGenerator +class TRINITY_DLL_SPEC MovementGenerator { public: virtual ~MovementGenerator(); @@ -48,7 +50,7 @@ class MANGOS_DLL_SPEC MovementGenerator }; template<class T, class D> -class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator +class TRINITY_DLL_SPEC MovementGeneratorMedium : public MovementGenerator { public: void Initialize(Unit &u) diff --git a/src/game/MovementGeneratorImpl.h b/src/game/MovementGeneratorImpl.h index c3859a548f5..df8bc33593f 100644 --- a/src/game/MovementGeneratorImpl.h +++ b/src/game/MovementGeneratorImpl.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_MOVEMENTGENERATOR_IMPL_H -#define MANGOS_MOVEMENTGENERATOR_IMPL_H +#ifndef TRINITY_MOVEMENTGENERATOR_IMPL_H +#define TRINITY_MOVEMENTGENERATOR_IMPL_H #include "MovementGenerator.h" diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 9853e339350..632c05b6e9f 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -48,6 +50,15 @@ void WorldSession::HandleMoveWorldportAckOpcode() return; } + if(!sWorld.IsAllowedMap(loc.mapid) && (GetSecurity() < SEC_GAMEMASTER)) + { + if(sWorld.IsAllowedMap(GetPlayer()->m_homebindMapId)) + GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); + else + LogoutPlayer(false); + return; + } + // get the destination map entry, not the current one, this will fix homebind and reset greeting MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid); InstanceTemplate const* mInstance = objmgr.GetInstanceTemplate(loc.mapid); @@ -249,7 +260,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) return; } - if (!MaNGOS::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o)) + if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o)) return; /* handle special cases */ @@ -260,7 +271,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) if( movementInfo.t_x > 50 || movementInfo.t_y > 50 || movementInfo.t_z > 50 ) return; - if( !MaNGOS::IsValidMapCoord(movementInfo.x+movementInfo.t_x, movementInfo.y+movementInfo.t_y, + if( !Trinity::IsValidMapCoord(movementInfo.x+movementInfo.t_x, movementInfo.y+movementInfo.t_y, movementInfo.z+movementInfo.t_z, movementInfo.o+movementInfo.t_o) ) return; diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index da56186868c..ce4692028f6 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -110,7 +112,7 @@ void WorldSession::HandleTrainerListOpcode( WorldPacket & recv_data ) void WorldSession::SendTrainerList( uint64 guid ) { - std::string str = GetMangosString(LANG_NPC_TAINER_HELLO); + std::string str = GetTrinityString(LANG_NPC_TAINER_HELLO); SendTrainerList( guid, str ); } diff --git a/src/game/NPCHandler.h b/src/game/NPCHandler.h index 1f42be22969..d8e018a9d42 100644 --- a/src/game/NPCHandler.h +++ b/src/game/NPCHandler.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __NPCHANDLER_H diff --git a/src/game/NullCreatureAI.cpp b/src/game/NullCreatureAI.cpp index 81f72c17da9..ea009fb458e 100644 --- a/src/game/NullCreatureAI.cpp +++ b/src/game/NullCreatureAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "NullCreatureAI.h" diff --git a/src/game/NullCreatureAI.h b/src/game/NullCreatureAI.h index 7404e0a40f8..d133b2de240 100644 --- a/src/game/NullCreatureAI.h +++ b/src/game/NullCreatureAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_NULLCREATUREAI_H -#define MANGOS_NULLCREATUREAI_H +#ifndef TRINITY_NULLCREATUREAI_H +#define TRINITY_NULLCREATUREAI_H #include "CreatureAI.h" -class MANGOS_DLL_DECL NullCreatureAI : public CreatureAI +class TRINITY_DLL_DECL NullCreatureAI : public CreatureAI { public: diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 82c9a40c3a3..cbe40ffb593 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -329,7 +331,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2 *data << (float)((Player*)this)->GetTransOffsetO(); *data << (uint32)((Player*)this)->GetTransTime(); } - //MaNGOS currently not have support for other than player on transport + //TrinIty currently not have support for other than player on transport } // 0x02200000 @@ -540,6 +542,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask IsActivateToQuest = true; updateMask->SetBit(GAMEOBJECT_DYN_FLAGS); } + if (GetUInt32Value(GAMEOBJECT_ARTKIT)) + updateMask->SetBit(GAMEOBJECT_ARTKIT); } } else //case UPDATETYPE_VALUES @@ -568,8 +572,9 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask if( updateMask->GetBit( index ) ) { // remove custom flag before send + if( index == UNIT_NPC_FLAGS ) - *data << uint32(m_uint32Values[ index ] & ~UNIT_NPC_FLAG_GUARD); + *data << uint32(m_uint32Values[ index ] & ~(UNIT_NPC_FLAG_GUARD + UNIT_NPC_FLAG_OUTDOORPVP)); // FIXME: Some values at server stored in float format but must be sent to client in uint32 format else if(index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME) { @@ -1116,8 +1121,8 @@ void WorldObject::GetRandomPoint( float x, float y, float z, float distance, flo rand_y = y + new_dist * sin(angle); rand_z = z; - MaNGOS::NormalizeMapCoord(rand_x); - MaNGOS::NormalizeMapCoord(rand_y); + Trinity::NormalizeMapCoord(rand_x); + Trinity::NormalizeMapCoord(rand_y); UpdateGroundPositionZ(rand_x,rand_y,rand_z); // update to LOS height if available } @@ -1130,7 +1135,7 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const bool WorldObject::IsPositionValid() const { - return MaNGOS::IsValidMapCoord(m_positionX,m_positionY,m_positionZ,m_orientation); + return Trinity::IsValidMapCoord(m_positionX,m_positionY,m_positionZ,m_orientation); } void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGuid) @@ -1176,7 +1181,7 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf) SendMessageToSet( &data, true ); // ToSelf ignored in this case } -namespace MaNGOS +namespace Trinity { class MessageChatLocaleCacheDo { @@ -1209,7 +1214,7 @@ namespace MaNGOS if(i_data_cache.size() < cache_idx+1) i_data_cache.resize(cache_idx+1); - char const* text = objmgr.GetMangosString(i_textId,loc_idx); + char const* text = objmgr.GetTrinityString(i_textId,loc_idx); data = new WorldPacket(SMSG_MESSAGECHAT, 200); @@ -1233,49 +1238,49 @@ namespace MaNGOS float i_dist; std::vector<WorldPacket*> i_data_cache; // 0 = default, i => i-1 locale index }; -} // namespace MaNGOS +} // namespace Trinity void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) { - CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()); + CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::MessageChatLocaleCacheDo say_do(*this, CHAT_MSG_MONSTER_SAY, textId,language,TargetGuid,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); - MaNGOS::PlayerWorker<MaNGOS::MessageChatLocaleCacheDo> say_worker(say_do); - TypeContainerVisitor<MaNGOS::PlayerWorker<MaNGOS::MessageChatLocaleCacheDo>, WorldTypeMapContainer > message(say_worker); + Trinity::MessageChatLocaleCacheDo say_do(*this, CHAT_MSG_MONSTER_SAY, textId,language,TargetGuid,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); + Trinity::PlayerWorker<Trinity::MessageChatLocaleCacheDo> say_worker(say_do); + TypeContainerVisitor<Trinity::PlayerWorker<Trinity::MessageChatLocaleCacheDo>, WorldTypeMapContainer > message(say_worker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *GetMap()); } void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) { - CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()); + CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::MessageChatLocaleCacheDo say_do(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL)); - MaNGOS::PlayerWorker<MaNGOS::MessageChatLocaleCacheDo> say_worker(say_do); - TypeContainerVisitor<MaNGOS::PlayerWorker<MaNGOS::MessageChatLocaleCacheDo>, WorldTypeMapContainer > message(say_worker); + Trinity::MessageChatLocaleCacheDo say_do(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL)); + Trinity::PlayerWorker<Trinity::MessageChatLocaleCacheDo> say_worker(say_do); + TypeContainerVisitor<Trinity::PlayerWorker<Trinity::MessageChatLocaleCacheDo>, WorldTypeMapContainer > message(say_worker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *GetMap()); } void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote) { - CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()); + CellPair p = Trinity::ComputeCellPair(GetPositionX(), GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::MessageChatLocaleCacheDo say_do(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId,LANG_UNIVERSAL,TargetGuid,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); - MaNGOS::PlayerWorker<MaNGOS::MessageChatLocaleCacheDo> say_worker(say_do); - TypeContainerVisitor<MaNGOS::PlayerWorker<MaNGOS::MessageChatLocaleCacheDo>, WorldTypeMapContainer > message(say_worker); + Trinity::MessageChatLocaleCacheDo say_do(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId,LANG_UNIVERSAL,TargetGuid,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); + Trinity::PlayerWorker<Trinity::MessageChatLocaleCacheDo> say_worker(say_do); + TypeContainerVisitor<Trinity::PlayerWorker<Trinity::MessageChatLocaleCacheDo>, WorldTypeMapContainer > message(say_worker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, message, *GetMap()); } @@ -1287,7 +1292,7 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp return; uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); - char const* text = objmgr.GetMangosString(textId,loc_idx); + char const* text = objmgr.GetTrinityString(textId,loc_idx); WorldPacket data(SMSG_MESSAGECHAT, 200); BuildMonsterChat(&data,IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER,text,LANG_UNIVERSAL,GetName(),receiver); @@ -1435,8 +1440,8 @@ void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float abs x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle); y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle); - MaNGOS::NormalizeMapCoord(x); - MaNGOS::NormalizeMapCoord(y); + Trinity::NormalizeMapCoord(x); + Trinity::NormalizeMapCoord(y); } void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle ) const diff --git a/src/game/Object.h b/src/game/Object.h index f8b18941aa3..d290838b486 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _OBJECT_H @@ -105,7 +107,7 @@ struct WorldLocation : mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {} }; -class MANGOS_DLL_SPEC Object +class TRINITY_DLL_SPEC Object { public: virtual ~Object ( ); @@ -317,7 +319,7 @@ class MANGOS_DLL_SPEC Object Object& operator=(Object const&); // prevent generation assigment operator }; -class MANGOS_DLL_SPEC WorldObject : public Object +class TRINITY_DLL_SPEC WorldObject : public Object { public: virtual ~WorldObject ( ) {} diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 702bdc72123..4f720f4506b 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ObjectAccessor.h" @@ -39,14 +41,14 @@ #include <cmath> -#define CLASS_LOCK MaNGOS::ClassLevelLockable<ObjectAccessor, ZThread::FastMutex> +#define CLASS_LOCK Trinity::ClassLevelLockable<ObjectAccessor, ZThread::FastMutex> INSTANTIATE_SINGLETON_2(ObjectAccessor, CLASS_LOCK); INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ZThread::FastMutex); -namespace MaNGOS +namespace Trinity { - struct MANGOS_DLL_DECL BuildUpdateForPlayer + struct TRINITY_DLL_DECL BuildUpdateForPlayer { Player &i_player; UpdateDataMapType &i_updatePlayers; @@ -352,7 +354,7 @@ ObjectAccessor::_buildPacket(Player *pl, Object *obj, UpdateDataMapType &update_ void ObjectAccessor::_buildChangeObjectForPlayer(WorldObject *obj, UpdateDataMapType &update_players) { - CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -392,7 +394,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse) return; // build mapid*cellid -> guid_set map - CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); + CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; objmgr.DeleteCorpseCellData(corpse->GetMapId(),cell_id,corpse->GetOwnerGUID()); @@ -411,7 +413,7 @@ ObjectAccessor::AddCorpse(Corpse *corpse) i_player2corpse[corpse->GetOwnerGUID()] = corpse; // build mapid*cellid -> guid_set map - CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); + CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; objmgr.AddCorpseCellData(corpse->GetMapId(),cell_id,corpse->GetOwnerGUID(),corpse->GetInstanceId()); @@ -521,11 +523,11 @@ ObjectAccessor::Update(uint32 diff) Map *map; - MaNGOS::ObjectUpdater updater(diff); + Trinity::ObjectUpdater updater(diff); // for creature - TypeContainerVisitor<MaNGOS::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater); + TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater); // for pets - TypeContainerVisitor<MaNGOS::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater); + TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater); for(CreatureLocationHolderType::iterator iter=creature_locations.begin(); iter != creature_locations.end(); ++iter) { @@ -537,7 +539,7 @@ ObjectAccessor::Update(uint32 diff) Player *player = (*iter).second; map = MapManager::Instance().GetMap((*iter).first, player); - CellPair standing_cell(MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY())); + CellPair standing_cell(Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY())); // Check for correctness of standing_cell, it also avoids problems with update_cell if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) @@ -590,7 +592,7 @@ ObjectAccessor::PlayersNearGrid(uint32 x, uint32 y, uint32 m_id, uint32 i_id) co if( m_id != iter->second->GetMapId() || i_id != iter->second->GetInstanceId() ) continue; - CellPair p = MaNGOS::ComputeCellPair(iter->second->GetPositionX(), iter->second->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(iter->second->GetPositionX(), iter->second->GetPositionY()); if( (cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) && (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord) ) return true; @@ -610,7 +612,7 @@ ObjectAccessor::WorldObjectChangeAccumulator::Visit(PlayerMapType &m) void ObjectAccessor::UpdateObjectVisibility(WorldObject *obj) { - CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); Cell cell(p); MapManager::Instance().GetMap(obj->GetMapId(), obj)->UpdateObjectVisibility(obj,cell,p); @@ -618,7 +620,7 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj) void ObjectAccessor::UpdateVisibilityForPlayer( Player* player ) { - CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); + CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); Cell cell(p); Map* m = MapManager::Instance().GetMap(player->GetMapId(),player); diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index feb0780e36e..4376fa8caf2 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_OBJECTACCESSOR_H -#define MANGOS_OBJECTACCESSOR_H +#ifndef TRINITY_OBJECTACCESSOR_H +#define TRINITY_OBJECTACCESSOR_H #include "Platform/Define.h" #include "Policies/Singleton.h" @@ -49,7 +51,7 @@ class HashMapHolder typedef HM_NAMESPACE::hash_map< uint64, T* > MapType; typedef ZThread::FastMutex LockType; - typedef MaNGOS::GeneralLock<LockType > Guard; + typedef Trinity::GeneralLock<LockType > Guard; static void Insert(T* o) { m_objectMap[o->GetGUID()] = o; } @@ -79,10 +81,10 @@ class HashMapHolder static MapType m_objectMap; }; -class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, MaNGOS::ClassLevelLockable<ObjectAccessor, ZThread::FastMutex> > +class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassLevelLockable<ObjectAccessor, ZThread::FastMutex> > { - friend class MaNGOS::OperatorNew<ObjectAccessor>; + friend class Trinity::OperatorNew<ObjectAccessor>; ObjectAccessor(); ~ObjectAccessor(); ObjectAccessor(const ObjectAccessor &); @@ -116,14 +118,14 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, T* obj = HashMapHolder<T>::Find(guid); if(!obj || obj->GetMapId() != mapid) return NULL; - CellPair p = MaNGOS::ComputeCellPair(x,y); + CellPair p = Trinity::ComputeCellPair(x,y); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { sLog.outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); return NULL; } - CellPair q = MaNGOS::ComputeCellPair(obj->GetPositionX(),obj->GetPositionY()); + CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(),obj->GetPositionY()); if(q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { sLog.outError("ObjectAccessor::GetObjecInWorld: object "I64FMTD" has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); @@ -212,7 +214,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, Player2CorpsesMapType i_player2corpse; typedef ZThread::FastMutex LockType; - typedef MaNGOS::GeneralLock<LockType > Guard; + typedef Trinity::GeneralLock<LockType > Guard; static void _buildChangeObjectForPlayer(WorldObject *, UpdateDataMapType &); static void _buildPacket(Player *, Object *, UpdateDataMapType &); diff --git a/src/game/ObjectDefines.h b/src/game/ObjectDefines.h index ca0fecef5a6..1b594937317 100644 --- a/src/game/ObjectDefines.h +++ b/src/game/ObjectDefines.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_OBJECTDEFINES_H -#define MANGOS_OBJECTDEFINES_H +#ifndef TRINITY_OBJECTDEFINES_H +#define TRINITY_OBJECTDEFINES_H #include "Platform/Define.h" diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 2ce17d4650f..73177a5d7c2 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ObjectGridLoader.h" @@ -27,7 +29,7 @@ #include "World.h" #include "CellImpl.h" -class MANGOS_DLL_DECL ObjectGridRespawnMover +class TRINITY_DLL_DECL ObjectGridRespawnMover { public: ObjectGridRespawnMover() {} @@ -63,7 +65,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) float resp_x, resp_y, resp_z; c->GetRespawnCoord(resp_x, resp_y, resp_z); - CellPair resp_val = MaNGOS::ComputeCellPair(resp_x, resp_y); + CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y); Cell resp_cell(resp_val); if(cur_cell.DiffGrid(resp_cell)) diff --git a/src/game/ObjectGridLoader.h b/src/game/ObjectGridLoader.h index 26cc3543b60..fe527dc9c6e 100644 --- a/src/game/ObjectGridLoader.h +++ b/src/game/ObjectGridLoader.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_OBJECTGRIDLOADER_H -#define MANGOS_OBJECTGRIDLOADER_H +#ifndef TRINITY_OBJECTGRIDLOADER_H +#define TRINITY_OBJECTGRIDLOADER_H #include "Utilities/TypeList.h" #include "Platform/Define.h" @@ -27,7 +29,7 @@ class ObjectWorldLoader; -class MANGOS_DLL_DECL ObjectGridLoader +class TRINITY_DLL_DECL ObjectGridLoader { friend class ObjectWorldLoader; @@ -54,7 +56,7 @@ class MANGOS_DLL_DECL ObjectGridLoader uint32 i_corpses; }; -class MANGOS_DLL_DECL ObjectGridUnloader +class TRINITY_DLL_DECL ObjectGridUnloader { public: ObjectGridUnloader(NGridType &grid) : i_grid(grid) {} @@ -78,7 +80,7 @@ class MANGOS_DLL_DECL ObjectGridUnloader NGridType &i_grid; }; -class MANGOS_DLL_DECL ObjectGridStoper +class TRINITY_DLL_DECL ObjectGridStoper { public: ObjectGridStoper(NGridType &grid) : i_grid(grid) {} diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 66ad79a6e40..3783efaf0f9 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -322,7 +324,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction ) if(bidder_security > SEC_PLAYER ) // not do redundant DB requests { if(!GetPlayerNameByGUID(bidder_guid,bidder_name)) - bidder_name = GetMangosStringForDBCLocale(LANG_UNKNOWN); + bidder_name = GetTrinityStringForDBCLocale(LANG_UNKNOWN); } } @@ -330,7 +332,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction ) { std::string owner_name; if(!GetPlayerNameByGUID(auction->owner,owner_name)) - owner_name = GetMangosStringForDBCLocale(LANG_UNKNOWN); + owner_name = GetTrinityStringForDBCLocale(LANG_UNKNOWN); uint32 owner_accid = GetPlayerAccountIdByGUID(auction->owner); @@ -1019,7 +1021,7 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) { if(mask & 1) { - CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); + CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id]; @@ -1035,7 +1037,7 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data) { if(mask & 1) { - CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); + CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id]; @@ -1089,6 +1091,7 @@ void ObjectMgr::LoadGameobjects() data.spawntimesecs = fields[11].GetInt32(); data.animprogress = fields[12].GetUInt32(); data.go_state = fields[13].GetUInt32(); + data.ArtKit = 0; data.spawnMask = fields[14].GetUInt8(); int16 gameEvent = fields[15].GetInt16(); @@ -1118,7 +1121,7 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) { if(mask & 1) { - CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); + CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id]; @@ -1134,7 +1137,7 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data { if(mask & 1) { - CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); + CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id]; @@ -1841,7 +1844,7 @@ void ObjectMgr::LoadPetLevelInfo() if(current_level > 255) // hardcoded level maximum sLog.outErrorDb("Wrong (> 255) level %u in `pet_levelstats` table, ignoring.",current_level); else - sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `pet_levelstats` table, ignoring.",current_level); + sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `pet_levelstats` table, ignoring.",current_level); continue; } else if(current_level < 1) @@ -2079,11 +2082,11 @@ void ObjectMgr::LoadPlayerInfo() // Load playercreate spells { - QueryResult *result = NULL; - if(sWorld.getConfig(CONFIG_START_ALL_SPELLS)) - result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); - else - result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell"); + QueryResult *result = NULL; + if(sWorld.getConfig(CONFIG_START_ALL_SPELLS)) + result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); + else + result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell"); uint32 count = 0; @@ -2223,7 +2226,7 @@ void ObjectMgr::LoadPlayerInfo() if(current_level > 255) // hardcoded level maximum sLog.outErrorDb("Wrong (> 255) level %u in `player_classlevelstats` table, ignoring.",current_level); else - sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level); + sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level); continue; } @@ -2318,7 +2321,7 @@ void ObjectMgr::LoadPlayerInfo() if(current_level > 255) // hardcoded level maximum sLog.outErrorDb("Wrong (> 255) level %u in `player_levelstats` table, ignoring.",current_level); else - sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_levelstats` table, ignoring.",current_level); + sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_levelstats` table, ignoring.",current_level); continue; } @@ -2803,19 +2806,19 @@ void ObjectMgr::LoadQuests() sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod()); } - if (qinfo->QuestFlags & ~QUEST_MANGOS_FLAGS_DB_ALLOWED) + if (qinfo->QuestFlags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED) { sLog.outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", - qinfo->GetQuestId(),qinfo->QuestFlags,QUEST_MANGOS_FLAGS_DB_ALLOWED >> 16); - qinfo->QuestFlags &= QUEST_MANGOS_FLAGS_DB_ALLOWED; + qinfo->GetQuestId(),qinfo->QuestFlags,QUEST_TRINITY_FLAGS_DB_ALLOWED >> 16); + qinfo->QuestFlags &= QUEST_TRINITY_FLAGS_DB_ALLOWED; } if(qinfo->QuestFlags & QUEST_FLAGS_DAILY) { - if(!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE)) + if(!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE)) { sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId()); - qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE; + qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE; } } @@ -3028,7 +3031,7 @@ void ObjectMgr::LoadQuests() // no changes, quest can't be done for this requirement } - qinfo->SetFlag(QUEST_MANGOS_FLAGS_DELIVER); + qinfo->SetFlag(QUEST_TRINITY_FLAGS_DELIVER); if(!sItemStorage.LookupEntry<ItemPrototype>(id)) { @@ -3145,12 +3148,12 @@ void ObjectMgr::LoadQuests() if(found) { - if(!qinfo->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) + if(!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1); + sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1); // this will prevent quest completing without objective - const_cast<Quest*>(qinfo)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); + const_cast<Quest*>(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); } } else @@ -3184,7 +3187,7 @@ void ObjectMgr::LoadQuests() { // In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast - qinfo->SetFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO); + qinfo->SetFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO); if(!qinfo->ReqCreatureOrGOCount[j]) { @@ -3373,10 +3376,10 @@ void ObjectMgr::LoadQuests() if(qinfo->ExclusiveGroup) mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId())); if(qinfo->LimitTime) - qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED); + qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED); } - // check QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE + // check QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(i); @@ -3396,12 +3399,12 @@ void ObjectMgr::LoadQuests() if(!quest) continue; - if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) + if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id); + sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id); // this will prevent quest completing without objective - const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); + const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); } } } @@ -3658,7 +3661,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) continue; } - if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) + if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) { sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",tablename,tmp.x,tmp.y,tmp.id); continue; @@ -3668,7 +3671,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: { - if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) + if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) { sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",tablename,tmp.x,tmp.y,tmp.id); continue; @@ -3743,12 +3746,12 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) continue; } - if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) + if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",tablename,tmp.datalong,tmp.id); + sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",tablename,tmp.datalong,tmp.id); // this will prevent quest completing without objective - const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); + const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); // continue; - quest objective requiremet set and command can be allowed } @@ -4377,12 +4380,12 @@ void ObjectMgr::LoadQuestAreaTriggers() continue; } - if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) + if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID); + sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID); // this will prevent quest completing without objective - const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); + const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); // continue; - quest modified to required obkective and trigger can be allowed. } @@ -4801,6 +4804,54 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inD return true; } +void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inDB) +{ + GraveYardMap::iterator graveLow = mGraveYardMap.lower_bound(zoneId); + GraveYardMap::iterator graveUp = mGraveYardMap.upper_bound(zoneId); + if(graveLow==graveUp) + { + //sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team); + return; + } + + bool found = false; + + GraveYardMap::iterator itr; + + for(itr = graveLow; itr != graveUp; ++itr) + { + GraveYardData & data = itr->second; + + // skip not matching safezone id + if(data.safeLocId != id) + continue; + + // skip enemy faction graveyard at same map (normal area, city, or battleground) + // team == 0 case can be at call from .neargrave + if(data.team != 0 && team != 0 && data.team != team) + continue; + + found = true; + break; + } + + // no match, return + if(!found) + return; + + // remove from links + mGraveYardMap.erase(itr); + + // remove link from DB + if(inDB) + { + WorldDatabase.PExecute("DELETE FROM game_graveyard_zone WHERE id = '%u' AND ghost_zone = '%u' AND faction = '%u'",id,zoneId,team); + } + + return; +} + + void ObjectMgr::LoadAreaTriggerTeleports() { mAreaTriggers.clear(); // need for reload case @@ -6146,16 +6197,16 @@ void ObjectMgr::LoadGameObjectForQuests() sLog.outString( ">> Loaded %u GameObject for quests", count ); } -bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value) +bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value) { // cleanup affected map part for reloading case - for(MangosStringLocaleMap::iterator itr = mMangosStringLocaleMap.begin(); itr != mMangosStringLocaleMap.end();) + for(TrinityStringLocaleMap::iterator itr = mTrinityStringLocaleMap.begin(); itr != mTrinityStringLocaleMap.end();) { if(itr->first >= min_value && itr->first <= max_value) { - MangosStringLocaleMap::iterator itr2 = itr; + TrinityStringLocaleMap::iterator itr2 = itr; ++itr; - mMangosStringLocaleMap.erase(itr2); + mTrinityStringLocaleMap.erase(itr2); } else ++itr; @@ -6171,7 +6222,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min sLog.outString(""); if(min_value > 0) // error only in case internal strings - sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Cannot continue.",table); + sLog.outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.",table); else sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.",table); return false; @@ -6201,7 +6252,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min continue; } - MangosStringLocale& data = mMangosStringLocaleMap[entry]; + TrinityStringLocale& data = mTrinityStringLocaleMap[entry]; if(data.Content.size() > 0) { @@ -6236,19 +6287,19 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min delete result; sLog.outString(); - if(min_value > 0) // internal mangos strings - sLog.outString( ">> Loaded %u MaNGOS strings from table %s", count,table); + if(min_value > 0) // internal Trinity strings + sLog.outString( ">> Loaded %u Trinity strings from table %s", count,table); else sLog.outString( ">> Loaded %u string templates from %s", count,table); return true; } -const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const +const char *ObjectMgr::GetTrinityString(int32 entry, int locale_idx) const { // locale_idx==-1 -> default, locale_idx >= 0 in to idx+1 - // Content[0] always exist if exist MangosStringLocale - if(MangosStringLocale const *msl = GetMangosStringLocale(entry)) + // Content[0] always exist if exist TrinityStringLocale + if(TrinityStringLocale const *msl = GetTrinityStringLocale(entry)) { if(msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty()) return msl->Content[locale_idx+1].c_str(); @@ -6257,9 +6308,9 @@ const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const } if(entry > 0) - sLog.outErrorDb("Entry %i not found in `mangos_string` table.",entry); + sLog.outErrorDb("Entry %i not found in `trinity_string` table.",entry); else - sLog.outErrorDb("Mangos string entry %i not found in DB.",entry); + sLog.outErrorDb("Trinity string entry %i not found in DB.",entry); return "<error>"; } @@ -6868,15 +6919,15 @@ void ObjectMgr::LoadNpcTextId() sLog.outString( ">> Loaded %d NpcTextId ", count ); } -void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost ) +void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) { VendorItemData& vList = m_mCacheVendorItemMap[entry]; vList.AddItem(item,maxcount,incrtime,extendedcost); - WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); + if(savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); } -bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item ) +bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb) { CacheVendorItemMap::iterator iter = m_mCacheVendorItemMap.find(entry); if(iter == m_mCacheVendorItemMap.end()) @@ -6886,11 +6937,11 @@ bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item ) return false; iter->second.RemoveItem(item); - WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item); + if(savetodb) WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item); return true; } -bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors ) const +bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const { CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry); if(!cInfo) @@ -6898,18 +6949,18 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m if(pl) ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - sLog.outErrorDb("Table `npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); + sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); return false; } - if(!(cInfo->npcflag & UNIT_NPC_FLAG_VENDOR)) + if(!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR)) { if(!skip_vendors || skip_vendors->count(vendor_entry)==0) { if(pl) ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - sLog.outErrorDb("Table `npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); + sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); if(skip_vendors) skip_vendors->insert(vendor_entry); @@ -6922,7 +6973,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m if(pl) ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id); else - sLog.outErrorDb("Table `npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id); + sLog.outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id); return false; } @@ -6931,7 +6982,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m if(pl) ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost); else - sLog.outErrorDb("Table `npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry); + sLog.outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry); return false; } @@ -6940,7 +6991,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m if(pl) ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount); else - sLog.outErrorDb( "Table `npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); + sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); return false; } else if(maxcount==0 && incrtime > 0) @@ -6948,7 +6999,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m if(pl) ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0"); else - sLog.outErrorDb( "Table `npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); + sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); return false; } @@ -6961,7 +7012,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m if(pl) ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id); else - sLog.outErrorDb( "Table `npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); + sLog.outErrorDb( "Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); return false; } @@ -6983,7 +7034,7 @@ const char* GetAreaTriggerScriptNameById(uint32 id) return objmgr.GetAreaTriggerScriptName(id); } -bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value) +bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value) { if(start_value >= 0 || start_value <= end_value) // start/end reversed for negative values { @@ -6993,5 +7044,5 @@ bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, in } // for scripting localized strings allowed use _only_ negative entries - return objmgr.LoadMangosStrings(db,table,end_value,start_value); + return objmgr.LoadTrinityStrings(db,table,end_value,start_value); } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index a75e3902425..6afd1fc094e 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _OBJECTMGR_H @@ -125,7 +127,7 @@ typedef HM_NAMESPACE::hash_map<uint32/*(mapid,spawnMode) pair*/,CellObjectGuidsM typedef HM_NAMESPACE::hash_map<uint64/*(instance,guid) pair*/,time_t> RespawnTimes; -struct MangosStringLocale +struct TrinityStringLocale { std::vector<std::string> Content; // 0 -> default, i -> i-1 locale index }; @@ -138,7 +140,7 @@ typedef HM_NAMESPACE::hash_map<uint32,ItemLocale> ItemLocaleMap; typedef HM_NAMESPACE::hash_map<uint32,QuestLocale> QuestLocaleMap; typedef HM_NAMESPACE::hash_map<uint32,NpcTextLocale> NpcTextLocaleMap; typedef HM_NAMESPACE::hash_map<uint32,PageTextLocale> PageTextLocaleMap; -typedef HM_NAMESPACE::hash_map<uint32,MangosStringLocale> MangosStringLocaleMap; +typedef HM_NAMESPACE::hash_map<uint32,TrinityStringLocale> TrinityStringLocaleMap; typedef std::multimap<uint32,uint32> QuestRelations; @@ -248,7 +250,7 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial); bool normalizePlayerName(std::string& name); -struct MANGOS_DLL_SPEC LanguageDesc +struct TRINITY_DLL_SPEC LanguageDesc { Language lang_id; uint32 spell_id; @@ -256,7 +258,7 @@ struct MANGOS_DLL_SPEC LanguageDesc }; extern LanguageDesc lang_description[LANGUAGES_COUNT]; -MANGOS_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang); +TRINITY_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang); class PlayerDumpReader; @@ -441,6 +443,7 @@ class ObjectMgr WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team); bool AddGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = true); + void RemoveGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = false); void LoadGraveyardZones(); GraveYardData const* FindGraveYardData(uint32 id, uint32 zone); @@ -499,8 +502,8 @@ class ObjectMgr void LoadEventScripts(); void LoadSpellScripts(); - bool LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); - bool LoadMangosStrings() { return LoadMangosStrings(WorldDatabase,"mangos_string",1,std::numeric_limits<int32>::max()); } + bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); + bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",1,std::numeric_limits<int32>::max()); } void LoadPetCreateSpells(); void LoadCreatureLocales(); void LoadCreatureTemplates(); @@ -650,14 +653,14 @@ class ObjectMgr GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; } void DeleteGOData(uint32 guid); - MangosStringLocale const* GetMangosStringLocale(int32 entry) const + TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const { - MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry); - if(itr==mMangosStringLocaleMap.end()) return NULL; + TrinityStringLocaleMap::const_iterator itr = mTrinityStringLocaleMap.find(entry); + if(itr==mTrinityStringLocaleMap.end()) return NULL; return &itr->second; } - const char *GetMangosString(int32 entry, int locale_idx) const; - const char *GetMangosStringForDBCLocale(int32 entry) const { return GetMangosString(entry,DBCLocaleIndex); } + const char *GetTrinityString(int32 entry, int locale_idx) const; + const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance); @@ -740,9 +743,9 @@ class ObjectMgr return &iter->second; } - void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost); - bool RemoveVendorItem(uint32 entry,uint32 item); - bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL ) const; + void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); + bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); + bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const; protected: uint32 m_auctionid; uint32 m_mailid; @@ -840,7 +843,7 @@ class ObjectMgr QuestLocaleMap mQuestLocaleMap; NpcTextLocaleMap mNpcTextLocaleMap; PageTextLocaleMap mPageTextLocaleMap; - MangosStringLocaleMap mMangosStringLocaleMap; + TrinityStringLocaleMap mTrinityStringLocaleMap; RespawnTimes mCreatureRespawnTimes; RespawnTimes mGORespawnTimes; @@ -856,10 +859,10 @@ class ObjectMgr CacheTrainerSpellMap m_mCacheTrainerSpellMap; }; -#define objmgr MaNGOS::Singleton<ObjectMgr>::Instance() +#define objmgr Trinity::Singleton<ObjectMgr>::Instance() // scripting access functions -bool MANGOS_DLL_SPEC LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); -MANGOS_DLL_SPEC const char* GetAreaTriggerScriptNameById(uint32 id); +bool TRINITY_DLL_SPEC LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); +TRINITY_DLL_SPEC const char* GetAreaTriggerScriptNameById(uint32 id); #endif diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index ed37eca8759..6b234261cd0 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 423fad2351f..31fb86ff734 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup u2w diff --git a/src/game/OutdoorPvP.cpp b/src/game/OutdoorPvP.cpp new file mode 100644 index 00000000000..9e8f4f25076 --- /dev/null +++ b/src/game/OutdoorPvP.cpp @@ -0,0 +1,747 @@ +#include "OutdoorPvP.h" +#include "OutdoorPvPMgr.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Map.h" +#include "MapManager.h" +#include "OutdoorPvPObjectiveAI.h" +#include "Group.h" +#include "WorldPacket.h" + +OutdoorPvPObjective::OutdoorPvPObjective(OutdoorPvP * pvp) +: m_PvP(pvp), m_AllianceActivePlayerCount(0), m_HordeActivePlayerCount(0), +m_ShiftTimer(0), m_ShiftPhase(0), m_ShiftMaxPhase(0), m_OldPhase(0), +m_State(0), m_OldState(0), m_CapturePoint(0), m_NeutralValue(0), m_ShiftMaxCaptureSpeed(0), m_CapturePointCreature(0) +{ +} + +bool OutdoorPvPObjective::HandlePlayerEnter(Player * plr) +{ + // only called if really entered, so no use in the return value anymore + // player distance and activity state was checked already in the AI + std::set<uint64>::iterator pitr = m_ActivePlayerGuids.find(plr->GetGUID()); + // if not already counted as active, add player + if(pitr == m_ActivePlayerGuids.end()) + { + if(plr->GetTeam() == ALLIANCE) + ++m_AllianceActivePlayerCount; + else + ++m_HordeActivePlayerCount; + m_ActivePlayerGuids.insert(plr->GetGUID()); + sLog.outDebug("player %u entered an outdoorpvpobjective", plr->GetGUIDLow()); + return true; + } + return true; +} + +void OutdoorPvPObjective::HandlePlayerLeave(Player * plr) +{ + // only decrease the count if the player is in the active list + if(m_ActivePlayerGuids.find(plr->GetGUID())!=m_ActivePlayerGuids.end()) + { + if(plr->GetTeam() == ALLIANCE) + --m_AllianceActivePlayerCount; + else + --m_HordeActivePlayerCount; + m_ActivePlayerGuids.erase(plr->GetGUID()); + } +} + +void OutdoorPvPObjective::HandlePlayerActivityChanged(Player * plr) +{ + if(m_CapturePointCreature) + if(Creature * c = HashMapHolder<Creature>::Find(m_CapturePointCreature)) + if(c->AI()) + c->AI()->MoveInLineOfSight(plr); +} + +bool OutdoorPvPObjective::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) +{ + GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry); + if (!goinfo) + return false; + + uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); + + GameObjectData& data = objmgr.NewGOData(guid); + + data.id = entry; + data.mapid = map; + data.posX = x; + data.posY = y; + data.posZ = z; + data.orientation = o; + data.rotation0 = rotation0; + data.rotation1 = rotation1; + data.rotation2 = rotation2; + data.rotation3 = rotation3; + data.spawntimesecs = 0; + data.animprogress = 100; + data.spawnMask = 1; + data.go_state = 1; + + objmgr.AddGameobjectToGrid(guid, &data); + + // 2 way registering + m_Objects[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT); + m_ObjectTypes[m_Objects[type]]=type; + + Map * pMap = MapManager::Instance().FindMap(map); + if(!pMap) + return true; + GameObject * go = new GameObject; + if(!go->Create(guid,entry, pMap,x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,1)) + { + sLog.outError("Gameobject template %u not found in database.", entry); + delete go; + return true; + } + + go->SetRespawnTime(0); + objmgr.SaveGORespawnTime(go->GetDBTableGUIDLow(),0,0); + pMap->Add(go); + + return true; +} + +bool OutdoorPvPObjective::AddCreature(uint32 type, uint32 entry, uint32 teamval, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay) +{ + CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(entry); + if(!cinfo) + { + return false; + } + + uint32 displayId = objmgr.ChooseDisplayId(teamval, cinfo, NULL); + CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(displayId); + if (!minfo) + { + return false; + } + else + displayId = minfo->modelid; // it can be different (for another gender) + + uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); + + CreatureData& data = objmgr.NewOrExistCreatureData(guid); + + data.id = entry; + data.mapid = map; + data.displayid = displayId; + data.equipmentId = cinfo->equipmentId; + data.posX = x; + data.posY = y; + data.posZ = z; + data.orientation = o; + data.spawntimesecs = spawntimedelay; + data.spawndist = 0; + data.currentwaypoint = 0; + data.curhealth = cinfo->maxhealth; + data.curmana = cinfo->maxmana; + data.is_dead = false; + data.movementType = cinfo->MovementType; + data.spawnMask = 1; + + objmgr.AddCreatureToGrid(guid, &data); + + m_Creatures[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_UNIT); + m_CreatureTypes[m_Creatures[type]] = type; + + Map * pMap = MapManager::Instance().FindMap(map); + if(!pMap) + return true; + Creature* pCreature = new Creature; + if (!pCreature->Create(guid, pMap, entry, teamval)) + { + sLog.outError("Can't create creature entry: %u",entry); + delete pCreature; + return true; + } + + pCreature->AIM_Initialize(); + + pCreature->Relocate(x, y, z, o); + + if(!pCreature->IsPositionValid()) + { + sLog.outError("ERROR: Creature (guidlow %d, entry %d) not added to opvp. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); + return false; + } + + if(spawntimedelay) + pCreature->SetRespawnDelay(spawntimedelay); + + pMap->Add(pCreature); + + return true; +} + +bool OutdoorPvPObjective::AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) +{ + sLog.outDebug("creating capture point %u and capture point creature",entry); + + // check info existence + GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry); + if (!goinfo) + return false; + + CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(OPVP_TRIGGER_CREATURE_ENTRY); + if(!cinfo) + return false; + + // create capture point creature + uint32 displayId = objmgr.ChooseDisplayId(0, cinfo, NULL); + + uint32 creature_guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT); + + CreatureData& cdata = objmgr.NewOrExistCreatureData(creature_guid); + + cdata.id = OPVP_TRIGGER_CREATURE_ENTRY; + cdata.mapid = map; + cdata.displayid = displayId; + cdata.equipmentId = cinfo->equipmentId; + cdata.posX = x; + cdata.posY = y; + cdata.posZ = z; + cdata.orientation = o; + cdata.spawntimesecs = 1; + cdata.spawndist = 0; + cdata.currentwaypoint = 0; + cdata.curhealth = cinfo->maxhealth; + cdata.curmana = cinfo->maxmana; + cdata.is_dead = false; + cdata.movementType = cinfo->MovementType; + cdata.spawnMask = 1; + + objmgr.AddCreatureToGrid(creature_guid, &cdata); + m_CapturePointCreature = MAKE_NEW_GUID(creature_guid, OPVP_TRIGGER_CREATURE_ENTRY, HIGHGUID_UNIT); + + // create capture point go + uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); + + GameObjectData& data = objmgr.NewGOData(guid); + + data.id = entry; + data.mapid = map; + data.posX = x; + data.posY = y; + data.posZ = z; + data.orientation = o; + data.rotation0 = rotation0; + data.rotation1 = rotation1; + data.rotation2 = rotation2; + data.rotation3 = rotation3; + data.spawntimesecs = 1; + data.animprogress = 100; + data.spawnMask = 1; + data.go_state = 1; + + objmgr.AddGameobjectToGrid(guid, &data); + + m_CapturePoint = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT); + + // get the needed values from goinfo + m_ShiftMaxPhase = goinfo->raw.data[17]; + m_ShiftMaxCaptureSpeed = m_ShiftMaxPhase / float(goinfo->raw.data[16]); + m_NeutralValue = goinfo->raw.data[12]; + + // add to map if map is already loaded + Map * pMap = MapManager::Instance().FindMap(map); + if(!pMap) + return true; + // add GO... + GameObject * go = new GameObject; + if(!go->Create(guid,entry, pMap,x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,1)) + { + sLog.outError("Gameobject template %u not found in database.", entry); + delete go; + } + else + { + go->SetRespawnTime(0); + objmgr.SaveGORespawnTime(go->GetDBTableGUIDLow(), 0, 0); + pMap->Add(go); + } + // add creature... + Creature* pCreature = new Creature; + if (!pCreature->Create(creature_guid, pMap, OPVP_TRIGGER_CREATURE_ENTRY, 0)) + { + sLog.outError("Can't create creature entry: %u",entry); + delete pCreature; + } + else + { + pCreature->AIM_Initialize(); + + pCreature->Relocate(x, y, z, o); + + if(!pCreature->IsPositionValid()) + { + sLog.outError("ERROR: Creature (guidlow %d, entry %d) not added to opvp. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); + return false; + } + + pMap->Add(pCreature); + } + return true; +} + +bool OutdoorPvPObjective::DelCreature(uint32 type) +{ + if(!m_Creatures[type]) + { + sLog.outDebug("opvp creature type %u was already deleted",type); + return false; + } + + Creature *cr = HashMapHolder<Creature>::Find(m_Creatures[type]); + if(!cr) + { + // can happen when closing the core + m_Creatures[type] = 0; + return false; + } + sLog.outDebug("deleting opvp creature type %u",type); + uint32 guid = cr->GetDBTableGUIDLow(); + // dont save respawn time + cr->SetRespawnTime(0); + cr->RemoveCorpse(); + cr->CleanupsBeforeDelete(); + // explicit removal from map + // beats me why this is needed, but with the recent removal "cleanup" some creatures stay in the map if "properly" deleted + // so this is a big fat workaround, if AddObjectToRemoveList and DoDelayedMovesAndRemoves worked correctly, this wouldn't be needed + if(Map * map = MapManager::Instance().FindMap(cr->GetMapId())) + map->Remove(cr,false); + // delete respawn time for this creature + WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u'", guid); + cr->AddObjectToRemoveList(); + objmgr.DeleteCreatureData(guid); + m_CreatureTypes[m_Creatures[type]] = 0; + m_Creatures[type] = 0; + return true; +} + +bool OutdoorPvPObjective::DelObject(uint32 type) +{ + if(!m_Objects[type]) + return false; + + GameObject *obj = HashMapHolder<GameObject>::Find(m_Objects[type]); + if(!obj) + { + m_Objects[type] = 0; + return false; + } + uint32 guid = obj->GetDBTableGUIDLow(); + obj->SetRespawnTime(0); // not save respawn time + obj->Delete(); + objmgr.DeleteGOData(guid); + m_ObjectTypes[m_Objects[type]] = 0; + m_Objects[type] = 0; + return true; +} + +bool OutdoorPvPObjective::DelCapturePoint() +{ + if(m_CapturePoint) + { + GameObject *obj = HashMapHolder<GameObject>::Find(m_CapturePoint); + if(obj) + { + uint32 guid = obj->GetDBTableGUIDLow(); + obj->SetRespawnTime(0); // not save respawn time + obj->Delete(); + objmgr.DeleteGOData(guid); + } + m_CapturePoint = 0; + } + if(m_CapturePointCreature) + { + Creature *cr = HashMapHolder<Creature>::Find(m_CapturePointCreature); + if(cr) + { + uint32 guid = cr->GetDBTableGUIDLow(); + // dont save respawn time + cr->SetRespawnTime(0); + cr->RemoveCorpse(); + cr->CleanupsBeforeDelete(); + // explicit removal from map + // beats me why this is needed, but with the recent removal "cleanup" some creatures stay in the map if "properly" deleted + // so this is a big fat workaround, if AddObjectToRemoveList and DoDelayedMovesAndRemoves worked correctly, this wouldn't be needed + if(Map * map = MapManager::Instance().FindMap(cr->GetMapId())) + map->Remove(cr,false); + // delete respawn time for this creature + WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u'", guid); + cr->AddObjectToRemoveList(); + objmgr.DeleteCreatureData(guid); + } + m_CapturePointCreature = 0; + } + return true; +} + +void OutdoorPvPObjective::DeleteSpawns() +{ + for(std::map<uint32,uint64>::iterator i = m_Objects.begin(); i != m_Objects.end(); ++i) + DelObject(i->first); + for(std::map<uint32,uint64>::iterator i = m_Creatures.begin(); i != m_Creatures.end(); ++i) + DelCreature(i->first); + DelCapturePoint(); +} + +void OutdoorPvP::DeleteSpawns() +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + (*itr)->DeleteSpawns(); +} + +OutdoorPvP::OutdoorPvP() +{ +} + +OutdoorPvP::~OutdoorPvP() +{ + DeleteSpawns(); +} + +void OutdoorPvP::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + if(plr->GetTeam()==ALLIANCE) + m_PlayerGuids[0].insert(plr->GetGUID()); + else + m_PlayerGuids[1].insert(plr->GetGUID()); +} + +void OutdoorPvP::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // inform the objectives of the leaving + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + (*itr)->HandlePlayerLeave(plr); + // remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones) + if(zone != plr->GetZoneId()) + SendRemoveWorldStates(plr); + if(plr->GetTeam()==ALLIANCE) + m_PlayerGuids[0].erase(plr->GetGUID()); + else + m_PlayerGuids[1].erase(plr->GetGUID()); + sLog.outDebug("player left an outdoorpvp zone"); +} + +bool OutdoorPvP::Update(uint32 diff) +{ + bool objective_changed = false; + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + objective_changed |= (*itr)->Update(diff); + return objective_changed; +} + +bool OutdoorPvPObjective::Update(uint32 diff) +{ + uint32 Challenger = 0; + if(m_ShiftTimer<diff) + { + m_ShiftTimer = OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL; + + // get the difference of numbers + float fact_diff = (m_AllianceActivePlayerCount - m_HordeActivePlayerCount); + + if(fact_diff<0) + { + if(fact_diff < - m_ShiftMaxCaptureSpeed) + fact_diff = - m_ShiftMaxCaptureSpeed; + Challenger = HORDE; + // horde is in majority, but it's already horde-controlled -> no change + if(m_State == OBJECTIVESTATE_HORDE && m_ShiftPhase == - m_ShiftMaxPhase) + return false; + } + else if(fact_diff>0) + { + if(fact_diff > m_ShiftMaxCaptureSpeed) + fact_diff = m_ShiftMaxCaptureSpeed; + Challenger = ALLIANCE; + // ally is in majority, but it's already ally-controlled -> no change + if(m_State == OBJECTIVESTATE_ALLIANCE && m_ShiftPhase == m_ShiftMaxPhase) + return false; + } + else /*if(fact_diff==0)*/ // no change + return false; + + m_OldPhase = m_ShiftPhase; + + m_OldState = m_State; + + m_ShiftPhase += fact_diff; + + // check limits, these are over the grey part + if(m_ShiftPhase <= - m_ShiftMaxPhase * (float)(m_NeutralValue) / 100.0f) + { + if(m_ShiftPhase <= - m_ShiftMaxPhase) + m_ShiftPhase = - m_ShiftMaxPhase; + m_State = OBJECTIVESTATE_HORDE; + return true; + } + else if(m_ShiftPhase >= m_ShiftMaxPhase * (float)(m_NeutralValue) / 100.0f) + { + if(m_ShiftPhase >= m_ShiftMaxPhase) + m_ShiftPhase = m_ShiftMaxPhase; + m_State = OBJECTIVESTATE_ALLIANCE; + return true; + } + + if(m_OldPhase*m_ShiftPhase <=0) + { + // gone through neutral + // if challenger is ally, then n->a challenge + if(Challenger == ALLIANCE) + m_State = OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE; + // if challenger is horde, then n->h challenge + else if(Challenger == HORDE) + m_State = OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE; + } + else + { + // old phase and current are on the same side, so one team challenges the other + if(Challenger == ALLIANCE && (m_OldState == OBJECTIVESTATE_HORDE || m_OldState == OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE)) + m_State = OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE; + else if(Challenger == HORDE && (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE)) + m_State = OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE; + } + + return true; + } else m_ShiftTimer-=diff; + + return false; +} + +bool OutdoorPvPObjective::HandleCaptureCreaturePlayerMoveInLos(Player * p, Creature * c) +{ + // check if guid matches + if(c->GetGUID() != m_CapturePointCreature) + return false; + + // check if capture point go is spawned + GameObject * cp = HashMapHolder<GameObject>::Find(m_CapturePoint); + if(!cp) + return false; + + // check range and activity + if(cp->IsWithinDistInMap(p,cp->GetGOInfo()->raw.data[0]) && p->IsOutdoorPvPActive()) + { + // data[8] will be used for player enter + return HandleCapturePointEvent(p, cp->GetGOInfo()->raw.data[8]); //i_objective->HandlePlayerEnter((Player*)u); + } + else + { + // data[9] will be used for player leave + return HandleCapturePointEvent(p, cp->GetGOInfo()->raw.data[9]); //i_objective->HandlePlayerLeave((Player*)u); + } +} + +void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value) +{ + // send to both factions + for(int i = 0; i < 2; ++i) + { + // send to all players present in the area + for(std::set<uint64>::iterator itr = m_PlayerGuids[i].begin(); itr != m_PlayerGuids[i].end(); ++itr) + { + Player * plr = objmgr.GetPlayer(*itr); + if(plr) + { + plr->SendUpdateWorldState(field,value); + } + } + } +} + +void OutdoorPvPObjective::SendUpdateWorldState(uint32 field, uint32 value) +{ + // send to all players present in the area + for(std::set<uint64>::iterator itr = m_ActivePlayerGuids.begin(); itr != m_ActivePlayerGuids.end(); ++itr) + { + Player * plr = objmgr.GetPlayer(*itr); + if(plr) + { + plr->SendUpdateWorldState(field,value); + } + } +} + +void OutdoorPvPObjective::SendObjectiveComplete(uint32 id,uint64 guid) +{ + uint32 controlling_faction; + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + controlling_faction = ALLIANCE; + break; + case OBJECTIVESTATE_HORDE: + controlling_faction = HORDE; + break; + default: + return; + break; + } + + // send to all players present in the area + for(std::set<uint64>::iterator itr = m_ActivePlayerGuids.begin(); itr != m_ActivePlayerGuids.end(); ++itr) + { + Player * plr = objmgr.GetPlayer(*itr); + if(plr && plr->GetTeam() == controlling_faction) + { + plr->KilledMonster(id,guid); + } + } +} + +void OutdoorPvP::HandlePlayerActivityChanged(Player * plr) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + (*itr)->HandlePlayerActivityChanged(plr); +} + +void OutdoorPvP::HandleKill(Player *killer, Unit * killed) +{ + if(Group * pGroup = killer->GetGroup()) + { + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *pGroupGuy = itr->getSource(); + + if(!pGroupGuy) + continue; + + // skip if too far away + if(!pGroupGuy->IsAtGroupRewardDistance(killed)) + continue; + + // creature kills must be notified, even if not inside objective / not outdoor pvp active + // player kills only count if active and inside objective + if(( pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy) ) || killed->GetTypeId() == TYPEID_UNIT) + { + HandleKillImpl(pGroupGuy, killed); + } + } + } + else + { + // creature kills must be notified, even if not inside objective / not outdoor pvp active + if(killer && (( killer->IsOutdoorPvPActive() && IsInsideObjective(killer) ) || killed->GetTypeId() == TYPEID_UNIT)) + { + HandleKillImpl(killer, killed); + } + } +} + +bool OutdoorPvP::IsInsideObjective(Player *plr) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->IsInsideObjective(plr)) + return true; + } + return false; +} + +bool OutdoorPvPObjective::IsInsideObjective(Player *plr) +{ + std::set<uint64>::iterator itr = m_ActivePlayerGuids.find(plr->GetGUID()); + return itr != m_ActivePlayerGuids.end(); +} + +bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->HandleCustomSpell(plr,spellId,go)) + return true; + } + return false; +} + +bool OutdoorPvPObjective::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go) +{ + if(!plr->IsOutdoorPvPActive()) + return false; + return false; +} + +bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->HandleOpenGo(plr,guid) >= 0) + return true; + } + return false; +} + +bool OutdoorPvP::HandleCaptureCreaturePlayerMoveInLos(Player * p, Creature * c) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->HandleCaptureCreaturePlayerMoveInLos(p, c)) + return true; + } + return false; +} + +bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->HandleGossipOption(plr, guid, id)) + return true; + } + return false; +} + +bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipOption &gso) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->CanTalkTo(plr, c, gso)) + return true; + } + return false; +} + +bool OutdoorPvP::HandleDropFlag(Player * plr, uint32 id) +{ + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + if((*itr)->HandleDropFlag(plr, id)) + return true; + } + return false; +} + +bool OutdoorPvPObjective::HandleGossipOption(Player * plr, uint64 guid, uint32 id) +{ + return false; +} + +bool OutdoorPvPObjective::CanTalkTo(Player * plr, Creature * c, GossipOption &gso) +{ + return false; +} + +bool OutdoorPvPObjective::HandleDropFlag(Player * plr, uint32 id) +{ + return false; +} + +int32 OutdoorPvPObjective::HandleOpenGo(Player *plr, uint64 guid) +{ + std::map<uint64,uint32>::iterator itr = m_ObjectTypes.find(guid); + if(itr != m_ObjectTypes.end()) + { + return itr->second; + } + return -1; +} + +bool OutdoorPvP::HandleAreaTrigger(Player *plr, uint32 trigger) +{ + return false; +} diff --git a/src/game/OutdoorPvP.h b/src/game/OutdoorPvP.h new file mode 100644 index 00000000000..c5dbeb8714f --- /dev/null +++ b/src/game/OutdoorPvP.h @@ -0,0 +1,211 @@ +#ifndef OUTDOOR_PVP_H_ +#define OUTDOOR_PVP_H_ + +#include "Util.h" + +#include <map> +#include <set> + +#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000 + +#define OPVP_TRIGGER_CREATURE_ENTRY 12999 + +enum ObjectiveStates{ + OBJECTIVESTATE_NEUTRAL = 0, + OBJECTIVESTATE_ALLIANCE = 1, + OBJECTIVESTATE_HORDE = 2, + OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE = 3, + OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE = 4, + OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE = 5, + OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE = 6 +}; + +enum OutdoorPvPTypes{ + OUTDOOR_PVP_HP = 1, + OUTDOOR_PVP_NA = 2, + OUTDOOR_PVP_TF = 3, + OUTDOOR_PVP_ZM = 4, + OUTDOOR_PVP_SI = 5, + OUTDOOR_PVP_EP = 6 +}; + +// struct for go spawning +struct go_type{ + uint32 entry; + uint32 map; + float x; + float y; + float z; + float o; + float rot0; + float rot1; + float rot2; + float rot3; +}; + +// struct for creature spawning +struct creature_type{ + uint32 entry; + uint32 teamval; + uint32 map; + float x; + float y; + float z; + float o; +}; + +// some class predefs +class Player; +class GameObject; +class WorldPacket; +class Creature; +class Unit; +struct GossipOption; + +class OutdoorPvP; +class OutdoorPvPObjective +{ +public: + OutdoorPvPObjective(OutdoorPvP * pvp); + + virtual void FillInitialWorldStates(WorldPacket & data) {} + + // send world state update to all players present + virtual void SendUpdateWorldState(uint32 field, uint32 value); + // send kill notify to players in the controlling faction + virtual void SendObjectiveComplete(uint32 id, uint64 guid); + + // used when player is activated/inactivated in the area + virtual bool HandlePlayerEnter(Player * plr); + virtual void HandlePlayerLeave(Player * plr); + virtual void HandlePlayerActivityChanged(Player * plr); + + // checks if player is in range of a capture credit marker + virtual bool IsInsideObjective(Player * plr); + + virtual bool HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go); + virtual int32 HandleOpenGo(Player *plr, uint64 guid); + + // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. + virtual bool Update(uint32 diff); + + virtual bool HandleCapturePointEvent(Player * plr, uint32 eventId) { return false; } + + virtual bool HandleCaptureCreaturePlayerMoveInLos(Player * p, Creature * c); + + virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); + + virtual bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); + + virtual bool HandleDropFlag(Player * plr, uint32 spellId); + + virtual void DeleteSpawns(); +protected: + + virtual bool AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3); + virtual bool AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3); + virtual bool AddCreature(uint32 type, uint32 entry, uint32 teamval, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0); + + virtual bool DelCreature(uint32 type); + virtual bool DelObject(uint32 type); + virtual bool DelCapturePoint(); + +protected: + // active players in the area of the objective + std::set<uint64> m_ActivePlayerGuids; + int32 m_AllianceActivePlayerCount; + int32 m_HordeActivePlayerCount; + // time left to capture the objective + uint32 m_ShiftTimer; + // total shift needed to capture the objective + float m_ShiftMaxPhase; + // maximum speed of capture + float m_ShiftMaxCaptureSpeed; + // the status of the objective + float m_ShiftPhase; + // phase before update, used to check which faction is in conquer / control + float m_OldPhase; + // objective states + uint32 m_OldState; + uint32 m_State; + // neutral value on capture bar + uint32 m_NeutralValue; + + // pointer to the OutdoorPvP this objective belongs to + OutdoorPvP* m_PvP; + + // map to store the various gameobjects and creatures spawned by the objective + // type , guid + std::map<uint32,uint64> m_Objects; + std::map<uint32,uint64> m_Creatures; + std::map<uint64,uint32> m_ObjectTypes; + std::map<uint64,uint32> m_CreatureTypes; + uint64 m_CapturePoint; + uint64 m_CapturePointCreature; +}; + +// base class for specific outdoor pvp handlers +class OutdoorPvP +{ +public: + // ctor + OutdoorPvP(); + // dtor + ~OutdoorPvP(); + // deletes all gos/creatures spawned by the pvp + void DeleteSpawns(); + + typedef std::set<OutdoorPvPObjective *> OutdoorPvPObjectiveSet; + + // called from Player::UpdateZone to add / remove buffs given by outdoor pvp events + virtual void HandlePlayerEnterZone(Player * plr, uint32 zone); + virtual void HandlePlayerLeaveZone(Player * plr, uint32 zone); + virtual void HandlePlayerActivityChanged(Player * plr); + // called when a player triggers an areatrigger + virtual bool HandleAreaTrigger(Player * plr, uint32 trigger); + // called on custom spell + virtual bool HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go); + // called on go use + virtual bool HandleOpenGo(Player *plr, uint64 guid); + // called from moveinlineofsight + virtual bool HandleCaptureCreaturePlayerMoveInLos(Player * p, Creature * c); + + // setup stuff + virtual bool SetupOutdoorPvP() {return true;} + + // world state stuff + virtual void SendRemoveWorldStates(Player * plr) {} + virtual void FillInitialWorldStates(WorldPacket & data) {} + + // send world state update to all players present + virtual void SendUpdateWorldState(uint32 field, uint32 value); + + // called by OutdoorPvPMgr, updates the objectives and if needed, sends new worldstateui information + virtual bool Update(uint32 diff); + + // handle npc/player kill + virtual void HandleKill(Player * killer, Unit * killed); + virtual void HandleKillImpl(Player * killer, Unit * killed) {} + + // checks if player is in range of a capture credit marker + virtual bool IsInsideObjective(Player * plr); + + // awards rewards for player kill + virtual void AwardKillBonus(Player * plr) {} + + uint32 GetTypeId() {return m_TypeId;} + + virtual bool HandleDropFlag(Player * plr, uint32 spellId); + + virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); + + virtual bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); +protected: + // the map of the objectives belonging to this outdoorpvp + OutdoorPvPObjectiveSet m_OutdoorPvPObjectives; + // players in the zones of this outdoorpvp, 0 - alliance, 1 - horde + std::set<uint64> m_PlayerGuids[2]; + uint32 m_TypeId; +}; + +#endif /*OUTDOOR_PVP_H_*/ diff --git a/src/game/OutdoorPvPEP.cpp b/src/game/OutdoorPvPEP.cpp new file mode 100644 index 00000000000..581a6f558ff --- /dev/null +++ b/src/game/OutdoorPvPEP.cpp @@ -0,0 +1,912 @@ +#include "OutdoorPvPEP.h" +#include "WorldPacket.h" +#include "Player.h" +#include "GameObject.h" +#include "ObjectMgr.h" +#include "ObjectAccessor.h" +#include "OutdoorPvPMgr.h" +#include "Creature.h" +#include "Language.h" +#include "World.h" +#include "GossipDef.h" + +OutdoorPvPObjectiveEP_EWT::OutdoorPvPObjectiveEP_EWT(OutdoorPvP *pvp) +: OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) +{ + AddCapturePoint(EPCapturePoints[EP_EWT].entry,EPCapturePoints[EP_EWT].map,EPCapturePoints[EP_EWT].x,EPCapturePoints[EP_EWT].y,EPCapturePoints[EP_EWT].z,EPCapturePoints[EP_EWT].o,EPCapturePoints[EP_EWT].rot0,EPCapturePoints[EP_EWT].rot1,EPCapturePoints[EP_EWT].rot2,EPCapturePoints[EP_EWT].rot3); + AddObject(EP_EWT_FLAGS,EPTowerFlags[EP_EWT].entry,EPTowerFlags[EP_EWT].map,EPTowerFlags[EP_EWT].x,EPTowerFlags[EP_EWT].y,EPTowerFlags[EP_EWT].z,EPTowerFlags[EP_EWT].o,EPTowerFlags[EP_EWT].rot0,EPTowerFlags[EP_EWT].rot1,EPTowerFlags[EP_EWT].rot2,EPTowerFlags[EP_EWT].rot3); +} + +bool OutdoorPvPObjectiveEP_EWT::Update(uint32 diff) +{ + if(OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase) // state won't change, only phase when maxed out! + { + // if changing from controlling alliance to horde or vice versa + if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_A)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; + } + else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_H)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; + } + + uint32 artkit = 21; + + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + if(m_ShiftPhase == m_ShiftMaxPhase) + m_TowerState = EP_TS_A; + else + m_TowerState = EP_TS_A_P; + artkit = 2; + SummonSupportUnitAtNorthpassTower(ALLIANCE); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); + break; + case OBJECTIVESTATE_HORDE: + if(m_ShiftPhase == -m_ShiftMaxPhase) + m_TowerState = EP_TS_H; + else + m_TowerState = EP_TS_H_P; + artkit = 1; + SummonSupportUnitAtNorthpassTower(HORDE); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); + break; + case OBJECTIVESTATE_NEUTRAL: + m_TowerState = EP_TS_N; + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_TowerState = EP_TS_N_A; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + m_TowerState = EP_TS_N_H; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_EWT_FLAGS]); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + if(flag2) + { + flag2->SetGoArtKit(artkit); + flag2->SendUpdateObjectToAllExcept(NULL); + } + + + UpdateTowerState(); + + // complete quest objective + if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) + SendObjectiveComplete(EP_EWT_CM, 0); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + // send this too, sometimes it resets :S + SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + } + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_EWT::FillInitialWorldStates(WorldPacket &data) +{ + data << EP_EWT_A << uint32(bool(m_TowerState & EP_TS_A)); + data << EP_EWT_H << uint32(bool(m_TowerState & EP_TS_H)); + data << EP_EWT_A_P << uint32(bool(m_TowerState & EP_TS_A_P)); + data << EP_EWT_H_P << uint32(bool(m_TowerState & EP_TS_H_P)); + data << EP_EWT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); + data << EP_EWT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); + data << EP_EWT_N << uint32(bool(m_TowerState & EP_TS_N)); +} + +void OutdoorPvPObjectiveEP_EWT::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(EP_EWT_A , bool(m_TowerState & EP_TS_A)); + m_PvP->SendUpdateWorldState(EP_EWT_H , bool(m_TowerState & EP_TS_H)); + m_PvP->SendUpdateWorldState(EP_EWT_A_P , bool(m_TowerState & EP_TS_A_P)); + m_PvP->SendUpdateWorldState(EP_EWT_H_P , bool(m_TowerState & EP_TS_H_P)); + m_PvP->SendUpdateWorldState(EP_EWT_N_A , bool(m_TowerState & EP_TS_N_A)); + m_PvP->SendUpdateWorldState(EP_EWT_N_H , bool(m_TowerState & EP_TS_N_H)); + m_PvP->SendUpdateWorldState(EP_EWT_N , bool(m_TowerState & EP_TS_N)); +} + +bool OutdoorPvPObjectiveEP_EWT::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_EWT::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +bool OutdoorPvPObjectiveEP_EWT::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == EPTowerPlayerEnterEvents[EP_EWT]) + { + this->HandlePlayerEnter(plr); + return true; + } + else if (eventId == EPTowerPlayerLeaveEvents[EP_EWT]) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_EWT::SummonSupportUnitAtNorthpassTower(uint32 team) +{ + if(m_UnitsSummonedSide != team) + { + m_UnitsSummonedSide = team; + const creature_type * ct = NULL; + if(team == ALLIANCE) + ct=EP_EWT_Summons_A; + else + ct=EP_EWT_Summons_H; + + for(int i = 0; i < EP_EWT_NUM_CREATURES; ++i) + { + DelCreature(i); + AddCreature(i,ct[i].entry,ct[i].teamval,ct[i].map,ct[i].x,ct[i].y,ct[i].z,ct[i].o,1000000); + } + } +} + +// NPT +OutdoorPvPObjectiveEP_NPT::OutdoorPvPObjectiveEP_NPT(OutdoorPvP *pvp) +: OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_SummonedGOSide(0) +{ + AddCapturePoint(EPCapturePoints[EP_NPT].entry,EPCapturePoints[EP_NPT].map,EPCapturePoints[EP_NPT].x,EPCapturePoints[EP_NPT].y,EPCapturePoints[EP_NPT].z,EPCapturePoints[EP_NPT].o,EPCapturePoints[EP_NPT].rot0,EPCapturePoints[EP_NPT].rot1,EPCapturePoints[EP_NPT].rot2,EPCapturePoints[EP_NPT].rot3); + AddObject(EP_NPT_FLAGS,EPTowerFlags[EP_NPT].entry,EPTowerFlags[EP_NPT].map,EPTowerFlags[EP_NPT].x,EPTowerFlags[EP_NPT].y,EPTowerFlags[EP_NPT].z,EPTowerFlags[EP_NPT].o,EPTowerFlags[EP_NPT].rot0,EPTowerFlags[EP_NPT].rot1,EPTowerFlags[EP_NPT].rot2,EPTowerFlags[EP_NPT].rot3); +} + +bool OutdoorPvPObjectiveEP_NPT::Update(uint32 diff) +{ + if(OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase) // state won't change, only phase when maxed out! + { + // if changing from controlling alliance to horde or vice versa + if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; + } + else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_H)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; + } + + uint32 artkit = 21; + + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + if(m_ShiftPhase == m_ShiftMaxPhase) + m_TowerState = EP_TS_A; + else + m_TowerState = EP_TS_A_P; + artkit = 2; + SummonGO(ALLIANCE); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); + break; + case OBJECTIVESTATE_HORDE: + if(m_ShiftPhase == -m_ShiftMaxPhase) + m_TowerState = EP_TS_H; + else + m_TowerState = EP_TS_H_P; + artkit = 1; + SummonGO(HORDE); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); + break; + case OBJECTIVESTATE_NEUTRAL: + m_TowerState = EP_TS_N; + m_SummonedGOSide = 0; + DelObject(EP_NPT_BUFF); + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_TowerState = EP_TS_N_A; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + m_TowerState = EP_TS_N_H; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_FLAGS]); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + if(flag2) + { + flag2->SetGoArtKit(artkit); + flag2->SendUpdateObjectToAllExcept(NULL); + } + + UpdateTowerState(); + + // complete quest objective + if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) + SendObjectiveComplete(EP_NPT_CM, 0); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + // send this too, sometimes it resets :S + SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + } + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_NPT::FillInitialWorldStates(WorldPacket &data) +{ + data << EP_NPT_A << uint32(bool(m_TowerState & EP_TS_A)); + data << EP_NPT_H << uint32(bool(m_TowerState & EP_TS_H)); + data << EP_NPT_A_P << uint32(bool(m_TowerState & EP_TS_A_P)); + data << EP_NPT_H_P << uint32(bool(m_TowerState & EP_TS_H_P)); + data << EP_NPT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); + data << EP_NPT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); + data << EP_NPT_N << uint32(bool(m_TowerState & EP_TS_N)); +} + +void OutdoorPvPObjectiveEP_NPT::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(EP_NPT_A , bool(m_TowerState & EP_TS_A)); + m_PvP->SendUpdateWorldState(EP_NPT_H , bool(m_TowerState & EP_TS_H)); + m_PvP->SendUpdateWorldState(EP_NPT_A_P , bool(m_TowerState & EP_TS_A_P)); + m_PvP->SendUpdateWorldState(EP_NPT_H_P , bool(m_TowerState & EP_TS_H_P)); + m_PvP->SendUpdateWorldState(EP_NPT_N_A , bool(m_TowerState & EP_TS_N_A)); + m_PvP->SendUpdateWorldState(EP_NPT_N_H , bool(m_TowerState & EP_TS_N_H)); + m_PvP->SendUpdateWorldState(EP_NPT_N , bool(m_TowerState & EP_TS_N)); +} + +bool OutdoorPvPObjectiveEP_NPT::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_NPT::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +bool OutdoorPvPObjectiveEP_NPT::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == EPTowerPlayerEnterEvents[EP_NPT]) + { + this->HandlePlayerEnter(plr); + return true; + } + else if (eventId == EPTowerPlayerLeaveEvents[EP_NPT]) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_NPT::SummonGO(uint32 team) +{ + if(m_SummonedGOSide != team) + { + m_SummonedGOSide = team; + DelObject(EP_NPT_BUFF); + AddObject(EP_NPT_BUFF,EP_NPT_LordaeronShrine.entry,EP_NPT_LordaeronShrine.map,EP_NPT_LordaeronShrine.x,EP_NPT_LordaeronShrine.y,EP_NPT_LordaeronShrine.z,EP_NPT_LordaeronShrine.o,EP_NPT_LordaeronShrine.rot0,EP_NPT_LordaeronShrine.rot1,EP_NPT_LordaeronShrine.rot2,EP_NPT_LordaeronShrine.rot3); + GameObject * go = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_BUFF]); + if(go) + go->SetUInt32Value(GAMEOBJECT_FACTION,(team == ALLIANCE ? 84 : 83)); + } +} + +// CGT +OutdoorPvPObjectiveEP_CGT::OutdoorPvPObjectiveEP_CGT(OutdoorPvP *pvp) +: OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_GraveyardSide(0) +{ + AddCapturePoint(EPCapturePoints[EP_CGT].entry,EPCapturePoints[EP_CGT].map,EPCapturePoints[EP_CGT].x,EPCapturePoints[EP_CGT].y,EPCapturePoints[EP_CGT].z,EPCapturePoints[EP_CGT].o,EPCapturePoints[EP_CGT].rot0,EPCapturePoints[EP_CGT].rot1,EPCapturePoints[EP_CGT].rot2,EPCapturePoints[EP_CGT].rot3); + AddObject(EP_CGT_FLAGS,EPTowerFlags[EP_CGT].entry,EPTowerFlags[EP_CGT].map,EPTowerFlags[EP_CGT].x,EPTowerFlags[EP_CGT].y,EPTowerFlags[EP_CGT].z,EPTowerFlags[EP_CGT].o,EPTowerFlags[EP_CGT].rot0,EPTowerFlags[EP_CGT].rot1,EPTowerFlags[EP_CGT].rot2,EPTowerFlags[EP_CGT].rot3); +} + +bool OutdoorPvPObjectiveEP_CGT::Update(uint32 diff) +{ + if(OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase) // state won't change, only phase when maxed out! + { + // if changing from controlling alliance to horde or vice versa + if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_A)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; + } + else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_H)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; + } + + uint32 artkit = 21; + + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + if(m_ShiftPhase == m_ShiftMaxPhase) + m_TowerState = EP_TS_A; + else + m_TowerState = EP_TS_A_P; + artkit = 2; + LinkGraveYard(ALLIANCE); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = ALLIANCE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); + break; + case OBJECTIVESTATE_HORDE: + if(m_ShiftPhase == -m_ShiftMaxPhase) + m_TowerState = EP_TS_H; + else + m_TowerState = EP_TS_H_P; + artkit = 1; + LinkGraveYard(HORDE); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = HORDE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); + break; + case OBJECTIVESTATE_NEUTRAL: + m_TowerState = EP_TS_N; + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_TowerState = EP_TS_N_A; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + m_TowerState = EP_TS_N_H; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_CGT_FLAGS]); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + if(flag2) + { + flag2->SetGoArtKit(artkit); + flag2->SendUpdateObjectToAllExcept(NULL); + } + + UpdateTowerState(); + + // complete quest objective + if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) + SendObjectiveComplete(EP_CGT_CM, 0); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + // send this too, sometimes it resets :S + SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + } + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_CGT::FillInitialWorldStates(WorldPacket &data) +{ + data << EP_CGT_A << uint32(bool(m_TowerState & EP_TS_A)); + data << EP_CGT_H << uint32(bool(m_TowerState & EP_TS_H)); + data << EP_CGT_A_P << uint32(bool(m_TowerState & EP_TS_A_P)); + data << EP_CGT_H_P << uint32(bool(m_TowerState & EP_TS_H_P)); + data << EP_CGT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); + data << EP_CGT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); + data << EP_CGT_N << uint32(bool(m_TowerState & EP_TS_N)); +} + +void OutdoorPvPObjectiveEP_CGT::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(EP_CGT_A , bool(m_TowerState & EP_TS_A)); + m_PvP->SendUpdateWorldState(EP_CGT_H , bool(m_TowerState & EP_TS_H)); + m_PvP->SendUpdateWorldState(EP_CGT_A_P , bool(m_TowerState & EP_TS_A_P)); + m_PvP->SendUpdateWorldState(EP_CGT_H_P , bool(m_TowerState & EP_TS_H_P)); + m_PvP->SendUpdateWorldState(EP_CGT_N_A , bool(m_TowerState & EP_TS_N_A)); + m_PvP->SendUpdateWorldState(EP_CGT_N_H , bool(m_TowerState & EP_TS_N_H)); + m_PvP->SendUpdateWorldState(EP_CGT_N , bool(m_TowerState & EP_TS_N)); +} + +bool OutdoorPvPObjectiveEP_CGT::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_CGT::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +bool OutdoorPvPObjectiveEP_CGT::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == EPTowerPlayerEnterEvents[EP_CGT]) + { + this->HandlePlayerEnter(plr); + return true; + } + else if (eventId == EPTowerPlayerLeaveEvents[EP_CGT]) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_CGT::LinkGraveYard(uint32 team) +{ + if(m_GraveyardSide != team) + { + m_GraveyardSide = team; + objmgr.RemoveGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false); + objmgr.AddGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false); + } +} + +// PWT +OutdoorPvPObjectiveEP_PWT::OutdoorPvPObjectiveEP_PWT(OutdoorPvP *pvp) +: OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_FlightMasterSpawned(0) +{ + AddCapturePoint(EPCapturePoints[EP_PWT].entry,EPCapturePoints[EP_PWT].map,EPCapturePoints[EP_PWT].x,EPCapturePoints[EP_PWT].y,EPCapturePoints[EP_PWT].z,EPCapturePoints[EP_PWT].o,EPCapturePoints[EP_PWT].rot0,EPCapturePoints[EP_PWT].rot1,EPCapturePoints[EP_PWT].rot2,EPCapturePoints[EP_PWT].rot3); + AddObject(EP_PWT_FLAGS,EPTowerFlags[EP_PWT].entry,EPTowerFlags[EP_PWT].map,EPTowerFlags[EP_PWT].x,EPTowerFlags[EP_PWT].y,EPTowerFlags[EP_PWT].z,EPTowerFlags[EP_PWT].o,EPTowerFlags[EP_PWT].rot0,EPTowerFlags[EP_PWT].rot1,EPTowerFlags[EP_PWT].rot2,EPTowerFlags[EP_PWT].rot3); +} + +bool OutdoorPvPObjectiveEP_PWT::Update(uint32 diff) +{ + if(OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase) // state won't change, only phase when maxed out! + { + // if changing from controlling alliance to horde or vice versa + if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; + } + else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) + { + sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_H)); + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; + } + + uint32 artkit = 21; + + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + if(m_ShiftPhase == m_ShiftMaxPhase) + m_TowerState = EP_TS_A; + else + m_TowerState = EP_TS_A_P; + SummonFlightMaster(ALLIANCE); + artkit = 2; + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); + break; + case OBJECTIVESTATE_HORDE: + if(m_ShiftPhase == -m_ShiftMaxPhase) + m_TowerState = EP_TS_H; + else + m_TowerState = EP_TS_H_P; + SummonFlightMaster(HORDE); + artkit = 1; + ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE; + if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); + break; + case OBJECTIVESTATE_NEUTRAL: + m_TowerState = EP_TS_N; + DelCreature(EP_PWT_FLIGHTMASTER); + m_FlightMasterSpawned = 0; + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_TowerState = EP_TS_N_A; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + m_TowerState = EP_TS_N_H; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + if(flag2) + { + flag2->SetGoArtKit(artkit); + flag2->SendUpdateObjectToAllExcept(NULL); + } + + UpdateTowerState(); + + // complete quest objective + if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) + SendObjectiveComplete(EP_PWT_CM, 0); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + // send this too, sometimes it resets :S + SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + } + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_PWT::FillInitialWorldStates(WorldPacket &data) +{ + data << EP_PWT_A << uint32(bool(m_TowerState & EP_TS_A)); + data << EP_PWT_H << uint32(bool(m_TowerState & EP_TS_H)); + data << EP_PWT_A_P << uint32(bool(m_TowerState & EP_TS_A_P)); + data << EP_PWT_H_P << uint32(bool(m_TowerState & EP_TS_H_P)); + data << EP_PWT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); + data << EP_PWT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); + data << EP_PWT_N << uint32(bool(m_TowerState & EP_TS_N)); +} + +void OutdoorPvPObjectiveEP_PWT::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(EP_PWT_A , bool(m_TowerState & EP_TS_A)); + m_PvP->SendUpdateWorldState(EP_PWT_H , bool(m_TowerState & EP_TS_H)); + m_PvP->SendUpdateWorldState(EP_PWT_A_P , bool(m_TowerState & EP_TS_A_P)); + m_PvP->SendUpdateWorldState(EP_PWT_H_P , bool(m_TowerState & EP_TS_H_P)); + m_PvP->SendUpdateWorldState(EP_PWT_N_A , bool(m_TowerState & EP_TS_N_A)); + m_PvP->SendUpdateWorldState(EP_PWT_N_H , bool(m_TowerState & EP_TS_N_H)); + m_PvP->SendUpdateWorldState(EP_PWT_N , bool(m_TowerState & EP_TS_N)); +} + +bool OutdoorPvPObjectiveEP_PWT::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_PWT::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +bool OutdoorPvPObjectiveEP_PWT::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == EPTowerPlayerEnterEvents[EP_PWT]) + { + this->HandlePlayerEnter(plr); + return true; + } + else if (eventId == EPTowerPlayerLeaveEvents[EP_PWT]) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} + +void OutdoorPvPObjectiveEP_PWT::SummonFlightMaster(uint32 team) +{ + if(m_FlightMasterSpawned != team) + { + m_FlightMasterSpawned = team; + DelCreature(EP_PWT_FLIGHTMASTER); + AddCreature(EP_PWT_FLIGHTMASTER,EP_PWT_FlightMaster.entry,team,EP_PWT_FlightMaster.map,EP_PWT_FlightMaster.x,EP_PWT_FlightMaster.y,EP_PWT_FlightMaster.z,EP_PWT_FlightMaster.o); + Creature * c = HashMapHolder<Creature>::Find(m_Creatures[EP_PWT_FLIGHTMASTER]); + if(c) + { + GossipOption gso; + gso.Action = GOSSIP_OPTION_OUTDOORPVP; + gso.GossipId = 0; + gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT)); + gso.Id = 50; + gso.Icon = 0; + gso.NpcFlag = 0; + c->addGossipOption(gso); + + gso.Action = GOSSIP_OPTION_OUTDOORPVP; + gso.GossipId = 0; + gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT)); + gso.Id = 50; + gso.Icon = 0; + gso.NpcFlag = 0; + c->addGossipOption(gso); + + gso.Action = GOSSIP_OPTION_OUTDOORPVP; + gso.GossipId = 0; + gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT)); + gso.Id = 50; + gso.Icon = 0; + gso.NpcFlag = 0; + c->addGossipOption(gso); + } + } +} + +bool OutdoorPvPObjectiveEP_PWT::CanTalkTo(Player * p, Creature * c, GossipOption &gso) +{ + if( p->GetTeam() == m_FlightMasterSpawned && + c->GetGUID() == m_Creatures[EP_PWT_FLIGHTMASTER] && + gso.Id == 50 ) + return true; + return false; +} + +bool OutdoorPvPObjectiveEP_PWT::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid) +{ + std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid); + if(itr != m_CreatureTypes.end()) + { + Creature * cr = HashMapHolder<Creature>::Find(guid); + if(!cr) + return true; + if(itr->second == EP_PWT_FLIGHTMASTER) + { + uint32 src = EP_PWT_Taxi; + uint32 dst = 0; + switch(gossipid) + { + case 0: + dst = EP_NPT_Taxi; + break; + case 1: + dst = EP_EWT_Taxi; + break; + default: + dst = EP_CGT_Taxi; + break; + } + + std::vector<uint32> nodes; + nodes.resize(2); + nodes[0] = src; + nodes[1] = dst; + + plr->PlayerTalkClass->CloseGossip(); + plr->ActivateTaxiPathTo(nodes, 0, cr); + // leave the opvp, seems like moveinlineofsight isn't called when entering a taxi + HandlePlayerLeave(plr); + } + return true; + } + return false; +} + +// ep +OutdoorPvPEP::OutdoorPvPEP() +{ + m_TypeId = OUTDOOR_PVP_EP; + memset(EP_Controls,0,sizeof(EP_Controls)); + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; +} + +bool OutdoorPvPEP::SetupOutdoorPvP() +{ + for(int i = 0; i < EPBuffZonesNum; ++i) + sOutdoorPvPMgr.AddZone(EPBuffZones[i],this); + + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_EWT(this)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_PWT(this)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_CGT(this)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_NPT(this)); + return true; +} + +bool OutdoorPvPEP::Update(uint32 diff) +{ + if(OutdoorPvP::Update(diff)) + { + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; + for(int i = 0; i < EP_TOWER_NUM; ++i) + { + if(EP_Controls[i] == ALLIANCE) + ++m_AllianceTowersControlled; + else if(EP_Controls[i] == HORDE) + ++m_HordeTowersControlled; + SendUpdateWorldState(EP_UI_TOWER_COUNT_A,m_AllianceTowersControlled); + SendUpdateWorldState(EP_UI_TOWER_COUNT_H,m_HordeTowersControlled); + BuffTeams(); + } + return true; + } + return false; +} + +void OutdoorPvPEP::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + // add buffs + if(plr->GetTeam() == ALLIANCE) + { + if(m_AllianceTowersControlled && m_AllianceTowersControlled < 5) + plr->CastSpell(plr,EP_AllianceBuffs[m_AllianceTowersControlled-1],true); + } + else + { + if(m_HordeTowersControlled && m_HordeTowersControlled < 5) + plr->CastSpell(plr,EP_HordeBuffs[m_HordeTowersControlled-1],true); + } + OutdoorPvP::HandlePlayerEnterZone(plr,zone); +} + +void OutdoorPvPEP::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // remove buffs + if(plr->GetTeam() == ALLIANCE) + { + for(int i = 0; i < 4; ++i) + plr->RemoveAurasDueToSpell(EP_AllianceBuffs[i]); + } + else + { + for(int i = 0; i < 4; ++i) + plr->RemoveAurasDueToSpell(EP_HordeBuffs[i]); + } + OutdoorPvP::HandlePlayerLeaveZone(plr, zone); +} + +void OutdoorPvPEP::BuffTeams() +{ + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + { + for(int i = 0; i < 4; ++i) + plr->RemoveAurasDueToSpell(EP_AllianceBuffs[i]); + if(m_AllianceTowersControlled && m_AllianceTowersControlled < 5) + plr->CastSpell(plr,EP_AllianceBuffs[m_AllianceTowersControlled-1],true); + } + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + { + for(int i = 0; i < 4; ++i) + plr->RemoveAurasDueToSpell(EP_HordeBuffs[i]); + if(m_HordeTowersControlled && m_HordeTowersControlled < 5) + plr->CastSpell(plr,EP_HordeBuffs[m_HordeTowersControlled-1],true); + } + } +} + +void OutdoorPvPEP::FillInitialWorldStates(WorldPacket & data) +{ + data << EP_UI_TOWER_COUNT_A << m_AllianceTowersControlled; + data << EP_UI_TOWER_COUNT_H << m_HordeTowersControlled; + data << EP_UI_TOWER_SLIDER_DISPLAY << uint32(0); + data << EP_UI_TOWER_SLIDER_POS << uint32(50); + data << EP_UI_TOWER_SLIDER_N << uint32(100); + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + (*itr)->FillInitialWorldStates(data); + } +} + +void OutdoorPvPEP::SendRemoveWorldStates(Player *plr) +{ + plr->SendUpdateWorldState(EP_UI_TOWER_COUNT_A,0); + plr->SendUpdateWorldState(EP_UI_TOWER_COUNT_H,0); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY,0); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS,0); + plr->SendUpdateWorldState(EP_UI_TOWER_SLIDER_N,0); + + plr->SendUpdateWorldState(EP_EWT_A,0); + plr->SendUpdateWorldState(EP_EWT_H,0); + plr->SendUpdateWorldState(EP_EWT_N,0); + plr->SendUpdateWorldState(EP_EWT_A_P,0); + plr->SendUpdateWorldState(EP_EWT_H_P,0); + plr->SendUpdateWorldState(EP_EWT_N_A,0); + plr->SendUpdateWorldState(EP_EWT_N_H,0); + + plr->SendUpdateWorldState(EP_PWT_A,0); + plr->SendUpdateWorldState(EP_PWT_H,0); + plr->SendUpdateWorldState(EP_PWT_N,0); + plr->SendUpdateWorldState(EP_PWT_A_P,0); + plr->SendUpdateWorldState(EP_PWT_H_P,0); + plr->SendUpdateWorldState(EP_PWT_N_A,0); + plr->SendUpdateWorldState(EP_PWT_N_H,0); + + plr->SendUpdateWorldState(EP_NPT_A,0); + plr->SendUpdateWorldState(EP_NPT_H,0); + plr->SendUpdateWorldState(EP_NPT_N,0); + plr->SendUpdateWorldState(EP_NPT_A_P,0); + plr->SendUpdateWorldState(EP_NPT_H_P,0); + plr->SendUpdateWorldState(EP_NPT_N_A,0); + plr->SendUpdateWorldState(EP_NPT_N_H,0); + + plr->SendUpdateWorldState(EP_CGT_A,0); + plr->SendUpdateWorldState(EP_CGT_H,0); + plr->SendUpdateWorldState(EP_CGT_N,0); + plr->SendUpdateWorldState(EP_CGT_A_P,0); + plr->SendUpdateWorldState(EP_CGT_H_P,0); + plr->SendUpdateWorldState(EP_CGT_N_A,0); + plr->SendUpdateWorldState(EP_CGT_N_H,0); +} diff --git a/src/game/OutdoorPvPEP.h b/src/game/OutdoorPvPEP.h new file mode 100644 index 00000000000..e7a80a34b7f --- /dev/null +++ b/src/game/OutdoorPvPEP.h @@ -0,0 +1,263 @@ +#ifndef OUTDOOR_PVP_EP_ +#define OUTDOOR_PVP_EP_ + +#include "OutdoorPvP.h" + +#include "Database/DBCStructure.h" + +const uint32 EP_AllianceBuffs[4] = {11413, 11414, 11415, 1386}; + +const uint32 EP_HordeBuffs[4] = {30880, 30683, 30682, 29520}; + +const uint32 EP_GraveYardZone = 139; + +const uint32 EP_GraveYardId = 927; + +const uint32 EPBuffZonesNum = 3; + +const uint32 EP_EWT_CM = 17690; +const uint32 EP_CGT_CM = 17689; +const uint32 EP_NPT_CM = 17696; +const uint32 EP_PWT_CM = 17698; + +const uint32 EPBuffZones[EPBuffZonesNum] = {139, 2017, 2057}; + +enum EP_TaxiNodes { + EP_CGT_Taxi = 87, + EP_EWT_Taxi = 86, + EP_NPT_Taxi = 85, + EP_PWT_Taxi = 84 +}; + +enum EP_EastwallTowerWorldStates { + EP_EWT_A = 2354, + EP_EWT_H = 2356, + EP_EWT_A_P = 2357, // ally progressing + EP_EWT_H_P = 2358, + EP_EWT_N_A = 2359, // ally conquested + EP_EWT_N_H = 2360, + EP_EWT_N = 2361 +}; + +enum EP_NorthpassTowerWorldStates { + EP_NPT_N = 2352, + EP_NPT_N_A = 2362, + EP_NPT_N_H = 2363, + EP_NPT_A_P = 2364, + EP_NPT_H_P = 2365, + EP_NPT_A = 2372, + EP_NPT_H = 2373 +}; + +enum EP_PlagewoodTowerWorldStates { + EP_PWT_N_A = 2366, + EP_PWT_N_H = 2353, //2367 not present! use neutral! + EP_PWT_A_P = 2368, + EP_PWT_H_P = 2369, + EP_PWT_A = 2370, + EP_PWT_H = 2371, + EP_PWT_N = 2353 +}; + +enum EP_CrownGuardTowerWorldStates { + EP_CGT_N_A = 2374, + EP_CGT_N_H = 2375, + EP_CGT_A_P = 2376, + EP_CGT_H_P = 2377, + EP_CGT_A = 2378, + EP_CGT_H = 2379, + EP_CGT_N = 2355 +}; + +enum EP_WorldStates { + EP_UI_TOWER_SLIDER_DISPLAY = 2426, + EP_UI_TOWER_SLIDER_POS = 2427, + EP_UI_TOWER_SLIDER_N = 2428, + + EP_UI_TOWER_COUNT_A = 2327, + EP_UI_TOWER_COUNT_H = 2328 +}; + +enum EP_Summons { + EP_EWT_COMMANDER = 0, + EP_EWT_SOLDIER1, + EP_EWT_SOLDIER2, + EP_EWT_SOLDIER3, + EP_EWT_SOLDIER4, + EP_PWT_FLIGHTMASTER, +}; + +enum EP_GoSummons { + EP_NPT_BUFF = 0, + EP_NPT_FLAGS, + EP_EWT_FLAGS, + EP_CGT_FLAGS, + EP_PWT_FLAGS +}; + +enum EP_Towers { + EP_EWT = 0, // plaguelands 03 + EP_NPT,// plaguelands 01 + EP_PWT,// plaguelands 04 + EP_CGT,// plaguelands 02 + EP_TOWER_NUM +}; + +const go_type EPCapturePoints[EP_TOWER_NUM] = { + {182097,0,2574.51,-4794.89,144.704,-1.45003,-0.097056,0.095578,-0.656229,0.742165}, + {181899,0,3181.08,-4379.36,174.123,-2.03472,-0.065392,0.119494,-0.842275,0.521553}, + {182098,0,2962.71,-3042.31,154.789,2.08426,-0.074807,-0.113837,0.855928,0.49883}, + {182096,0,1860.85,-3731.23,196.716,-2.53214,0.033967,-0.131914,0.944741,-0.298177} +}; + +const go_type EPTowerFlags[EP_TOWER_NUM] = { + {182106,0,2569.60,-4772.93,115.399,2.72271,0,0,0.978148,0.207912}, + {182106,0,3148.17,-4365.51,145.029,1.53589,0,0,0.694658,0.71934}, + {182106,0,2992.63,-3022.95,125.593,3.03687,0,0,0.99863,0.052336}, + {182106,0,1838.42,-3703.56,167.713,0.890118,0,0,0.430511,0.902585} +}; + +const uint32 EPTowerPlayerEnterEvents[EP_TOWER_NUM] = {10691,10699,10701,10705}; + +const uint32 EPTowerPlayerLeaveEvents[EP_TOWER_NUM] = {10692,10698,10700,10704}; + +const uint32 EP_NUM_CREATURES = 6; +const uint32 EP_EWT_NUM_CREATURES = 5; + +// one lordaeron commander, 4 soldiers +// should be spawned at EWT and follow a path, but trans-grid pathing isn't safe, so summon them directly at NPT +const creature_type EP_EWT_Summons_A[EP_EWT_NUM_CREATURES] = { + {17635,469,0, 3167.61,-4352.09,138.20,4.5811}, + {17647,469,0, 3172.74,-4352.99,139.14,4.9873}, + {17647,469,0, 3165.89,-4354.46,138.67,3.7244}, + {17647,469,0, 3164.65,-4350.26,138.22,2.4794}, + {17647,469,0, 3169.91,-4349.68,138.37,0.7444} +}; + +const creature_type EP_EWT_Summons_H[EP_EWT_NUM_CREATURES] = { + {17995,67,0, 3167.61,-4352.09,138.20,4.5811}, + {17996,67,0, 3172.74,-4352.99,139.14,4.9873}, + {17996,67,0, 3165.89,-4354.46,138.67,3.7244}, + {17996,67,0, 3164.65,-4350.26,138.22,2.4794}, + {17996,67,0, 3169.91,-4349.68,138.37,0.7444} +}; + +enum EP_TowerStates { + EP_TS_N = 1, + EP_TS_N_A = 2, + EP_TS_N_H = 4, + EP_TS_A_P = 8, + EP_TS_H_P = 16, + EP_TS_A = 32, + EP_TS_H = 64 +}; + +// when spawning, pay attention at setting the faction manually! +const creature_type EP_PWT_FlightMaster = {17209,0,0,2987.5,-3049.11,120.126,5.75959}; + +// after spawning, modify the faction so that only the controller will be able to use it with SetUInt32Value(GAMEOBJECT_FACTION, faction_id); +const go_type EP_NPT_LordaeronShrine = {181682,0,3167.72,-4355.91,138.785,1.69297,0,0,0.748956,0.66262}; + +class OutdoorPvPEP; + +class OutdoorPvPObjectiveEP_EWT : public OutdoorPvPObjective +{ +friend class OutdoorPvPEP; +public: + OutdoorPvPObjectiveEP_EWT(OutdoorPvP * pvp); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); +protected: + bool HandleCapturePointEvent(Player * plr, uint32 eventId); + void SummonSupportUnitAtNorthpassTower(uint32 team); + void UpdateTowerState(); +protected: + uint32 m_TowerState; + uint32 m_UnitsSummonedSide; +}; + +class OutdoorPvPObjectiveEP_NPT : public OutdoorPvPObjective +{ +friend class OutdoorPvPEP; +public: + OutdoorPvPObjectiveEP_NPT(OutdoorPvP * pvp); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); +protected: + bool HandleCapturePointEvent(Player * plr, uint32 eventId); + void SummonGO(uint32 team); + void UpdateTowerState(); +protected: + uint32 m_TowerState; + uint32 m_SummonedGOSide; +}; + +class OutdoorPvPObjectiveEP_CGT : public OutdoorPvPObjective +{ +friend class OutdoorPvPEP; +public: + OutdoorPvPObjectiveEP_CGT(OutdoorPvP * pvp); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); +protected: + bool HandleCapturePointEvent(Player * plr, uint32 eventId); + void LinkGraveYard(uint32 team); + void UpdateTowerState(); +protected: + uint32 m_TowerState; + uint32 m_GraveyardSide; +}; + +class OutdoorPvPObjectiveEP_PWT : public OutdoorPvPObjective +{ +friend class OutdoorPvPEP; +public: + OutdoorPvPObjectiveEP_PWT(OutdoorPvP * pvp); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); + bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); + bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); +protected: + bool HandleCapturePointEvent(Player * plr, uint32 eventId); + void SummonFlightMaster(uint32 team); + void UpdateTowerState(); +protected: + uint32 m_FlightMasterSpawned; + uint32 m_TowerState; +}; + +class OutdoorPvPEP : public OutdoorPvP +{ +friend class OutdoorPvPObjectiveEP_EWT; +friend class OutdoorPvPObjectiveEP_NPT; +friend class OutdoorPvPObjectiveEP_PWT; +friend class OutdoorPvPObjectiveEP_CGT; +public: + OutdoorPvPEP(); + bool SetupOutdoorPvP(); + void HandlePlayerEnterZone(Player *plr, uint32 zone); + void HandlePlayerLeaveZone(Player *plr, uint32 zone); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket &data); + void SendRemoveWorldStates(Player * plr); + void BuffTeams(); +private: + // how many towers are controlled + uint32 EP_Controls[EP_TOWER_NUM]; + uint32 m_AllianceTowersControlled; + uint32 m_HordeTowersControlled; +}; + +#endif diff --git a/src/game/OutdoorPvPHP.cpp b/src/game/OutdoorPvPHP.cpp new file mode 100644 index 00000000000..b8ff59583a7 --- /dev/null +++ b/src/game/OutdoorPvPHP.cpp @@ -0,0 +1,380 @@ +#include "OutdoorPvPHP.h" +#include "OutdoorPvP.h" +#include "OutdoorPvPMgr.h" +#include "Player.h" +#include "WorldPacket.h" +#include "World.h" +#include "ObjectMgr.h" +#include "Language.h" + +const uint32 HP_LANG_LOOSE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_LOOSE_BROKENHILL_A,LANG_OPVP_HP_LOOSE_OVERLOOK_A,LANG_OPVP_HP_LOOSE_STADIUM_A}; + +const uint32 HP_LANG_LOOSE_H[HP_TOWER_NUM] = {LANG_OPVP_HP_LOOSE_BROKENHILL_H,LANG_OPVP_HP_LOOSE_OVERLOOK_H,LANG_OPVP_HP_LOOSE_STADIUM_H}; + +const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_A,LANG_OPVP_HP_CAPTURE_OVERLOOK_A,LANG_OPVP_HP_CAPTURE_STADIUM_A}; + +const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_H,LANG_OPVP_HP_CAPTURE_OVERLOOK_H,LANG_OPVP_HP_CAPTURE_STADIUM_H}; + +OutdoorPvPObjectiveHP::OutdoorPvPObjectiveHP(OutdoorPvP *pvp,OutdoorPvPHPTowerType type) +: OutdoorPvPObjective(pvp), m_TowerType(type) +{ + AddCapturePoint(HPCapturePoints[type].entry, + HPCapturePoints[type].map, + HPCapturePoints[type].x, + HPCapturePoints[type].y, + HPCapturePoints[type].z, + HPCapturePoints[type].o, + HPCapturePoints[type].rot0, + HPCapturePoints[type].rot1, + HPCapturePoints[type].rot2, + HPCapturePoints[type].rot3); + AddObject(type, + HPTowerFlags[type].entry, + HPTowerFlags[type].map, + HPTowerFlags[type].x, + HPTowerFlags[type].y, + HPTowerFlags[type].z, + HPTowerFlags[type].o, + HPTowerFlags[type].rot0, + HPTowerFlags[type].rot1, + HPTowerFlags[type].rot2, + HPTowerFlags[type].rot3); +} + +OutdoorPvPHP::OutdoorPvPHP() +{ + m_TypeId = OUTDOOR_PVP_HP; +} + +bool OutdoorPvPHP::SetupOutdoorPvP() +{ + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; + // add the zones affected by the pvp buff + for(int i = 0; i < OutdoorPvPHPBuffZonesNum; ++i) + sOutdoorPvPMgr.AddZone(OutdoorPvPHPBuffZones[i],this); + + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveHP(this,HP_TOWER_BROKEN_HILL)); + + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveHP(this,HP_TOWER_OVERLOOK)); + + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveHP(this,HP_TOWER_STADIUM)); + + return true; +} + +void OutdoorPvPHP::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + // add buffs + if(plr->GetTeam() == ALLIANCE) + { + if(m_AllianceTowersControlled >=3) + plr->CastSpell(plr,AllianceBuff,true); + } + else + { + if(m_HordeTowersControlled >=3) + plr->CastSpell(plr,HordeBuff,true); + } + OutdoorPvP::HandlePlayerEnterZone(plr,zone); +} + +void OutdoorPvPHP::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // remove buffs + if(plr->GetTeam() == ALLIANCE) + { + plr->RemoveAurasDueToSpell(AllianceBuff); + } + else + { + plr->RemoveAurasDueToSpell(HordeBuff); + } + OutdoorPvP::HandlePlayerLeaveZone(plr, zone); +} + +bool OutdoorPvPHP::Update(uint32 diff) +{ + bool changed = false; + if(changed = OutdoorPvP::Update(diff)) + { + if(m_AllianceTowersControlled == 3) + BuffTeam(ALLIANCE); + else if(m_HordeTowersControlled == 3) + BuffTeam(HORDE); + else + BuffTeam(NULL); + SendUpdateWorldState(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); + SendUpdateWorldState(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled); + } + return changed; +} + +void OutdoorPvPHP::SendRemoveWorldStates(Player *plr) +{ + plr->SendUpdateWorldState(HP_UI_TOWER_DISPLAY_A,0); + plr->SendUpdateWorldState(HP_UI_TOWER_DISPLAY_H,0); + plr->SendUpdateWorldState(HP_UI_TOWER_COUNT_H,0); + plr->SendUpdateWorldState(HP_UI_TOWER_COUNT_A,0); + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N,0); + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS,0); + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY,0); + for(int i = 0; i < HP_TOWER_NUM; ++i) + { + plr->SendUpdateWorldState(HP_MAP_N[i],0); + plr->SendUpdateWorldState(HP_MAP_A[i],0); + plr->SendUpdateWorldState(HP_MAP_H[i],0); + } +} + +void OutdoorPvPHP::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(HP_UI_TOWER_DISPLAY_A) << uint32(1); + data << uint32(HP_UI_TOWER_DISPLAY_H) << uint32(1); + data << uint32(HP_UI_TOWER_COUNT_A) << uint32(m_AllianceTowersControlled); + data << uint32(HP_UI_TOWER_COUNT_H) << uint32(m_HordeTowersControlled); + data << uint32(HP_UI_TOWER_SLIDER_DISPLAY) << uint32(0); + data << uint32(HP_UI_TOWER_SLIDER_POS) << uint32(50); + data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100); + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + (*itr)->FillInitialWorldStates(data); + } +} + +bool OutdoorPvPObjectiveHP::Update(uint32 diff) +{ + // if status changed: + if(OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State) + { + uint32 field = 0; + switch(m_OldState) + { + case OBJECTIVESTATE_NEUTRAL: + field = HP_MAP_N[m_TowerType]; + break; + case OBJECTIVESTATE_ALLIANCE: + field = HP_MAP_A[m_TowerType]; + if(((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled) + ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled--; + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_A[m_TowerType])); + break; + case OBJECTIVESTATE_HORDE: + field = HP_MAP_H[m_TowerType]; + if(((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled) + ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled--; + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_H[m_TowerType])); + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + field = HP_MAP_N[m_TowerType]; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + field = HP_MAP_N[m_TowerType]; + break; + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + field = HP_MAP_A[m_TowerType]; + break; + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + field = HP_MAP_H[m_TowerType]; + break; + } + + // send world state update + if(field) + { + m_PvP->SendUpdateWorldState(field, 0); + field = 0; + } + uint32 artkit = 21; + uint32 artkit2 = HP_TowerArtKit_N[m_TowerType]; + switch(m_State) + { + case OBJECTIVESTATE_NEUTRAL: + field = HP_MAP_N[m_TowerType]; + break; + case OBJECTIVESTATE_ALLIANCE: + field = HP_MAP_A[m_TowerType]; + artkit = 2; + artkit2 = HP_TowerArtKit_A[m_TowerType]; + if(((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3) + ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled++; + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType])); + break; + case OBJECTIVESTATE_HORDE: + field = HP_MAP_H[m_TowerType]; + artkit = 1; + artkit2 = HP_TowerArtKit_H[m_TowerType]; + if(((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3) + ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled++; + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType])); + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + field = HP_MAP_N[m_TowerType]; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + field = HP_MAP_N[m_TowerType]; + break; + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + field = HP_MAP_A[m_TowerType]; + artkit = 2; + artkit2 = HP_TowerArtKit_A[m_TowerType]; + break; + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + field = HP_MAP_H[m_TowerType]; + artkit = 1; + artkit2 = HP_TowerArtKit_H[m_TowerType]; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[m_TowerType]); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + if(flag2) + { + flag2->SetGoArtKit(artkit2); + flag2->SendUpdateObjectToAllExcept(NULL); + } + + // send world state update + if(field) + m_PvP->SendUpdateWorldState(field, 1); + + // complete quest objective + if(m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE) + SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], 0); + } + + if(m_ShiftPhase != m_OldPhase) + { + SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_NeutralValue); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase); + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); + } + return true; + } + return false; +} + +void OutdoorPvPObjectiveHP::FillInitialWorldStates(WorldPacket &data) +{ + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + data << uint32(HP_MAP_N[m_TowerType]) << uint32(0); + data << uint32(HP_MAP_A[m_TowerType]) << uint32(1); + data << uint32(HP_MAP_H[m_TowerType]) << uint32(0); + break; + case OBJECTIVESTATE_HORDE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + data << uint32(HP_MAP_N[m_TowerType]) << uint32(0); + data << uint32(HP_MAP_A[m_TowerType]) << uint32(0); + data << uint32(HP_MAP_H[m_TowerType]) << uint32(1); + break; + case OBJECTIVESTATE_NEUTRAL: + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + default: + data << uint32(HP_MAP_N[m_TowerType]) << uint32(1); + data << uint32(HP_MAP_A[m_TowerType]) << uint32(0); + data << uint32(HP_MAP_H[m_TowerType]) << uint32(0); + break; + } +} + +bool OutdoorPvPObjectiveHP::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveHP::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +void OutdoorPvPHP::BuffTeam(uint32 team) +{ + if(team == ALLIANCE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,AllianceBuff,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(HordeBuff); + } + } + else if(team == HORDE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,HordeBuff,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(AllianceBuff); + } + } + else + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(AllianceBuff); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(HordeBuff); + } + } +} + +void OutdoorPvPHP::HandleKillImpl(Player *plr, Unit * killed) +{ + if(killed->GetTypeId() != TYPEID_PLAYER) + return; + + if(plr->GetTeam() == ALLIANCE && ((Player*)killed)->GetTeam() != ALLIANCE) + plr->CastSpell(plr,AlliancePlayerKillReward,true); + else if(plr->GetTeam() == HORDE && ((Player*)killed)->GetTeam() != HORDE) + plr->CastSpell(plr,HordePlayerKillReward,true); +} + +bool OutdoorPvPObjectiveHP::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == HP_CapturePointEvent_Enter[m_TowerType]) + { + this->HandlePlayerEnter(plr); + return true; + } + else if(eventId == HP_CapturePointEvent_Leave[m_TowerType]) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} diff --git a/src/game/OutdoorPvPHP.h b/src/game/OutdoorPvPHP.h new file mode 100644 index 00000000000..33a5bbfe894 --- /dev/null +++ b/src/game/OutdoorPvPHP.h @@ -0,0 +1,100 @@ +#ifndef OUTDOOR_PVP_HP_ +#define OUTDOOR_PVP_HP_ + +#include "OutdoorPvP.h" + +#define OutdoorPvPHPBuffZonesNum 6 + // HP, citadel, ramparts, blood furnace, shattered halls, mag's lair +const uint32 OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum] = { 3483, 3563, 3562, 3713, 3714, 3836 }; + +const uint32 AllianceBuff = 32071; + +const uint32 HordeBuff = 32049; + +const uint32 AlliancePlayerKillReward = 32155; + +const uint32 HordePlayerKillReward = 32158; + +enum OutdoorPvPHPTowerType{ + HP_TOWER_BROKEN_HILL = 0, + HP_TOWER_OVERLOOK = 1, + HP_TOWER_STADIUM = 2, + HP_TOWER_NUM = 3 +}; + +const uint32 HP_CREDITMARKER[HP_TOWER_NUM] = {19032,19028,19029}; + +const uint32 HP_CapturePointEvent_Enter[HP_TOWER_NUM] = {11404,11396,11388}; + +const uint32 HP_CapturePointEvent_Leave[HP_TOWER_NUM] = {11403,11395,11387}; + +enum OutdoorPvPHPWorldStates{ + HP_UI_TOWER_DISPLAY_A = 0x9ba, + HP_UI_TOWER_DISPLAY_H = 0x9b9, + + HP_UI_TOWER_COUNT_H = 0x9ae, + HP_UI_TOWER_COUNT_A = 0x9ac, + + HP_UI_TOWER_SLIDER_N = 2475, + HP_UI_TOWER_SLIDER_POS = 2474, + HP_UI_TOWER_SLIDER_DISPLAY = 2473 +}; + +const uint32 HP_MAP_N[HP_TOWER_NUM] = {0x9b5,0x9b2,0x9a8}; + +const uint32 HP_MAP_A[HP_TOWER_NUM] = {0x9b3,0x9b0,0x9a7}; + +const uint32 HP_MAP_H[HP_TOWER_NUM] = {0x9b4,0x9b1,0x9a6}; + +const uint32 HP_TowerArtKit_A[HP_TOWER_NUM] = {65,62,67}; + +const uint32 HP_TowerArtKit_H[HP_TOWER_NUM] = {64,61,68}; + +const uint32 HP_TowerArtKit_N[HP_TOWER_NUM] = {66,63,69}; + +const go_type HPCapturePoints[HP_TOWER_NUM] = { + {182175,530,-471.462,3451.09,34.6432,0.174533,0,0,0.087156,0.996195}, // 0 - Broken Hill + {182174,530,-184.889,3476.93,38.205,-0.017453,0,0,0.008727,-0.999962}, // 1 - Overlook + {182173,530,-290.016,3702.42,56.6729,0.034907,0,0,0.017452,0.999848} // 2 - Stadium +}; + +const go_type HPTowerFlags[HP_TOWER_NUM] = { + {183514,530,-467.078,3528.17,64.7121,3.14159,0,0,1,0}, // 0 broken hill + {182525,530,-187.887,3459.38,60.0403,-3.12414,0,0,0.999962,-0.008727}, // 1 overlook + {183515,530,-289.610,3696.83,75.9447,3.12414,0,0,0.999962,0.008727} // 2 stadium +}; + +class OutdoorPvPObjectiveHP : public OutdoorPvPObjective +{ +public: + OutdoorPvPObjectiveHP(OutdoorPvP * pvp, OutdoorPvPHPTowerType type); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); + bool HandleCapturePointEvent(Player * plr, uint32 eventId); +private: + OutdoorPvPHPTowerType m_TowerType; +}; + +class OutdoorPvPHP : public OutdoorPvP +{ +friend class OutdoorPvPObjectiveHP; +public: + OutdoorPvPHP(); + bool SetupOutdoorPvP(); + void HandlePlayerEnterZone(Player *plr, uint32 zone); + void HandlePlayerLeaveZone(Player *plr, uint32 zone); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket &data); + void SendRemoveWorldStates(Player * plr); + void HandleKillImpl(Player * plr, Unit * killed); + void BuffTeam(uint32 team); +private: + // how many towers are controlled + uint32 m_AllianceTowersControlled; + uint32 m_HordeTowersControlled; +}; + +#endif diff --git a/src/game/OutdoorPvPMgr.cpp b/src/game/OutdoorPvPMgr.cpp new file mode 100644 index 00000000000..f2b25c2533e --- /dev/null +++ b/src/game/OutdoorPvPMgr.cpp @@ -0,0 +1,219 @@ +#include "OutdoorPvPMgr.h" +#include "OutdoorPvPHP.h" +#include "OutdoorPvPNA.h" +#include "OutdoorPvPTF.h" +#include "OutdoorPvPZM.h" +#include "OutdoorPvPSI.h" +#include "OutdoorPvPEP.h" +#include "Player.h" +#include "Policies/SingletonImp.h" + +INSTANTIATE_SINGLETON_1( OutdoorPvPMgr ); + +OutdoorPvPMgr::OutdoorPvPMgr() +{ + //sLog.outDebug("Instantiating OutdoorPvPMgr"); +} + +OutdoorPvPMgr::~OutdoorPvPMgr() +{ + //sLog.outDebug("Deleting OutdoorPvPMgr"); + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + (*itr)->DeleteSpawns(); + } +} + +void OutdoorPvPMgr::InitOutdoorPvP() +{ + // create new opvp + OutdoorPvP * pOP = new OutdoorPvPHP; + // respawn, init variables + if(!pOP->SetupOutdoorPvP()) + { + sLog.outDebug("OutdoorPvP : HP init failed."); + delete pOP; + } + else + { + m_OutdoorPvPSet.insert(pOP); + sLog.outDebug("OutdoorPvP : HP successfully initiated."); + } + + + pOP = new OutdoorPvPNA; + // respawn, init variables + if(!pOP->SetupOutdoorPvP()) + { + sLog.outDebug("OutdoorPvP : NA init failed."); + delete pOP; + } + else + { + m_OutdoorPvPSet.insert(pOP); + sLog.outDebug("OutdoorPvP : NA successfully initiated."); + } + + + pOP = new OutdoorPvPTF; + // respawn, init variables + if(!pOP->SetupOutdoorPvP()) + { + sLog.outDebug("OutdoorPvP : TF init failed."); + delete pOP; + } + else + { + m_OutdoorPvPSet.insert(pOP); + sLog.outDebug("OutdoorPvP : TF successfully initiated."); + } + + pOP = new OutdoorPvPZM; + // respawn, init variables + if(!pOP->SetupOutdoorPvP()) + { + sLog.outDebug("OutdoorPvP : ZM init failed."); + delete pOP; + } + else + { + m_OutdoorPvPSet.insert(pOP); + sLog.outDebug("OutdoorPvP : ZM successfully initiated."); + } + + pOP = new OutdoorPvPSI; + // respawn, init variables + if(!pOP->SetupOutdoorPvP()) + { + sLog.outDebug("OutdoorPvP : SI init failed."); + delete pOP; + } + else + { + m_OutdoorPvPSet.insert(pOP); + sLog.outDebug("OutdoorPvP : SI successfully initiated."); + } + + pOP = new OutdoorPvPEP; + // respawn, init variables + if(!pOP->SetupOutdoorPvP()) + { + sLog.outDebug("OutdoorPvP : EP init failed."); + delete pOP; + } + else + { + m_OutdoorPvPSet.insert(pOP); + sLog.outDebug("OutdoorPvP : EP successfully initiated."); + } +} + +void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP *handle) +{ + m_OutdoorPvPMap[zoneid] = handle; +} + + +void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid) +{ + OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); + if(itr == m_OutdoorPvPMap.end()) + { + // no handle for this zone, return + return; + } + // add possibly beneficial buffs to plr for zone + itr->second->HandlePlayerEnterZone(plr, zoneid); + plr->SendInitWorldStates(); + sLog.outDebug("Player %u entered outdoorpvp id %u",plr->GetGUIDLow(), itr->second->GetTypeId()); +} + +void OutdoorPvPMgr::HandlePlayerLeaveZone(Player *plr, uint32 zoneid) +{ + OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); + if(itr == m_OutdoorPvPMap.end()) + { + // no handle for this zone, return + return; + } + // inform the OutdoorPvP class of the leaving, it should remove the player from all objectives + itr->second->HandlePlayerLeaveZone(plr, zoneid); + sLog.outDebug("Player %u left outdoorpvp id %u",plr->GetGUIDLow(), itr->second->GetTypeId()); +} + +OutdoorPvP * OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid) +{ + OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); + if(itr == m_OutdoorPvPMap.end()) + { + // no handle for this zone, return + return NULL; + } + return itr->second; +} + +void OutdoorPvPMgr::Update(uint32 diff) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + (*itr)->Update(diff); + } +} + +bool OutdoorPvPMgr::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + if((*itr)->HandleCustomSpell(plr,spellId,go)) + return true; + } + return false; +} + +bool OutdoorPvPMgr::HandleOpenGo(Player *plr, uint64 guid) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + if((*itr)->HandleOpenGo(plr,guid)) + return true; + } + return false; +} + +bool OutdoorPvPMgr::HandleCaptureCreaturePlayerMoveInLos(Player * plr, Creature * c) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + if((*itr)->HandleCaptureCreaturePlayerMoveInLos(plr,c)) + return true; + } + return false; +} + +void OutdoorPvPMgr::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + if((*itr)->HandleGossipOption(plr,guid,gossipid)) + return; + } +} + +bool OutdoorPvPMgr::CanTalkTo(Player * plr, Creature * c, GossipOption & gso) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + if((*itr)->CanTalkTo(plr,c,gso)) + return true; + } + return false; +} + +void OutdoorPvPMgr::HandleDropFlag(Player *plr, uint32 spellId) +{ + for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) + { + if((*itr)->HandleDropFlag(plr,spellId)) + return; + } +} diff --git a/src/game/OutdoorPvPMgr.h b/src/game/OutdoorPvPMgr.h new file mode 100644 index 00000000000..ee1544fb168 --- /dev/null +++ b/src/game/OutdoorPvPMgr.h @@ -0,0 +1,59 @@ +#ifndef OUTDOOR_PVP_MGR_H_ +#define OUTDOOR_PVP_MGR_H_ + +#include "OutdoorPvP.h" +#include "Policies/Singleton.h" + +class Player; +class GameObject; +class Creature; +struct GossipOption; + +// class to handle player enter / leave / areatrigger / GO use events +class OutdoorPvPMgr +{ +public: + // ctor + OutdoorPvPMgr(); + // dtor + ~OutdoorPvPMgr(); + + // create outdoor pvp events + void InitOutdoorPvP(); + // called when a player enters an outdoor pvp area + void HandlePlayerEnterZone(Player * plr, uint32 areaflag); + // called when player leaves an outdoor pvp area + void HandlePlayerLeaveZone(Player * plr, uint32 areaflag); + // return assigned outdoor pvp + OutdoorPvP * GetOutdoorPvPToZoneId(uint32 zoneid); + // handle custom (non-exist in dbc) spell if registered + bool HandleCustomSpell(Player * plr, uint32 spellId, GameObject* go); + // handle custom go if registered + bool HandleOpenGo(Player * plr, uint64 guid); + + void AddZone(uint32 zoneid, OutdoorPvP * handle); + + void Update(uint32 diff); + + bool HandleCaptureCreaturePlayerMoveInLos(Player * plr, Creature * c); + + void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid); + + bool CanTalkTo(Player * player, Creature * creature, GossipOption & gso); + + void HandleDropFlag(Player * plr, uint32 spellId); + + typedef std::set<OutdoorPvP*> OutdoorPvPSet; + typedef std::map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap; +private: + // contains all initiated outdoor pvp events + // used when initing / cleaning up + OutdoorPvPSet m_OutdoorPvPSet; + // maps the zone ids to an outdoor pvp event + // used in player event handling + OutdoorPvPMap m_OutdoorPvPMap; +}; + +#define sOutdoorPvPMgr Trinity::Singleton<OutdoorPvPMgr>::Instance() + +#endif /*OUTDOOR_PVP_MGR_H_*/ diff --git a/src/game/OutdoorPvPNA.cpp b/src/game/OutdoorPvPNA.cpp new file mode 100644 index 00000000000..c56ef95e157 --- /dev/null +++ b/src/game/OutdoorPvPNA.cpp @@ -0,0 +1,706 @@ +#include "OutdoorPvPNA.h" +#include "Player.h" +#include "ObjectMgr.h" +#include "OutdoorPvPMgr.h" +#include "WorldPacket.h" +#include "Language.h" +#include "World.h" + +OutdoorPvPNA::OutdoorPvPNA() +{ + m_TypeId = OUTDOOR_PVP_NA; +} + +void OutdoorPvPNA::HandleKillImpl(Player *plr, Unit * killed) +{ + if(killed->GetTypeId() == TYPEID_PLAYER && plr->GetTeam() != ((Player*)killed)->GetTeam()) + { + plr->KilledMonster(NA_CREDIT_MARKER,0); // 0 guid, btw it isn't even used in killedmonster function :S + if(plr->GetTeam() == ALLIANCE) + plr->CastSpell(plr,NA_KILL_TOKEN_ALLIANCE,true); + else + plr->CastSpell(plr,NA_KILL_TOKEN_HORDE,true); + } +} + +uint32 OutdoorPvPObjectiveNA::GetAliveGuardsCount() +{ + uint32 cnt = 0; + for(std::map<uint32, uint64>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr) + { + switch(itr->first) + { + case NA_NPC_GUARD_01: + case NA_NPC_GUARD_02: + case NA_NPC_GUARD_03: + case NA_NPC_GUARD_04: + case NA_NPC_GUARD_05: + case NA_NPC_GUARD_06: + case NA_NPC_GUARD_07: + case NA_NPC_GUARD_08: + case NA_NPC_GUARD_09: + case NA_NPC_GUARD_10: + case NA_NPC_GUARD_11: + case NA_NPC_GUARD_12: + case NA_NPC_GUARD_13: + case NA_NPC_GUARD_14: + case NA_NPC_GUARD_15: + { + if(Creature * cr = HashMapHolder<Creature>::Find(itr->second)) + { + if(cr->isAlive()) + ++cnt; + } + else if (CreatureData const * cd = objmgr.GetCreatureData(GUID_LOPART(itr->second))) + { + if(!cd->is_dead) + ++cnt; + } + } + break; + default: + break; + } + } + return cnt; +} + +void OutdoorPvPNA::BuffTeam(uint32 team) +{ + if(team == ALLIANCE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,NA_CAPTURE_BUFF,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF); + } + } + else if(team == HORDE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,NA_CAPTURE_BUFF,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF); + } + } + else + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF); + } + } +} + +void OutdoorPvPObjectiveNA::SpawnNPCsForTeam(uint32 team) +{ + const creature_type * creatures = NULL; + if(team == ALLIANCE) + creatures=AllianceControlNPCs; + else if(team == HORDE) + creatures=HordeControlNPCs; + else + return; + for(int i = 0; i < NA_CONTROL_NPC_NUM; ++i) + AddCreature(i,creatures[i].entry,creatures[i].teamval,creatures[i].map,creatures[i].x,creatures[i].y,creatures[i].z,creatures[i].o,1000000); +} + +void OutdoorPvPObjectiveNA::DeSpawnNPCs() +{ + for(int i = 0; i < NA_CONTROL_NPC_NUM; ++i) + DelCreature(i); +} + +void OutdoorPvPObjectiveNA::SpawnGOsForTeam(uint32 team) +{ + const go_type * gos = NULL; + if(team == ALLIANCE) + gos=AllianceControlGOs; + else if(team == HORDE) + gos=HordeControlGOs; + else + return; + for(int i = 0; i < NA_CONTROL_GO_NUM; ++i) + { + if( i == NA_ROOST_S || + i == NA_ROOST_W || + i == NA_ROOST_N || + i == NA_ROOST_E || + i == NA_BOMB_WAGON_S || + i == NA_BOMB_WAGON_W || + i == NA_BOMB_WAGON_N || + i == NA_BOMB_WAGON_E ) + continue; // roosts and bomb wagons are spawned when someone uses the matching destroyed roost + AddObject(i,gos[i].entry,gos[i].map,gos[i].x,gos[i].y,gos[i].z,gos[i].o,gos[i].rot0,gos[i].rot1,gos[i].rot2,gos[i].rot3); + } +} + +void OutdoorPvPObjectiveNA::DeSpawnGOs() +{ + for(int i = 0; i < NA_CONTROL_GO_NUM; ++i) + { + DelObject(i); + } +} + +void OutdoorPvPObjectiveNA::FactionTakeOver(uint32 team) +{ + if(m_ControllingFaction) + objmgr.RemoveGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false); + if(m_ControllingFaction == ALLIANCE) + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_A)); + else if(m_ControllingFaction == HORDE) + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_H)); + + m_ControllingFaction = team; + if(m_ControllingFaction) + objmgr.AddGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false); + DeSpawnGOs(); + DeSpawnNPCs(); + SpawnGOsForTeam(team); + SpawnNPCsForTeam(team); + m_GuardsAlive = NA_GUARDS_MAX; + m_capturable = false; + this->UpdateHalaaWorldState(); + if(team == ALLIANCE) + { + m_WyvernStateSouth = WYVERN_NEU_HORDE; + m_WyvernStateNorth = WYVERN_NEU_HORDE; + m_WyvernStateEast = WYVERN_NEU_HORDE; + m_WyvernStateWest = WYVERN_NEU_HORDE; + m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 0); + m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 1); + m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive); + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A)); + } + else + { + m_WyvernStateSouth = WYVERN_NEU_ALLIANCE; + m_WyvernStateNorth = WYVERN_NEU_ALLIANCE; + m_WyvernStateEast = WYVERN_NEU_ALLIANCE; + m_WyvernStateWest = WYVERN_NEU_ALLIANCE; + m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 1); + m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 0); + m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive); + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H)); + } + this->UpdateWyvernRoostWorldState(NA_ROOST_S); + this->UpdateWyvernRoostWorldState(NA_ROOST_N); + this->UpdateWyvernRoostWorldState(NA_ROOST_W); + this->UpdateWyvernRoostWorldState(NA_ROOST_E); + ((OutdoorPvPNA*)m_PvP)->BuffTeam(team); +} + +bool OutdoorPvPObjectiveNA::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveNA::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +OutdoorPvPObjectiveNA::OutdoorPvPObjectiveNA(OutdoorPvP *pvp) : +OutdoorPvPObjective(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), +m_HalaaState(HALAA_N), m_WyvernStateSouth(0), m_WyvernStateNorth(0), m_WyvernStateWest(0), +m_WyvernStateEast(0), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME) +{ + AddCapturePoint(182210,530,-1572.57,7945.3,-22.475,2.05949,0,0,0.857167,0.515038); +} + +bool OutdoorPvPNA::SetupOutdoorPvP() +{ +// m_TypeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup + // add the zones affected by the pvp buff + sOutdoorPvPMgr.AddZone(NA_BUFF_ZONE,this); + + // halaa + m_obj = new OutdoorPvPObjectiveNA(this); + if(!m_obj) + return false; + m_OutdoorPvPObjectives.insert(m_obj); + + return true; +} + +void OutdoorPvPNA::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + // add buffs + if(plr->GetTeam() == m_obj->m_ControllingFaction) + plr->CastSpell(plr,NA_CAPTURE_BUFF,true); + OutdoorPvP::HandlePlayerEnterZone(plr,zone); +} + +void OutdoorPvPNA::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // remove buffs + plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF); + OutdoorPvP::HandlePlayerLeaveZone(plr, zone); +} + +void OutdoorPvPNA::FillInitialWorldStates(WorldPacket &data) +{ + m_obj->FillInitialWorldStates(data); +} + +void OutdoorPvPObjectiveNA::FillInitialWorldStates(WorldPacket &data) +{ + if(m_ControllingFaction == ALLIANCE) + { + data << NA_UI_HORDE_GUARDS_SHOW << uint32(0); + data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(1); + } + else if(m_ControllingFaction == HORDE) + { + data << NA_UI_HORDE_GUARDS_SHOW << uint32(1); + data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(0); + } + else + { + data << NA_UI_HORDE_GUARDS_SHOW << uint32(0); + data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(0); + } + + data << NA_UI_GUARDS_MAX << NA_GUARDS_MAX; + data << NA_UI_GUARDS_LEFT << uint32(m_GuardsAlive); + + data << NA_UI_TOWER_SLIDER_DISPLAY << uint32(0); + data << NA_UI_TOWER_SLIDER_POS << uint32(50); + data << NA_UI_TOWER_SLIDER_N << uint32(100); + + data << NA_MAP_WYVERN_NORTH_NEU_H << uint32(bool(m_WyvernStateNorth & WYVERN_NEU_HORDE)); + data << NA_MAP_WYVERN_NORTH_NEU_A << uint32(bool(m_WyvernStateNorth & WYVERN_NEU_ALLIANCE)); + data << NA_MAP_WYVERN_NORTH_H << uint32(bool(m_WyvernStateNorth & WYVERN_HORDE)); + data << NA_MAP_WYVERN_NORTH_A << uint32(bool(m_WyvernStateNorth & WYVERN_ALLIANCE)); + + data << NA_MAP_WYVERN_SOUTH_NEU_H << uint32(bool(m_WyvernStateSouth & WYVERN_NEU_HORDE)); + data << NA_MAP_WYVERN_SOUTH_NEU_A << uint32(bool(m_WyvernStateSouth & WYVERN_NEU_ALLIANCE)); + data << NA_MAP_WYVERN_SOUTH_H << uint32(bool(m_WyvernStateSouth & WYVERN_HORDE)); + data << NA_MAP_WYVERN_SOUTH_A << uint32(bool(m_WyvernStateSouth & WYVERN_ALLIANCE)); + + data << NA_MAP_WYVERN_WEST_NEU_H << uint32(bool(m_WyvernStateWest & WYVERN_NEU_HORDE)); + data << NA_MAP_WYVERN_WEST_NEU_A << uint32(bool(m_WyvernStateWest & WYVERN_NEU_ALLIANCE)); + data << NA_MAP_WYVERN_WEST_H << uint32(bool(m_WyvernStateWest & WYVERN_HORDE)); + data << NA_MAP_WYVERN_WEST_A << uint32(bool(m_WyvernStateWest & WYVERN_ALLIANCE)); + + data << NA_MAP_WYVERN_EAST_NEU_H << uint32(bool(m_WyvernStateEast & WYVERN_NEU_HORDE)); + data << NA_MAP_WYVERN_EAST_NEU_A << uint32(bool(m_WyvernStateEast & WYVERN_NEU_ALLIANCE)); + data << NA_MAP_WYVERN_EAST_H << uint32(bool(m_WyvernStateEast & WYVERN_HORDE)); + data << NA_MAP_WYVERN_EAST_A << uint32(bool(m_WyvernStateEast & WYVERN_ALLIANCE)); + + data << NA_MAP_HALAA_NEUTRAL << uint32(bool(m_HalaaState & HALAA_N)); + data << NA_MAP_HALAA_NEU_A << uint32(bool(m_HalaaState & HALAA_N_A)); + data << NA_MAP_HALAA_NEU_H << uint32(bool(m_HalaaState & HALAA_N_H)); + data << NA_MAP_HALAA_HORDE << uint32(bool(m_HalaaState & HALAA_H)); + data << NA_MAP_HALAA_ALLIANCE << uint32(bool(m_HalaaState & HALAA_A)); +} + +void OutdoorPvPNA::SendRemoveWorldStates(Player *plr) +{ + plr->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW,0); + plr->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW,0); + plr->SendUpdateWorldState(NA_UI_GUARDS_MAX,0); + plr->SendUpdateWorldState(NA_UI_GUARDS_LEFT,0); + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY,0); + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS,0); + plr->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_WEST_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_WEST_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_A,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_EAST_H,0); + plr->SendUpdateWorldState(NA_MAP_WYVERN_EAST_A,0); + plr->SendUpdateWorldState(NA_MAP_HALAA_NEUTRAL,0); + plr->SendUpdateWorldState(NA_MAP_HALAA_NEU_A,0); + plr->SendUpdateWorldState(NA_MAP_HALAA_NEU_H,0); + plr->SendUpdateWorldState(NA_MAP_HALAA_HORDE,0); + plr->SendUpdateWorldState(NA_MAP_HALAA_ALLIANCE,0); +} + +bool OutdoorPvPNA::Update(uint32 diff) +{ + return m_obj->Update(diff); +} + +bool OutdoorPvPObjectiveNA::HandleCustomSpell(Player * plr, uint32 spellId, GameObject * go) +{ + std::vector<uint32> nodes; + nodes.resize(2); + bool retval = false; + switch(spellId) + { + case NA_SPELL_FLY_NORTH: + nodes[0] = FlightPathStartNodes[NA_ROOST_N]; + nodes[1] = FlightPathEndNodes[NA_ROOST_N]; + plr->ActivateTaxiPathTo(nodes); + plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); + plr->UpdatePvP(true,true); + retval = true; + break; + case NA_SPELL_FLY_SOUTH: + nodes[0] = FlightPathStartNodes[NA_ROOST_S]; + nodes[1] = FlightPathEndNodes[NA_ROOST_S]; + plr->ActivateTaxiPathTo(nodes); + plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); + plr->UpdatePvP(true,true); + retval = true; + break; + case NA_SPELL_FLY_WEST: + nodes[0] = FlightPathStartNodes[NA_ROOST_W]; + nodes[1] = FlightPathEndNodes[NA_ROOST_W]; + plr->ActivateTaxiPathTo(nodes); + plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); + plr->UpdatePvP(true,true); + retval = true; + break; + case NA_SPELL_FLY_EAST: + nodes[0] = FlightPathStartNodes[NA_ROOST_E]; + nodes[1] = FlightPathEndNodes[NA_ROOST_E]; + plr->ActivateTaxiPathTo(nodes); + plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); + plr->UpdatePvP(true,true); + retval = true; + break; + default: + break; + } + + if(retval) + { + //Adding items + uint32 noSpaceForCount = 0; + + // check space and find places + ItemPosCountVec dest; + + int32 count = 10; + uint32 itemid = 24538; + // bomb id count + uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount ); + if( msg != EQUIP_ERR_OK ) // convert to possible store amount + count -= noSpaceForCount; + + if( count == 0 || dest.empty()) // can't add any + { + return true; + } + + Item* item = plr->StoreNewItem( dest, itemid, true); + + if(count > 0 && item) + { + plr->SendNewItem(item,count,true,false); + } + + return true; + } + return false; +} + +int32 OutdoorPvPObjectiveNA::HandleOpenGo(Player *plr, uint64 guid) +{ + uint32 retval = OutdoorPvPObjective::HandleOpenGo(plr, guid); + if(retval>=0) + { + const go_type * gos = NULL; + if(m_ControllingFaction == ALLIANCE) + gos=AllianceControlGOs; + else if(m_ControllingFaction == HORDE) + gos=HordeControlGOs; + else + return -1; + + int32 del = -1; + int32 del2 = -1; + int32 add = -1; + int32 add2 = -1; + + switch(retval) + { + case NA_DESTROYED_ROOST_S: + del = NA_DESTROYED_ROOST_S; + add = NA_ROOST_S; + add2 = NA_BOMB_WAGON_S; + if(m_ControllingFaction == HORDE) + m_WyvernStateSouth = WYVERN_ALLIANCE; + else + m_WyvernStateSouth = WYVERN_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_S); + break; + case NA_DESTROYED_ROOST_N: + del = NA_DESTROYED_ROOST_N; + add = NA_ROOST_N; + add2 = NA_BOMB_WAGON_N; + if(m_ControllingFaction == HORDE) + m_WyvernStateNorth = WYVERN_ALLIANCE; + else + m_WyvernStateNorth = WYVERN_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_N); + break; + case NA_DESTROYED_ROOST_W: + del = NA_DESTROYED_ROOST_W; + add = NA_ROOST_W; + add2 = NA_BOMB_WAGON_W; + if(m_ControllingFaction == HORDE) + m_WyvernStateWest = WYVERN_ALLIANCE; + else + m_WyvernStateWest = WYVERN_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_W); + break; + case NA_DESTROYED_ROOST_E: + del = NA_DESTROYED_ROOST_E; + add = NA_ROOST_E; + add2 = NA_BOMB_WAGON_E; + if(m_ControllingFaction == HORDE) + m_WyvernStateEast = WYVERN_ALLIANCE; + else + m_WyvernStateEast = WYVERN_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_E); + break; + case NA_BOMB_WAGON_S: + del = NA_BOMB_WAGON_S; + del2 = NA_ROOST_S; + add = NA_DESTROYED_ROOST_S; + if(m_ControllingFaction == HORDE) + m_WyvernStateSouth = WYVERN_NEU_ALLIANCE; + else + m_WyvernStateSouth = WYVERN_NEU_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_S); + break; + case NA_BOMB_WAGON_N: + del = NA_BOMB_WAGON_N; + del2 = NA_ROOST_N; + add = NA_DESTROYED_ROOST_N; + if(m_ControllingFaction == HORDE) + m_WyvernStateNorth = WYVERN_NEU_ALLIANCE; + else + m_WyvernStateNorth = WYVERN_NEU_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_N); + break; + case NA_BOMB_WAGON_W: + del = NA_BOMB_WAGON_W; + del2 = NA_ROOST_W; + add = NA_DESTROYED_ROOST_W; + if(m_ControllingFaction == HORDE) + m_WyvernStateWest = WYVERN_NEU_ALLIANCE; + else + m_WyvernStateWest = WYVERN_NEU_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_W); + break; + case NA_BOMB_WAGON_E: + del = NA_BOMB_WAGON_E; + del2 = NA_ROOST_E; + add = NA_DESTROYED_ROOST_E; + if(m_ControllingFaction == HORDE) + m_WyvernStateEast = WYVERN_NEU_ALLIANCE; + else + m_WyvernStateEast = WYVERN_NEU_HORDE; + UpdateWyvernRoostWorldState(NA_ROOST_E); + break; + default: + return -1; + break; + } + + if(del>-1) + DelObject(del); + + if(del2>-1) + DelObject(del2); + + if(add>-1) + AddObject(add,gos[add].entry,gos[add].map,gos[add].x,gos[add].y,gos[add].z,gos[add].o,gos[add].rot0,gos[add].rot1,gos[add].rot2,gos[add].rot3); + + if(add2>-1) + AddObject(add2,gos[add2].entry,gos[add2].map,gos[add2].x,gos[add2].y,gos[add2].z,gos[add2].o,gos[add2].rot0,gos[add2].rot1,gos[add2].rot2,gos[add2].rot3); + + return retval; + } + return -1; +} + +bool OutdoorPvPObjectiveNA::Update(uint32 diff) +{ + // let the controlling faction advance in phase + bool capturable = false; + if(m_ControllingFaction == ALLIANCE && m_AllianceActivePlayerCount > m_HordeActivePlayerCount) + capturable = true; + else if(m_ControllingFaction == HORDE && m_AllianceActivePlayerCount < m_HordeActivePlayerCount) + capturable = true; + + if(m_GuardCheckTimer < diff) + { + m_GuardCheckTimer = NA_GUARD_CHECK_TIME; + uint32 cnt = GetAliveGuardsCount(); + if(cnt != m_GuardsAlive) + { + m_GuardsAlive = cnt; + if(m_GuardsAlive == 0) + m_capturable = true; + // update the guard count for the players in zone + m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT,m_GuardsAlive); + } + } else m_GuardCheckTimer -= diff; + + if((m_capturable || capturable) && OutdoorPvPObjective::Update(diff)) + { + if(m_RespawnTimer < diff) + { + // if the guards have been killed, then the challenger has one hour to take over halaa. + // in case they fail to do it, the guards are respawned, and they have to start again. + if(m_ControllingFaction) + FactionTakeOver(m_ControllingFaction); + m_RespawnTimer = NA_RESPAWN_TIME; + } else m_RespawnTimer -= diff; + + if(m_OldState != m_State) + { + uint32 artkit = 21; + switch(m_State) + { + case OBJECTIVESTATE_NEUTRAL: + m_HalaaState = HALAA_N; + break; + case OBJECTIVESTATE_ALLIANCE: + m_HalaaState = HALAA_A; + FactionTakeOver(ALLIANCE); + artkit = 2; + break; + case OBJECTIVESTATE_HORDE: + m_HalaaState = HALAA_H; + FactionTakeOver(HORDE); + artkit = 1; + break; + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + m_HalaaState = HALAA_N_A; + break; + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + m_HalaaState = HALAA_N_H; + break; + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + m_HalaaState = HALAA_N_A; + artkit = 2; + break; + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_HalaaState = HALAA_N_H; + artkit = 1; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + + UpdateHalaaWorldState(); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase); + SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_NeutralValue); + } + return true; + } + return false; +} + +void OutdoorPvPObjectiveNA::UpdateHalaaWorldState() +{ + m_PvP->SendUpdateWorldState( NA_MAP_HALAA_NEUTRAL ,uint32(bool(m_HalaaState & HALAA_N))); + m_PvP->SendUpdateWorldState( NA_MAP_HALAA_NEU_A ,uint32(bool(m_HalaaState & HALAA_N_A))); + m_PvP->SendUpdateWorldState( NA_MAP_HALAA_NEU_H ,uint32(bool(m_HalaaState & HALAA_N_H))); + m_PvP->SendUpdateWorldState( NA_MAP_HALAA_HORDE ,uint32(bool(m_HalaaState & HALAA_H))); + m_PvP->SendUpdateWorldState( NA_MAP_HALAA_ALLIANCE ,uint32(bool(m_HalaaState & HALAA_A))); +} + +void OutdoorPvPObjectiveNA::UpdateWyvernRoostWorldState(uint32 roost) +{ + switch(roost) + { + case NA_ROOST_S: + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_H,uint32(bool(m_WyvernStateSouth & WYVERN_NEU_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_NEU_A,uint32(bool(m_WyvernStateSouth & WYVERN_NEU_ALLIANCE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_H,uint32(bool(m_WyvernStateSouth & WYVERN_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_SOUTH_A,uint32(bool(m_WyvernStateSouth & WYVERN_ALLIANCE))); + break; + case NA_ROOST_N: + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_H,uint32(bool(m_WyvernStateNorth & WYVERN_NEU_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_A,uint32(bool(m_WyvernStateNorth & WYVERN_NEU_ALLIANCE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_H,uint32(bool(m_WyvernStateNorth & WYVERN_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_A,uint32(bool(m_WyvernStateNorth & WYVERN_ALLIANCE))); + break; + case NA_ROOST_W: + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_H,uint32(bool(m_WyvernStateWest & WYVERN_NEU_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_NEU_A,uint32(bool(m_WyvernStateWest & WYVERN_NEU_ALLIANCE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_H,uint32(bool(m_WyvernStateWest & WYVERN_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_WEST_A,uint32(bool(m_WyvernStateWest & WYVERN_ALLIANCE))); + break; + case NA_ROOST_E: + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_H,uint32(bool(m_WyvernStateEast & WYVERN_NEU_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_NEU_A,uint32(bool(m_WyvernStateEast & WYVERN_NEU_ALLIANCE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_H,uint32(bool(m_WyvernStateEast & WYVERN_HORDE))); + m_PvP->SendUpdateWorldState(NA_MAP_WYVERN_EAST_A,uint32(bool(m_WyvernStateEast & WYVERN_ALLIANCE))); + break; + } +} + +bool OutdoorPvPObjectiveNA::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + switch(eventId) + { + case 11821: + this->HandlePlayerEnter(plr); + return true; + break; + case 11822: + this->HandlePlayerLeave(plr); + return true; + break; + default: + break; + } + return false; +} diff --git a/src/game/OutdoorPvPNA.h b/src/game/OutdoorPvPNA.h new file mode 100644 index 00000000000..65a70bbd1db --- /dev/null +++ b/src/game/OutdoorPvPNA.h @@ -0,0 +1,279 @@ +#ifndef OUTDOOR_PVP_NA_ +#define OUTDOOR_PVP_NA_ + +// TODO: "sometimes" set to neutral + +#include "OutdoorPvP.h" + +// kill credit for pks +const uint32 NA_CREDIT_MARKER = 24867; + +const uint32 NA_KILL_TOKEN_ALLIANCE = 33005; +const uint32 NA_KILL_TOKEN_HORDE = 33004; + +const uint32 NA_CAPTURE_BUFF = 33795; // strength of the halaani + +const uint32 NA_GUARDS_MAX = 15; + +const uint32 NA_BUFF_ZONE = 3518; + +const uint32 NA_HALAA_GRAVEYARD = 993; + +const uint32 NA_HALAA_GRAVEYARD_ZONE = 3518; // need to add zone id, not area id + +const uint32 NA_RESPAWN_TIME = 3600000; // one hour to capture after defeating all guards + +const uint32 NA_GUARD_CHECK_TIME = 500; // every half second + +enum OutdoorPvPNAWorldStates{ + NA_UI_HORDE_GUARDS_SHOW = 2503, + NA_UI_ALLIANCE_GUARDS_SHOW = 2502, + NA_UI_GUARDS_MAX = 2493, + NA_UI_GUARDS_LEFT = 2491, + + NA_UI_TOWER_SLIDER_DISPLAY = 2495, + NA_UI_TOWER_SLIDER_POS = 2494, + NA_UI_TOWER_SLIDER_N = 2497, + + NA_MAP_WYVERN_NORTH_NEU_H = 2762, + NA_MAP_WYVERN_NORTH_NEU_A = 2662, + NA_MAP_WYVERN_NORTH_H = 2663, + NA_MAP_WYVERN_NORTH_A = 2664, + + NA_MAP_WYVERN_SOUTH_NEU_H = 2760, + NA_MAP_WYVERN_SOUTH_NEU_A = 2670, + NA_MAP_WYVERN_SOUTH_H = 2668, + NA_MAP_WYVERN_SOUTH_A = 2669, + + NA_MAP_WYVERN_WEST_NEU_H = 2761, + NA_MAP_WYVERN_WEST_NEU_A = 2667, + NA_MAP_WYVERN_WEST_H = 2665, + NA_MAP_WYVERN_WEST_A = 2666, + + NA_MAP_WYVERN_EAST_NEU_H = 2763, + NA_MAP_WYVERN_EAST_NEU_A = 2659, + NA_MAP_WYVERN_EAST_H = 2660, + NA_MAP_WYVERN_EAST_A = 2661, + + NA_MAP_HALAA_NEUTRAL = 2671, + NA_MAP_HALAA_NEU_A = 2676, + NA_MAP_HALAA_NEU_H = 2677, + NA_MAP_HALAA_HORDE = 2672, + NA_MAP_HALAA_ALLIANCE = 2673 +}; + +const uint32 FLIGHT_NODES_NUM = 4; + +// used to access the elements of Horde/AllyControlGOs +enum ControlGOTypes{ + NA_ROOST_S = 0, + NA_ROOST_W = 1, + NA_ROOST_N = 2, + NA_ROOST_E = 3, + + NA_BOMB_WAGON_S = 4, + NA_BOMB_WAGON_W = 5, + NA_BOMB_WAGON_N = 6, + NA_BOMB_WAGON_E = 7, + + NA_DESTROYED_ROOST_S = 8, + NA_DESTROYED_ROOST_W = 9, + NA_DESTROYED_ROOST_N = 10, + NA_DESTROYED_ROOST_E = 11, + + NA_CONTROL_GO_NUM = 12 +}; + +const uint32 FlightPathStartNodes[FLIGHT_NODES_NUM] = {103,105,107,109}; +const uint32 FlightPathEndNodes[FLIGHT_NODES_NUM] = {104,106,108,110}; + +enum FlightSpellsNA{ + NA_SPELL_FLY_SOUTH = 32059, + NA_SPELL_FLY_WEST = 32068, + NA_SPELL_FLY_NORTH = 32075, + NA_SPELL_FLY_EAST = 32081 +}; + +// spawned when the alliance is attacking, horde is in control +const go_type HordeControlGOs[NA_CONTROL_GO_NUM] = { + {182267,530,-1815.8,8036.51,-26.2354,-2.89725,0,0,0.992546,-0.121869}, //ALLY_ROOST_SOUTH + {182280,530,-1507.95,8132.1,-19.5585,-1.3439,0,0,0.622515,-0.782608}, //ALLY_ROOST_WEST + {182281,530,-1384.52,7779.33,-11.1663,-0.575959,0,0,0.284015,-0.95882}, //ALLY_ROOST_NORTH + {182282,530,-1650.11,7732.56,-15.4505,-2.80998,0,0,0.986286,-0.165048}, //ALLY_ROOST_EAST + + {182222,530,-1825.4022,8039.2602,-26.08,-2.89725,0,0,0.992546,-0.121869}, //HORDE_BOMB_WAGON_SOUTH + {182272,530,-1515.37,8136.91,-20.42,-1.3439,0,0,0.622515,-0.782608}, //HORDE_BOMB_WAGON_WEST + {182273,530,-1377.95,7773.44,-10.31,-0.575959,0,0,0.284015,-0.95882}, //HORDE_BOMB_WAGON_NORTH + {182274,530,-1659.87,7733.15,-15.75,-2.80998,0,0,0.986286,-0.165048}, //HORDE_BOMB_WAGON_EAST + + {182266,530,-1815.8,8036.51,-26.2354,-2.89725,0,0,0.992546,-0.121869}, //DESTROYED_ALLY_ROOST_SOUTH + {182275,530,-1507.95,8132.1,-19.5585,-1.3439,0,0,0.622515,-0.782608}, //DESTROYED_ALLY_ROOST_WEST + {182276,530,-1384.52,7779.33,-11.1663,-0.575959,0,0,0.284015,-0.95882}, //DESTROYED_ALLY_ROOST_NORTH + {182277,530,-1650.11,7732.56,-15.4505,-2.80998,0,0,0.986286,-0.165048} //DESTROYED_ALLY_ROOST_EAST +}; + +// spawned when the horde is attacking, alliance is in control +const go_type AllianceControlGOs[NA_CONTROL_GO_NUM] = { + {182301,530,-1815.8,8036.51,-26.2354,-2.89725,0,0,0.992546,-0.121869}, //HORDE_ROOST_SOUTH + {182302,530,-1507.95,8132.1,-19.5585,-1.3439,0,0,0.622515,-0.782608}, //HORDE_ROOST_WEST + {182303,530,-1384.52,7779.33,-11.1663,-0.575959,0,0,0.284015,-0.95882}, //HORDE_ROOST_NORTH + {182304,530,-1650.11,7732.56,-15.4505,-2.80998,0,0,0.986286,-0.165048}, //HORDE_ROOST_EAST + + {182305,530,-1825.4022,8039.2602,-26.08,-2.89725,0,0,0.992546,-0.121869}, //ALLY_BOMB_WAGON_SOUTH + {182306,530,-1515.37,8136.91,-20.42,-1.3439,0,0,0.622515,-0.782608}, //ALLY_BOMB_WAGON_WEST + {182307,530,-1377.95,7773.44,-10.31,-0.575959,0,0,0.284015,-0.95882}, //ALLY_BOMB_WAGON_NORTH + {182308,530,-1659.87,7733.15,-15.75,-2.80998,0,0,0.986286,-0.165048}, //ALLY_BOMB_WAGON_EAST + + {182297,530,-1815.8,8036.51,-26.2354,-2.89725,0,0,0.992546,-0.121869}, //DESTROYED_HORDE_ROOST_SOUTH + {182298,530,-1507.95,8132.1,-19.5585,-1.3439,0,0,0.622515,-0.782608}, //DESTROYED_HORDE_ROOST_WEST + {182299,530,-1384.52,7779.33,-11.1663,-0.575959,0,0,0.284015,-0.95882}, //DESTROYED_HORDE_ROOST_NORTH + {182300,530,-1650.11,7732.56,-15.4505,-2.80998,0,0,0.986286,-0.165048} //DESTROYED_HORDE_ROOST_EAST +}; + +enum ControlNPCTypes{ + NA_NPC_RESEARCHER = 0, + NA_NPC_QUARTERMASTER, + NA_NPC_BLADE_MERCHANT, + NA_NPC_FOOD_MERCHANT, + NA_NPC_AMMO, + + NA_NPC_GUARD_01, + NA_NPC_GUARD_02, + NA_NPC_GUARD_03, + NA_NPC_GUARD_04, + NA_NPC_GUARD_05, + NA_NPC_GUARD_06, + NA_NPC_GUARD_07, + NA_NPC_GUARD_08, + NA_NPC_GUARD_09, + NA_NPC_GUARD_10, + NA_NPC_GUARD_11, + NA_NPC_GUARD_12, + NA_NPC_GUARD_13, + NA_NPC_GUARD_14, + NA_NPC_GUARD_15, + + NA_CONTROL_NPC_NUM +}; + +const creature_type HordeControlNPCs[NA_CONTROL_NPC_NUM] = { + {18816,67,530,-1523.92,7951.76,-17.6942,3.51172}, + {18821,67,530,-1527.75,7952.46,-17.6948,3.99317}, + {21474,67,530,-1520.14,7927.11,-20.2527,3.39389}, + {21484,67,530,-1524.84,7930.34,-20.182,3.6405}, + {21483,67,530,-1570.01,7993.8,-22.4505,5.02655}, + {18192,67,530,-1654.06,8000.46,-26.59,3.37}, + {18192,67,530,-1487.18,7899.1,-19.53,0.954}, + {18192,67,530,-1480.88,7908.79,-19.19,4.485}, + {18192,67,530,-1540.56,7995.44,-20.45,0.947}, + {18192,67,530,-1546.95,8000.85,-20.72,6.035}, + {18192,67,530,-1595.31,7860.53,-21.51,3.747}, + {18192,67,530,-1642.31,7995.59,-25.8,3.317}, + {18192,67,530,-1545.46,7995.35,-20.63,1.094}, + {18192,67,530,-1487.58,7907.99,-19.27,5.567}, + {18192,67,530,-1651.54,7988.56,-26.5289,2.98451}, + {18192,67,530,-1602.46,7866.43,-22.1177,4.74729}, + {18192,67,530,-1591.22,7875.29,-22.3536,4.34587}, + {18192,67,530,-1550.6,7944.45,-21.63,3.559}, + {18192,67,530,-1545.57,7935.83,-21.13,3.448}, + {18192,67,530,-1550.86,7937.56,-21.7,3.801} +}; + +const creature_type AllianceControlNPCs[NA_CONTROL_NPC_NUM] = { + {18817,469,530,-1591.18,8020.39,-22.2042,4.59022}, + {18822,469,530,-1588.0,8019.0,-22.2042,4.06662}, + {21485,469,530,-1521.93,7927.37,-20.2299,3.24631}, + {21487,469,530,-1540.33,7971.95,-20.7186,3.07178}, + {21488,469,530,-1570.01,7993.8,-22.4505,5.02655}, + {18256,469,530,-1654.06,8000.46,-26.59,3.37}, + {18256,469,530,-1487.18,7899.1,-19.53,0.954}, + {18256,469,530,-1480.88,7908.79,-19.19,4.485}, + {18256,469,530,-1540.56,7995.44,-20.45,0.947}, + {18256,469,530,-1546.95,8000.85,-20.72,6.035}, + {18256,469,530,-1595.31,7860.53,-21.51,3.747}, + {18256,469,530,-1642.31,7995.59,-25.8,3.317}, + {18256,469,530,-1545.46,7995.35,-20.63,1.094}, + {18256,469,530,-1487.58,7907.99,-19.27,5.567}, + {18256,469,530,-1651.54,7988.56,-26.5289,2.98451}, + {18256,469,530,-1602.46,7866.43,-22.1177,4.74729}, + {18256,469,530,-1591.22,7875.29,-22.3536,4.34587}, + {18256,469,530,-1603.75,8000.36,-24.18,4.516}, + {18256,469,530,-1585.73,7994.68,-23.29,4.439}, + {18256,469,530,-1595.5,7991.27,-23.53,4.738} +}; + +enum WyvernStates{ + WYVERN_NEU_HORDE = 1, + WYVERN_NEU_ALLIANCE = 2, + WYVERN_HORDE = 4, + WYVERN_ALLIANCE = 8 +}; + +enum HalaaStates{ + HALAA_N = 1, + HALAA_N_A = 2, + HALAA_A = 4, + HALAA_N_H = 8, + HALAA_H = 16 +}; + +class Unit; +class Creature; +class OutdoorPvPNA; +class OutdoorPvPObjectiveNA : public OutdoorPvPObjective +{ +friend class OutdoorPvPNA; +public: + OutdoorPvPObjectiveNA(OutdoorPvP * pvp); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); + bool HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go); + int32 HandleOpenGo(Player *plr, uint64 guid); + uint32 GetAliveGuardsCount(); +protected: + // called when a faction takes control + void FactionTakeOver(uint32 team); + + void DeSpawnNPCs(); + void DeSpawnGOs(); + void SpawnNPCsForTeam(uint32 team); + void SpawnGOsForTeam(uint32 team); + + void UpdateWyvernRoostWorldState(uint32 roost); + void UpdateHalaaWorldState(); + + bool HandleCapturePointEvent(Player * plr, uint32 eventId); +private: + bool m_capturable; + uint32 m_GuardsAlive; + uint32 m_ControllingFaction; + uint32 m_WyvernStateNorth; + uint32 m_WyvernStateSouth; + uint32 m_WyvernStateEast; + uint32 m_WyvernStateWest; + uint32 m_HalaaState; + uint32 m_RespawnTimer; + uint32 m_GuardCheckTimer; +}; + +class OutdoorPvPNA : public OutdoorPvP +{ +friend class OutdoorPvPObjectiveNA; +public: + OutdoorPvPNA(); + bool SetupOutdoorPvP(); + void HandlePlayerEnterZone(Player *plr, uint32 zone); + void HandlePlayerLeaveZone(Player *plr, uint32 zone); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket &data); + void SendRemoveWorldStates(Player * plr); + void HandleKillImpl(Player * plr, Unit * killed); + void BuffTeam(uint32 team); +private: + OutdoorPvPObjectiveNA * m_obj; +}; + +#endif diff --git a/src/game/OutdoorPvPObjectiveAI.cpp b/src/game/OutdoorPvPObjectiveAI.cpp new file mode 100644 index 00000000000..51e53d964cf --- /dev/null +++ b/src/game/OutdoorPvPObjectiveAI.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 + */ + +#include "OutdoorPvPObjectiveAI.h" +#include "Creature.h" +#include "Player.h" +#include "Unit.h" +#include "OutdoorPvPMgr.h" +#include "World.h" + +#define MAX_OUTDOOR_PVP_DISTANCE 200 // the max value in capture point type go data0 is 100 currently, so use twice that much to handle leaving as well + +OutdoorPvPObjectiveAI::OutdoorPvPObjectiveAI(Creature &c) : i_creature(c) +{ + sLog.outDebug("OutdoorPvP objective AI assigned to creature guid %u", c.GetGUIDLow()); +} + +void OutdoorPvPObjectiveAI::MoveInLineOfSight(Unit *u) +{ + // IsVisible only passes for players in range, so no need to check again + // leaving/entering distance will be checked based on go range data + sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature); +} + +int OutdoorPvPObjectiveAI::Permissible(const Creature * c) +{ + // only assigned through AI name, never by permissibility check + return PERMIT_BASE_NO; +} + +bool OutdoorPvPObjectiveAI::IsVisible(Unit *pl) const +{ + return (pl->GetTypeId() == TYPEID_PLAYER) && (i_creature.GetDistance(pl) < MAX_OUTDOOR_PVP_DISTANCE); +} + +void OutdoorPvPObjectiveAI::AttackStart(Unit *) +{ + EnterEvadeMode(); +} + +void OutdoorPvPObjectiveAI::EnterEvadeMode() +{ + i_creature.DeleteThreatList(); + i_creature.CombatStop(); +} + +void OutdoorPvPObjectiveAI::UpdateAI(const uint32 diff) +{ +} diff --git a/src/game/OutdoorPvPObjectiveAI.h b/src/game/OutdoorPvPObjectiveAI.h new file mode 100644 index 00000000000..48e1fd241e0 --- /dev/null +++ b/src/game/OutdoorPvPObjectiveAI.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 TRINITY_OUTDOORPVPOBJECTIVEAI_H +#define TRINITY_OUTDOORPVPOBJECTIVEAI_H + +#include "CreatureAI.h" + +class Creature; + +class TRINITY_DLL_DECL OutdoorPvPObjectiveAI : public CreatureAI +{ + public: + + OutdoorPvPObjectiveAI(Creature &c); + + void MoveInLineOfSight(Unit *); + bool IsVisible(Unit *) const; + void AttackStart(Unit *); + void EnterEvadeMode(); + void UpdateAI(const uint32 diff); + + static int Permissible(const Creature *); + + private: + Creature &i_creature; +}; +#endif diff --git a/src/game/OutdoorPvPSI.cpp b/src/game/OutdoorPvPSI.cpp new file mode 100644 index 00000000000..464ba11e1df --- /dev/null +++ b/src/game/OutdoorPvPSI.cpp @@ -0,0 +1,244 @@ +#include "OutdoorPvPSI.h" +#include "WorldPacket.h" +#include "Player.h" +#include "GameObject.h" +#include "MapManager.h" +#include "ObjectMgr.h" +#include "OutdoorPvPMgr.h" +#include "Language.h" +#include "World.h" + +OutdoorPvPSI::OutdoorPvPSI() +{ + m_TypeId = OUTDOOR_PVP_SI; + m_Gathered_A = 0; + m_Gathered_H = 0; + m_LastController = 0; +} + +void OutdoorPvPSI::FillInitialWorldStates(WorldPacket &data) +{ + data << SI_GATHERED_A << m_Gathered_A; + data << SI_GATHERED_H << m_Gathered_H; + data << SI_SILITHYST_MAX << SI_MAX_RESOURCES; +} + +void OutdoorPvPSI::SendRemoveWorldStates(Player *plr) +{ + plr->SendUpdateWorldState(SI_GATHERED_A,0); + plr->SendUpdateWorldState(SI_GATHERED_H,0); + plr->SendUpdateWorldState(SI_SILITHYST_MAX,0); +} + +void OutdoorPvPSI::UpdateWorldState() +{ + SendUpdateWorldState(SI_GATHERED_A,m_Gathered_A); + SendUpdateWorldState(SI_GATHERED_H,m_Gathered_H); + SendUpdateWorldState(SI_SILITHYST_MAX,SI_MAX_RESOURCES); +} + +bool OutdoorPvPSI::SetupOutdoorPvP() +{ + for(int i = 0; i < OutdoorPvPSIBuffZonesNum; ++i) + sOutdoorPvPMgr.AddZone(OutdoorPvPSIBuffZones[i],this); + return true; +} + +bool OutdoorPvPSI::Update(uint32 diff) +{ + return false; +} + +void OutdoorPvPSI::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + if(plr->GetTeam() == m_LastController) + plr->CastSpell(plr,SI_CENARION_FAVOR,true); + OutdoorPvP::HandlePlayerEnterZone(plr,zone); +} + +void OutdoorPvPSI::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // remove buffs + plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR); + OutdoorPvP::HandlePlayerLeaveZone(plr, zone); +} + +void OutdoorPvPSI::BuffTeam(uint32 team) +{ + if(team == ALLIANCE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,SI_CENARION_FAVOR,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR); + } + } + else if(team == HORDE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,SI_CENARION_FAVOR,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR); + } + } + else + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR); + } + } +} + +bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger) +{ + switch(trigger) + { + case SI_AREATRIGGER_A: + if(plr->GetTeam() == ALLIANCE && plr->HasAura(SI_SILITHYST_FLAG,0)) + { + // remove aura + plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG); + ++ m_Gathered_A; + if(m_Gathered_A >= SI_MAX_RESOURCES) + { + BuffTeam(ALLIANCE); + sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A)); + m_LastController = ALLIANCE; + m_Gathered_A = 0; + m_Gathered_H = 0; + } + UpdateWorldState(); + // reward player + plr->CastSpell(plr,SI_TRACES_OF_SILITHYST,true); + // add 19 honor + plr->RewardHonor(NULL,1,19); + // add 20 cenarion circle repu + plr->ModifyFactionReputation(609,20); + // complete quest + plr->KilledMonster(SI_TURNIN_QUEST_CM_A,0); + } + return true; + case SI_AREATRIGGER_H: + if(plr->GetTeam() == HORDE && plr->HasAura(SI_SILITHYST_FLAG,0)) + { + // remove aura + plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG); + ++ m_Gathered_H; + if(m_Gathered_H >= SI_MAX_RESOURCES) + { + BuffTeam(HORDE); + sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H)); + m_LastController = HORDE; + m_Gathered_A = 0; + m_Gathered_H = 0; + } + UpdateWorldState(); + // reward player + plr->CastSpell(plr,SI_TRACES_OF_SILITHYST,true); + // add 19 honor + plr->RewardHonor(NULL,1,19); + // add 20 cenarion circle repu + plr->ModifyFactionReputation(609,20); + // complete quest + plr->KilledMonster(SI_TURNIN_QUEST_CM_H,0); + } + return true; + } + return false; +} + +bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId) +{ + if(spellId == SI_SILITHYST_FLAG) + { + // if it was dropped away from the player's turn-in point, then create a silithyst mound, if it was dropped near the areatrigger, then it was dispelled by the outdoorpvp, so do nothing + switch(plr->GetTeam()) + { + case ALLIANCE: + { + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_A); + if(atEntry) + { + // 5.0f is safe-distance + if(plr->GetDistance(atEntry->x,atEntry->y,atEntry->z) > 5.0f + atEntry->radius) + { + // he dropped it further, summon mound + GameObject * go = new GameObject; + Map * map = MapManager::Instance().GetMap(plr->GetMapId(), plr); + if(!map) + return true; + if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map,plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,1)) + { + delete go; + } + else + { + go->SetRespawnTime(0); + map->Add(go); + } + } + } + } + break; + case HORDE: + { + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_H); + if(atEntry) + { + // 5.0f is safe-distance + if(plr->GetDistance(atEntry->x,atEntry->y,atEntry->z) > 5.0f + atEntry->radius) + { + // he dropped it further, summon mound + GameObject * go = new GameObject; + Map * map = MapManager::Instance().GetMap(plr->GetMapId(), plr); + if(!map) + return true; + if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map ,plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,1)) + { + delete go; + } + else + { + go->SetRespawnTime(0); + map->Add(go); + } + } + } + } + break; + } + return true; + } + return false; +} + +bool OutdoorPvPSI::HandleCustomSpell(Player *plr, uint32 spellId, GameObject *go) +{ + if(!go || spellId != SI_SILITHYST_FLAG_GO_SPELL) + return false; + plr->CastSpell(plr,SI_SILITHYST_FLAG,true); + if(go->GetGOInfo()->id == SI_SILITHYST_MOUND) + { + // despawn go + go->SetRespawnTime(0); + go->Delete(); + } + return true; +} diff --git a/src/game/OutdoorPvPSI.h b/src/game/OutdoorPvPSI.h new file mode 100644 index 00000000000..9ee8c8a63b3 --- /dev/null +++ b/src/game/OutdoorPvPSI.h @@ -0,0 +1,57 @@ +#ifndef OUTDOOR_PVP_SI_ +#define OUTDOOR_PVP_SI_ + +#include "OutdoorPvP.h" + +const uint32 SI_SILITHYST_FLAG_GO_SPELL = 29518; + +const uint32 SI_SILITHYST_FLAG = 29519; + +const uint32 SI_TRACES_OF_SILITHYST = 29534; + +const uint32 SI_CENARION_FAVOR = 30754; + +const uint32 SI_MAX_RESOURCES = 200; + +const uint32 OutdoorPvPSIBuffZonesNum = 3; + +const uint32 OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum] = { 1377, 3428, 3429 }; + +const uint32 SI_AREATRIGGER_H = 4168; + +const uint32 SI_AREATRIGGER_A = 4162; + +const uint32 SI_TURNIN_QUEST_CM_A = 17090; + +const uint32 SI_TURNIN_QUEST_CM_H = 18199; + +const uint32 SI_SILITHYST_MOUND = 181597; + +enum SI_WorldStates{ + SI_GATHERED_A = 2313, + SI_GATHERED_H = 2314, + SI_SILITHYST_MAX = 2317 +}; + +class OutdoorPvPSI : public OutdoorPvP +{ +public: + OutdoorPvPSI(); + bool SetupOutdoorPvP(); + void HandlePlayerEnterZone(Player *plr, uint32 zone); + void HandlePlayerLeaveZone(Player *plr, uint32 zone); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket &data); + void SendRemoveWorldStates(Player * plr); + bool HandleAreaTrigger(Player * plr, uint32 trigger); + bool HandleDropFlag(Player * plr, uint32 spellId); + bool HandleCustomSpell(Player * plr, uint32 spellId, GameObject *go); + void BuffTeam(uint32 team); + void UpdateWorldState(); +private: + uint32 m_Gathered_A; + uint32 m_Gathered_H; + uint32 m_LastController; +}; + +#endif diff --git a/src/game/OutdoorPvPTF.cpp b/src/game/OutdoorPvPTF.cpp new file mode 100644 index 00000000000..7fff6fbdd4f --- /dev/null +++ b/src/game/OutdoorPvPTF.cpp @@ -0,0 +1,348 @@ +#include "OutdoorPvPTF.h" +#include "OutdoorPvPMgr.h" +#include "WorldPacket.h" +#include "Player.h" +#include "ObjectMgr.h" +#include "Language.h" +#include "World.h" + +OutdoorPvPTF::OutdoorPvPTF() +{ + m_TypeId = OUTDOOR_PVP_TF; +} + +OutdoorPvPObjectiveTF::OutdoorPvPObjectiveTF(OutdoorPvP *pvp, OutdoorPvPTF_TowerType type) +: OutdoorPvPObjective(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N) +{ + AddCapturePoint(TFCapturePoints[type].entry,TFCapturePoints[type].map,TFCapturePoints[type].x,TFCapturePoints[type].y,TFCapturePoints[type].z,TFCapturePoints[type].o,TFCapturePoints[type].rot0,TFCapturePoints[type].rot1,TFCapturePoints[type].rot2,TFCapturePoints[type].rot3); +} + +void OutdoorPvPObjectiveTF::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(TFTowerWorldStates[m_TowerType].n) << uint32(bool(m_TowerState & TF_TOWERSTATE_N)); + data << uint32(TFTowerWorldStates[m_TowerType].h) << uint32(bool(m_TowerState & TF_TOWERSTATE_H)); + data << uint32(TFTowerWorldStates[m_TowerType].a) << uint32(bool(m_TowerState & TF_TOWERSTATE_A)); +} + +void OutdoorPvPTF::FillInitialWorldStates(WorldPacket &data) +{ + data << TF_UI_TOWER_SLIDER_POS << uint32(50); + data << TF_UI_TOWER_SLIDER_N << uint32(100); + data << TF_UI_TOWER_SLIDER_DISPLAY << uint32(0); + + data << TF_UI_TOWER_COUNT_H << m_HordeTowersControlled; + data << TF_UI_TOWER_COUNT_A << m_AllianceTowersControlled; + data << TF_UI_TOWERS_CONTROLLED_DISPLAY << uint32(!m_IsLocked); + + data << TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT << first_digit; + data << TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT << second_digit; + data << TF_UI_LOCKED_TIME_HOURS << hours_left; + + data << TF_UI_LOCKED_DISPLAY_NEUTRAL << uint32(m_IsLocked && !m_HordeTowersControlled && !m_AllianceTowersControlled); + data << TF_UI_LOCKED_DISPLAY_HORDE << uint32(m_IsLocked && (m_HordeTowersControlled > m_AllianceTowersControlled)); + data << TF_UI_LOCKED_DISPLAY_ALLIANCE << uint32(m_IsLocked && (m_HordeTowersControlled < m_AllianceTowersControlled)); + + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + (*itr)->FillInitialWorldStates(data); + } +} + +void OutdoorPvPTF::SendRemoveWorldStates(Player * plr) +{ + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS,uint32(0)); + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N,uint32(0)); + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY,uint32(0)); + + plr->SendUpdateWorldState(TF_UI_TOWER_COUNT_H,uint32(0)); + plr->SendUpdateWorldState(TF_UI_TOWER_COUNT_A,uint32(0)); + plr->SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY,uint32(0)); + + plr->SendUpdateWorldState(TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT,uint32(0)); + plr->SendUpdateWorldState(TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT,uint32(0)); + plr->SendUpdateWorldState(TF_UI_LOCKED_TIME_HOURS,uint32(0)); + + plr->SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL,uint32(0)); + plr->SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE,uint32(0)); + plr->SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE,uint32(0)); + + for(int i = 0; i < TF_TOWER_NUM; ++i) + { + plr->SendUpdateWorldState(uint32(TFTowerWorldStates[i].n),uint32(0)); + plr->SendUpdateWorldState(uint32(TFTowerWorldStates[i].h),uint32(0)); + plr->SendUpdateWorldState(uint32(TFTowerWorldStates[i].a),uint32(0)); + } +} + +void OutdoorPvPObjectiveTF::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].n),uint32(bool(m_TowerState & TF_TOWERSTATE_N))); + m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].h),uint32(bool(m_TowerState & TF_TOWERSTATE_H))); + m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].a),uint32(bool(m_TowerState & TF_TOWERSTATE_A))); +} + +bool OutdoorPvPObjectiveTF::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveTF::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +bool OutdoorPvPObjectiveTF::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == TFTowerPlayerEnterEvents[m_TowerType]) + { + this->HandlePlayerEnter(plr); + return true; + } + else if (eventId == TFTowerPlayerLeaveEvents[m_TowerType]) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} + +void OutdoorPvPTF::BuffTeam(uint32 team) +{ + if(team == ALLIANCE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,TF_CAPTURE_BUFF,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF); + } + } + else if(team == HORDE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,TF_CAPTURE_BUFF,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF); + } + } + else + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF); + } + } +} + +bool OutdoorPvPTF::Update(uint32 diff) +{ + bool changed = false; + + if(changed = OutdoorPvP::Update(diff)) + { + if(m_AllianceTowersControlled == TF_TOWER_NUM) + { + BuffTeam(ALLIANCE); + m_IsLocked = true; + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL,uint32(0)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE,uint32(0)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE,uint32(1)); + SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0)); + } + else if(m_HordeTowersControlled == TF_TOWER_NUM) + { + BuffTeam(HORDE); + m_IsLocked = true; + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL,uint32(0)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE,uint32(1)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE,uint32(0)); + SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0)); + } + else + BuffTeam(NULL); + SendUpdateWorldState(TF_UI_TOWER_COUNT_A, m_AllianceTowersControlled); + SendUpdateWorldState(TF_UI_TOWER_COUNT_H, m_HordeTowersControlled); + } + if(m_IsLocked) + { + // lock timer is down, release lock + if(m_LockTimer < diff) + { + m_LockTimer = TF_LOCK_TIME; + m_LockTimerUpdate = 0; + m_IsLocked = false; + SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(1)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL,uint32(0)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE,uint32(0)); + SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_ALLIANCE,uint32(0)); + } + else + { + // worldstateui update timer is down, update ui with new time data + if(m_LockTimerUpdate < diff) + { + m_LockTimerUpdate = TF_LOCK_TIME_UPDATE; + uint32 minutes_left = m_LockTimer / 60000; + hours_left = minutes_left / 60; + minutes_left -= hours_left * 60; + second_digit = minutes_left % 10; + first_digit = minutes_left / 10; + + SendUpdateWorldState(TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT,first_digit); + SendUpdateWorldState(TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT,second_digit); + SendUpdateWorldState(TF_UI_LOCKED_TIME_HOURS,hours_left); + } else m_LockTimerUpdate -= diff; + m_LockTimer -= diff; + } + } + return changed; +} + +void OutdoorPvPTF::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + if(plr->GetTeam() == ALLIANCE) + { + if(m_AllianceTowersControlled >= TF_TOWER_NUM) + plr->CastSpell(plr,TF_CAPTURE_BUFF,true); + } + else + { + if(m_HordeTowersControlled >= TF_TOWER_NUM) + plr->CastSpell(plr,TF_CAPTURE_BUFF,true); + } + OutdoorPvP::HandlePlayerEnterZone(plr,zone); +} + +void OutdoorPvPTF::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // remove buffs + plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF); + OutdoorPvP::HandlePlayerLeaveZone(plr, zone); +} + +bool OutdoorPvPTF::SetupOutdoorPvP() +{ + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; + + m_IsLocked = false; + m_LockTimer = TF_LOCK_TIME; + m_LockTimerUpdate = 0; + hours_left = 6; + second_digit = 0; + first_digit = 0; + + // add the zones affected by the pvp buff + for(int i = 0; i < OutdoorPvPTFBuffZonesNum; ++i) + sOutdoorPvPMgr.AddZone(OutdoorPvPTFBuffZones[i],this); + + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_NW)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_N)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_NE)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_SE)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_S)); + + return true; +} + +bool OutdoorPvPObjectiveTF::Update(uint32 diff) +{ + // can update even in locked state if gathers the controlling faction + bool canupdate = ((((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled > 0) && this->m_AllianceActivePlayerCount > this->m_HordeActivePlayerCount) || + ((((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled > 0) && this->m_AllianceActivePlayerCount < this->m_HordeActivePlayerCount); + // if gathers the other faction, then only update if the pvp is unlocked + canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->m_IsLocked; + if(canupdate && OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State) + { + // if changing from controlling alliance to horde + if( m_OldState == OBJECTIVESTATE_ALLIANCE ) + { + if(((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled) + ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--; + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_A)); + } + // if changing from controlling horde to alliance + else if ( m_OldState == OBJECTIVESTATE_HORDE ) + { + if(((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled) + ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--; + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_H)); + } + + uint32 artkit = 21; + + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + m_TowerState = TF_TOWERSTATE_A; + artkit = 2; + if(((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled<TF_TOWER_NUM) + ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled++; + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); + break; + case OBJECTIVESTATE_HORDE: + m_TowerState = TF_TOWERSTATE_H; + artkit = 1; + if(((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled<TF_TOWER_NUM) + ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled++; + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); + break; + case OBJECTIVESTATE_NEUTRAL: + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_TowerState = TF_TOWERSTATE_N; + break; + } + + GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); + if(flag) + { + flag->SetGoArtKit(artkit); + flag->SendUpdateObjectToAllExcept(NULL); + } + + UpdateTowerState(); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); + // send this too, sometimes it resets :S + SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_NeutralValue); + } + return true; + } + return false; +} diff --git a/src/game/OutdoorPvPTF.h b/src/game/OutdoorPvPTF.h new file mode 100644 index 00000000000..802f163d977 --- /dev/null +++ b/src/game/OutdoorPvPTF.h @@ -0,0 +1,117 @@ +#ifndef OUTDOOR_PVP_TF_ +#define OUTDOOR_PVP_TF_ + +#include "OutdoorPvP.h" + +const uint32 OutdoorPvPTFBuffZonesNum = 5; + +const uint32 OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum] = { 3519 /*Terokkar Forest*/, 3791 /*Sethekk Halls*/, 3789 /*Shadow Labyrinth*/, 3792 /*Mana-Tombs*/, 3790 /*Auchenai Crypts*/ }; + +// locked for 6 hours after capture +const uint32 TF_LOCK_TIME = 3600 * 6 * 1000; +// update lock timer every 1/4 minute (overkill, but this way it's sure the timer won't "jump" 2 minutes at once.) +const uint32 TF_LOCK_TIME_UPDATE = 15000; + +// blessing of auchindoun +const uint32 TF_CAPTURE_BUFF = 33377; + +const uint32 TF_ALLY_QUEST = 11505; +const uint32 TF_HORDE_QUEST = 11506; + +enum OutdoorPvPTF_TowerType{ + TF_TOWER_NW = 0, + TF_TOWER_N, + TF_TOWER_NE, + TF_TOWER_SE, + TF_TOWER_S, + TF_TOWER_NUM +}; + +const go_type TFCapturePoints[TF_TOWER_NUM] = { + {183104,530,-3081.65,5335.03,17.1853,-2.14675,0,0,0.878817,-0.477159}, + {183411,530,-2939.9,4788.73,18.987,2.77507,0,0,0.983255,0.182236}, + {183412,530,-3174.94,4440.97,16.2281,1.86750,0,0.803857,0.594823}, + {183413,530,-3603.31,4529.15,20.9077,0.994838,0,0,0.477159,0.878817}, + {183414,530,-3812.37,4899.3,17.7249,0.087266,0,0,0.043619,0.999048} +}; + +struct tf_tower_world_state{ + uint32 n; + uint32 h; + uint32 a; +}; + +const tf_tower_world_state TFTowerWorldStates[TF_TOWER_NUM] = { + {0xa79,0xa7a,0xa7b}, + {0xa7e,0xa7d,0xa7c}, + {0xa82,0xa81,0xa80}, + {0xa88,0xa87,0xa86}, + {0xa85,0xa84,0xa83} +}; + +const uint32 TFTowerPlayerEnterEvents[TF_TOWER_NUM] = {12226, 12497, 12486, 12499, 12501}; + +const uint32 TFTowerPlayerLeaveEvents[TF_TOWER_NUM] = {12225, 12496, 12487, 12498, 12500}; + +enum TFWorldStates{ + TF_UI_TOWER_SLIDER_POS = 0xa41, + TF_UI_TOWER_SLIDER_N = 0xa40, + TF_UI_TOWER_SLIDER_DISPLAY = 0xa3f, + + TF_UI_TOWER_COUNT_H = 0xa3e, + TF_UI_TOWER_COUNT_A = 0xa3d, + TF_UI_TOWERS_CONTROLLED_DISPLAY = 0xa3c, + + TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT = 0x9d0, + TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT = 0x9ce, + TF_UI_LOCKED_TIME_HOURS = 0x9cd, + TF_UI_LOCKED_DISPLAY_NEUTRAL = 0x9cc, + TF_UI_LOCKED_DISPLAY_HORDE = 0xad0, + TF_UI_LOCKED_DISPLAY_ALLIANCE = 0xacf +}; + +enum TFTowerStates { + TF_TOWERSTATE_N = 1, + TF_TOWERSTATE_H = 2, + TF_TOWERSTATE_A = 4 +}; + +class OutdoorPvPObjectiveTF : public OutdoorPvPObjective +{ +public: + OutdoorPvPObjectiveTF(OutdoorPvP * pvp, OutdoorPvPTF_TowerType type); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); + void UpdateTowerState(); +protected: + virtual bool HandleCapturePointEvent(Player * plr, uint32 eventId); +protected: + OutdoorPvPTF_TowerType m_TowerType; + uint32 m_TowerState; +}; + +class OutdoorPvPTF : public OutdoorPvP +{ +friend class OutdoorPvPObjectiveTF; +public: + OutdoorPvPTF(); + bool SetupOutdoorPvP(); + void HandlePlayerEnterZone(Player *plr, uint32 zone); + void HandlePlayerLeaveZone(Player *plr, uint32 zone); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket &data); + void SendRemoveWorldStates(Player * plr); + void BuffTeam(uint32 team); +private: + bool m_IsLocked; + uint32 m_LockTimer; + uint32 m_LockTimerUpdate; + uint32 m_AllianceTowersControlled; + uint32 m_HordeTowersControlled; + uint32 hours_left, second_digit, first_digit; +}; + +#endif diff --git a/src/game/OutdoorPvPZM.cpp b/src/game/OutdoorPvPZM.cpp new file mode 100644 index 00000000000..4700c79de06 --- /dev/null +++ b/src/game/OutdoorPvPZM.cpp @@ -0,0 +1,476 @@ +#include "OutdoorPvPZM.h" +#include "ObjectMgr.h" +#include "OutdoorPvPMgr.h" +#include "Player.h" +#include "Creature.h" +#include "ObjectAccessor.h" +#include "WorldPacket.h" +#include "GossipDef.h" +#include "World.h" + +OutdoorPvPObjectiveZM_Beacon::OutdoorPvPObjectiveZM_Beacon(OutdoorPvP *pvp, ZM_BeaconType type) +: OutdoorPvPObjective(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) +{ + AddCapturePoint(ZMCapturePoints[type].entry,ZMCapturePoints[type].map,ZMCapturePoints[type].x,ZMCapturePoints[type].y,ZMCapturePoints[type].z,ZMCapturePoints[type].o,ZMCapturePoints[type].rot0,ZMCapturePoints[type].rot1,ZMCapturePoints[type].rot2,ZMCapturePoints[type].rot3); +} + +void OutdoorPvPObjectiveZM_Beacon::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N)); + data << uint32(ZMBeaconInfo[m_TowerType].map_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N)); + data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A)); + data << uint32(ZMBeaconInfo[m_TowerType].map_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A)); + data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H)); + data << uint32(ZMBeaconInfo[m_TowerType].map_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H)); +} + +void OutdoorPvPObjectiveZM_Beacon::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_n),uint32(bool(m_TowerState & ZM_TOWERSTATE_N))); + m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_n),uint32(bool(m_TowerState & ZM_TOWERSTATE_N))); + m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_a),uint32(bool(m_TowerState & ZM_TOWERSTATE_A))); + m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_a),uint32(bool(m_TowerState & ZM_TOWERSTATE_A))); + m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].ui_tower_h),uint32(bool(m_TowerState & ZM_TOWERSTATE_H))); + m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_h),uint32(bool(m_TowerState & ZM_TOWERSTATE_H))); +} + +bool OutdoorPvPObjectiveZM_Beacon::HandlePlayerEnter(Player *plr) +{ + if(OutdoorPvPObjective::HandlePlayerEnter(plr)) + { + plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1); + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase); + plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_NeutralValue); + return true; + } + return false; +} + +void OutdoorPvPObjectiveZM_Beacon::HandlePlayerLeave(Player *plr) +{ + plr->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 0); + OutdoorPvPObjective::HandlePlayerLeave(plr); +} + +bool OutdoorPvPObjectiveZM_Beacon::HandleCapturePointEvent(Player *plr, uint32 eventId) +{ + if(eventId == ZMBeaconInfo[m_TowerType].event_enter) + { + this->HandlePlayerEnter(plr); + return true; + } + else if (eventId == ZMBeaconInfo[m_TowerType].event_leave) + { + this->HandlePlayerLeave(plr); + return true; + } + return false; +} + +bool OutdoorPvPObjectiveZM_Beacon::Update(uint32 diff) +{ + if(OutdoorPvPObjective::Update(diff)) + { + if(m_OldState != m_State) + { + // if changing from controlling alliance to horde + if( m_OldState == OBJECTIVESTATE_ALLIANCE ) + { + if(((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled) + ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--; + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseA[m_TowerType])); + } + // if changing from controlling horde to alliance + else if ( m_OldState == OBJECTIVESTATE_HORDE ) + { + if(((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled) + ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--; + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseH[m_TowerType])); + } + + switch(m_State) + { + case OBJECTIVESTATE_ALLIANCE: + m_TowerState = ZM_TOWERSTATE_A; + if(((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled<ZM_NUM_BEACONS) + ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled++; + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); + break; + case OBJECTIVESTATE_HORDE: + m_TowerState = ZM_TOWERSTATE_H; + if(((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled<ZM_NUM_BEACONS) + ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled++; + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); + break; + case OBJECTIVESTATE_NEUTRAL: + case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: + case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: + case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: + case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: + m_TowerState = ZM_TOWERSTATE_N; + break; + } + + UpdateTowerState(); + } + + if(m_ShiftPhase != m_OldPhase) + { + // send this too, sometimes the slider disappears, dunno why :( + SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1); + // send these updates to only the ones in this objective + uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); + SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase); + SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_NeutralValue); + } + return true; + } + return false; +} + +bool OutdoorPvPZM::Update(uint32 diff) +{ + bool changed = false; + if(changed = OutdoorPvP::Update(diff)) + { + if(m_AllianceTowersControlled == ZM_NUM_BEACONS) + m_GraveYard->SetBeaconState(ALLIANCE); + else if(m_HordeTowersControlled == ZM_NUM_BEACONS) + m_GraveYard->SetBeaconState(HORDE); + else + m_GraveYard->SetBeaconState(0); + } + return changed; +} + +void OutdoorPvPZM::HandlePlayerEnterZone(Player * plr, uint32 zone) +{ + if(plr->GetTeam() == ALLIANCE) + { + if(m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_A) + plr->CastSpell(plr,ZM_CAPTURE_BUFF,true); + } + else + { + if(m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_H) + plr->CastSpell(plr,ZM_CAPTURE_BUFF,true); + } + OutdoorPvP::HandlePlayerEnterZone(plr,zone); +} + +void OutdoorPvPZM::HandlePlayerLeaveZone(Player * plr, uint32 zone) +{ + // remove buffs + plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF); + // remove flag + plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); + plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); + OutdoorPvP::HandlePlayerLeaveZone(plr, zone); +} + +OutdoorPvPZM::OutdoorPvPZM() +{ + m_TypeId = OUTDOOR_PVP_ZM; + m_GraveYard = NULL; + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; + +} + +bool OutdoorPvPZM::SetupOutdoorPvP() +{ + m_AllianceTowersControlled = 0; + m_HordeTowersControlled = 0; + + // add the zones affected by the pvp buff + for(int i = 0; i < OutdoorPvPZMBuffZonesNum; ++i) + sOutdoorPvPMgr.AddZone(OutdoorPvPZMBuffZones[i],this); + + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveZM_Beacon(this,ZM_BEACON_WEST)); + m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveZM_Beacon(this,ZM_BEACON_EAST)); + m_GraveYard = new OutdoorPvPObjectiveZM_GraveYard(this); + m_OutdoorPvPObjectives.insert(m_GraveYard); // though the update function isn't used, the handleusego is! + + return true; +} + +void OutdoorPvPZM::HandleKillImpl(Player *plr, Unit * killed) +{ + if(killed->GetTypeId() != TYPEID_PLAYER) + return; + + if(plr->GetTeam() == ALLIANCE && ((Player*)killed)->GetTeam() != ALLIANCE) + plr->CastSpell(plr,ZM_AlliancePlayerKillReward,true); + else if(plr->GetTeam() == HORDE && ((Player*)killed)->GetTeam() != HORDE) + plr->CastSpell(plr,ZM_HordePlayerKillReward,true); +} + +void OutdoorPvPZM::BuffTeam(uint32 team) +{ + if(team == ALLIANCE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,ZM_CAPTURE_BUFF,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF); + } + } + else if(team == HORDE) + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->CastSpell(plr,ZM_CAPTURE_BUFF,true); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF); + } + } + else + { + for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF); + } + for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr) + { + if(Player * plr = objmgr.GetPlayer(*itr)) + plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF); + } + } +} + +bool OutdoorPvPObjectiveZM_GraveYard::Update(uint32 diff) +{ + bool retval = m_State != m_OldState; + m_State = m_OldState; + return retval; +} + +int32 OutdoorPvPObjectiveZM_GraveYard::HandleOpenGo(Player *plr, uint64 guid) +{ + uint32 retval = OutdoorPvPObjective::HandleOpenGo(plr, guid); + if(retval>=0) + { + if(plr->HasAura(ZM_BATTLE_STANDARD_A,0) && m_GraveYardState != ZM_GRAVEYARD_A) + { + if(m_GraveYardState == ZM_GRAVEYARD_H) + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_H)); + m_GraveYardState = ZM_GRAVEYARD_A; + DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant + AddObject(0,ZM_Banner_A.entry,ZM_Banner_A.map,ZM_Banner_A.x,ZM_Banner_A.y,ZM_Banner_A.z,ZM_Banner_A.o,ZM_Banner_A.rot0,ZM_Banner_A.rot1,ZM_Banner_A.rot2,ZM_Banner_A.rot3); + objmgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE); // rem gy + objmgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy + ((OutdoorPvPZM*)m_PvP)->BuffTeam(ALLIANCE); + plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A)); + } + else if(plr->HasAura(ZM_BATTLE_STANDARD_H,0) && m_GraveYardState != ZM_GRAVEYARD_H) + { + if(m_GraveYardState == ZM_GRAVEYARD_A) + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_A)); + m_GraveYardState = ZM_GRAVEYARD_H; + DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant + AddObject(0,ZM_Banner_H.entry,ZM_Banner_H.map,ZM_Banner_H.x,ZM_Banner_H.y,ZM_Banner_H.z,ZM_Banner_H.o,ZM_Banner_H.rot0,ZM_Banner_H.rot1,ZM_Banner_H.rot2,ZM_Banner_H.rot3); + objmgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE); // rem gy + objmgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy + ((OutdoorPvPZM*)m_PvP)->BuffTeam(HORDE); + plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); + } + UpdateTowerState(); + } + return retval; +} + +OutdoorPvPObjectiveZM_GraveYard::OutdoorPvPObjectiveZM_GraveYard(OutdoorPvP *pvp) +: OutdoorPvPObjective(pvp) +{ + m_BothControllingFaction = 0; + m_GraveYardState = ZM_GRAVEYARD_N; + m_FlagCarrierGUID = 0; + // add field scouts here + AddCreature(ZM_ALLIANCE_FIELD_SCOUT,ZM_AllianceFieldScout.entry,ZM_AllianceFieldScout.teamval,ZM_AllianceFieldScout.map,ZM_AllianceFieldScout.x,ZM_AllianceFieldScout.y,ZM_AllianceFieldScout.z,ZM_AllianceFieldScout.o); + AddCreature(ZM_HORDE_FIELD_SCOUT,ZM_HordeFieldScout.entry,ZM_HordeFieldScout.teamval,ZM_HordeFieldScout.map,ZM_HordeFieldScout.x,ZM_HordeFieldScout.y,ZM_HordeFieldScout.z,ZM_HordeFieldScout.o); + // add neutral banner + AddObject(0,ZM_Banner_N.entry,ZM_Banner_N.map,ZM_Banner_N.x,ZM_Banner_N.y,ZM_Banner_N.z,ZM_Banner_N.o,ZM_Banner_N.rot0,ZM_Banner_N.rot1,ZM_Banner_N.rot2,ZM_Banner_N.rot3); +} + +void OutdoorPvPObjectiveZM_GraveYard::UpdateTowerState() +{ + m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N,uint32(bool(m_GraveYardState & ZM_GRAVEYARD_N))); + m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H,uint32(bool(m_GraveYardState & ZM_GRAVEYARD_H))); + m_PvP->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A,uint32(bool(m_GraveYardState & ZM_GRAVEYARD_A))); + + m_PvP->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_READY,uint32(m_BothControllingFaction == ALLIANCE)); + m_PvP->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_NOT_READY,uint32(m_BothControllingFaction != ALLIANCE)); + m_PvP->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_READY,uint32(m_BothControllingFaction == HORDE)); + m_PvP->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY,uint32(m_BothControllingFaction != HORDE)); +} + +void OutdoorPvPObjectiveZM_GraveYard::FillInitialWorldStates(WorldPacket &data) +{ + data << ZM_MAP_GRAVEYARD_N << uint32(bool(m_GraveYardState & ZM_GRAVEYARD_N)); + data << ZM_MAP_GRAVEYARD_H << uint32(bool(m_GraveYardState & ZM_GRAVEYARD_H)); + data << ZM_MAP_GRAVEYARD_A << uint32(bool(m_GraveYardState & ZM_GRAVEYARD_A)); + + data << ZM_MAP_ALLIANCE_FLAG_READY << uint32(m_BothControllingFaction == ALLIANCE); + data << ZM_MAP_ALLIANCE_FLAG_NOT_READY << uint32(m_BothControllingFaction != ALLIANCE); + data << ZM_MAP_HORDE_FLAG_READY << uint32(m_BothControllingFaction == HORDE); + data << ZM_MAP_HORDE_FLAG_NOT_READY << uint32(m_BothControllingFaction != HORDE); +} + +void OutdoorPvPObjectiveZM_GraveYard::SetBeaconState(uint32 controlling_faction) +{ + // nothing to do here + if(m_BothControllingFaction == controlling_faction) + return; + m_BothControllingFaction = controlling_faction; + + switch(controlling_faction) + { + case ALLIANCE: + // if ally already controls the gy and taken back both beacons, return, nothing to do for us + if(m_GraveYardState & ZM_GRAVEYARD_A) + return; + // ally doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner + break; + case HORDE: + // if horde already controls the gy and taken back both beacons, return, nothing to do for us + if(m_GraveYardState & ZM_GRAVEYARD_H) + return; + // horde doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner + break; + default: + // if the graveyard is not neutral, then leave it that way + // if the graveyard is neutral, then we have to dispel the buff from the flag carrier + if(m_GraveYardState & ZM_GRAVEYARD_N) + { + // gy was neutral, thus neutral banner was spawned, it is possible that someone was taking the flag to the gy + if(m_FlagCarrierGUID) + { + // remove flag from carrier, reset flag carrier guid + Player * p = objmgr.GetPlayer(m_FlagCarrierGUID); + if(p) + { + p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); + p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); + } + m_FlagCarrierGUID = 0; + } + } + break; + } + // send worldstateupdate + UpdateTowerState(); +} + +bool OutdoorPvPObjectiveZM_GraveYard::CanTalkTo(Player * plr, Creature * c, GossipOption & gso) +{ + uint64 guid = c->GetGUID(); + std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid); + if(itr != m_CreatureTypes.end()) + { + if(itr->second == ZM_ALLIANCE_FIELD_SCOUT && plr->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A) + { + gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_ALLIANCE)); + return true; + } + else if(itr->second == ZM_HORDE_FIELD_SCOUT && plr->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H) + { + gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_HORDE)); + return true; + } + } + return false; +} + +bool OutdoorPvPObjectiveZM_GraveYard::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid) +{ + std::map<uint64,uint32>::iterator itr = m_CreatureTypes.find(guid); + if(itr != m_CreatureTypes.end()) + { + Creature * cr = HashMapHolder<Creature>::Find(guid); + if(!cr) + return true; + // if the flag is already taken, then return + if(m_FlagCarrierGUID) + return true; + if(itr->second == ZM_ALLIANCE_FIELD_SCOUT) + { + cr->CastSpell(plr,ZM_BATTLE_STANDARD_A,true); + m_FlagCarrierGUID = plr->GetGUID(); + } + else if(itr->second == ZM_HORDE_FIELD_SCOUT) + { + cr->CastSpell(plr,ZM_BATTLE_STANDARD_H,true); + m_FlagCarrierGUID = plr->GetGUID(); + } + UpdateTowerState(); + plr->PlayerTalkClass->CloseGossip(); + return true; + } + return false; +} + +bool OutdoorPvPObjectiveZM_GraveYard::HandleDropFlag(Player * plr, uint32 spellId) +{ + switch(spellId) + { + case ZM_BATTLE_STANDARD_A: + m_FlagCarrierGUID = 0; + return true; + case ZM_BATTLE_STANDARD_H: + m_FlagCarrierGUID = 0; + return true; + } + return false; +} + +void OutdoorPvPZM::FillInitialWorldStates(WorldPacket &data) +{ + data << ZM_WORLDSTATE_UNK_1 << uint32(1); + for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr) + { + (*itr)->FillInitialWorldStates(data); + } +} + +void OutdoorPvPZM::SendRemoveWorldStates(Player *plr) +{ + plr->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_N_W,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_POS_W,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_DISPLAY_W,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_N_E,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_POS_E,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_DISPLAY_E,0); + plr->SendUpdateWorldState(ZM_WORLDSTATE_UNK_1,1); + plr->SendUpdateWorldState(ZM_UI_TOWER_EAST_N,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_EAST_H,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_EAST_A,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_WEST_N,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_WEST_H,0); + plr->SendUpdateWorldState(ZM_UI_TOWER_WEST_A,0); + plr->SendUpdateWorldState(ZM_MAP_TOWER_EAST_N,0); + plr->SendUpdateWorldState(ZM_MAP_TOWER_EAST_H,0); + plr->SendUpdateWorldState(ZM_MAP_TOWER_EAST_A,0); + plr->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H,0); + plr->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A,0); + plr->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N,0); + plr->SendUpdateWorldState(ZM_MAP_TOWER_WEST_N,0); + plr->SendUpdateWorldState(ZM_MAP_TOWER_WEST_H,0); + plr->SendUpdateWorldState(ZM_MAP_TOWER_WEST_A,0); + plr->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_READY,0); + plr->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY,0); + plr->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_NOT_READY,0); + plr->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_READY,0); +} diff --git a/src/game/OutdoorPvPZM.h b/src/game/OutdoorPvPZM.h new file mode 100644 index 00000000000..ae94f59355c --- /dev/null +++ b/src/game/OutdoorPvPZM.h @@ -0,0 +1,197 @@ +#ifndef OUTDOOR_PVP_ZM_ +#define OUTDOOR_PVP_ZM_ + +#include "OutdoorPvP.h" +#include "Language.h" + +const uint32 OutdoorPvPZMBuffZonesNum = 5; +// the buff is cast in these zones +const uint32 OutdoorPvPZMBuffZones[OutdoorPvPZMBuffZonesNum] = {3521,3607,3717,3715,3716}; +// cast on the players of the controlling faction +const uint32 ZM_CAPTURE_BUFF = 33779; // twin spire blessing +// spell that the field scout casts on the player to carry the flag +const uint32 ZM_BATTLE_STANDARD_A = 32430; +// spell that the field scout casts on the player to carry the flag +const uint32 ZM_BATTLE_STANDARD_H = 32431; +// linked when the central tower is controlled +const uint32 ZM_GRAVEYARD_ZONE = 3521; +// linked when the central tower is controlled +const uint32 ZM_GRAVEYARD_ID = 969; +// token create spell +const uint32 ZM_AlliancePlayerKillReward = 32155; +// token create spell +const uint32 ZM_HordePlayerKillReward = 32158; + +// banners 182527, 182528, 182529, gotta check them ingame +const go_type ZM_Banner_A = { 182527,530,253.54,7083.81,36.7728,-0.017453,0,0,0.008727,-0.999962 }; +const go_type ZM_Banner_H = { 182528,530,253.54,7083.81,36.7728,-0.017453,0,0,0.008727,-0.999962 }; +const go_type ZM_Banner_N = { 182529,530,253.54,7083.81,36.7728,-0.017453,0,0,0.008727,-0.999962 }; + +// horde field scout spawn data +const creature_type ZM_HordeFieldScout = {18564,67,530,296.625,7818.4,42.6294,5.18363}; +// alliance field scout spawn data +const creature_type ZM_AllianceFieldScout = {18581,469,530,374.395,6230.08,22.8351,0.593412}; + +enum ZMCreatureTypes{ + ZM_ALLIANCE_FIELD_SCOUT = 0, + ZM_HORDE_FIELD_SCOUT, + ZM_CREATURE_NUM +}; + +struct zm_beacon { + uint32 slider_disp; + uint32 slider_n; + uint32 slider_pos; + uint32 ui_tower_n; + uint32 ui_tower_h; + uint32 ui_tower_a; + uint32 map_tower_n; + uint32 map_tower_h; + uint32 map_tower_a; + uint32 event_enter; + uint32 event_leave; +}; + +enum ZM_BeaconType{ + ZM_BEACON_EAST = 0, + ZM_BEACON_WEST, + ZM_NUM_BEACONS +}; + +const zm_beacon ZMBeaconInfo[ZM_NUM_BEACONS] = { + {2533,2535,2534,2560,2559,2558,2652,2651,2650,11807,11806}, + {2527,2529,2528,2557,2556,2555,2646,2645,2644,11805,11804} +}; + +const uint32 ZMBeaconCaptureA[ZM_NUM_BEACONS] = { + LANG_OPVP_ZM_CAPTURE_EAST_A, + LANG_OPVP_ZM_CAPTURE_WEST_A +}; + +const uint32 ZMBeaconCaptureH[ZM_NUM_BEACONS] = { + LANG_OPVP_ZM_CAPTURE_EAST_H, + LANG_OPVP_ZM_CAPTURE_WEST_H +}; + +const uint32 ZMBeaconLooseA[ZM_NUM_BEACONS] = { + LANG_OPVP_ZM_LOOSE_EAST_A, + LANG_OPVP_ZM_LOOSE_WEST_A +}; + +const uint32 ZMBeaconLooseH[ZM_NUM_BEACONS] = { + LANG_OPVP_ZM_LOOSE_EAST_H, + LANG_OPVP_ZM_LOOSE_WEST_H +}; + +const go_type ZMCapturePoints[ZM_NUM_BEACONS] = { + {182523,530,303.243,6841.36,40.1245,-1.58825,0,0,0.71325,-0.700909}, + {182522,530,336.466,7340.26,41.4984,-1.58825,0,0,0.71325,-0.700909} +}; + +enum OutdoorPvPZMWorldStates +{ + ZM_UI_TOWER_SLIDER_N_W = 2529, + ZM_UI_TOWER_SLIDER_POS_W = 2528, + ZM_UI_TOWER_SLIDER_DISPLAY_W = 2527, + + ZM_UI_TOWER_SLIDER_N_E = 2535, + ZM_UI_TOWER_SLIDER_POS_E = 2534, + ZM_UI_TOWER_SLIDER_DISPLAY_E = 2533, + + ZM_WORLDSTATE_UNK_1 = 2653, + + ZM_UI_TOWER_EAST_N = 2560, + ZM_UI_TOWER_EAST_H = 2559, + ZM_UI_TOWER_EAST_A = 2558, + ZM_UI_TOWER_WEST_N = 2557, + ZM_UI_TOWER_WEST_H = 2556, + ZM_UI_TOWER_WEST_A = 2555, + + ZM_MAP_TOWER_EAST_N = 2652, + ZM_MAP_TOWER_EAST_H = 2651, + ZM_MAP_TOWER_EAST_A = 2650, + ZM_MAP_GRAVEYARD_H = 2649, + ZM_MAP_GRAVEYARD_A = 2648, + ZM_MAP_GRAVEYARD_N = 2647, + ZM_MAP_TOWER_WEST_N = 2646, + ZM_MAP_TOWER_WEST_H = 2645, + ZM_MAP_TOWER_WEST_A = 2644, + + ZM_MAP_HORDE_FLAG_READY = 2658, + ZM_MAP_HORDE_FLAG_NOT_READY = 2657, + ZM_MAP_ALLIANCE_FLAG_NOT_READY = 2656, + ZM_MAP_ALLIANCE_FLAG_READY = 2655 +}; + +enum ZM_TowerStateMask{ + ZM_TOWERSTATE_N = 1, + ZM_TOWERSTATE_A = 2, + ZM_TOWERSTATE_H = 4 +}; + +class OutdoorPvPZM; +class OutdoorPvPObjectiveZM_Beacon : public OutdoorPvPObjective +{ +friend class OutdoorPvPZM; +public: + OutdoorPvPObjectiveZM_Beacon(OutdoorPvP * pvp, ZM_BeaconType type); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + // used when player is activated/inactivated in the area + bool HandlePlayerEnter(Player * plr); + void HandlePlayerLeave(Player * plr); + void UpdateTowerState(); +protected: + bool HandleCapturePointEvent(Player * plr, uint32 eventId); +protected: + ZM_BeaconType m_TowerType; + uint32 m_TowerState; +}; + +enum ZM_GraveYardState{ + ZM_GRAVEYARD_N = 1, + ZM_GRAVEYARD_A = 2, + ZM_GRAVEYARD_H = 4 +}; + +class OutdoorPvPObjectiveZM_GraveYard : public OutdoorPvPObjective +{ +friend class OutdoorPvPZM; +public: + OutdoorPvPObjectiveZM_GraveYard(OutdoorPvP * pvp); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket & data); + void UpdateTowerState(); + int32 HandleOpenGo(Player *plr, uint64 guid); + void SetBeaconState(uint32 controlling_team); // not good atm + bool HandleGossipOption(Player * plr, uint64 guid, uint32 gossipid); + bool HandleDropFlag(Player * plr, uint32 spellId); + bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso); +private: + uint32 m_GraveYardState; +protected: + uint32 m_BothControllingFaction; + uint64 m_FlagCarrierGUID; +}; + +class OutdoorPvPZM : public OutdoorPvP +{ +friend class OutdoorPvPObjectiveZM_Beacon; +public: + OutdoorPvPZM(); + bool SetupOutdoorPvP(); + void HandlePlayerEnterZone(Player *plr, uint32 zone); + void HandlePlayerLeaveZone(Player *plr, uint32 zone); + bool Update(uint32 diff); + void FillInitialWorldStates(WorldPacket &data); + void SendRemoveWorldStates(Player * plr); + void HandleKillImpl(Player * plr, Unit * killed); + void BuffTeam(uint32 team); +private: + OutdoorPvPObjectiveZM_GraveYard * m_GraveYard; + uint32 m_AllianceTowersControlled; + uint32 m_HordeTowersControlled; +}; + +// todo: flag carrier death/leave/mount/activitychange should give back the gossip options +#endif diff --git a/src/game/Path.h b/src/game/Path.h index 2085e567def..24ddf0b08a6 100644 --- a/src/game/Path.h +++ b/src/game/Path.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_PATH_H -#define MANGOSSERVER_PATH_H +#ifndef TRINITYCORE_PATH_H +#define TRINITYCORE_PATH_H #include "Common.h" #include <vector> diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 25e29798c08..a45fdef1728 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -887,7 +889,7 @@ void Pet::GivePetXP(uint32 xp) newXP -= nextLvlXP; SetLevel( level + 1 ); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((MaNGOS::XP::xp_to_level(level+1))/4)); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((Trinity::XP::xp_to_level(level+1))/4)); level = getLevel(); nextLvlXP = GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP); @@ -954,7 +956,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) setPowerType(POWER_FOCUS); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((MaNGOS::XP::xp_to_level(creature->getLevel()))/4)); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((Trinity::XP::xp_to_level(creature->getLevel()))/4)); SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); SetUInt32Value(UNIT_NPC_FLAGS , 0); @@ -1102,7 +1104,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel) } case HUNTER_PET: { - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((MaNGOS::XP::xp_to_level(petlevel))/4)); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((Trinity::XP::xp_to_level(petlevel))/4)); //these formula may not be correct; however, it is designed to be close to what it should be //this makes dps 0.5 of pets level diff --git a/src/game/Pet.h b/src/game/Pet.h index f7866cbe0fc..72b607243d9 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_PET_H -#define MANGOSSERVER_PET_H +#ifndef TRINITYCORE_PET_H +#define TRINITYCORE_PET_H #include "ObjectDefines.h" #include "Creature.h" diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index c9aeaf66ec9..6cf9db0d750 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "PetAI.h" diff --git a/src/game/PetAI.h b/src/game/PetAI.h index b8124bb3520..af8a0377ebd 100644 --- a/src/game/PetAI.h +++ b/src/game/PetAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,23 +10,23 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_PETAI_H -#define MANGOS_PETAI_H +#ifndef TRINITY_PETAI_H +#define TRINITY_PETAI_H #include "CreatureAI.h" #include "Timer.h" class Creature; -class MANGOS_DLL_DECL PetAI : public CreatureAI +class TRINITY_DLL_DECL PetAI : public CreatureAI { public: diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 3eafbd4dd73..78d69b37833 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 612bb14b684..f2a87dad802 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -284,7 +286,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12)); data << petitionguid; // petition guid data << _player->GetGUID(); // owner guid - data << petitionguid_low; // guild guid (in mangos always same as GUID_LOPART(petitionguid) + data << petitionguid_low; // guild guid (in Trinity always same as GUID_LOPART(petitionguid) data << signs; // sign's count for(uint8 i = 1; i <= signs; i++) @@ -310,7 +312,7 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recv_data) uint32 guildguid; uint64 petitionguid; - recv_data >> guildguid; // in mangos always same as GUID_LOPART(petitionguid) + recv_data >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid) recv_data >> petitionguid; // petition guid sLog.outDebug("CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid); @@ -358,7 +360,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) } WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*13)); - data << GUID_LOPART(petitionguid); // guild/team guid (in mangos always same as GUID_LOPART(petition guid) + data << GUID_LOPART(petitionguid); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid) data << ownerguid; // charter owner guid data << name; // name (guild/arena team) data << uint8(0); // 1 @@ -651,7 +653,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12)); data << petitionguid; // petition guid data << _player->GetGUID(); // owner guid - data << GUID_LOPART(petitionguid); // guild guid (in mangos always same as GUID_LOPART(petition guid) + data << GUID_LOPART(petitionguid); // guild guid (in Trinity always same as GUID_LOPART(petition guid) data << signs; // sign's count for(uint8 i = 1; i <= signs; i++) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ce2b936229f..694c9eafc7b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -53,12 +55,14 @@ #include "Weather.h" #include "BattleGround.h" #include "BattleGroundMgr.h" +#include "OutdoorPvP.h" +#include "OutdoorPvPMgr.h" #include "ArenaTeam.h" #include "Chat.h" #include "Database/DatabaseImpl.h" #include "Spell.h" #include "SocialMgr.h" -#include "IRCClient.h" +#include "GameEvent.h" #include <cmath> @@ -579,25 +583,68 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, SetUInt32Value( PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0 ); // set starting level - if(GetSession()->GetSecurity() >= SEC_MODERATOR) - SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_GM_START_LEVEL) ); //ImpConfig - else - SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) ); - // set starting gold - SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.PlayerStartGold()*10000 ); - - // set starting honor - SetUInt32Value( PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_HONOR) ); - - // set starting arena pts - SetUInt32Value( PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_ARENAPTS) ); - - // start with every map explored - if(sWorld.getConfig(CONFIG_START_ALL_EXPLORED)) - { - for (uint8 i=0; i<64; i++) - SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF); - } + if(GetSession()->GetSecurity() >= SEC_MODERATOR) + SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_GM_START_LEVEL) ); + else + SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) ); + // set starting gold + SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD)*10000 ); + + // set starting honor + SetUInt32Value( PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_HONOR) ); + + // set starting arena pts + SetUInt32Value( PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_ARENAPTS) ); + + // start with every map explored + if(sWorld.getConfig(CONFIG_START_ALL_EXPLORED)) + { + for (uint8 i=0; i<64; i++) + SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF); + } + + //Reputations if "StartAllReputation" is enabled, -- TODO: Fix this in a better way + if(sWorld.getConfig(CONFIG_START_ALL_REP)) + { + SetFactionReputation(sFactionStore.LookupEntry(942),42999); + SetFactionReputation(sFactionStore.LookupEntry(935),42999); + SetFactionReputation(sFactionStore.LookupEntry(936),42999); + SetFactionReputation(sFactionStore.LookupEntry(1011),42999); + SetFactionReputation(sFactionStore.LookupEntry(970),42999); + SetFactionReputation(sFactionStore.LookupEntry(967),42999); + SetFactionReputation(sFactionStore.LookupEntry(989),42999); + SetFactionReputation(sFactionStore.LookupEntry(932),42999); + SetFactionReputation(sFactionStore.LookupEntry(934),42999); + SetFactionReputation(sFactionStore.LookupEntry(1038),42999); + SetFactionReputation(sFactionStore.LookupEntry(1077),42999); + + // Factions depending on team, like cities and some more stuff + switch(GetTeam()) + { + case ALLIANCE: + SetFactionReputation(sFactionStore.LookupEntry(72),42999); + SetFactionReputation(sFactionStore.LookupEntry(47),42999); + SetFactionReputation(sFactionStore.LookupEntry(69),42999); + SetFactionReputation(sFactionStore.LookupEntry(930),42999); + SetFactionReputation(sFactionStore.LookupEntry(730),42999); + SetFactionReputation(sFactionStore.LookupEntry(978),42999); + SetFactionReputation(sFactionStore.LookupEntry(54),42999); + SetFactionReputation(sFactionStore.LookupEntry(946),42999); + break; + case HORDE: + SetFactionReputation(sFactionStore.LookupEntry(76),42999); + SetFactionReputation(sFactionStore.LookupEntry(68),42999); + SetFactionReputation(sFactionStore.LookupEntry(81),42999); + SetFactionReputation(sFactionStore.LookupEntry(911),42999); + SetFactionReputation(sFactionStore.LookupEntry(729),42999); + SetFactionReputation(sFactionStore.LookupEntry(941),42999); + SetFactionReputation(sFactionStore.LookupEntry(530),42999); + SetFactionReputation(sFactionStore.LookupEntry(947),42999); + break; + default: + break; + } + } // Played time m_Last_tick = time(NULL); @@ -1452,6 +1499,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } + if((GetSession()->GetSecurity() < SEC_GAMEMASTER) && !sWorld.IsAllowedMap(mapid)) + { + sLog.outError("Player %s tried to enter a forbidden map", GetName()); + return false; + } + // preparing unsummon pet if lost (we must get pet before teleportation or will not find it later) Pet* pet = GetPet(); @@ -1717,8 +1770,6 @@ void Player::AddToWorld() if(m_items[i]) m_items[i]->AddToWorld(); } - if(sIRC.ajoin == 1) - sIRC.AutoJoinChannel(this); } void Player::RemoveFromWorld() @@ -1809,7 +1860,7 @@ void Player::Regenerate(Powers power) float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA); if (recentCast) { - // Mangos Updates Mana in intervals of 2s, which is correct + // Trinity Updates Mana in intervals of 2s, which is correct addvalue = GetFloatValue(PLAYER_FIELD_MOD_MANA_REGEN_INTERRUPT) * ManaIncreaseRate * 2.00f; } else @@ -2129,7 +2180,7 @@ void Player::GiveLevel(uint32 level) GetSession()->SendPacket(&data); - SetUInt32Value(PLAYER_NEXT_LEVEL_XP, MaNGOS::XP::xp_to_level(level)); + SetUInt32Value(PLAYER_NEXT_LEVEL_XP, Trinity::XP::xp_to_level(level)); //update level, max level of skills if(getLevel()!= level) @@ -2149,19 +2200,8 @@ void Player::GiveLevel(uint32 level) UpdateAllStats(); - if((sIRC.BOTMASK & 64) != 0) - { - char temp [5]; - sprintf(temp, "%u", level); - std::string plevel = temp; - std::string pname = GetName(); - std::string ircchan = "#"; - ircchan += sIRC._irc_chan[sIRC.Status].c_str(); - sIRC.Send_IRC_Channel(ircchan, "\00311["+pname+"] : Has Reached Level: "+plevel, true); - } - if(sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up - UpdateSkillsToMaxSkillsForLevel(); + UpdateSkillsToMaxSkillsForLevel(); // set current level health and mana/energy to maximum after applying all mods. SetHealth(GetMaxHealth()); @@ -2220,7 +2260,7 @@ void Player::InitStatsForLevel(bool reapplyMods) objmgr.GetPlayerLevelInfo(getRace(),getClass(),getLevel(),&info); SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) ); - SetUInt32Value(PLAYER_NEXT_LEVEL_XP, MaNGOS::XP::xp_to_level(getLevel())); + SetUInt32Value(PLAYER_NEXT_LEVEL_XP, Trinity::XP::xp_to_level(getLevel())); UpdateMaxSkills (); @@ -3121,7 +3161,7 @@ bool Player::resetTalents(bool no_cost) uint32 cost = 0; - if(!no_cost) + if(!no_cost && !sWorld.getConfig(CONFIG_NO_RESET_TALENT_COST)) { cost = resetTalentsCost(); @@ -3636,7 +3676,6 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC CharacterDatabase.PExecute("DELETE FROM mail_items WHERE receiver = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u'",guid); CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u'",guid); - CharacterDatabase.PExecute("DELETE FROM has_logged_in_before WHERE guid = %u",guid); CharacterDatabase.CommitTransaction(); //loginDatabase.PExecute("UPDATE realmcharacters SET numchars = numchars - 1 WHERE acctid = %d AND realmid = %d", accountId, realmID); @@ -3761,7 +3800,7 @@ void Player::ResurrectPlayer(float restore_percent, bool updateToWorld, bool app // some items limited to specific map DestroyZoneLimitedItem( true, GetZoneId()); - if(sWorld.getConfig(CONFIG_DISABLE_RES_SICKNESS) || !applySickness || getLevel() <= 10) + if(!applySickness || getLevel() <= 10) return; //Characters from level 1-10 are not affected by resurrection sickness. @@ -4834,7 +4873,7 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, MeleeHi } uint32 plevel = getLevel(); // if defense than pVictim == attacker - uint32 greylevel = MaNGOS::XP::GetGrayLevel(plevel); + uint32 greylevel = Trinity::XP::GetGrayLevel(plevel); uint32 moblevel = pVictim->getLevelForTarget(this); if(moblevel < greylevel) return; @@ -5215,7 +5254,7 @@ void Player::SetDontMove(bool dontMove) bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport) { // prevent crash when a bad coord is sent by the client - if(!MaNGOS::IsValidMapCoord(x,y,z,orientation)) + if(!Trinity::IsValidMapCoord(x,y,z,orientation)) { sLog.outDebug("Player::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for player %d!",x,y,z,orientation,teleport,GetGUIDLow()); return false; @@ -5815,7 +5854,7 @@ bool Player::SetOneFactionReputation(FactionEntry const* factionEntry, int32 sta int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest) { // for grey creature kill received 20%, in other case 100. - int32 percent = (!for_quest && (creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel()))) ? 20 : 100; + int32 percent = (!for_quest && (creatureOrQuestLevel <= Trinity::XP::GetGrayLevel(getLevel()))) ? 20 : 100; int32 repMod = GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN); @@ -6053,40 +6092,42 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true); - if( sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken ) - { - if(!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) - return true; - - if(uVictim->GetTypeId() == TYPEID_PLAYER) - { - // Check if allowed to receive it in current map - uint8 MapType = sWorld.getConfig(CONFIG_PVP_TOKEN_MAP_TYPE); - if(MapType == 1 && !InBattleGround() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) || MapType == 2 && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) || MapType == 3 && !InBattleGround()) - return true; - - uint32 noSpaceForCount = 0; - uint32 itemId = sWorld.getConfig(CONFIG_PVP_TOKEN_ID); - int32 count = sWorld.getConfig(CONFIG_PVP_TOKEN_COUNT); - - // check space and find places - ItemPosCountVec dest; - uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount ); - if( msg != EQUIP_ERR_OK ) // convert to possible store amount - count = noSpaceForCount; - - if( count == 0 || dest.empty()) // can't add any - { - // -- TODO: Send to mailbox if no space - ChatHandler(this).PSendSysMessage("You don't have any space in your bags for a token."); - return true; - } - - Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); - SendNewItem(item,count,true,false); - ChatHandler(this).PSendSysMessage("You have been awarded a token for slaying another player."); - } - } + if( sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken ) + { + if(!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) + return true; + + if(uVictim->GetTypeId() == TYPEID_PLAYER) + { + // Check if allowed to receive it in current map + uint8 MapType = sWorld.getConfig(CONFIG_PVP_TOKEN_MAP_TYPE); + if( (MapType == 1 && !InBattleGround() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP)) + || (MapType == 2 && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP)) + || (MapType == 3 && !InBattleGround()) ) + return true; + + uint32 noSpaceForCount = 0; + uint32 itemId = sWorld.getConfig(CONFIG_PVP_TOKEN_ID); + int32 count = sWorld.getConfig(CONFIG_PVP_TOKEN_COUNT); + + // check space and find places + ItemPosCountVec dest; + uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount ); + if( msg != EQUIP_ERR_OK ) // convert to possible store amount + count = noSpaceForCount; + + if( count == 0 || dest.empty()) // can't add any + { + // -- TODO: Send to mailbox if no space + ChatHandler(this).PSendSysMessage("You don't have any space in your bags for a token."); + return true; + } + + Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + SendNewItem(item,count,true,false); + ChatHandler(this).PSendSysMessage("You have been awarded a token for slaying another player."); + } + } return true; } @@ -6239,6 +6280,7 @@ void Player::UpdateArea(uint32 newArea) void Player::UpdateZone(uint32 newZone) { + uint32 oldZoneId = m_zoneUpdateId; m_zoneUpdateId = newZone; m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; @@ -6249,6 +6291,13 @@ void Player::UpdateZone(uint32 newZone) if(!zone) return; + // inform outdoor pvp + if(oldZoneId != m_zoneUpdateId) + { + sOutdoorPvPMgr.HandlePlayerLeaveZone(this, oldZoneId); + sOutdoorPvPMgr.HandlePlayerEnterZone(this, m_zoneUpdateId); + } + if (sWorld.getConfig(CONFIG_WEATHER)) { Weather *wth = sWorld.FindWeather(zone->ID); @@ -6382,6 +6431,11 @@ void Player::CheckDuelDistance(time_t currTime) } } +bool Player::IsOutdoorPvPActive() +{ + return (isAlive() && !HasInvisibilityAura() && !HasStealthAura() && (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) || sWorld.IsPvPRealm()) && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING2) && !isInFlight()); +} + void Player::DuelComplete(DuelCompleteType type) { // duel not requested @@ -6456,12 +6510,9 @@ void Player::DuelComplete(DuelCompleteType type) else if(duel->opponent->GetComboTarget()==GetPetGUID()) duel->opponent->ClearComboPoints(); - // Honor points after duel (the winner) - ImpConfig - if(sWorld.getConfig(CONFIG_HONOR_AFTER_DUEL > 0)) - { - uint32 amount = sWorld.getConfig(CONFIG_HONOR_AFTER_DUEL); - duel->opponent->RewardHonor(NULL,1,amount); - } + // Honor points after duel (the winner) - ImpConfig + if(uint32 amount = sWorld.getConfig(CONFIG_HONOR_AFTER_DUEL)) + duel->opponent->RewardHonor(NULL,1,amount); //cleanups SetUInt64Value(PLAYER_DUEL_ARBITER, 0); @@ -7483,13 +7534,18 @@ void Player::SendUpdateWorldState(uint32 Field, uint32 Value) GetSession()->SendPacket(&data); } -void Player::SendInitWorldStates() +void Player::SendInitWorldStates(bool forceZone, uint32 forceZoneId) { // data depends on zoneid/mapid... BattleGround* bg = GetBattleGround(); uint16 NumberOfFields = 0; uint32 mapid = GetMapId(); - uint32 zoneid = GetZoneId(); + uint32 zoneid; + if(forceZone) + zoneid = forceZoneId; + else + zoneid = GetZoneId(); + OutdoorPvP * pvp = sOutdoorPvPMgr.GetOutdoorPvPToZoneId(zoneid); uint32 areaid = GetAreaId(); sLog.outDebug("Sending SMSG_INIT_WORLD_STATES to Map:%u, Zone: %u", mapid, zoneid); // may be exist better way to do this... @@ -7514,6 +7570,12 @@ void Player::SendInitWorldStates() case 2918: NumberOfFields = 6; break; + case 139: + NumberOfFields = 39; + break; + case 1377: + NumberOfFields = 13; + break; case 2597: NumberOfFields = 81; break; @@ -7525,7 +7587,10 @@ void Player::SendInitWorldStates() NumberOfFields = 38; break; case 3483: - NumberOfFields = 22; + NumberOfFields = 25; + break; + case 3518: + NumberOfFields = 37; break; case 3519: NumberOfFields = 36; @@ -7575,6 +7640,66 @@ void Player::SendInitWorldStates() case 1537: case 2257: break; + case 139: // EPL + { + if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0x97a) << uint32(0x0); // 10 2426 + data << uint32(0x917) << uint32(0x0); // 11 2327 + data << uint32(0x918) << uint32(0x0); // 12 2328 + data << uint32(0x97b) << uint32(0x32); // 13 2427 + data << uint32(0x97c) << uint32(0x32); // 14 2428 + data << uint32(0x933) << uint32(0x1); // 15 2355 + data << uint32(0x946) << uint32(0x0); // 16 2374 + data << uint32(0x947) << uint32(0x0); // 17 2375 + data << uint32(0x948) << uint32(0x0); // 18 2376 + data << uint32(0x949) << uint32(0x0); // 19 2377 + data << uint32(0x94a) << uint32(0x0); // 20 2378 + data << uint32(0x94b) << uint32(0x0); // 21 2379 + data << uint32(0x932) << uint32(0x0); // 22 2354 + data << uint32(0x934) << uint32(0x0); // 23 2356 + data << uint32(0x935) << uint32(0x0); // 24 2357 + data << uint32(0x936) << uint32(0x0); // 25 2358 + data << uint32(0x937) << uint32(0x0); // 26 2359 + data << uint32(0x938) << uint32(0x0); // 27 2360 + data << uint32(0x939) << uint32(0x1); // 28 2361 + data << uint32(0x930) << uint32(0x1); // 29 2352 + data << uint32(0x93a) << uint32(0x0); // 30 2362 + data << uint32(0x93b) << uint32(0x0); // 31 2363 + data << uint32(0x93c) << uint32(0x0); // 32 2364 + data << uint32(0x93d) << uint32(0x0); // 33 2365 + data << uint32(0x944) << uint32(0x0); // 34 2372 + data << uint32(0x945) << uint32(0x0); // 35 2373 + data << uint32(0x931) << uint32(0x1); // 36 2353 + data << uint32(0x93e) << uint32(0x0); // 37 2366 + data << uint32(0x931) << uint32(0x1); // 38 2367 ?? grey horde not in dbc! send for consistency's sake, and to match field count + data << uint32(0x940) << uint32(0x0); // 39 2368 + data << uint32(0x941) << uint32(0x0); // 7 2369 + data << uint32(0x942) << uint32(0x0); // 8 2370 + data << uint32(0x943) << uint32(0x0); // 9 2371 + } + } + break; + case 1377: // Silithus + { + if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_SI) + pvp->FillInitialWorldStates(data); + else + { + // states are always shown + data << uint32(2313) << uint32(0x0); // 7 ally silityst gathered + data << uint32(2314) << uint32(0x0); // 8 horde silityst gathered + data << uint32(2317) << uint32(0x0); // 9 max silithyst + } + // dunno about these... aq opening event maybe? + data << uint32(2322) << uint32(0x0); // 10 sandworm N + data << uint32(2323) << uint32(0x0); // 11 sandworm S + data << uint32(2324) << uint32(0x0); // 12 sandworm SW + data << uint32(2325) << uint32(0x0); // 13 sandworm E + } + break; case 2597: // AV data << uint32(0x7ae) << uint32(0x1); // 7 data << uint32(0x532) << uint32(0x1); // 8 @@ -7746,77 +7871,146 @@ void Player::SendInitWorldStates() // and some more ... unknown } break; + // any of these needs change! the client remembers the prev setting! + // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF! case 3483: // Hellfire Peninsula - data << uint32(0x9ba) << uint32(0x1); // 10 - data << uint32(0x9b9) << uint32(0x1); // 11 - data << uint32(0x9b5) << uint32(0x0); // 12 - data << uint32(0x9b4) << uint32(0x1); // 13 - data << uint32(0x9b3) << uint32(0x0); // 14 - data << uint32(0x9b2) << uint32(0x0); // 15 - data << uint32(0x9b1) << uint32(0x1); // 16 - data << uint32(0x9b0) << uint32(0x0); // 17 - data << uint32(0x9ae) << uint32(0x0); // 18 horde pvp objectives captured - data << uint32(0x9ac) << uint32(0x0); // 19 - data << uint32(0x9a8) << uint32(0x0); // 20 - data << uint32(0x9a7) << uint32(0x0); // 21 - data << uint32(0x9a6) << uint32(0x1); // 22 + { + if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0x9ba) << uint32(0x1); // 10 // add ally tower main gui icon // maybe should be sent only on login? + data << uint32(0x9b9) << uint32(0x1); // 11 // add horde tower main gui icon // maybe should be sent only on login? + data << uint32(0x9b5) << uint32(0x0); // 12 // show neutral broken hill icon // 2485 + data << uint32(0x9b4) << uint32(0x1); // 13 // show icon above broken hill // 2484 + data << uint32(0x9b3) << uint32(0x0); // 14 // show ally broken hill icon // 2483 + data << uint32(0x9b2) << uint32(0x0); // 15 // show neutral overlook icon // 2482 + data << uint32(0x9b1) << uint32(0x1); // 16 // show the overlook arrow // 2481 + data << uint32(0x9b0) << uint32(0x0); // 17 // show ally overlook icon // 2480 + data << uint32(0x9ae) << uint32(0x0); // 18 // horde pvp objectives captured // 2478 + data << uint32(0x9ac) << uint32(0x0); // 19 // ally pvp objectives captured // 2476 + data << uint32(2475) << uint32(100); //: ally / horde slider grey area // show only in direct vicinity! + data << uint32(2474) << uint32(50); //: ally / horde slider percentage, 100 for ally, 0 for horde // show only in direct vicinity! + data << uint32(2473) << uint32(0); //: ally / horde slider display // show only in direct vicinity! + data << uint32(0x9a8) << uint32(0x0); // 20 // show the neutral stadium icon // 2472 + data << uint32(0x9a7) << uint32(0x0); // 21 // show the ally stadium icon // 2471 + data << uint32(0x9a6) << uint32(0x1); // 22 // show the horde stadium icon // 2470 + } + } + break; + case 3518: + { + if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(2503) << uint32(0x0); // 10 + data << uint32(2502) << uint32(0x0); // 11 + data << uint32(2493) << uint32(0x0); // 12 + data << uint32(2491) << uint32(0x0); // 13 + + data << uint32(2495) << uint32(0x0); // 14 + data << uint32(2494) << uint32(0x0); // 15 + data << uint32(2497) << uint32(0x0); // 16 + + data << uint32(2762) << uint32(0x0); // 17 + data << uint32(2662) << uint32(0x0); // 18 + data << uint32(2663) << uint32(0x0); // 19 + data << uint32(2664) << uint32(0x0); // 20 + + data << uint32(2760) << uint32(0x0); // 21 + data << uint32(2670) << uint32(0x0); // 22 + data << uint32(2668) << uint32(0x0); // 23 + data << uint32(2669) << uint32(0x0); // 24 + + data << uint32(2761) << uint32(0x0); // 25 + data << uint32(2667) << uint32(0x0); // 26 + data << uint32(2665) << uint32(0x0); // 27 + data << uint32(2666) << uint32(0x0); // 28 + + data << uint32(2763) << uint32(0x0); // 29 + data << uint32(2659) << uint32(0x0); // 30 + data << uint32(2660) << uint32(0x0); // 31 + data << uint32(2661) << uint32(0x0); // 32 + + data << uint32(2671) << uint32(0x0); // 33 + data << uint32(2676) << uint32(0x0); // 34 + data << uint32(2677) << uint32(0x0); // 35 + data << uint32(2672) << uint32(0x0); // 36 + data << uint32(2673) << uint32(0x0); // 37 + } + } break; case 3519: // Terokkar Forest - data << uint32(0xa41) << uint32(0x0); // 10 - data << uint32(0xa40) << uint32(0x14); // 11 - data << uint32(0xa3f) << uint32(0x0); // 12 - data << uint32(0xa3e) << uint32(0x0); // 13 - data << uint32(0xa3d) << uint32(0x5); // 14 - data << uint32(0xa3c) << uint32(0x0); // 15 - data << uint32(0xa87) << uint32(0x0); // 16 - data << uint32(0xa86) << uint32(0x0); // 17 - data << uint32(0xa85) << uint32(0x0); // 18 - data << uint32(0xa84) << uint32(0x0); // 19 - data << uint32(0xa83) << uint32(0x0); // 20 - data << uint32(0xa82) << uint32(0x0); // 21 - data << uint32(0xa81) << uint32(0x0); // 22 - data << uint32(0xa80) << uint32(0x0); // 23 - data << uint32(0xa7e) << uint32(0x0); // 24 - data << uint32(0xa7d) << uint32(0x0); // 25 - data << uint32(0xa7c) << uint32(0x0); // 26 - data << uint32(0xa7b) << uint32(0x0); // 27 - data << uint32(0xa7a) << uint32(0x0); // 28 - data << uint32(0xa79) << uint32(0x0); // 29 - data << uint32(0x9d0) << uint32(0x5); // 30 - data << uint32(0x9ce) << uint32(0x0); // 31 - data << uint32(0x9cd) << uint32(0x0); // 32 - data << uint32(0x9cc) << uint32(0x0); // 33 - data << uint32(0xa88) << uint32(0x0); // 34 - data << uint32(0xad0) << uint32(0x0); // 35 - data << uint32(0xacf) << uint32(0x1); // 36 + { + if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0xa41) << uint32(0x0); // 10 // 2625 capture bar pos + data << uint32(0xa40) << uint32(0x14); // 11 // 2624 capture bar neutral + data << uint32(0xa3f) << uint32(0x0); // 12 // 2623 show capture bar + data << uint32(0xa3e) << uint32(0x0); // 13 // 2622 horde towers controlled + data << uint32(0xa3d) << uint32(0x5); // 14 // 2621 ally towers controlled + data << uint32(0xa3c) << uint32(0x0); // 15 // 2620 show towers controlled + data << uint32(0xa88) << uint32(0x0); // 16 // 2696 SE Neu + data << uint32(0xa87) << uint32(0x0); // 17 // SE Horde + data << uint32(0xa86) << uint32(0x0); // 18 // SE Ally + data << uint32(0xa85) << uint32(0x0); // 19 //S Neu + data << uint32(0xa84) << uint32(0x0); // 20 S Horde + data << uint32(0xa83) << uint32(0x0); // 21 S Ally + data << uint32(0xa82) << uint32(0x0); // 22 NE Neu + data << uint32(0xa81) << uint32(0x0); // 23 NE Horde + data << uint32(0xa80) << uint32(0x0); // 24 NE Ally + data << uint32(0xa7e) << uint32(0x0); // 25 // 2686 N Neu + data << uint32(0xa7d) << uint32(0x0); // 26 N Horde + data << uint32(0xa7c) << uint32(0x0); // 27 N Ally + data << uint32(0xa7b) << uint32(0x0); // 28 NW Ally + data << uint32(0xa7a) << uint32(0x0); // 29 NW Horde + data << uint32(0xa79) << uint32(0x0); // 30 NW Neutral + data << uint32(0x9d0) << uint32(0x5); // 31 // 2512 locked time remaining seconds first digit + data << uint32(0x9ce) << uint32(0x0); // 32 // 2510 locked time remaining seconds second digit + data << uint32(0x9cd) << uint32(0x0); // 33 // 2509 locked time remaining minutes + data << uint32(0x9cc) << uint32(0x0); // 34 // 2508 neutral locked time show + data << uint32(0xad0) << uint32(0x0); // 35 // 2768 horde locked time show + data << uint32(0xacf) << uint32(0x1); // 36 // 2767 ally locked time show + } + } break; case 3521: // Zangarmarsh - data << uint32(0x9e1) << uint32(0x0); // 10 - data << uint32(0x9e0) << uint32(0x0); // 11 - data << uint32(0x9df) << uint32(0x0); // 12 - data << uint32(0xa5d) << uint32(0x1); // 13 - data << uint32(0xa5c) << uint32(0x0); // 14 - data << uint32(0xa5b) << uint32(0x1); // 15 - data << uint32(0xa5a) << uint32(0x0); // 16 - data << uint32(0xa59) << uint32(0x1); // 17 - data << uint32(0xa58) << uint32(0x0); // 18 - data << uint32(0xa57) << uint32(0x0); // 19 - data << uint32(0xa56) << uint32(0x0); // 20 - data << uint32(0xa55) << uint32(0x1); // 21 - data << uint32(0xa54) << uint32(0x0); // 22 - data << uint32(0x9e7) << uint32(0x0); // 23 - data << uint32(0x9e6) << uint32(0x0); // 24 - data << uint32(0x9e5) << uint32(0x0); // 25 - data << uint32(0xa00) << uint32(0x0); // 26 - data << uint32(0x9ff) << uint32(0x1); // 27 - data << uint32(0x9fe) << uint32(0x0); // 28 - data << uint32(0x9fd) << uint32(0x0); // 29 - data << uint32(0x9fc) << uint32(0x1); // 30 - data << uint32(0x9fb) << uint32(0x0); // 31 - data << uint32(0xa62) << uint32(0x0); // 32 - data << uint32(0xa61) << uint32(0x1); // 33 - data << uint32(0xa60) << uint32(0x1); // 34 - data << uint32(0xa5f) << uint32(0x0); // 35 + { + if(pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0x9e1) << uint32(0x0); // 10 //2529 + data << uint32(0x9e0) << uint32(0x0); // 11 + data << uint32(0x9df) << uint32(0x0); // 12 + data << uint32(0xa5d) << uint32(0x1); // 13 //2653 + data << uint32(0xa5c) << uint32(0x0); // 14 //2652 east beacon neutral + data << uint32(0xa5b) << uint32(0x1); // 15 horde + data << uint32(0xa5a) << uint32(0x0); // 16 ally + data << uint32(0xa59) << uint32(0x1); // 17 // 2649 Twin spire graveyard horde 12??? + data << uint32(0xa58) << uint32(0x0); // 18 ally 14 ??? + data << uint32(0xa57) << uint32(0x0); // 19 neutral 7??? + data << uint32(0xa56) << uint32(0x0); // 20 // 2646 west beacon neutral + data << uint32(0xa55) << uint32(0x1); // 21 horde + data << uint32(0xa54) << uint32(0x0); // 22 ally + data << uint32(0x9e7) << uint32(0x0); // 23 // 2535 + data << uint32(0x9e6) << uint32(0x0); // 24 + data << uint32(0x9e5) << uint32(0x0); // 25 + data << uint32(0xa00) << uint32(0x0); // 26 // 2560 + data << uint32(0x9ff) << uint32(0x1); // 27 + data << uint32(0x9fe) << uint32(0x0); // 28 + data << uint32(0x9fd) << uint32(0x0); // 29 + data << uint32(0x9fc) << uint32(0x1); // 30 + data << uint32(0x9fb) << uint32(0x0); // 31 + data << uint32(0xa62) << uint32(0x0); // 32 // 2658 + data << uint32(0xa61) << uint32(0x1); // 33 + data << uint32(0xa60) << uint32(0x1); // 34 + data << uint32(0xa5f) << uint32(0x0); // 35 + } + } break; case 3698: // Nagrand Arena if (bg && bg->GetTypeID() == BATTLEGROUND_NA) @@ -7884,11 +8078,9 @@ void Player::SendTalentWipeConfirm(uint64 guid) { WorldPacket data(MSG_TALENT_WIPE_CONFIRM, (8+4)); data << uint64(guid); - data << uint32(resetTalentsCost()); - if(sWorld.getConfig(CONFIG_NO_RESET_TALENT_COST)) - data << uint32(0); - else - data << uint32(resetTalentsCost()); + uint32 cost = sWorld.getConfig(CONFIG_NO_RESET_TALENT_COST) ? 0 : resetTalentsCost(); + data << cost; + data << cost; GetSession()->SendPacket( &data ); } @@ -11907,7 +12099,7 @@ bool Player::CanCompleteQuest( uint32 quest_id ) if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) { - if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if ( qInfo->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) { for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { @@ -11916,7 +12108,7 @@ bool Player::CanCompleteQuest( uint32 quest_id ) } } - if ( qInfo->HasFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO) ) + if ( qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO) ) { for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { @@ -11928,10 +12120,10 @@ bool Player::CanCompleteQuest( uint32 quest_id ) } } - if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT ) && !q_status.m_explored ) + if ( qInfo->HasFlag( QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT ) && !q_status.m_explored ) return false; - if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) && q_status.m_timer == 0 ) + if ( qInfo->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) && q_status.m_timer == 0 ) return false; if ( qInfo->GetRewOrReqMoney() < 0 ) @@ -11958,7 +12150,7 @@ bool Player::CanCompleteRepeatableQuest( Quest const *pQuest ) if( !CanTakeQuest(pQuest, false) ) return false; - if (pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER) ) + if (pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER) ) for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) if( pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i],pQuest->ReqItemCount[i]) ) return false; @@ -11984,7 +12176,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) return false; // prevent receive reward with quest items in bank - if ( pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) { for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { @@ -12061,13 +12253,13 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) questStatusData.m_status = QUEST_STATUS_INCOMPLETE; questStatusData.m_explored = false; - if ( pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) { for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) questStatusData.m_itemcount[i] = 0; } - if ( pQuest->HasFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO) ) + if ( pQuest->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO) ) { for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) questStatusData.m_creatureOrGOcount[i] = 0; @@ -12080,7 +12272,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver ) SetFactionVisibleForFactionId(pQuest->GetRepObjectiveFaction()); uint32 qtime = 0; - if( pQuest->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) ) + if( pQuest->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) ) { uint32 limittime = pQuest->GetLimitTime(); @@ -12544,7 +12736,7 @@ bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg ) bool Player::SatisfyQuestTimed( Quest const* qInfo, bool msg ) { - if ( (find(m_timedquests.begin(), m_timedquests.end(), qInfo->GetQuestId()) != m_timedquests.end()) && qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED) ) + if ( (find(m_timedquests.begin(), m_timedquests.end(), qInfo->GetQuestId()) != m_timedquests.end()) && qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED) ) { if( msg ) SendCanTakeQuestResponse( INVALIDREASON_QUEST_ONLY_ONE_TIMED ); @@ -12769,7 +12961,7 @@ void Player::SetQuestStatus( uint32 quest_id, QuestStatus status ) { if( status == QUEST_STATUS_NONE || status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE ) { - if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) ) + if( qInfo->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) ) m_timedquests.erase(qInfo->GetQuestId()); } @@ -12782,7 +12974,7 @@ void Player::SetQuestStatus( uint32 quest_id, QuestStatus status ) UpdateForQuestsGO(); } -// not used in MaNGOS, but used in scripting code +// not used in TrinIty, but used in scripting code uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) { Quest const* qInfo = objmgr.GetQuestTemplate(quest_id); @@ -12798,7 +12990,7 @@ uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) void Player::AdjustQuestReqItemCount( Quest const* pQuest ) { - if ( pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if ( pQuest->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) { for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { @@ -12846,7 +13038,7 @@ void Player::AreaExploredOrEventHappens( uint32 questId ) } } -//not used in mangosd, function for external script library +//not used in Trinityd, function for external script library void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject ) { if( Group *pGroup = GetGroup() ) @@ -12878,7 +13070,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count ) continue; Quest const* qInfo = objmgr.GetQuestTemplate(questid); - if( !qInfo || !qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if( !qInfo || !qInfo->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) continue; for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) @@ -12915,7 +13107,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count ) Quest const* qInfo = objmgr.GetQuestTemplate(questid); if ( !qInfo ) continue; - if( !qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) + if( !qInfo->HasFlag( QUEST_TRINITY_FLAGS_DELIVER ) ) continue; for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) @@ -12962,7 +13154,7 @@ void Player::KilledMonster( uint32 entry, uint64 guid ) QuestStatusData& q_status = mQuestStatus[questid]; if( q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->GetType() == QUEST_TYPE_RAID)) { - if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST) ) + if( qInfo->HasFlag( QUEST_TRINITY_FLAGS_KILL_OR_CAST) ) { for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) { @@ -13018,7 +13210,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id ) if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) { - if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST ) ) + if( qInfo->HasFlag( QUEST_TRINITY_FLAGS_KILL_OR_CAST ) ) { for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) { @@ -13085,7 +13277,7 @@ void Player::TalkedToCreature( uint32 entry, uint64 guid ) if ( q_status.m_status == QUEST_STATUS_INCOMPLETE ) { - if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO ) ) + if( qInfo->HasFlag( QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO ) ) { for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) { @@ -13225,6 +13417,7 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive { uint32 questid = pQuest->GetQuestId(); sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid ); + gameeventmgr.HandleQuestComplete(questid); WorldPacket data( SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4+4+pQuest->GetRewItemsCount()*8) ); data << questid; data << uint32(0x03); @@ -13608,7 +13801,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_movementInfo.t_z = fields[22].GetFloat(); m_movementInfo.t_o = fields[23].GetFloat(); - if( !MaNGOS::IsValidMapCoord( + if( !Trinity::IsValidMapCoord( GetPositionX()+m_movementInfo.t_x,GetPositionY()+m_movementInfo.t_y, GetPositionZ()+m_movementInfo.t_z,GetOrientation()+m_movementInfo.t_o) || // transport size limited @@ -14222,7 +14415,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff) mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item); } - std::string subject = GetSession()->GetMangosString(LANG_NOT_EQUIPPED_ITEM); + std::string subject = GetSession()->GetTrinityString(LANG_NOT_EQUIPPED_ITEM); WorldSession::SendMailTo(this, MAIL_NORMAL, MAIL_STATIONERY_GM, GetGUIDLow(), GetGUIDLow(), subject, 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE); } @@ -14387,7 +14580,7 @@ void Player::_LoadQuestStatus(QueryResult *result) time_t quest_time = time_t(fields[4].GetUInt64()); - if( pQuest->HasFlag( QUEST_MANGOS_FLAGS_TIMED ) && !GetQuestRewardStatus(quest_id) && questStatusData.m_status != QUEST_STATUS_NONE ) + if( pQuest->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) && !GetQuestRewardStatus(quest_id) && questStatusData.m_status != QUEST_STATUS_NONE ) { AddTimedQuest( quest_id ); @@ -16212,16 +16405,16 @@ void Player::HandleStealthedUnitsDetection() { std::list<Unit*> stealthedUnits; - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(),GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::AnyStealthedCheck u_check; - MaNGOS::UnitListSearcher<MaNGOS::AnyStealthedCheck > searcher(stealthedUnits, u_check); + Trinity::AnyStealthedCheck u_check; + Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(stealthedUnits, u_check); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyStealthedCheck >, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyStealthedCheck >, GridTypeMapContainer > grid_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyStealthedCheck >, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyStealthedCheck >, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); @@ -16241,7 +16434,7 @@ void Player::HandleStealthedUnitsDetection() (*i)->SendUpdateToPlayer(this); m_clientGUIDs.insert((*i)->GetGUID()); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i)); #endif @@ -17104,7 +17297,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) target->DestroyForPlayer(this); m_clientGUIDs.erase(target->GetGUID()); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) sLog.outDebug("Object %u (Type: %u) out of range for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),GetGUIDLow(),GetDistance(target)); #endif @@ -17118,7 +17311,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) if(target->GetTypeId()!=TYPEID_GAMEOBJECT||!((GameObject*)target)->IsTransport()) m_clientGUIDs.insert(target->GetGUID()); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) sLog.outDebug("Object %u (Type: %u) is visible now for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),GetGUIDLow(),GetDistance(target)); #endif @@ -17157,7 +17350,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& target->BuildOutOfRangeUpdateBlock(&data); m_clientGUIDs.erase(target->GetGUID()); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) sLog.outDebug("Object %u (Type: %u, Entry: %u) is out of range for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),target->GetEntry(),GetGUIDLow(),GetDistance(target)); #endif @@ -17172,7 +17365,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& target->BuildCreateUpdateBlockForPlayer(&data, this); UpdateVisibilityOf_helper(m_clientGUIDs,target); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) sLog.outDebug("Object %u (Type: %u, Entry: %u) is visible now for player %u. Distance = %f",target->GetGUIDLow(),target->GetTypeId(),target->GetEntry(),GetGUIDLow(),GetDistance(target)); #endif @@ -17821,6 +18014,11 @@ void Player::AutoUnequipOffhandIfNeed() } } +OutdoorPvP * Player::GetOutdoorPvP() const +{ + return sOutdoorPvPMgr.GetOutdoorPvPToZoneId(GetZoneId()); +} + bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem) { if(spellInfo->EquippedItemClass < 0) @@ -17961,12 +18159,12 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim) if(member_with_max_level) { - xp = PvP ? 0 : MaNGOS::XP::Gain(member_with_max_level, pVictim); + xp = PvP ? 0 : Trinity::XP::Gain(member_with_max_level, pVictim); // skip in check PvP case (for speed, not used) bool is_raid = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsRaid() && pGroup->isRaidGroup(); bool is_dungeon = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsDungeon(); - float group_rate = MaNGOS::XP::xp_in_group_rate(count,is_raid); + float group_rate = Trinity::XP::xp_in_group_rate(count,is_raid); for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { @@ -18013,7 +18211,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim) } else // if (!pGroup) { - xp = PvP ? 0 : MaNGOS::XP::Gain(this, pVictim); + xp = PvP ? 0 : Trinity::XP::Gain(this, pVictim); // honor can be in PvP and !PvP (racial leader) cases if(RewardHonor(pVictim,1, -1, true)) diff --git a/src/game/Player.h b/src/game/Player.h index 4779ce46baa..4ceb1c01657 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PLAYER_H @@ -45,6 +47,7 @@ class PlayerMenu; class Transport; class UpdateMask; class PlayerSocial; +class OutdoorPvP; typedef std::deque<Mail*> PlayerMails; @@ -832,7 +835,7 @@ struct InstancePlayerBind InstancePlayerBind() : save(NULL), perm(false) {} }; -class MANGOS_DLL_SPEC PlayerTaxi +class TRINITY_DLL_SPEC PlayerTaxi { public: PlayerTaxi(); @@ -883,7 +886,7 @@ class MANGOS_DLL_SPEC PlayerTaxi std::deque<uint32> m_TaxiDestinations; }; -class MANGOS_DLL_SPEC Player : public Unit +class TRINITY_DLL_SPEC Player : public Unit { friend class WorldSession; friend void Item::AddToUpdateQueueOf(Player *player); @@ -1776,7 +1779,7 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateEquipSpellsAtFormChange(); void CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType); - void SendInitWorldStates(); + void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0); void SendUpdateWorldState(uint32 Field, uint32 Value); void SendDirectMessage(WorldPacket *data); @@ -1803,13 +1806,13 @@ class MANGOS_DLL_SPEC Player : public Unit static uint32 GetMaxLevelForBattleGroundQueueId(uint32 queue_id); uint32 GetBattleGroundQueueIdFromLevel() const; - bool InBattleGroundQueue() const - { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) - if (m_bgBattleGroundQueueID[i].bgQueueType != 0) - return true; - return false; - } + bool InBattleGroundQueue() const + { + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + if (m_bgBattleGroundQueueID[i].bgQueueType != 0) + return true; + return false; + } uint32 GetBattleGroundQueueId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueType; } uint32 GetBattleGroundQueueIndex(uint32 bgQueueType) const @@ -1904,6 +1907,14 @@ class MANGOS_DLL_SPEC Player : public Unit bool isAllowUseBattleGroundObject(); /*********************************************************/ + /*** OUTDOOR PVP SYSTEM ***/ + /*********************************************************/ + + OutdoorPvP * GetOutdoorPvP() const; + // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise + bool IsOutdoorPvPActive(); + + /*********************************************************/ /*** REST SYSTEM ***/ /*********************************************************/ diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 413f006b501..ae8367bf61d 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/PlayerDump.h b/src/game/PlayerDump.h index dfcb2e8b528..290ed7fd4f9 100644 --- a/src/game/PlayerDump.h +++ b/src/game/PlayerDump.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PLAYER_DUMP_H diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index 33660fabde9..dba504ba4f3 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "PointMovementGenerator.h" diff --git a/src/game/PointMovementGenerator.h b/src/game/PointMovementGenerator.h index 7127bbecee5..c0fe7c4d78d 100644 --- a/src/game/PointMovementGenerator.h +++ b/src/game/PointMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_POINTMOVEMENTGENERATOR_H -#define MANGOS_POINTMOVEMENTGENERATOR_H +#ifndef TRINITY_POINTMOVEMENTGENERATOR_H +#define TRINITY_POINTMOVEMENTGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" @@ -25,7 +27,7 @@ #include "FollowerReference.h" template<class T> -class MANGOS_DLL_SPEC PointMovementGenerator +class TRINITY_DLL_SPEC PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> > { public: diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index e04c4a909e4..acf41740c8a 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -92,7 +94,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 std::string name = fields[1].GetCppString(); uint32 field = 0; if(name == "") - name = session->GetMangosString(LANG_NON_EXIST_CHARACTER); + name = session->GetTrinityString(LANG_NON_EXIST_CHARACTER); else field = fields[2].GetUInt32(); diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp index f9c73cef4a9..330e848212e 100644 --- a/src/game/QuestDef.cpp +++ b/src/game/QuestDef.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "QuestDef.h" diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index dfa7ec92654..96321ebe9ce 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_QUEST_H -#define MANGOSSERVER_QUEST_H +#ifndef TRINITYCORE_QUEST_H +#define TRINITYCORE_QUEST_H #include "Platform/Define.h" #include "Database/DatabaseEnv.h" @@ -127,16 +129,16 @@ enum __QuestFlags QUEST_FLAGS_TBC_RACES = 2048, // Not used currently: Bloodelf/draenei starting zone quests QUEST_FLAGS_DAILY = 4096, // Used to know quest is Daily one - // Mangos flags for set SpecialFlags in DB if required but used only at server - QUEST_MANGOS_FLAGS_REPEATABLE = 0x010000, // Set by 1 in SpecialFlags from DB - QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT = 0x020000, // Set by 2 in SpecialFlags from DB (if reequired area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script DLL) - QUEST_MANGOS_FLAGS_DB_ALLOWED = 0xFFFF | QUEST_MANGOS_FLAGS_REPEATABLE | QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT, + // Trinity flags for set SpecialFlags in DB if required but used only at server + QUEST_TRINITY_FLAGS_REPEATABLE = 0x010000, // Set by 1 in SpecialFlags from DB + QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT = 0x020000, // Set by 2 in SpecialFlags from DB (if reequired area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script DLL) + QUEST_TRINITY_FLAGS_DB_ALLOWED = 0xFFFF | QUEST_TRINITY_FLAGS_REPEATABLE | QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT, - // Mangos flags for internal use only - QUEST_MANGOS_FLAGS_DELIVER = 0x040000, // Internal flag computed only - QUEST_MANGOS_FLAGS_SPEAKTO = 0x080000, // Internal flag computed only - QUEST_MANGOS_FLAGS_KILL_OR_CAST = 0x100000, // Internal flag computed only - QUEST_MANGOS_FLAGS_TIMED = 0x200000, // Internal flag computed only + // Trinity flags for internal use only + QUEST_TRINITY_FLAGS_DELIVER = 0x040000, // Internal flag computed only + QUEST_TRINITY_FLAGS_SPEAKTO = 0x080000, // Internal flag computed only + QUEST_TRINITY_FLAGS_KILL_OR_CAST = 0x100000, // Internal flag computed only + QUEST_TRINITY_FLAGS_TIMED = 0x200000, // Internal flag computed only }; struct QuestLocale @@ -212,7 +214,7 @@ class Quest uint32 GetCompleteEmote() const { return CompleteEmote; } uint32 GetQuestStartScript() const { return QuestStartScript; } uint32 GetQuestCompleteScript() const { return QuestCompleteScript; } - bool IsRepeatable() const { return QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE; } + bool IsRepeatable() const { return QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE; } bool IsAutoComplete() const { return QuestMethod ? false : true; } uint32 GetFlags() const { return QuestFlags; } bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; } diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 56ff45d7ef1..85a7666b23b 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index a926dd9aa4f..8b0043b5633 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Creature.h" @@ -51,8 +53,8 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature) ny = Y + distanceY; // prevent invalid coordinates generation - MaNGOS::NormalizeMapCoord(nx); - MaNGOS::NormalizeMapCoord(ny); + Trinity::NormalizeMapCoord(nx); + Trinity::NormalizeMapCoord(ny); dist = (nx - X)*(nx - X) + (ny - Y)*(ny - Y); diff --git a/src/game/RandomMovementGenerator.h b/src/game/RandomMovementGenerator.h index 62b836e4261..e52b16fd73e 100644 --- a/src/game/RandomMovementGenerator.h +++ b/src/game/RandomMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_RANDOMMOTIONGENERATOR_H -#define MANGOS_RANDOMMOTIONGENERATOR_H +#ifndef TRINITY_RANDOMMOTIONGENERATOR_H +#define TRINITY_RANDOMMOTIONGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" @@ -25,7 +27,7 @@ template<class T> -class MANGOS_DLL_SPEC RandomMovementGenerator +class TRINITY_DLL_SPEC RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> > { public: diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp index a91af776e6d..f2729e0a1f2 100644 --- a/src/game/ReactorAI.cpp +++ b/src/game/ReactorAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ByteBuffer.h" diff --git a/src/game/ReactorAI.h b/src/game/ReactorAI.h index a64208b89ef..550b1302b5e 100644 --- a/src/game/ReactorAI.h +++ b/src/game/ReactorAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,22 +10,22 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_REACTORAI_H -#define MANGOS_REACTORAI_H +#ifndef TRINITY_REACTORAI_H +#define TRINITY_REACTORAI_H #include "CreatureAI.h" class Unit; -class MANGOS_DLL_DECL ReactorAI : public CreatureAI +class TRINITY_DLL_DECL ReactorAI : public CreatureAI { public: diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp index c3021958804..bb76fe0beca 100644 --- a/src/game/ScriptCalls.cpp +++ b/src/game/ScriptCalls.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef WIN32 @@ -31,7 +33,7 @@ void UnloadScriptingModule() { //todo: some check if some func from script library is called right now Script->ScriptsFree(); - MANGOS_CLOSE_LIBRARY(Script->hScriptsLib); + TRINITY_CLOSE_LIBRARY(Script->hScriptsLib); delete Script; Script = NULL; } @@ -41,10 +43,10 @@ bool LoadScriptingModule(char const* libName) { ScriptsSet testScript=new _ScriptSet; - std::string name = strlen(libName) ? libName : MANGOS_SCRIPT_NAME; - name += MANGOS_SCRIPT_EXT; + std::string name = strlen(libName) ? libName : TRINITY_SCRIPT_NAME; + name += TRINITY_SCRIPT_EXT; - testScript->hScriptsLib=MANGOS_LOAD_LIBRARY(name.c_str()); + testScript->hScriptsLib=TRINITY_LOAD_LIBRARY(name.c_str()); if(!testScript->hScriptsLib ) { @@ -53,31 +55,31 @@ bool LoadScriptingModule(char const* libName) return false; } - if( !(testScript->ScriptsInit =(scriptCallScriptsInit )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" )) - ||!(testScript->ScriptsFree =(scriptCallScriptsFree )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" )) - ||!(testScript->GossipHello =(scriptCallGossipHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" )) - ||!(testScript->GOChooseReward =(scriptCallGOChooseReward )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" )) - ||!(testScript->QuestAccept =(scriptCallQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" )) - ||!(testScript->GossipSelect =(scriptCallGossipSelect )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect" )) - ||!(testScript->GossipSelectWithCode=(scriptCallGossipSelectWithCode)MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelectWithCode")) - ||!(testScript->QuestSelect =(scriptCallQuestSelect )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestSelect" )) - ||!(testScript->QuestComplete =(scriptCallQuestComplete )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestComplete" )) - ||!(testScript->NPCDialogStatus =(scriptCallNPCDialogStatus )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"NPCDialogStatus" )) - ||!(testScript->GODialogStatus =(scriptCallGODialogStatus )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GODialogStatus" )) - ||!(testScript->ChooseReward =(scriptCallChooseReward )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ChooseReward" )) - ||!(testScript->ItemHello =(scriptCallItemHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemHello" )) - ||!(testScript->GOHello =(scriptCallGOHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOHello" )) - ||!(testScript->scriptAreaTrigger =(scriptCallAreaTrigger )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"AreaTrigger" )) - ||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" )) - ||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" )) - ||!(testScript->ReceiveEmote =(scriptCallReceiveEmote )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ReceiveEmote" )) - ||!(testScript->ItemUse =(scriptCallItemUse )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" )) - ||!(testScript->GetAI =(scriptCallGetAI )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GetAI" )) - ||!(testScript->CreateInstanceData =(scriptCallCreateInstanceData )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"CreateInstanceData" )) + if( !(testScript->ScriptsInit =(scriptCallScriptsInit )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" )) + ||!(testScript->ScriptsFree =(scriptCallScriptsFree )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" )) + ||!(testScript->GossipHello =(scriptCallGossipHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" )) + ||!(testScript->GOChooseReward =(scriptCallGOChooseReward )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" )) + ||!(testScript->QuestAccept =(scriptCallQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" )) + ||!(testScript->GossipSelect =(scriptCallGossipSelect )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect" )) + ||!(testScript->GossipSelectWithCode=(scriptCallGossipSelectWithCode)TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelectWithCode")) + ||!(testScript->QuestSelect =(scriptCallQuestSelect )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestSelect" )) + ||!(testScript->QuestComplete =(scriptCallQuestComplete )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"QuestComplete" )) + ||!(testScript->NPCDialogStatus =(scriptCallNPCDialogStatus )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"NPCDialogStatus" )) + ||!(testScript->GODialogStatus =(scriptCallGODialogStatus )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GODialogStatus" )) + ||!(testScript->ChooseReward =(scriptCallChooseReward )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ChooseReward" )) + ||!(testScript->ItemHello =(scriptCallItemHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemHello" )) + ||!(testScript->GOHello =(scriptCallGOHello )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOHello" )) + ||!(testScript->scriptAreaTrigger =(scriptCallAreaTrigger )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"AreaTrigger" )) + ||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" )) + ||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" )) + ||!(testScript->ReceiveEmote =(scriptCallReceiveEmote )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ReceiveEmote" )) + ||!(testScript->ItemUse =(scriptCallItemUse )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" )) + ||!(testScript->GetAI =(scriptCallGetAI )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GetAI" )) + ||!(testScript->CreateInstanceData =(scriptCallCreateInstanceData )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"CreateInstanceData" )) ) { printf("Error loading Scripts Library %s !\n Library missing required functions.",name.c_str()); - MANGOS_CLOSE_LIBRARY(testScript->hScriptsLib); + TRINITY_CLOSE_LIBRARY(testScript->hScriptsLib); delete testScript; return false; } diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h index 07c415497ad..9e18b65d389 100644 --- a/src/game/ScriptCalls.h +++ b/src/game/ScriptCalls.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __SCRIPT_CALLS_H @@ -35,28 +37,28 @@ class InstanceData; bool LoadScriptingModule(char const* libName = ""); void UnloadScriptingModule(); -typedef void(MANGOS_IMPORT * scriptCallScriptsInit) (); -typedef void(MANGOS_IMPORT * scriptCallScriptsFree) (); +typedef void(TRINITY_IMPORT * scriptCallScriptsInit) (); +typedef void(TRINITY_IMPORT * scriptCallScriptsFree) (); -typedef bool(MANGOS_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature ); -typedef bool(MANGOS_IMPORT * scriptCallQuestAccept) (Player *player, Creature *_Creature, Quest const *); -typedef bool(MANGOS_IMPORT * scriptCallGossipSelect)(Player *player, Creature *_Creature, uint32 sender, uint32 action); -typedef bool(MANGOS_IMPORT * scriptCallGossipSelectWithCode)( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ); -typedef bool(MANGOS_IMPORT * scriptCallQuestSelect)( Player *player, Creature *_Creature, Quest const* ); -typedef bool(MANGOS_IMPORT * scriptCallQuestComplete)(Player *player, Creature *_Creature, Quest const*); -typedef uint32(MANGOS_IMPORT * scriptCallNPCDialogStatus)( Player *player, Creature *_Creature); -typedef uint32(MANGOS_IMPORT * scriptCallGODialogStatus)( Player *player, GameObject * _GO); -typedef bool(MANGOS_IMPORT * scriptCallChooseReward)( Player *player, Creature *_Creature, Quest const*, uint32 opt ); -typedef bool(MANGOS_IMPORT * scriptCallItemHello)( Player *player, Item *, Quest const*); -typedef bool(MANGOS_IMPORT * scriptCallGOHello)( Player *player, GameObject * ); -typedef bool(MANGOS_IMPORT * scriptCallAreaTrigger)( Player *player, AreaTriggerEntry const* ); -typedef bool(MANGOS_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *, Quest const*); -typedef bool(MANGOS_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*); -typedef bool(MANGOS_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt ); -typedef bool(MANGOS_IMPORT * scriptCallReceiveEmote) ( Player *player, Creature *_Creature, uint32 emote ); -typedef bool(MANGOS_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets); -typedef CreatureAI* (MANGOS_IMPORT * scriptCallGetAI) ( Creature *_Creature ); -typedef InstanceData* (MANGOS_IMPORT * scriptCallCreateInstanceData) (Map *map); +typedef bool(TRINITY_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature ); +typedef bool(TRINITY_IMPORT * scriptCallQuestAccept) (Player *player, Creature *_Creature, Quest const *); +typedef bool(TRINITY_IMPORT * scriptCallGossipSelect)(Player *player, Creature *_Creature, uint32 sender, uint32 action); +typedef bool(TRINITY_IMPORT * scriptCallGossipSelectWithCode)( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ); +typedef bool(TRINITY_IMPORT * scriptCallQuestSelect)( Player *player, Creature *_Creature, Quest const* ); +typedef bool(TRINITY_IMPORT * scriptCallQuestComplete)(Player *player, Creature *_Creature, Quest const*); +typedef uint32(TRINITY_IMPORT * scriptCallNPCDialogStatus)( Player *player, Creature *_Creature); +typedef uint32(TRINITY_IMPORT * scriptCallGODialogStatus)( Player *player, GameObject * _GO); +typedef bool(TRINITY_IMPORT * scriptCallChooseReward)( Player *player, Creature *_Creature, Quest const*, uint32 opt ); +typedef bool(TRINITY_IMPORT * scriptCallItemHello)( Player *player, Item *, Quest const*); +typedef bool(TRINITY_IMPORT * scriptCallGOHello)( Player *player, GameObject * ); +typedef bool(TRINITY_IMPORT * scriptCallAreaTrigger)( Player *player, AreaTriggerEntry const* ); +typedef bool(TRINITY_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *, Quest const*); +typedef bool(TRINITY_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*); +typedef bool(TRINITY_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt ); +typedef bool(TRINITY_IMPORT * scriptCallReceiveEmote) ( Player *player, Creature *_Creature, uint32 emote ); +typedef bool(TRINITY_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets); +typedef CreatureAI* (TRINITY_IMPORT * scriptCallGetAI) ( Creature *_Creature ); +typedef InstanceData* (TRINITY_IMPORT * scriptCallCreateInstanceData) (Map *map); typedef struct { @@ -83,7 +85,7 @@ typedef struct scriptCallGetAI GetAI; scriptCallCreateInstanceData CreateInstanceData; - MANGOS_LIBRARY_HANDLE hScriptsLib; + TRINITY_LIBRARY_HANDLE hScriptsLib; }_ScriptSet,*ScriptsSet; extern ScriptsSet Script; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index ab04389601b..b9348b5f568 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SHAREDDEFINES_H -#define MANGOS_SHAREDDEFINES_H +#ifndef TRINITY_SHAREDDEFINES_H +#define TRINITY_SHAREDDEFINES_H #include "Platform/Define.h" #include <cassert> diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index 388d06ad184..02b3119adb1 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Database/DatabaseEnv.h" diff --git a/src/game/SkillDiscovery.h b/src/game/SkillDiscovery.h index 6a7a16c3849..f82498a8eb4 100644 --- a/src/game/SkillDiscovery.h +++ b/src/game/SkillDiscovery.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SKILLDISCOVERY_H -#define MANGOS_SKILLDISCOVERY_H +#ifndef TRINITY_SKILLDISCOVERY_H +#define TRINITY_SKILLDISCOVERY_H #include "Common.h" diff --git a/src/game/SkillExtraItems.cpp b/src/game/SkillExtraItems.cpp index 42e465be41d..15b73253e46 100644 --- a/src/game/SkillExtraItems.cpp +++ b/src/game/SkillExtraItems.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SkillExtraItems.h" diff --git a/src/game/SkillExtraItems.h b/src/game/SkillExtraItems.h index 51d34da40dd..0a19272864d 100644 --- a/src/game/SkillExtraItems.h +++ b/src/game/SkillExtraItems.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SKILL_EXTRA_ITEMS_H -#define MANGOS_SKILL_EXTRA_ITEMS_H +#ifndef TRINITY_SKILL_EXTRA_ITEMS_H +#define TRINITY_SKILL_EXTRA_ITEMS_H #include "Common.h" diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp index 18016018ecd..00941c98636 100644 --- a/src/game/SkillHandler.cpp +++ b/src/game/SkillHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index 1f01c6ee1f6..f8935a2e856 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SocialMgr.h" diff --git a/src/game/SocialMgr.h b/src/game/SocialMgr.h index 332ddafa51d..9f9103f98e4 100644 --- a/src/game/SocialMgr.h +++ b/src/game/SocialMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __MANGOS_SOCIALMGR_H -#define __MANGOS_SOCIALMGR_H +#ifndef __TRINITY_SOCIALMGR_H +#define __TRINITY_SOCIALMGR_H #include "Policies/Singleton.h" #include "Database/DatabaseEnv.h" @@ -149,5 +151,5 @@ class SocialMgr SocialMap m_socialMap; }; -#define sSocialMgr MaNGOS::Singleton<SocialMgr>::Instance() +#define sSocialMgr Trinity::Singleton<SocialMgr>::Instance() #endif diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 70459c0e670..5dbe5c7c9ea 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -183,7 +185,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) return false; *data >> m_srcX >> m_srcY >> m_srcZ; - if(!MaNGOS::IsValidMapCoord(m_srcX, m_srcY, m_srcZ)) + if(!Trinity::IsValidMapCoord(m_srcX, m_srcY, m_srcZ)) return false; } @@ -193,7 +195,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) return false; *data >> m_destX >> m_destY >> m_destZ; - if(!MaNGOS::IsValidMapCoord(m_destX, m_destY, m_destZ)) + if(!Trinity::IsValidMapCoord(m_destX, m_destY, m_destZ)) return false; } @@ -463,23 +465,23 @@ void Spell::FillTargetMap() SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); float max_range = GetSpellMaxRange(srange); - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); WorldObject* result = NULL; - MaNGOS::CannibalizeObjectCheck u_check(m_caster, max_range); - MaNGOS::WorldObjectSearcher<MaNGOS::CannibalizeObjectCheck > searcher(result, u_check); + Trinity::CannibalizeObjectCheck u_check(m_caster, max_range); + Trinity::WorldObjectSearcher<Trinity::CannibalizeObjectCheck > searcher(result, u_check); - TypeContainerVisitor<MaNGOS::WorldObjectSearcher<MaNGOS::CannibalizeObjectCheck >, GridTypeMapContainer > grid_searcher(searcher); + TypeContainerVisitor<Trinity::WorldObjectSearcher<Trinity::CannibalizeObjectCheck >, GridTypeMapContainer > grid_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); if(!result) { - TypeContainerVisitor<MaNGOS::WorldObjectSearcher<MaNGOS::CannibalizeObjectCheck >, WorldTypeMapContainer > world_searcher(searcher); + TypeContainerVisitor<Trinity::WorldObjectSearcher<Trinity::CannibalizeObjectCheck >, WorldTypeMapContainer > world_searcher(searcher); cell_lock->Visit(cell_lock, world_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); } @@ -1201,7 +1203,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) unMaxTargets = EffectChainTarget; float max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS; - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1209,11 +1211,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) std::list<Unit *> tempUnitMap; { - MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(m_caster, m_caster, max_range); - MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(tempUnitMap, u_check); + Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(m_caster, m_caster, max_range); + Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(tempUnitMap, u_check); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1297,7 +1299,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) //FIXME: This very like horrible hack and wrong for most spells max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS; - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1308,11 +1310,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) std::list<Unit *> tempUnitMap; { - MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range); - MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(tempUnitMap, u_check); + Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range); + Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(tempUnitMap, u_check); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1362,15 +1364,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) // targets the ground, not the units in the area if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) { - CellPair p(MaNGOS::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); + CellPair p(Trinity::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1445,15 +1447,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) }break; case TARGET_ALL_AROUND_CASTER: { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_SELF_CENTER,SPELL_TARGETS_AOE_DAMAGE); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_SELF_CENTER,SPELL_TARGETS_AOE_DAMAGE); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1461,15 +1463,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) }break; case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER: { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_SELF_CENTER,SPELL_TARGETS_FRIENDLY); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_SELF_CENTER,SPELL_TARGETS_FRIENDLY); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1477,15 +1479,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) }break; case TARGET_ALL_FRIENDLY_UNITS_IN_AREA: { - CellPair p(MaNGOS::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); + CellPair p(Trinity::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_FRIENDLY); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_FRIENDLY); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1553,16 +1555,16 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) }break; case TARGET_IN_FRONT_OF_CASTER: { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); bool inFront = m_spellInfo->SpellVisual != 3879; - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, inFront ? PUSH_IN_FRONT : PUSH_IN_BACK,SPELL_TARGETS_AOE_DAMAGE); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, inFront ? PUSH_IN_FRONT : PUSH_IN_BACK,SPELL_TARGETS_AOE_DAMAGE); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1604,15 +1606,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) // targets the ground, not the units in the area if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1723,15 +1725,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) std::list<Unit *> tempUnitMap; { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, tempUnitMap, max_range, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, tempUnitMap, max_range, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1791,13 +1793,13 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA_INSTANT) { - CellPair p(MaNGOS::ComputeCellPair(currentTarget->GetPositionX(), currentTarget->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(currentTarget->GetPositionX(), currentTarget->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius,PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius,PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); cell_lock->Visit(cell_lock, grid_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -1840,7 +1842,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) // if B==TARGET_TABLE_X_Y_Z_COORDINATES then A already fill all required targets if (m_spellInfo->EffectImplicitTargetB[i] && m_spellInfo->EffectImplicitTargetB[i]!=TARGET_TABLE_X_Y_Z_COORDINATES) { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1850,10 +1852,10 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) if (IsPositiveEffect(m_spellInfo->Id, i)) targetB = SPELL_TARGETS_FRIENDLY; - MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius,PUSH_DEST_CENTER, targetB); + Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius,PUSH_DEST_CENTER, targetB); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier); - TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier); + TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -3364,14 +3366,14 @@ uint8 Spell::CanCast(bool strict) if(i_spellST->second.targetEntry) { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*m_caster,i_spellST->second.targetEntry,range); - MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(p_GameObject,go_check); + Trinity::NearestGameObjectEntryInObjectRangeCheck go_check(*m_caster,i_spellST->second.targetEntry,range); + Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> checker(p_GameObject,go_check); - TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -3401,15 +3403,15 @@ uint8 Spell::CanCast(bool strict) { Creature *p_Creature = NULL; - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); // Really don't know what is that??? - MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type!=SPELL_TARGET_TYPE_DEAD,range); - MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(p_Creature, u_check); + Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type!=SPELL_TARGET_TYPE_DEAD,range); + Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(p_Creature, u_check); - TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); + TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); @@ -4439,15 +4441,15 @@ uint8 Spell::CheckItems() if(m_spellInfo->RequiresSpellFocus) { - CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; GameObject* ok = NULL; - MaNGOS::GameObjectFocusCheck go_check(m_caster,m_spellInfo->RequiresSpellFocus); - MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(ok,go_check); + Trinity::GameObjectFocusCheck go_check(m_caster,m_spellInfo->RequiresSpellFocus); + Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> checker(ok,go_check); - TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); diff --git a/src/game/Spell.h b/src/game/Spell.h index 4384ab256e0..688dd5fb412 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __SPELL_H @@ -78,7 +80,7 @@ enum SpellNotifyPushType bool IsQuestTameSpell(uint32 spellId); -namespace MaNGOS +namespace Trinity { struct SpellNotifierPlayer; struct SpellNotifierCreatureAndPlayer; @@ -184,8 +186,8 @@ typedef std::multimap<uint64, uint64> SpellTargetTimeMap; class Spell { - friend struct MaNGOS::SpellNotifierPlayer; - friend struct MaNGOS::SpellNotifierCreatureAndPlayer; + friend struct Trinity::SpellNotifierPlayer; + friend struct Trinity::SpellNotifierCreatureAndPlayer; public: void EffectNULL(uint32 ); @@ -533,9 +535,9 @@ enum SpellTargets SPELL_TARGETS_AOE_DAMAGE }; -namespace MaNGOS +namespace Trinity { - struct MANGOS_DLL_DECL SpellNotifierPlayer + struct TRINITY_DLL_DECL SpellNotifierPlayer { std::list<Unit*> &i_data; Spell &i_spell; @@ -570,7 +572,7 @@ namespace MaNGOS template<class SKIP> void Visit(GridRefManager<SKIP> &) {} }; - struct MANGOS_DLL_DECL SpellNotifierCreatureAndPlayer + struct TRINITY_DLL_DECL SpellNotifierCreatureAndPlayer { std::list<Unit*> *i_data; Spell &i_spell; diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index e9dbbb12adf..7db60d335a2 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SPELLAURADEFINES_H -#define MANGOS_SPELLAURADEFINES_H +#ifndef TRINITY_SPELLAURADEFINES_H +#define TRINITY_SPELLAURADEFINES_H #define MAX_AURAS 56 #define MAX_POSITIVE_AURAS 40 diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 474ec7ea04d..c536531ff14 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -40,6 +42,8 @@ #include "Creature.h" #include "Formulas.h" #include "BattleGround.h" +#include "OutdoorPvP.h" +#include "OutdoorPvPMgr.h" #include "CreatureAI.h" #include "Util.h" #include "GridNotifiers.h" @@ -662,15 +666,15 @@ void AreaAura::Update(uint32 diff) } case AREA_AURA_FRIEND: { - CellPair p(MaNGOS::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(caster, owner, m_radius); - MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, u_check); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(caster, owner, m_radius); + Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, u_check); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); @@ -678,15 +682,15 @@ void AreaAura::Update(uint32 diff) } case AREA_AURA_ENEMY: { - CellPair p(MaNGOS::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(caster, owner, m_radius); // No GetCharmer in searcher - MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(targets, u_check); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(caster, owner, m_radius); // No GetCharmer in searcher + Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(targets, u_check); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); @@ -2811,7 +2815,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) // Soul Shard only from non-grey units if( spellInfo->EffectItemType[m_effIndex] == 6265 && - (victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) || + (victim->getLevel() <= Trinity::XP::GetGrayLevel(caster->getLevel()) || victim->GetTypeId()==TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim)) ) return; ItemPosCountVec dest; @@ -3262,10 +3266,18 @@ void Aura::HandleModStealth(bool apply, bool Real) { if(apply) { - // drop flag at stealth in bg - if(Real && m_target->GetTypeId()==TYPEID_PLAYER && ((Player*)m_target)->InBattleGround()) - if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) - bg->EventPlayerDroppedFlag((Player*)m_target); + if(Real && m_target->GetTypeId()==TYPEID_PLAYER) + { + // drop flag at stealth in bg + if(((Player*)m_target)->InBattleGround()) + { + if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) + bg->EventPlayerDroppedFlag((Player*)m_target); + } + // remove player from the objective's active player count at stealth + if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) + pvp->HandlePlayerActivityChanged((Player*)m_target); + } // only at real aura add if(Real) @@ -3309,7 +3321,12 @@ void Aura::HandleModStealth(bool apply, bool Real) m_target->SetVisibility(VISIBILITY_GROUP_INVISIBILITY); } else + { m_target->SetVisibility(VISIBILITY_ON); + if(m_target->GetTypeId() == TYPEID_PLAYER) + if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) + pvp->HandlePlayerActivityChanged((Player*)m_target); + } } } } @@ -3342,6 +3359,9 @@ void Aura::HandleInvisibility(bool apply, bool Real) { // apply glow vision m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); + // remove player from the objective's active player count at invisibility + if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) + pvp->HandlePlayerActivityChanged((Player*)m_target); // drop flag at invisible in bg if(((Player*)m_target)->InBattleGround()) @@ -3377,7 +3397,12 @@ void Aura::HandleInvisibility(bool apply, bool Real) { // if have stealth aura then already have stealth visibility if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) + { m_target->SetVisibility(VISIBILITY_ON); + if(m_target->GetTypeId() == TYPEID_PLAYER) + if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) + pvp->HandlePlayerActivityChanged((Player*)m_target); + } } } } @@ -3819,6 +3844,8 @@ void Aura::HandleAuraModEffectImmunity(bool apply, bool Real) } } } + else + sOutdoorPvPMgr.HandleDropFlag((Player*)m_target,GetSpellProto()->Id); } } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 54beccf9dbf..3d8fbc4b340 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_SPELLAURAS_H -#define MANGOS_SPELLAURAS_H +#ifndef TRINITY_SPELLAURAS_H +#define TRINITY_SPELLAURAS_H #include "SpellAuraDefines.h" @@ -55,11 +57,11 @@ typedef void(Aura::*pAuraHandler)(bool Apply, bool Real); // (percent auras, stats mods, etc) // Second rule: Code must be guarded by if(Real) check if it modifies object state (start/stop attack, send packets to client, etc) // -// Other case choice: each code line moved under if(Real) check is mangos speedup, -// each setting object update field code line moved under if(Real) check is significant mangos speedup, and less server->client data sends -// each packet sending code moved under if(Real) check is _large_ mangos speedup, and lot less server->client data sends +// Other case choice: each code line moved under if(Real) check is Trinity speedup, +// each setting object update field code line moved under if(Real) check is significant Trinity speedup, and less server->client data sends +// each packet sending code moved under if(Real) check is _large_ Trinity speedup, and lot less server->client data sends -class MANGOS_DLL_SPEC Aura +class TRINITY_DLL_SPEC Aura { friend Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem); @@ -340,7 +342,7 @@ class MANGOS_DLL_SPEC Aura void SetAuraApplication(uint32 slot, int8 count); }; -class MANGOS_DLL_SPEC AreaAura : public Aura +class TRINITY_DLL_SPEC AreaAura : public Aura { public: AreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); @@ -351,7 +353,7 @@ class MANGOS_DLL_SPEC AreaAura : public Aura AreaAuraType m_areaAuraType; }; -class MANGOS_DLL_SPEC PersistentAreaAura : public Aura +class TRINITY_DLL_SPEC PersistentAreaAura : public Aura { public: PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); @@ -359,7 +361,7 @@ class MANGOS_DLL_SPEC PersistentAreaAura : public Aura void Update(uint32 diff); }; -class MANGOS_DLL_SPEC SingleEnemyTargetAura : public Aura +class TRINITY_DLL_SPEC SingleEnemyTargetAura : public Aura { friend Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 9a37b07ee4f..c8f5c91156a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -48,6 +50,7 @@ #include "BattleGround.h" #include "BattleGroundEY.h" #include "BattleGroundWS.h" +#include "OutdoorPvPMgr.h" #include "VMapFactory.h" #include "Language.h" #include "SocialMgr.h" @@ -220,7 +223,7 @@ void Spell::EffectNULL(uint32 /*i*/) void Spell::EffectUnused(uint32 /*i*/) { - // NOT USED BY ANY SPELL OR USELESS OR IMPLEMENTED IN DIFFERENT WAY IN MANGOS + // NOT USED BY ANY SPELL OR USELESS OR IMPLEMENTED IN DIFFERENT WAY IN TRINITY } void Spell::EffectResurrectNew(uint32 i) @@ -2861,6 +2864,10 @@ void Spell::EffectOpenLock(uint32 /*i*/) return; } } + // handle outdoor pvp object opening, return true if go was registered for handling + // these objects must have been spawned by outdoorpvp! + else if(gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr.HandleOpenGo(player, gameObjTarget->GetGUID())) + return; lockId = gameObjTarget->GetLockId(); guid = gameObjTarget->GetGUID(); } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 7bad99b38b5..3937d4a83b4 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fc8c5d43b7b..617a39f770a 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SpellMgr.h" diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 7e8ffc82564..1205f56591a 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SPELLMGR_H diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index eda78f95033..8ab1c38534f 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Unit.h" diff --git a/src/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp index cc4f7b7b869..fc15e464fbe 100644 --- a/src/game/TargetedMovementGenerator.cpp +++ b/src/game/TargetedMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ByteBuffer.h" diff --git a/src/game/TargetedMovementGenerator.h b/src/game/TargetedMovementGenerator.h index 725f07224ba..8233ef7f76a 100644 --- a/src/game/TargetedMovementGenerator.h +++ b/src/game/TargetedMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,23 +10,23 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TARGETEDMOVEMENTGENERATOR_H -#define MANGOS_TARGETEDMOVEMENTGENERATOR_H +#ifndef TRINITY_TARGETEDMOVEMENTGENERATOR_H +#define TRINITY_TARGETEDMOVEMENTGENERATOR_H #include "MovementGenerator.h" #include "DestinationHolder.h" #include "Traveller.h" #include "FollowerReference.h" -class MANGOS_DLL_SPEC TargetedMovementGeneratorBase +class TRINITY_DLL_SPEC TargetedMovementGeneratorBase { public: TargetedMovementGeneratorBase(Unit &target) { i_target.link(&target, this); } @@ -34,7 +36,7 @@ class MANGOS_DLL_SPEC TargetedMovementGeneratorBase }; template<class T> -class MANGOS_DLL_SPEC TargetedMovementGenerator +class TRINITY_DLL_SPEC TargetedMovementGenerator : public MovementGeneratorMedium< T, TargetedMovementGenerator<T> >, public TargetedMovementGeneratorBase { public: diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index e804bec8463..88dfd7853bf 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 130c4a7904a..9974cd8a59c 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "TemporarySummon.h" diff --git a/src/game/TemporarySummon.h b/src/game/TemporarySummon.h index 8007b853938..22fd6f21ea3 100644 --- a/src/game/TemporarySummon.h +++ b/src/game/TemporarySummon.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_TEMPSUMMON_H -#define MANGOSSERVER_TEMPSUMMON_H +#ifndef TRINITYCORE_TEMPSUMMON_H +#define TRINITYCORE_TEMPSUMMON_H #include "Creature.h" #include "ObjectAccessor.h" diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index b9fd7a44f87..ab6e02801c9 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ThreatManager.h" diff --git a/src/game/ThreatManager.h b/src/game/ThreatManager.h index ab0270645f7..643f7beaed4 100644 --- a/src/game/ThreatManager.h +++ b/src/game/ThreatManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _THREATMANAGER @@ -44,7 +46,7 @@ class ThreatCalcHelper //============================================================== -class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager> +class TRINITY_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager> { private: float iThreat; @@ -128,7 +130,7 @@ class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager> //============================================================== class ThreatManager; -class MANGOS_DLL_SPEC ThreatContainer +class TRINITY_DLL_SPEC ThreatContainer { private: std::list<HostilReference*> iThreatList; @@ -166,7 +168,7 @@ class MANGOS_DLL_SPEC ThreatContainer //================================================= -class MANGOS_DLL_SPEC ThreatManager +class TRINITY_DLL_SPEC ThreatManager { private: HostilReference* iCurrentVictim; diff --git a/src/game/Tools.h b/src/game/Tools.h index d9615b7df63..0763e0c5812 100644 --- a/src/game/Tools.h +++ b/src/game/Tools.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TOOLS_H -#define MANGOS_TOOLS_H +#ifndef TRINITY_TOOLS_H +#define TRINITY_TOOLS_H #include "Common.h" #include "WorldPacket.h" diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 5415e4dbe87..a891087d4ac 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Totem.h" diff --git a/src/game/Totem.h b/src/game/Totem.h index 34bf440c68e..442cef809b9 100644 --- a/src/game/Totem.h +++ b/src/game/Totem.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_TOTEM_H -#define MANGOSSERVER_TOTEM_H +#ifndef TRINITYCORE_TOTEM_H +#define TRINITYCORE_TOTEM_H #include "Creature.h" diff --git a/src/game/TotemAI.cpp b/src/game/TotemAI.cpp index 8fc038a8946..fa49a25a096 100644 --- a/src/game/TotemAI.cpp +++ b/src/game/TotemAI.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "TotemAI.h" @@ -80,17 +82,17 @@ TotemAI::UpdateAI(const uint32 /*diff*/) !victim->isTargetableForAttack() || !i_totem.IsWithinDistInMap(victim, max_range) || i_totem.IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(&i_totem,false) ) { - CellPair p(MaNGOS::ComputeCellPair(i_totem.GetPositionX(),i_totem.GetPositionY())); + CellPair p(Trinity::ComputeCellPair(i_totem.GetPositionX(),i_totem.GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; victim = NULL; - MaNGOS::NearestAttackableUnitInObjectRangeCheck u_check(&i_totem, &i_totem, max_range); - MaNGOS::UnitLastSearcher<MaNGOS::NearestAttackableUnitInObjectRangeCheck> checker(victim, u_check); + Trinity::NearestAttackableUnitInObjectRangeCheck u_check(&i_totem, &i_totem, max_range); + Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(victim, u_check); - TypeContainerVisitor<MaNGOS::UnitLastSearcher<MaNGOS::NearestAttackableUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); - TypeContainerVisitor<MaNGOS::UnitLastSearcher<MaNGOS::NearestAttackableUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); + TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); + TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(i_totem.GetMapId(), &i_totem)); diff --git a/src/game/TotemAI.h b/src/game/TotemAI.h index e113ac441a1..84c111d537f 100644 --- a/src/game/TotemAI.h +++ b/src/game/TotemAI.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TOTEMAI_H -#define MANGOS_TOTEMAI_H +#ifndef TRINITY_TOTEMAI_H +#define TRINITY_TOTEMAI_H #include "CreatureAI.h" #include "Timer.h" @@ -25,7 +27,7 @@ class Creature; class Totem; -class MANGOS_DLL_DECL TotemAI : public CreatureAI +class TRINITY_DLL_DECL TotemAI : public CreatureAI { public: diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index a8abe3a8cf2..387b2eef87c 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index be5fa09606f..53bbae3b016 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/Transports.h b/src/game/Transports.h index e104012c850..6a7b9760d61 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef TRANSPORTS_H diff --git a/src/game/Traveller.h b/src/game/Traveller.h index 07a02bb3056..4d2b641a37c 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TRAVELLER_H -#define MANGOS_TRAVELLER_H +#ifndef TRINITY_TRAVELLER_H +#define TRINITY_TRAVELLER_H #include "MapManager.h" #include "Creature.h" @@ -30,7 +32,7 @@ #define PLAYER_FLIGHT_SPEED 32.0f template<class T> -struct MANGOS_DLL_DECL Traveller +struct TRINITY_DLL_DECL Traveller { T &i_traveller; Traveller(T &t) : i_traveller(t) {} diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c72d88c24ad..763ae5daf4c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -39,6 +41,7 @@ #include "Util.h" #include "Totem.h" #include "BattleGround.h" +#include "OutdoorPvP.h" #include "InstanceSaveMgr.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" @@ -634,6 +637,24 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if(!spiritOfRedemtionTalentReady) pVictim->setDeathState(JUST_DIED); + // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh... + // handle player kill only if not suicide (spirit of redemption for example) + if(GetTypeId() == TYPEID_PLAYER && this != pVictim) + { + if(OutdoorPvP * pvp = ((Player*)this)->GetOutdoorPvP()) + { + pvp->HandleKill((Player*)this,pVictim); + } + } + + if(pVictim->GetTypeId() == TYPEID_PLAYER) + { + if(OutdoorPvP * pvp = ((Player*)pVictim)->GetOutdoorPvP()) + { + pvp->HandlePlayerActivityChanged((Player*)pVictim); + } + } + DEBUG_LOG("DealDamageHealth1"); if(spiritOfRedemtionTalentReady) @@ -10567,7 +10588,7 @@ void Unit::UpdateReactives( uint32 p_time ) Unit* Unit::SelectNearbyTarget() const { - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -10575,11 +10596,11 @@ Unit* Unit::SelectNearbyTarget() const std::list<Unit *> targets; { - MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, ATTACK_DISTANCE); - MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> searcher(targets, u_check); + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, ATTACK_DISTANCE); + Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(targets, u_check); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); diff --git a/src/game/Unit.h b/src/game/Unit.h index 47b8da7f9ba..4410dd45b72 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __UNIT_H @@ -511,6 +513,7 @@ enum NPCFlags UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode UNIT_NPC_FLAG_UNK3 = 0x01000000, // cause client to send 1015 opcode UNIT_NPC_FLAG_GUARD = 0x10000000, // custom flag for guards + UNIT_NPC_FLAG_OUTDOORPVP = 0x20000000, // custom flag for outdoor pvp creatures }; enum MovementFlags @@ -683,7 +686,7 @@ enum ReactiveType // delay time next attack to prevent client attack animation problems #define ATTACK_DISPLAY_DELAY 200 -class MANGOS_DLL_SPEC Unit : public WorldObject +class TRINITY_DLL_SPEC Unit : public WorldObject { public: typedef std::set<Unit*> AttackerSet; diff --git a/src/game/UnitEvents.h b/src/game/UnitEvents.h index 4ff99535035..40f5593e74f 100644 --- a/src/game/UnitEvents.h +++ b/src/game/UnitEvents.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UNITEVENTS @@ -67,7 +69,7 @@ enum UNIT_EVENT_TYPE //============================================================== -class MANGOS_DLL_SPEC UnitBaseEvent +class TRINITY_DLL_SPEC UnitBaseEvent { private: uint32 iType; @@ -82,7 +84,7 @@ class MANGOS_DLL_SPEC UnitBaseEvent //============================================================== -class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent +class TRINITY_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent { private: HostilReference* iHostilReference; @@ -119,7 +121,7 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent //============================================================== -class MANGOS_DLL_SPEC ThreatManagerEvent : public ThreatRefStatusChangeEvent +class TRINITY_DLL_SPEC ThreatManagerEvent : public ThreatRefStatusChangeEvent { private: ThreatContainer* iThreatContainer; diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp index eded8cb7395..01cc23671d4 100644 --- a/src/game/UpdateData.cpp +++ b/src/game/UpdateData.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/UpdateData.h b/src/game/UpdateData.h index 20f5749d507..36a15fa92ec 100644 --- a/src/game/UpdateData.h +++ b/src/game/UpdateData.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __UPDATEDATA_H diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 5cff686d209..b14d88963f1 100644 --- a/src/game/UpdateFields.h +++ b/src/game/UpdateFields.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UPDATEFIELDS_AUTO_H diff --git a/src/game/UpdateMask.h b/src/game/UpdateMask.h index 7b0b7bb0c6d..8e8a184a377 100644 --- a/src/game/UpdateMask.h +++ b/src/game/UpdateMask.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __UPDATEMASK_H diff --git a/src/game/VoiceChatHandler.cpp b/src/game/VoiceChatHandler.cpp index 1368ddc4f85..94435d097c3 100644 --- a/src/game/VoiceChatHandler.cpp +++ b/src/game/VoiceChatHandler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index a4b809ddbef..0d9c9707965 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Database/DatabaseEnv.h" @@ -86,14 +88,14 @@ void WaypointManager::Load() node.delay = fields[6].GetUInt16(); // prevent using invalid coordinates - if(!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation)) + if(!Trinity::IsValidMapCoord(node.x, node.y, node.z, node.orientation)) { QueryResult *result1 = WorldDatabase.PQuery("SELECT id, map FROM creature WHERE guid = '%u'", id); if(result1) sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %d, Y: %d).", id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y); else sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %d, Y: %d).", id, point, node.x, node.y); - MaNGOS::NormalizeMapCoord(node.x); - MaNGOS::NormalizeMapCoord(node.y); + Trinity::NormalizeMapCoord(node.x); + Trinity::NormalizeMapCoord(node.y); if(result1) { node.z = MapManager::Instance ().GetBaseMap(result1->Fetch()[1].GetUInt32())->GetHeight(node.x, node.y, node.z); diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index f0b66b66077..e7d786aa3cc 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_WAYPOINTMANAGER_H -#define MANGOS_WAYPOINTMANAGER_H +#ifndef TRINITY_WAYPOINTMANAGER_H +#define TRINITY_WAYPOINTMANAGER_H #include <vector> #include <string> @@ -84,6 +86,6 @@ class WaypointManager WaypointPathMap m_pathMap; }; -#define WaypointMgr MaNGOS::Singleton<WaypointManager>::Instance() +#define WaypointMgr Trinity::Singleton<WaypointManager>::Instance() #endif diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index ee9f7961f18..f03f3611e43 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 94762a961b6..28036bdb49c 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_WAYPOINTMOVEMENTGENERATOR_H -#define MANGOS_WAYPOINTMOVEMENTGENERATOR_H +#ifndef TRINITY_WAYPOINTMOVEMENTGENERATOR_H +#define TRINITY_WAYPOINTMOVEMENTGENERATOR_H /** @page PathMovementGenerator is used to generate movements * of waypoints and flight paths. Each serves the purpose @@ -40,7 +42,7 @@ #define STOP_TIME_FOR_PLAYER 3 * 60 * 1000 // 3 Minutes template<class T, class P = Path> -class MANGOS_DLL_SPEC PathMovementBase +class TRINITY_DLL_SPEC PathMovementBase { public: PathMovementBase() : i_currentNode(0) {} @@ -66,10 +68,10 @@ class MANGOS_DLL_SPEC PathMovementBase */ template<class T> -class MANGOS_DLL_SPEC WaypointMovementGenerator; +class TRINITY_DLL_SPEC WaypointMovementGenerator; template<> -class MANGOS_DLL_SPEC WaypointMovementGenerator<Creature> +class TRINITY_DLL_SPEC WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >, public PathMovementBase<Creature, WaypointPath*> { @@ -110,7 +112,7 @@ public PathMovementBase<Creature, WaypointPath*> /** FlightPathMovementGenerator generates movement of the player for the paths * and hence generates ground and activities for the player. */ -class MANGOS_DLL_SPEC FlightPathMovementGenerator +class TRINITY_DLL_SPEC FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >, public PathMovementBase<Player> { diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp index 77e81f0b16d..5749698565a 100644 --- a/src/game/Weather.cpp +++ b/src/game/Weather.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file diff --git a/src/game/Weather.h b/src/game/Weather.h index e6eaa49a3e7..b8935305101 100644 --- a/src/game/Weather.h +++ b/src/game/Weather.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup world diff --git a/src/game/World.cpp b/src/game/World.cpp index 10802b573e2..d912e807e87 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -45,6 +47,7 @@ #include "CreatureAIRegistry.h" #include "Policies/SingletonImp.h" #include "BattleGroundMgr.h" +#include "OutdoorPvPMgr.h" #include "TemporarySummon.h" #include "WaypointMovementGenerator.h" #include "VMapFactory.h" @@ -56,7 +59,6 @@ #include "InstanceSaveMgr.h" #include "WaypointManager.h" #include "Util.h" -#include "IRCClient.h" #include "Language.h" INSTANTIATE_SINGLETON_1( World ); @@ -64,7 +66,6 @@ INSTANTIATE_SINGLETON_1( World ); volatile bool World::m_stopEvent = false; volatile uint32 World::m_worldLoopCounter = 0; -float World::m_PlayerStartGold = 0; // starting gold float World::m_MaxVisibleDistanceForCreature = DEFAULT_VISIBILITY_DISTANCE; float World::m_MaxVisibleDistanceForPlayer = DEFAULT_VISIBILITY_DISTANCE; float World::m_MaxVisibleDistanceForObject = DEFAULT_VISIBILITY_DISTANCE; @@ -523,7 +524,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfig.GetIntDefault("WorldServerPort", DEFAULT_WORLDSERVER_PORT); if(val!=m_configs[CONFIG_PORT_WORLD]) - sLog.outError("WorldServerPort option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_PORT_WORLD]); + sLog.outError("WorldServerPort option can't be changed at Trinityd.conf reload, using current value (%u).",m_configs[CONFIG_PORT_WORLD]); } else m_configs[CONFIG_PORT_WORLD] = sConfig.GetIntDefault("WorldServerPort", DEFAULT_WORLDSERVER_PORT); @@ -532,7 +533,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME); if(val!=m_configs[CONFIG_SOCKET_SELECTTIME]) - sLog.outError("SocketSelectTime option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[DEFAULT_SOCKET_SELECT_TIME]); + sLog.outError("SocketSelectTime option can't be changed at Trinityd.conf reload, using current value (%u).",m_configs[DEFAULT_SOCKET_SELECT_TIME]); } else m_configs[CONFIG_SOCKET_SELECTTIME] = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME); @@ -540,7 +541,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_TCP_NO_DELAY] = sConfig.GetBoolDefault("TcpNoDelay", false); m_configs[CONFIG_GROUP_XP_DISTANCE] = sConfig.GetIntDefault("MaxGroupXPDistance", 74); - /// \todo Add MonsterSight and GuarderSight (with meaning) in mangosd.conf or put them as define + /// \todo Add MonsterSight and GuarderSight (with meaning) in Trinityd.conf or put them as define m_configs[CONFIG_SIGHT_MONSTER] = sConfig.GetIntDefault("MonsterSight", 50); m_configs[CONFIG_SIGHT_GUARDER] = sConfig.GetIntDefault("GuarderSight", 50); @@ -548,7 +549,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfig.GetIntDefault("GameType", 0); if(val!=m_configs[CONFIG_GAME_TYPE]) - sLog.outError("GameType option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_GAME_TYPE]); + sLog.outError("GameType option can't be changed at Trinityd.conf reload, using current value (%u).",m_configs[CONFIG_GAME_TYPE]); } else m_configs[CONFIG_GAME_TYPE] = sConfig.GetIntDefault("GameType", 0); @@ -557,7 +558,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfig.GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); if(val!=m_configs[CONFIG_REALM_ZONE]) - sLog.outError("RealmZone option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_REALM_ZONE]); + sLog.outError("RealmZone option can't be changed at Trinityd.conf reload, using current value (%u).",m_configs[CONFIG_REALM_ZONE]); } else m_configs[CONFIG_REALM_ZONE] = sConfig.GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); @@ -724,7 +725,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfig.GetIntDefault("Expansion",1); if(val!=m_configs[CONFIG_EXPANSION]) - sLog.outError("Expansion option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_EXPANSION]); + sLog.outError("Expansion option can't be changed at Trinityd.conf reload, using current value (%u).",m_configs[CONFIG_EXPANSION]); } else m_configs[CONFIG_EXPANSION] = sConfig.GetIntDefault("Expansion",1); @@ -773,47 +774,43 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfig.GetIntDefault("ListenRange.TextEmote", 25); m_configs[CONFIG_LISTEN_RANGE_YELL] = sConfig.GetIntDefault("ListenRange.Yell", 300); - m_PlayerStartGold = sConfig.GetFloatDefault("PlayerStart.Gold", 0); - if(m_PlayerStartGold < 0) - m_PlayerStartGold = 0; - - if(m_PlayerStartGold > MAX_MONEY_AMOUNT) - m_PlayerStartGold = MAX_MONEY_AMOUNT; - - m_configs[CONFIG_PLAYER_START_HONOR] = sConfig.GetIntDefault("PlayerStart.HonorPoints", 0); - if(m_configs[CONFIG_PLAYER_START_HONOR] < 0) - m_configs[CONFIG_PLAYER_START_HONOR] = 0; - - m_configs[CONFIG_PLAYER_START_ARENAPTS] = sConfig.GetIntDefault("PlayerStart.ArenaPoints", 0); - if(m_configs[CONFIG_PLAYER_START_ARENAPTS] < 0) - m_configs[CONFIG_PLAYER_START_ARENAPTS] = 0; - - m_configs[CONFIG_GM_START_LEVEL] = sConfig.GetIntDefault("GamemasterStartLevel", 70); - if(m_configs[CONFIG_GM_START_LEVEL] < 1) - m_configs[CONFIG_GM_START_LEVEL] = 1; - - m_configs[CONFIG_INSTANT_LOGOUT] = sConfig.GetBoolDefault("PlayerInstantLogout", false); - m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false); - m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false); - // Leaving GM queue option out for now, it's not 100% functional with the ACE patch - //m_configs[CONFIG_QUEUE_FOR_GM] = sConfig.GetBoolDefault("EnableQueueForGMs", false); - m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0); - if(m_configs[CONFIG_HONOR_AFTER_DUEL] < 0) - m_configs[CONFIG_HONOR_AFTER_DUEL]= 0; - m_configs[CONFIG_KICK_FROM_GMISLAND] = sConfig.GetBoolDefault("AntiCheat.GMIsland", false); - m_configs[CONFIG_START_ALL_EXPLORED] = sConfig.GetBoolDefault("PlayerStart.MapsExplored", false); - m_configs[CONFIG_DISABLE_BREATHING] = sConfig.GetBoolDefault("DisableWaterBreath", false); - m_configs[CONFIG_DISABLE_RES_SICKNESS] = sConfig.GetBoolDefault("DisableResurrectSickness", false); - m_configs[CONFIG_START_ALL_REP] = sConfig.GetBoolDefault("PlayerStart.AllReputation", false); - m_configs[CONFIG_ALWAYS_MAXSKILL] = sConfig.GetBoolDefault("AlwaysMaxWeaponSkill", false); - m_configs[CONFIG_START_ALL_TAXI] = sConfig.GetBoolDefault("PlayerStart.AllFlightPaths", false); - m_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfig.GetBoolDefault("PvPToken.Enable", false); - m_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfig.GetIntDefault("PvPToken.MapAllowType", 4); - m_configs[CONFIG_PVP_TOKEN_ID] = sConfig.GetIntDefault("PvPToken.ItemID", 29434); - m_configs[CONFIG_PVP_TOKEN_COUNT] = sConfig.GetIntDefault("PvPToken.ItemCount", 1); - if(m_configs[CONFIG_PVP_TOKEN_COUNT] < 1) - m_configs[CONFIG_PVP_TOKEN_COUNT] = 1; - m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false); + m_configs[CONFIG_PLAYER_START_GOLD] = sConfig.GetFloatDefault("PlayerStart.Gold", 0); + if(m_configs[CONFIG_PLAYER_START_GOLD] < 0) + m_configs[CONFIG_PLAYER_START_GOLD] = 0; + + if(m_configs[CONFIG_PLAYER_START_GOLD] > MAX_MONEY_AMOUNT) + m_configs[CONFIG_PLAYER_START_GOLD] = MAX_MONEY_AMOUNT; + + m_configs[CONFIG_PLAYER_START_HONOR] = sConfig.GetIntDefault("PlayerStart.HonorPoints", 0); + if(m_configs[CONFIG_PLAYER_START_HONOR] < 0) + m_configs[CONFIG_PLAYER_START_HONOR] = 0; + + m_configs[CONFIG_PLAYER_START_ARENAPTS] = sConfig.GetIntDefault("PlayerStart.ArenaPoints", 0); + if(m_configs[CONFIG_PLAYER_START_ARENAPTS] < 0) + m_configs[CONFIG_PLAYER_START_ARENAPTS] = 0; + + m_configs[CONFIG_GM_START_LEVEL] = sConfig.GetIntDefault("GamemasterStartLevel", 70); + if(m_configs[CONFIG_GM_START_LEVEL] < 1) + m_configs[CONFIG_GM_START_LEVEL] = 1; + + m_configs[CONFIG_INSTANT_LOGOUT] = sConfig.GetBoolDefault("PlayerInstantLogout", false); + m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false); + m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false); + m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0); + if(m_configs[CONFIG_HONOR_AFTER_DUEL] < 0) + m_configs[CONFIG_HONOR_AFTER_DUEL]= 0; + m_configs[CONFIG_START_ALL_EXPLORED] = sConfig.GetBoolDefault("PlayerStart.MapsExplored", false); + m_configs[CONFIG_DISABLE_BREATHING] = sConfig.GetBoolDefault("DisableWaterBreath", false); + m_configs[CONFIG_START_ALL_REP] = sConfig.GetBoolDefault("PlayerStart.AllReputation", false); + m_configs[CONFIG_ALWAYS_MAXSKILL] = sConfig.GetBoolDefault("AlwaysMaxWeaponSkill", false); + m_configs[CONFIG_START_ALL_TAXI] = sConfig.GetBoolDefault("PlayerStart.AllFlightPaths", false); + m_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfig.GetBoolDefault("PvPToken.Enable", false); + m_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfig.GetIntDefault("PvPToken.MapAllowType", 4); + m_configs[CONFIG_PVP_TOKEN_ID] = sConfig.GetIntDefault("PvPToken.ItemID", 29434); + m_configs[CONFIG_PVP_TOKEN_COUNT] = sConfig.GetIntDefault("PvPToken.ItemCount", 1); + if(m_configs[CONFIG_PVP_TOKEN_COUNT] < 1) + m_configs[CONFIG_PVP_TOKEN_COUNT] = 1; + m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false); m_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfig.GetIntDefault("Arena.MaxRatingDifference", 0); m_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfig.GetIntDefault("Arena.RatingDiscardTimer",300000); @@ -883,7 +880,7 @@ void World::LoadConfigSettings(bool reload) if(reload) { if(dataPath!=m_dataPath) - sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).",m_dataPath.c_str()); + sLog.outError("DataDir option can't be changed at Trinityd.conf reload, using current value (%s).",m_dataPath.c_str()); } else { @@ -891,6 +888,20 @@ void World::LoadConfigSettings(bool reload) sLog.outString("Using DataDir %s",m_dataPath.c_str()); } + std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", ""); + char * forbiddenMaps = new char[forbiddenmaps.length() + 1]; + forbiddenMaps[forbiddenmaps.length()] = 0; + strncpy(forbiddenMaps, forbiddenmaps.c_str(), forbiddenmaps.length()); + const char * delim = ","; + char * token = strtok(forbiddenMaps, delim); + while(token != NULL) + { + int32 mapid = strtol(token, NULL, 10); + m_forbiddenMapIds.insert(mapid); + token = strtok(NULL,delim); + } + delete[] forbiddenMaps; + bool enableLOS = sConfig.GetBoolDefault("vmap.enableLOS", false); bool enableHeight = sConfig.GetBoolDefault("vmap.enableHeight", false); std::string ignoreMapIds = sConfig.GetStringDefault("vmap.ignoreMapIds", ""); @@ -927,14 +938,14 @@ void World::SetInitialWorldSettings() ||m_configs[CONFIG_EXPANSION] && ( !MapManager::ExistMapAndVMap(530,10349.6f,-6357.29f) || !MapManager::ExistMapAndVMap(530,-3961.64f,-13931.2f) ) ) { - sLog.outError("Correct *.map files not found in path '%smaps' or *.vmap/*vmdir files in '%svmaps'. Please place *.map/*.vmap/*.vmdir files in appropriate directories or correct the DataDir value in the mangosd.conf file.",m_dataPath.c_str(),m_dataPath.c_str()); + sLog.outError("Correct *.map files not found in path '%smaps' or *.vmap/*vmdir files in '%svmaps'. Please place *.map/*.vmap/*.vmdir files in appropriate directories or correct the DataDir value in the Trinityd.conf file.",m_dataPath.c_str(),m_dataPath.c_str()); exit(1); } ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. sLog.outString( "" ); - sLog.outString( "Loading MaNGOS strings..." ); - if (!objmgr.LoadMangosStrings()) + sLog.outString( "Loading Trinity strings..." ); + if (!objmgr.LoadTrinityStrings()) exit(1); // Error message displayed in function already ///- Update the realm entry in the database with the realm type from the config file @@ -1180,9 +1191,6 @@ void World::SetInitialWorldSettings() WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', %ld, 0)", isoDate, m_startTime ); - static uint32 autoanc = 1; - autoanc = sIRC.autoanc; - m_timers[WUPDATE_OBJECTS].SetInterval(0); m_timers[WUPDATE_SESSIONS].SetInterval(0); m_timers[WUPDATE_WEATHERS].SetInterval(1000); @@ -1191,8 +1199,6 @@ void World::SetInitialWorldSettings() //Update "uptime" table based on configuration entry in minutes. m_timers[WUPDATE_CORPSES].SetInterval(20*MINUTE*1000); //erase corpses every 20 minutes - m_timers[WUPDATE_AUTOANC].SetInterval(autoanc*MINUTE*1000); - //to set mailtimer to return mails every day between 4 and 5 am //mailtimer is increased when updating auctions //one second is 1000 -(tested on win system) @@ -1215,6 +1221,10 @@ void World::SetInitialWorldSettings() sBattleGroundMgr.CreateInitialBattleGrounds(); sBattleGroundMgr.InitAutomaticArenaPointDistribution(); + ///- Initialize outdoor pvp + sLog.outString( "Starting Outdoor PvP System" ); + sOutdoorPvPMgr.InitOutdoorPvP(); + //Not sure if this can be moved up in the sequence (with static data loading) as it uses MapManager sLog.outString( "Loading Transports..." ); MapManager::Instance().LoadTransports(); @@ -1407,6 +1417,8 @@ void World::Update(time_t diff) ScriptsProcess(); sBattleGroundMgr.Update(diff); + + sOutdoorPvPMgr.Update(diff); } // execute callbacks from sql queries that were queued recently @@ -1429,11 +1441,6 @@ void World::Update(time_t diff) m_timers[WUPDATE_EVENTS].Reset(); } - if (m_timers[WUPDATE_AUTOANC].Passed()) - { - m_timers[WUPDATE_AUTOANC].Reset(); /// </ul> - SendRNDBroadcast(); - } MapManager::Instance().DoDelayedMovesAndRemoves(); ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" // update the instance reset times @@ -1443,6 +1450,14 @@ void World::Update(time_t diff) ProcessCliCommands(); } +void World::ForceGameEventUpdate() +{ + m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed + uint32 nextGameEvent = gameeventmgr.Update(); + m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); + m_timers[WUPDATE_EVENTS].Reset(); +} + /// Put scripts in the execution queue void World::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, Object* target) { @@ -1782,14 +1797,14 @@ void World::ScriptsProcess() GameObject *go = NULL; int32 time_to_despawn = step.script->datalong2<5 ? 5 : (int32)step.script->datalong2; - CellPair p(MaNGOS::ComputeCellPair(summoner->GetPositionX(), summoner->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(summoner->GetPositionX(), summoner->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*summoner,step.script->datalong); - MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(go,go_check); + Trinity::GameObjectWithDbGUIDCheck go_check(*summoner,step.script->datalong); + Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(go,go_check); - TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(summoner->GetMapId(), summoner)); @@ -1843,14 +1858,14 @@ void World::ScriptsProcess() GameObject *door = NULL; int32 time_to_close = step.script->datalong2 < 15 ? 15 : (int32)step.script->datalong2; - CellPair p(MaNGOS::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster,step.script->datalong); - MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(door,go_check); + Trinity::GameObjectWithDbGUIDCheck go_check(*caster,step.script->datalong); + Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(door,go_check); - TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source)); @@ -1899,14 +1914,14 @@ void World::ScriptsProcess() GameObject *door = NULL; int32 time_to_open = step.script->datalong2 < 15 ? 15 : (int32)step.script->datalong2; - CellPair p(MaNGOS::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); + CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster,step.script->datalong); - MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(door,go_check); + Trinity::GameObjectWithDbGUIDCheck go_check(*caster,step.script->datalong); + Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(door,go_check); - TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); + TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source)); @@ -2130,7 +2145,7 @@ void World::SendWorldText(int32 string_id, ...) data_list = &data_cache[cache_idx]; - char const* text = objmgr.GetMangosString(string_id,loc_idx); + char const* text = objmgr.GetTrinityString(string_id,loc_idx); char buf[1000]; @@ -2509,22 +2524,6 @@ void World::ProcessCliCommands() p_zprintf("TC> "); } -void World::SendRNDBroadcast() -{ - std::string msg; - QueryResult *result = WorldDatabase.PQuery("SELECT `message` FROM `IRC_AutoAnnounce` ORDER BY RAND() LIMIT 1"); - if(!result) - return; - msg = result->Fetch()[0].GetString(); - delete result; - std::string str = "|cffff0000[Automatic]:|r"; - str += msg; - sWorld.SendWorldText(LANG_AUTO_ANN); - std::string ircchan = "#"; - ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); - sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Automatic System Message \00304,08\037/!\\\037\017 %s", "%s", msg.c_str()), true); -} - void World::InitResultQueue() { m_resultQueue = new SqlResultQueue; diff --git a/src/game/World.h b/src/game/World.h index 742cd11385e..4d942ce25a8 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup world The World @@ -61,8 +63,6 @@ enum WorldTimers WUPDATE_EVENTS = 6, WUPDATE_COUNT = 7, - WUPDATE_AUTOANC = 7 - }; /// Configuration elements @@ -158,26 +158,24 @@ enum WorldConfigs CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, - CONFIG_PLAYER_START_HONOR, - CONFIG_PLAYER_START_ARENAPTS, - CONFIG_GM_START_LEVEL, - CONFIG_INSTANT_LOGOUT, - CONFIG_BG_START_MUSIC, - CONFIG_START_ALL_SPELLS, - CONFIG_QUEUE_FOR_GM, - CONFIG_HONOR_AFTER_DUEL, - CONFIG_KICK_FROM_GMISLAND, - CONFIG_START_ALL_EXPLORED, - CONFIG_DISABLE_BREATHING, - CONFIG_DISABLE_RES_SICKNESS, - CONFIG_START_ALL_REP, - CONFIG_ALWAYS_MAXSKILL, - CONFIG_START_ALL_TAXI, - CONFIG_PVP_TOKEN_ENABLE, - CONFIG_PVP_TOKEN_MAP_TYPE, - CONFIG_PVP_TOKEN_ID, - CONFIG_PVP_TOKEN_COUNT, - CONFIG_NO_RESET_TALENT_COST, + CONFIG_PLAYER_START_GOLD, + CONFIG_PLAYER_START_HONOR, + CONFIG_PLAYER_START_ARENAPTS, + CONFIG_GM_START_LEVEL, + CONFIG_INSTANT_LOGOUT, + CONFIG_BG_START_MUSIC, + CONFIG_START_ALL_SPELLS, + CONFIG_HONOR_AFTER_DUEL, + CONFIG_START_ALL_EXPLORED, + CONFIG_DISABLE_BREATHING, + CONFIG_START_ALL_REP, + CONFIG_ALWAYS_MAXSKILL, + CONFIG_START_ALL_TAXI, + CONFIG_PVP_TOKEN_ENABLE, + CONFIG_PVP_TOKEN_MAP_TYPE, + CONFIG_PVP_TOKEN_ID, + CONFIG_PVP_TOKEN_COUNT, + CONFIG_NO_RESET_TALENT_COST, CONFIG_THREAT_RADIUS, CONFIG_DECLINED_NAMES_USED, @@ -370,8 +368,6 @@ class World WorldSession* FindSession(uint32 id) const; void AddSession(WorldSession *s); - void SendRNDBroadcast(); - bool RemoveSession(uint32 id); /// Get the number of current active sessions void UpdateMaxSessionCounters(); @@ -486,7 +482,7 @@ class World void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target); bool IsScriptScheduled() const { return !m_scriptSchedule.empty(); } - static float PlayerStartGold() { return m_PlayerStartGold; } + bool IsAllowedMap(uint32 mapid) { return m_forbiddenMapIds.count(mapid) == 0 ;} // for max speed access static float GetMaxVisibleDistanceForCreature() { return m_MaxVisibleDistanceForCreature; } @@ -502,6 +498,8 @@ class World void UpdateResultQueue(); void InitResultQueue(); + void ForceGameEventUpdate(); + void UpdateRealmCharCount(uint32 accid); LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } @@ -539,12 +537,11 @@ class World bool m_allowMovement; std::string m_motd; std::string m_dataPath; + std::set<uint32> m_forbiddenMapIds; uint32 m_ShutdownTimer; uint32 m_ShutdownMask; - static float m_PlayerStartGold; - // for max speed access static float m_MaxVisibleDistanceForCreature; static float m_MaxVisibleDistanceForPlayer; @@ -570,6 +567,6 @@ class World extern uint32 realmID; -#define sWorld MaNGOS::Singleton<World>::Instance() +#define sWorld Trinity::Singleton<World>::Instance() #endif /// @} diff --git a/src/game/WorldLog.cpp b/src/game/WorldLog.cpp index 21fc26da41b..7247f7a2558 100644 --- a/src/game/WorldLog.cpp +++ b/src/game/WorldLog.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -24,7 +26,7 @@ #include "Policies/SingletonImp.h" #include "Config/ConfigEnv.h" -#define CLASS_LOCK MaNGOS::ClassLevelLockable<WorldLog, ZThread::FastMutex> +#define CLASS_LOCK Trinity::ClassLevelLockable<WorldLog, ZThread::FastMutex> INSTANTIATE_SINGLETON_2(WorldLog, CLASS_LOCK); INSTANTIATE_CLASS_MUTEX(WorldLog, ZThread::FastMutex); diff --git a/src/game/WorldLog.h b/src/game/WorldLog.h index 5047161b63e..725ac580a09 100644 --- a/src/game/WorldLog.h +++ b/src/game/WorldLog.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup u2w /// @{ /// \file -#ifndef MANGOS_WORLDLOG_H -#define MANGOS_WORLDLOG_H +#ifndef TRINITY_WORLDLOG_H +#define TRINITY_WORLDLOG_H #include "Common.h" #include "Policies/Singleton.h" @@ -30,13 +32,13 @@ #include <stdarg.h> /// %Log packets to a file -class MANGOS_DLL_DECL WorldLog : public MaNGOS::Singleton<WorldLog, MaNGOS::ClassLevelLockable<WorldLog, ZThread::FastMutex> > +class TRINITY_DLL_DECL WorldLog : public Trinity::Singleton<WorldLog, Trinity::ClassLevelLockable<WorldLog, ZThread::FastMutex> > { - friend class MaNGOS::OperatorNew<WorldLog>; + friend class Trinity::OperatorNew<WorldLog>; WorldLog() : i_file(NULL) { Initialize(); } WorldLog(const WorldLog &); WorldLog& operator=(const WorldLog &); - typedef MaNGOS::ClassLevelLockable<WorldLog, ZThread::FastMutex>::Lock Guard; + typedef Trinity::ClassLevelLockable<WorldLog, ZThread::FastMutex>::Lock Guard; /// Close the file in destructor ~WorldLog() diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index b8a3f9ec74e..3123544efaf 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -36,6 +38,7 @@ #include "MapManager.h" #include "ObjectAccessor.h" #include "BattleGroundMgr.h" +#include "OutdoorPvPMgr.h" #include "Language.h" // for CMSG_CANCEL_MOUNT_AURA handler #include "Chat.h" #include "SocialMgr.h" @@ -96,7 +99,7 @@ void WorldSession::SendPacket(WorldPacket const* packet) { if (!m_Socket) return; - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG // Code for network use statistic static uint64 sendPacketCount = 0; static uint64 sendPacketBytes = 0; @@ -128,7 +131,7 @@ void WorldSession::SendPacket(WorldPacket const* packet) sendLastPacketCount = 1; sendLastPacketBytes = packet->wpos(); // wpos is real written size } -#endif // !MANGOS_DEBUG +#endif // !TRINITY_DEBUG if (m_Socket->SendPacket (*packet) == -1) { @@ -301,6 +304,8 @@ void WorldSession::LogoutPlayer(bool Save) if(_player->InBattleGround()) _player->LeaveBattleground(); + sOutdoorPvPMgr.HandlePlayerLeaveZone(_player,_player->GetZoneId()); + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) { if(int32 bgTypeId = _player->GetBattleGroundQueueId(i)) @@ -442,7 +447,7 @@ void WorldSession::SendNotification(const char *format,...) void WorldSession::SendNotification(int32 string_id,...) { - char const* format = GetMangosString(string_id); + char const* format = GetTrinityString(string_id); if(format) { va_list ap; @@ -458,9 +463,9 @@ void WorldSession::SendNotification(int32 string_id,...) } } -const char * WorldSession::GetMangosString( int32 entry ) +const char * WorldSession::GetTrinityString( int32 entry ) { - return objmgr.GetMangosString(entry,GetSessionDbLocaleIndex()); + return objmgr.GetTrinityString(entry,GetSessionDbLocaleIndex()); } void WorldSession::Handle_NULL( WorldPacket& recvPacket ) @@ -509,3 +514,5 @@ void WorldSession::SendAuthWaitQue(uint32 position) } + + diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index b510f5043e8..125785c5e5a 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup u2w @@ -65,7 +67,7 @@ enum PartyResult }; /// Player session in the World -class MANGOS_DLL_SPEC WorldSession +class TRINITY_DLL_SPEC WorldSession { friend class CharacterHandler; public: @@ -193,7 +195,7 @@ class MANGOS_DLL_SPEC WorldSession // Locales LocaleConstant GetSessionDbcLocale() { return m_sessionDbcLocale; } int GetSessionDbLocaleIndex() { return m_sessionDbLocaleIndex; } - const char *GetMangosString(int32 entry); + const char *GetTrinityString(int32 entry); uint32 GetLatency() const { return m_latency; } void SetLatency(uint32 latency) { m_latency = latency; } diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index f51ca5a9656..aecee68b002 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/game/WorldSocket.h b/src/game/WorldSocket.h index 96b8f5eda38..460c931658c 100644 --- a/src/game/WorldSocket.h +++ b/src/game/WorldSocket.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \addtogroup u2w User to World Communication diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index 7af1389e92a..c431bf21b73 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008,2007 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file WorldSocketMgr.cpp diff --git a/src/game/WorldSocketMgr.h b/src/game/WorldSocketMgr.h index 923efa02fe1..275a396b91d 100644 --- a/src/game/WorldSocketMgr.h +++ b/src/game/WorldSocketMgr.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008,2007 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \addtogroup u2w User to World Communication diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index 555ddc84d1f..d1b9a6ea1a7 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -519,3 +521,46 @@ bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/) sBattleGroundMgr.ToggleArenaTesting(); return true; } + +bool ChatHandler::HandleDebugThreatList(const char * /*args*/) +{ + Creature* target = getSelectedCreature(); + if(!target || target->isTotem() || target->isPet()) + return false; + + std::list<HostilReference*>& tlist = target->getThreatManager().getThreatList(); + std::list<HostilReference*>::iterator itr; + uint32 cnt = 0; + PSendSysMessage("Threat list of %s (guid %u)",target->GetName(), target->GetGUIDLow()); + for(itr = tlist.begin(); itr != tlist.end(); ++itr) + { + Unit* unit = (*itr)->getTarget(); + if(!unit) + continue; + ++cnt; + PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat()); + } + SendSysMessage("End of threat list."); + return true; +} + +bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/) +{ + Unit* target = getSelectedUnit(); + if(!target) + target = m_session->GetPlayer(); + HostilReference* ref = target->getHostilRefManager().getFirst(); + uint32 cnt = 0; + PSendSysMessage("Hostil reference list of %s (guid %u)",target->GetName(), target->GetGUIDLow()); + while(ref) + { + if(Unit * unit = ref->getSource()->getOwner()) + { + ++cnt; + PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), ref->getThreat()); + } + ref = ref->next(); + } + SendSysMessage("End of hostil reference list."); + return true; +} diff --git a/src/game/tools.cpp b/src/game/tools.cpp index 7b4b4cffbaa..b0d669d60b6 100644 --- a/src/game/tools.cpp +++ b/src/game/tools.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Tools.h" diff --git a/src/shared/Auth/AuthCrypt.cpp b/src/shared/Auth/AuthCrypt.cpp index 56143c3417c..66b28a0556d 100644 --- a/src/shared/Auth/AuthCrypt.cpp +++ b/src/shared/Auth/AuthCrypt.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "AuthCrypt.h" diff --git a/src/shared/Auth/AuthCrypt.h b/src/shared/Auth/AuthCrypt.h index 94e075e584e..1d890b56bb5 100644 --- a/src/shared/Auth/AuthCrypt.h +++ b/src/shared/Auth/AuthCrypt.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTHCRYPT_H diff --git a/src/shared/Auth/BigNumber.cpp b/src/shared/Auth/BigNumber.cpp index 752e82f171e..322bdafe8ac 100644 --- a/src/shared/Auth/BigNumber.cpp +++ b/src/shared/Auth/BigNumber.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Auth/BigNumber.h" diff --git a/src/shared/Auth/BigNumber.h b/src/shared/Auth/BigNumber.h index c66798afd85..1132d037186 100644 --- a/src/shared/Auth/BigNumber.h +++ b/src/shared/Auth/BigNumber.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTH_BIGNUMBER_H diff --git a/src/shared/Auth/Hmac.cpp b/src/shared/Auth/Hmac.cpp index d2054a0a777..b031f5a0f6d 100644 --- a/src/shared/Auth/Hmac.cpp +++ b/src/shared/Auth/Hmac.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Auth/Hmac.h" diff --git a/src/shared/Auth/Hmac.h b/src/shared/Auth/Hmac.h index 083c84fe871..8375e484e18 100644 --- a/src/shared/Auth/Hmac.h +++ b/src/shared/Auth/Hmac.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTH_HMAC_H diff --git a/src/shared/Auth/Makefile.am b/src/shared/Auth/Makefile.am index 47fb5979922..1a630e9b9cd 100644 --- a/src/shared/Auth/Makefile.am +++ b/src/shared/Auth/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/shared/Auth/Sha1.cpp b/src/shared/Auth/Sha1.cpp index 6a4a3967b26..2abb0be1766 100644 --- a/src/shared/Auth/Sha1.cpp +++ b/src/shared/Auth/Sha1.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Auth/Sha1.h" diff --git a/src/shared/Auth/Sha1.h b/src/shared/Auth/Sha1.h index 3be4bcb8159..99fd6f263d9 100644 --- a/src/shared/Auth/Sha1.h +++ b/src/shared/Auth/Sha1.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTH_SHA1_H diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index d89466c2b1f..f2f6f45acbd 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BYTEBUFFER_H diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp index d64404a6e91..d59623eaec5 100644 --- a/src/shared/Common.cpp +++ b/src/shared/Common.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/shared/Common.h b/src/shared/Common.h index 36d6bc5e5ae..cb23d280da2 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_COMMON_H -#define MANGOSSERVER_COMMON_H +#ifndef TRINITYCORE_COMMON_H +#define TRINITYCORE_COMMON_H // config.h needs to be included 1st // TODO this thingy looks like hack ,but its not, need to diff --git a/src/shared/Config/Config.cpp b/src/shared/Config/Config.cpp index 292cf390276..882d51b8812 100644 --- a/src/shared/Config/Config.cpp +++ b/src/shared/Config/Config.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ConfigEnv.h" diff --git a/src/shared/Config/Config.h b/src/shared/Config/Config.h index bc753f6d33a..5c89ac5f588 100644 --- a/src/shared/Config/Config.h +++ b/src/shared/Config/Config.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CONFIG_H @@ -24,7 +26,7 @@ class DOTCONFDocument; -class MANGOS_DLL_SPEC Config +class TRINITY_DLL_SPEC Config { public: Config(); @@ -53,6 +55,6 @@ class MANGOS_DLL_SPEC Config DOTCONFDocument *mConf; }; -#define sConfig MaNGOS::Singleton<Config>::Instance() +#define sConfig Trinity::Singleton<Config>::Instance() #endif diff --git a/src/shared/Config/ConfigEnv.h b/src/shared/Config/ConfigEnv.h index 7ef06f015a2..94287b3c26b 100644 --- a/src/shared/Config/ConfigEnv.h +++ b/src/shared/Config/ConfigEnv.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined(CONFIGENVIRONMENT_H) diff --git a/src/shared/Config/Makefile.am b/src/shared/Config/Makefile.am index 6c1490dfef4..3e354408f53 100644 --- a/src/shared/Config/Makefile.am +++ b/src/shared/Config/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/shared/Config/dotconfpp/dotconfpp.cpp b/src/shared/Config/dotconfpp/dotconfpp.cpp index 60008747ad1..34be713138d 100644 --- a/src/shared/Config/dotconfpp/dotconfpp.cpp +++ b/src/shared/Config/dotconfpp/dotconfpp.cpp @@ -102,7 +102,7 @@ int DOTCONFDocument::cleanupLine(char * line) } // Allowing \" in there causes problems with directory paths - // like "C:\MaNGOS\" + // like "C:\TrinIty\" //if(*line == '\\' && (*(line+1) == '"' || *(line+1) == '\'')){ if(*line == '\\' && (*(line+1) == '\'')) { *bg++ = *(line+1); diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp index 623b9652fb3..685f9c893ce 100644 --- a/src/shared/Database/DBCStores.cpp +++ b/src/shared/Database/DBCStores.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DBCStores.h" @@ -273,7 +275,7 @@ void LoadDBCStores(std::string dataPath) // DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields // uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view - #if MANGOS_ENDIAN == MANGOS_BIGENDIAN + #if TRINITY_ENDIAN == TRINITY_BIGENDIAN std::swap(*((uint32*)(&spell->SpellFamilyFlags)),*(((uint32*)(&spell->SpellFamilyFlags))+1)); #endif } @@ -433,7 +435,7 @@ void LoadDBCStores(std::string dataPath) // error checks if(bad_dbc_files.size() >= DBCFilesCount ) { - sLog.outError("\nIncorrect DataDir value in mangosd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str()); + sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str()); exit(1); } else if(!bad_dbc_files.empty() ) @@ -637,6 +639,6 @@ uint32 const* GetTalentTabPages(uint32 cls) } // script support functions -MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; } -MANGOS_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore() { return &sSpellStore; } -MANGOS_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; } +TRINITY_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; } +TRINITY_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore() { return &sSpellStore; } +TRINITY_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; } diff --git a/src/shared/Database/DBCStores.h b/src/shared/Database/DBCStores.h index e1d05298695..5d2d60bd117 100644 --- a/src/shared/Database/DBCStores.h +++ b/src/shared/Database/DBCStores.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DBCSTORES_H @@ -196,7 +198,7 @@ extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore; void LoadDBCStores(std::string dataPath); // script support functions -MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore(); -MANGOS_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore(); -MANGOS_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore(); +TRINITY_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore(); +TRINITY_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore(); +TRINITY_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore(); #endif diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h index ce0887687ef..fa8048b96a4 100644 --- a/src/shared/Database/DBCStructure.h +++ b/src/shared/Database/DBCStructure.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DBCSTRUCTURE_H diff --git a/src/shared/Database/DBCfmt.cpp b/src/shared/Database/DBCfmt.cpp index 0b7e1439520..52b5e5faf47 100644 --- a/src/shared/Database/DBCfmt.cpp +++ b/src/shared/Database/DBCfmt.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxx"; diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 5726aeaa340..2995f7993bc 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DatabaseEnv.h" diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index 40097773430..6df4022162a 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DATABASE_H @@ -33,7 +35,7 @@ typedef HM_NAMESPACE::hash_map<ZThread::ThreadImpl*, SqlResultQueue*> QueryQueue #define MAX_QUERY_LEN 1024 -class MANGOS_DLL_SPEC Database +class TRINITY_DLL_SPEC Database { protected: Database() : m_threadBody(NULL), m_delayThread(NULL) {}; @@ -77,7 +79,7 @@ class MANGOS_DLL_SPEC Database virtual bool DirectExecute(const char* sql) = 0; bool DirectPExecute(const char *format,...) ATTR_PRINTF(2,3); - // Writes SQL commands to a LOG file (see mangosd.conf "LogSQL") + // Writes SQL commands to a LOG file (see Trinityd.conf "LogSQL") bool PExecuteLog(const char *format,...) ATTR_PRINTF(2,3); virtual bool BeginTransaction() // nothing do if DB not support transactions diff --git a/src/shared/Database/DatabaseEnv.h b/src/shared/Database/DatabaseEnv.h index 405dcbdfa33..5ea6a3c5f79 100644 --- a/src/shared/Database/DatabaseEnv.h +++ b/src/shared/Database/DatabaseEnv.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined(DATABASEENV_H) diff --git a/src/shared/Database/DatabaseImpl.h b/src/shared/Database/DatabaseImpl.h index 682f7b25ef7..c3373effe31 100644 --- a/src/shared/Database/DatabaseImpl.h +++ b/src/shared/Database/DatabaseImpl.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Database/Database.h" @@ -29,7 +31,7 @@ Database::AsyncQuery(Class *object, void (Class::*method)(QueryResult*), const c ZThread::ThreadImpl * queryThread = ZThread::ThreadImpl::current(); QueryQueues::iterator itr = m_queryQueues.find(queryThread); if (itr == m_queryQueues.end()) return false; - m_threadBody->Delay(new SqlQuery(sql, new MaNGOS::QueryCallback<Class>(object, method), itr->second)); + m_threadBody->Delay(new SqlQuery(sql, new Trinity::QueryCallback<Class>(object, method), itr->second)); return true; } @@ -41,7 +43,7 @@ Database::AsyncQuery(Class *object, void (Class::*method)(QueryResult*, ParamTyp ZThread::ThreadImpl * queryThread = ZThread::ThreadImpl::current(); QueryQueues::iterator itr = m_queryQueues.find(queryThread); if (itr == m_queryQueues.end()) return false; - m_threadBody->Delay(new SqlQuery(sql, new MaNGOS::QueryCallback<Class, ParamType1>(object, method, (QueryResult*)NULL, param1), itr->second)); + m_threadBody->Delay(new SqlQuery(sql, new Trinity::QueryCallback<Class, ParamType1>(object, method, (QueryResult*)NULL, param1), itr->second)); return true; } @@ -53,7 +55,7 @@ Database::AsyncQuery(void (*method)(QueryResult*, ParamType1), ParamType1 param1 ZThread::ThreadImpl * queryThread = ZThread::ThreadImpl::current(); QueryQueues::iterator itr = m_queryQueues.find(queryThread); if (itr == m_queryQueues.end()) return false; - m_threadBody->Delay(new SqlQuery(sql, new MaNGOS::SQueryCallback<ParamType1>(method, (QueryResult*)NULL, param1), itr->second)); + m_threadBody->Delay(new SqlQuery(sql, new Trinity::SQueryCallback<ParamType1>(method, (QueryResult*)NULL, param1), itr->second)); return true; } @@ -129,7 +131,7 @@ Database::DelayQueryHolder(Class *object, void (Class::*method)(QueryResult*, Sq ZThread::ThreadImpl * queryThread = ZThread::ThreadImpl::current(); QueryQueues::iterator itr = m_queryQueues.find(queryThread); if (itr == m_queryQueues.end()) return false; - holder->Execute(new MaNGOS::QueryCallback<Class, SqlQueryHolder*>(object, method, (QueryResult*)NULL, holder), m_threadBody, itr->second); + holder->Execute(new Trinity::QueryCallback<Class, SqlQueryHolder*>(object, method, (QueryResult*)NULL, holder), m_threadBody, itr->second); return true; } @@ -141,6 +143,6 @@ Database::DelayQueryHolder(Class *object, void (Class::*method)(QueryResult*, Sq ZThread::ThreadImpl * queryThread = ZThread::ThreadImpl::current(); QueryQueues::iterator itr = m_queryQueues.find(queryThread); if (itr == m_queryQueues.end()) return false; - holder->Execute(new MaNGOS::QueryCallback<Class, SqlQueryHolder*, ParamType1>(object, method, (QueryResult*)NULL, holder, param1), m_threadBody, itr->second); + holder->Execute(new Trinity::QueryCallback<Class, SqlQueryHolder*, ParamType1>(object, method, (QueryResult*)NULL, holder, param1), m_threadBody, itr->second); return true; } diff --git a/src/shared/Database/DatabaseMysql.cpp b/src/shared/Database/DatabaseMysql.cpp index b736a60aa1b..a82011bf44d 100644 --- a/src/shared/Database/DatabaseMysql.cpp +++ b/src/shared/Database/DatabaseMysql.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL @@ -151,7 +153,7 @@ bool DatabaseMysql::Initialize(const char *infoString) // by default. In crash case you can lose data!!! // So better to turn this off // --- - // This is wrong since mangos use transactions, + // This is wrong since Trinity use transactions, // autocommit is turned of during it. // Setting it to on makes atomic updates work if (!mysql_autocommit(mMysql, 1)) @@ -188,7 +190,7 @@ QueryResult* DatabaseMysql::Query(const char *sql) { // guarded block for thread-safe mySQL request ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG uint32 _s = getMSTime(); #endif if(mysql_query(mMysql, sql)) @@ -199,7 +201,7 @@ QueryResult* DatabaseMysql::Query(const char *sql) } else { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG sLog.outDebug("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql ); #endif } @@ -258,7 +260,7 @@ bool DatabaseMysql::DirectExecute(const char* sql) { // guarded block for thread-safe mySQL request ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG uint32 _s = getMSTime(); #endif if(mysql_query(mMysql, sql)) @@ -269,7 +271,7 @@ bool DatabaseMysql::DirectExecute(const char* sql) } else { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG sLog.outDebug("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql ); #endif } diff --git a/src/shared/Database/DatabaseMysql.h b/src/shared/Database/DatabaseMysql.h index 2608212d52a..b5eb3d8bd07 100644 --- a/src/shared/Database/DatabaseMysql.h +++ b/src/shared/Database/DatabaseMysql.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL @@ -33,9 +35,9 @@ #include <mysql.h> #endif -class MANGOS_DLL_SPEC DatabaseMysql : public Database +class TRINITY_DLL_SPEC DatabaseMysql : public Database { - friend class MaNGOS::OperatorNew<DatabaseMysql>; + friend class Trinity::OperatorNew<DatabaseMysql>; public: DatabaseMysql(); diff --git a/src/shared/Database/DatabasePostgre.cpp b/src/shared/Database/DatabasePostgre.cpp index 637c2ac9522..d2b1136c1d8 100644 --- a/src/shared/Database/DatabasePostgre.cpp +++ b/src/shared/Database/DatabasePostgre.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef DO_POSTGRESQL @@ -122,7 +124,7 @@ QueryResult* DatabasePostgre::Query(const char *sql) // guarded block for thread-safe request ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG uint32 _s = getMSTime(); #endif // Send the query @@ -141,7 +143,7 @@ QueryResult* DatabasePostgre::Query(const char *sql) } else { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG sLog.outDebug("[%u ms] SQL: %s", getMSTime() - _s, sql ); #endif } @@ -193,7 +195,7 @@ bool DatabasePostgre::DirectExecute(const char* sql) { // guarded block for thread-safe request ZThread::Guard<ZThread::FastMutex> query_connection_guard(mMutex); - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG uint32 _s = getMSTime(); #endif PGresult *res = PQexec(mPGconn, sql); @@ -205,7 +207,7 @@ bool DatabasePostgre::DirectExecute(const char* sql) } else { - #ifdef MANGOS_DEBUG + #ifdef TRINITY_DEBUG sLog.outDebug("[%u ms] SQL: %s", getMSTime() - _s, sql ); #endif } diff --git a/src/shared/Database/DatabasePostgre.h b/src/shared/Database/DatabasePostgre.h index b1929c46360..b1eea20d856 100644 --- a/src/shared/Database/DatabasePostgre.h +++ b/src/shared/Database/DatabasePostgre.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DatabasePostgre_H @@ -33,7 +35,7 @@ class DatabasePostgre : public Database { - friend class MaNGOS::OperatorNew<DatabasePostgre>; + friend class Trinity::OperatorNew<DatabasePostgre>; public: DatabasePostgre(); diff --git a/src/shared/Database/DatabaseSqlite.cpp b/src/shared/Database/DatabaseSqlite.cpp index 75307f9d430..a301f49c346 100644 --- a/src/shared/Database/DatabaseSqlite.cpp +++ b/src/shared/Database/DatabaseSqlite.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL diff --git a/src/shared/Database/DatabaseSqlite.h b/src/shared/Database/DatabaseSqlite.h index 37190a6b562..f6acd631221 100644 --- a/src/shared/Database/DatabaseSqlite.h +++ b/src/shared/Database/DatabaseSqlite.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL diff --git a/src/shared/Database/Field.cpp b/src/shared/Database/Field.cpp index 5c693403c06..c17671a7040 100644 --- a/src/shared/Database/Field.cpp +++ b/src/shared/Database/Field.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DatabaseEnv.h" diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index f829ec18424..3ed4ed686cc 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined(FIELD_H) diff --git a/src/shared/Database/Makefile.am b/src/shared/Database/Makefile.am index 7d60bb70fd3..17a54123a8f 100644 --- a/src/shared/Database/Makefile.am +++ b/src/shared/Database/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, diff --git a/src/shared/Database/MySQLDelayThread.h b/src/shared/Database/MySQLDelayThread.h index dcc979d6d53..ceaa50acd91 100644 --- a/src/shared/Database/MySQLDelayThread.h +++ b/src/shared/Database/MySQLDelayThread.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MYSQLDELAYTHREAD_H diff --git a/src/shared/Database/PGSQLDelayThread.h b/src/shared/Database/PGSQLDelayThread.h index 03907026899..0fffddab4f2 100644 --- a/src/shared/Database/PGSQLDelayThread.h +++ b/src/shared/Database/PGSQLDelayThread.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PGSQLDELAYTHREAD_H diff --git a/src/shared/Database/QueryResult.h b/src/shared/Database/QueryResult.h index 50ee98a9a22..d76345f5f3d 100644 --- a/src/shared/Database/QueryResult.h +++ b/src/shared/Database/QueryResult.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,18 +10,18 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined(QUERYRESULT_H) #define QUERYRESULT_H -class MANGOS_DLL_SPEC QueryResult +class TRINITY_DLL_SPEC QueryResult { public: QueryResult(uint64 rowCount, uint32 fieldCount) diff --git a/src/shared/Database/QueryResultMysql.cpp b/src/shared/Database/QueryResultMysql.cpp index b24e51c2352..90a5d6df5f8 100644 --- a/src/shared/Database/QueryResultMysql.cpp +++ b/src/shared/Database/QueryResultMysql.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL diff --git a/src/shared/Database/QueryResultMysql.h b/src/shared/Database/QueryResultMysql.h index e62a1a4c120..99d189cd173 100644 --- a/src/shared/Database/QueryResultMysql.h +++ b/src/shared/Database/QueryResultMysql.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL diff --git a/src/shared/Database/QueryResultPostgre.cpp b/src/shared/Database/QueryResultPostgre.cpp index 2cb6447b170..cbed35c4c9e 100644 --- a/src/shared/Database/QueryResultPostgre.cpp +++ b/src/shared/Database/QueryResultPostgre.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef DO_POSTGRESQL diff --git a/src/shared/Database/QueryResultPostgre.h b/src/shared/Database/QueryResultPostgre.h index f6726d20123..aede1e2a9df 100644 --- a/src/shared/Database/QueryResultPostgre.h +++ b/src/shared/Database/QueryResultPostgre.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if !defined(QUERYRESULTPOSTGRE_H) diff --git a/src/shared/Database/QueryResultSqlite.cpp b/src/shared/Database/QueryResultSqlite.cpp index 3eca2f08d46..59dedbe95c3 100644 --- a/src/shared/Database/QueryResultSqlite.cpp +++ b/src/shared/Database/QueryResultSqlite.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL diff --git a/src/shared/Database/QueryResultSqlite.h b/src/shared/Database/QueryResultSqlite.h index c72e5727999..70b6eef4411 100644 --- a/src/shared/Database/QueryResultSqlite.h +++ b/src/shared/Database/QueryResultSqlite.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DO_POSTGRESQL diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 6041eaf282e..7df8a649aac 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SQLStorage.h" diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index 4ddd44f593e..eeceee12f7d 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SQLSTORAGE_H diff --git a/src/shared/Database/SqlDelayThread.cpp b/src/shared/Database/SqlDelayThread.cpp index 257a3d686e8..4b6eb8fe02f 100644 --- a/src/shared/Database/SqlDelayThread.cpp +++ b/src/shared/Database/SqlDelayThread.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Database/SqlDelayThread.h" diff --git a/src/shared/Database/SqlDelayThread.h b/src/shared/Database/SqlDelayThread.h index dd729660dba..d63c152a589 100644 --- a/src/shared/Database/SqlDelayThread.h +++ b/src/shared/Database/SqlDelayThread.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __SQLDELAYTHREAD_H diff --git a/src/shared/Database/SqlOperations.cpp b/src/shared/Database/SqlOperations.cpp index 38febadbc5c..e32a0f066ed 100644 --- a/src/shared/Database/SqlOperations.cpp +++ b/src/shared/Database/SqlOperations.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SqlOperations.h" @@ -73,13 +75,13 @@ void SqlResultQueue::Update() /// execute the callbacks waiting in the synchronization queue while(!empty()) { - MaNGOS::IQueryCallback * callback = next(); + Trinity::IQueryCallback * callback = next(); callback->Execute(); delete callback; } } -void SqlQueryHolder::Execute(MaNGOS::IQueryCallback * callback, SqlDelayThread *thread, SqlResultQueue *queue) +void SqlQueryHolder::Execute(Trinity::IQueryCallback * callback, SqlDelayThread *thread, SqlResultQueue *queue) { if(!callback || !thread || !queue) return; diff --git a/src/shared/Database/SqlOperations.h b/src/shared/Database/SqlOperations.h index 0018a7ed08e..1a0e47e44ae 100644 --- a/src/shared/Database/SqlOperations.h +++ b/src/shared/Database/SqlOperations.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __SQLOPERATIONS_H @@ -70,7 +72,7 @@ class SqlResultQueue; /// queue for thread class SqlQueryHolder; /// groups several async quries class SqlQueryHolderEx; /// points to a holder, added to the delay thread -class SqlResultQueue : public ZThread::LockedQueue<MaNGOS::IQueryCallback*, ZThread::FastMutex> +class SqlResultQueue : public ZThread::LockedQueue<Trinity::IQueryCallback*, ZThread::FastMutex> { public: SqlResultQueue() {} @@ -81,10 +83,10 @@ class SqlQuery : public SqlOperation { private: const char *m_sql; - MaNGOS::IQueryCallback * m_callback; + Trinity::IQueryCallback * m_callback; SqlResultQueue * m_queue; public: - SqlQuery(const char *sql, MaNGOS::IQueryCallback * callback, SqlResultQueue * queue) + SqlQuery(const char *sql, Trinity::IQueryCallback * callback, SqlResultQueue * queue) : m_sql(strdup(sql)), m_callback(callback), m_queue(queue) {} ~SqlQuery() { void* tofree = const_cast<char*>(m_sql); free(tofree); } void Execute(Database *db); @@ -104,17 +106,17 @@ class SqlQueryHolder void SetSize(size_t size); QueryResult* GetResult(size_t index); void SetResult(size_t index, QueryResult *result); - void Execute(MaNGOS::IQueryCallback * callback, SqlDelayThread *thread, SqlResultQueue *queue); + void Execute(Trinity::IQueryCallback * callback, SqlDelayThread *thread, SqlResultQueue *queue); }; class SqlQueryHolderEx : public SqlOperation { private: SqlQueryHolder * m_holder; - MaNGOS::IQueryCallback * m_callback; + Trinity::IQueryCallback * m_callback; SqlResultQueue * m_queue; public: - SqlQueryHolderEx(SqlQueryHolder *holder, MaNGOS::IQueryCallback * callback, SqlResultQueue * queue) + SqlQueryHolderEx(SqlQueryHolder *holder, Trinity::IQueryCallback * callback, SqlResultQueue * queue) : m_holder(holder), m_callback(callback), m_queue(queue) {} void Execute(Database *db); }; diff --git a/src/shared/Database/dbcfile.cpp b/src/shared/Database/dbcfile.cpp index 2521ab22614..124584fd3c8 100644 --- a/src/shared/Database/dbcfile.cpp +++ b/src/shared/Database/dbcfile.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdio.h> diff --git a/src/shared/Database/dbcfile.h b/src/shared/Database/dbcfile.h index bc59914ce53..55d2fa3ad53 100644 --- a/src/shared/Database/dbcfile.h +++ b/src/shared/Database/dbcfile.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DBCFILE_H diff --git a/src/shared/Errors.h b/src/shared/Errors.h index a038b777916..3d5a4390f7c 100644 --- a/src/shared/Errors.h +++ b/src/shared/Errors.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_ERRORS_H -#define MANGOSSERVER_ERRORS_H +#ifndef TRINITYCORE_ERRORS_H +#define TRINITYCORE_ERRORS_H #define WPAssert( assertion ) { if( !(assertion) ) { fprintf( stderr, "\n%s:%i ASSERTION FAILED:\n %s\n", __FILE__, __LINE__, #assertion ); assert( #assertion &&0 ); } } #define WPError( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "%s:%i ERROR:\n %s\n", __FILE__, __LINE__, (char *)errmsg ); assert( false ); } diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index b6283bc8437..2dda08c598a 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -702,7 +704,7 @@ void outstring_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton<Log>::Instance().outString(buf); + Trinity::Singleton<Log>::Instance().outString(buf); } void detail_log(const char * str, ...) @@ -716,7 +718,7 @@ void detail_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton<Log>::Instance().outDetail(buf); + Trinity::Singleton<Log>::Instance().outDetail(buf); } void debug_log(const char * str, ...) @@ -730,7 +732,7 @@ void debug_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton<Log>::Instance().outDebug(buf); + Trinity::Singleton<Log>::Instance().outDebug(buf); } void error_log(const char * str, ...) @@ -744,7 +746,7 @@ void error_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton<Log>::Instance().outError(buf); + Trinity::Singleton<Log>::Instance().outError(buf); } void error_db_log(const char * str, ...) @@ -758,5 +760,5 @@ void error_db_log(const char * str, ...) vsnprintf(buf,256, str, ap); va_end(ap); - MaNGOS::Singleton<Log>::Instance().outErrorDb(buf); + Trinity::Singleton<Log>::Instance().outErrorDb(buf); } diff --git a/src/shared/Log.h b/src/shared/Log.h index e6e51afadd6..7d88f32c0d3 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_LOG_H -#define MANGOSSERVER_LOG_H +#ifndef TRINITYCORE_LOG_H +#define TRINITYCORE_LOG_H #include "Common.h" #include "Policies/Singleton.h" @@ -53,9 +55,9 @@ enum Color const int Color_count = int(WHITE)+1; -class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThread::FastMutex> > +class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ZThread::FastMutex> > { - friend class MaNGOS::OperatorNew<Log>; + friend class Trinity::OperatorNew<Log>; Log() : raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL), m_colored(false) { Initialize(); } ~Log() { @@ -137,18 +139,18 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea }; -#define sLog MaNGOS::Singleton<Log>::Instance() +#define sLog Trinity::Singleton<Log>::Instance() -#ifdef MANGOS_DEBUG -#define DEBUG_LOG MaNGOS::Singleton<Log>::Instance().outDebug +#ifdef TRINITY_DEBUG +#define DEBUG_LOG Trinity::Singleton<Log>::Instance().outDebug #else #define DEBUG_LOG #endif // primary for script library -void MANGOS_DLL_SPEC outstring_log(const char * str, ...) ATTR_PRINTF(1,2); -void MANGOS_DLL_SPEC detail_log(const char * str, ...) ATTR_PRINTF(1,2); -void MANGOS_DLL_SPEC debug_log(const char * str, ...) ATTR_PRINTF(1,2); -void MANGOS_DLL_SPEC error_log(const char * str, ...) ATTR_PRINTF(1,2); -void MANGOS_DLL_SPEC error_db_log(const char * str, ...) ATTR_PRINTF(1,2); +void TRINITY_DLL_SPEC outstring_log(const char * str, ...) ATTR_PRINTF(1,2); +void TRINITY_DLL_SPEC detail_log(const char * str, ...) ATTR_PRINTF(1,2); +void TRINITY_DLL_SPEC debug_log(const char * str, ...) ATTR_PRINTF(1,2); +void TRINITY_DLL_SPEC error_log(const char * str, ...) ATTR_PRINTF(1,2); +void TRINITY_DLL_SPEC error_db_log(const char * str, ...) ATTR_PRINTF(1,2); #endif diff --git a/src/shared/Makefile.am b/src/shared/Makefile.am index 5a64a45fc29..29d85e6c83f 100644 --- a/src/shared/Makefile.am +++ b/src/shared/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -118,3 +118,4 @@ EXTRA_DIST += \ WheatyExceptionReport.cpp \ WheatyExceptionReport.h + diff --git a/src/shared/Mthread.cpp b/src/shared/Mthread.cpp index 0dfaac4fcf7..8985b9cebc8 100644 --- a/src/shared/Mthread.cpp +++ b/src/shared/Mthread.cpp @@ -20,9 +20,9 @@ #include "Mthread.h" #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE_CC__) -# define MANGOS_PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE +# define TRINITY_PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE #else -# define MANGOS_PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP +# define TRINITY_PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP #endif #if PLATFORM != PLATFORM_WINDOWS @@ -73,7 +73,7 @@ MMutex::MMutex () if (!attr_refcount++) { pthread_mutexattr_init (&attr); - pthread_mutexattr_settype (&attr, MANGOS_PTHREAD_MUTEX_RECURSIVE); + pthread_mutexattr_settype (&attr, TRINITY_PTHREAD_MUTEX_RECURSIVE); } pthread_mutex_init (&mutex, &attr); diff --git a/src/shared/PacketLog.cpp b/src/shared/PacketLog.cpp index 835e174eb54..f57d5b71326 100644 --- a/src/shared/PacketLog.cpp +++ b/src/shared/PacketLog.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" diff --git a/src/shared/PacketLog.h b/src/shared/PacketLog.h index e2f4d2423d5..3cc9cfa1b3c 100644 --- a/src/shared/PacketLog.h +++ b/src/shared/PacketLog.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_PACKETLOG_H -#define MANGOSSERVER_PACKETLOG_H +#ifndef TRINITYCORE_PACKETLOG_H +#define TRINITYCORE_PACKETLOG_H #include "Common.h" #include "Policies/Singleton.h" @@ -42,5 +44,5 @@ class PacketLog void WorldHexDump(WorldPacket * data, uint32 socket, bool direction); }; -#define sPacketLog MaNGOS::Singleton<PacketLog>::Instance() +#define sPacketLog Trinity::Singleton<PacketLog>::Instance() #endif diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index b23add06262..73433fa0dc0 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ProgressBar.h" diff --git a/src/shared/ProgressBar.h b/src/shared/ProgressBar.h index 3ee5963070a..a009681e756 100644 --- a/src/shared/ProgressBar.h +++ b/src/shared/ProgressBar.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,20 +10,20 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_PROGRESSBAR_H -#define MANGOSSERVER_PROGRESSBAR_H +#ifndef TRINITYCORE_PROGRESSBAR_H +#define TRINITYCORE_PROGRESSBAR_H #include <stdio.h> #include "Platform/Define.h" -class MANGOS_DLL_SPEC barGoLink +class TRINITY_DLL_SPEC barGoLink { static char const * const empty; static char const * const full; diff --git a/src/shared/ServiceWin32.cpp b/src/shared/ServiceWin32.cpp index d95cfe90291..72fbb682252 100644 --- a/src/shared/ServiceWin32.cpp +++ b/src/shared/ServiceWin32.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -8,7 +10,7 @@ * * 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 + * 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 diff --git a/src/shared/ServiceWin32.h b/src/shared/ServiceWin32.h index 351e733d051..20c4dfde61d 100644 --- a/src/shared/ServiceWin32.h +++ b/src/shared/ServiceWin32.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -8,7 +10,7 @@ * * 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 + * 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 diff --git a/src/shared/SystemConfig.h b/src/shared/SystemConfig.h index c1fd6e66a99..15bf0e31e46 100644 --- a/src/shared/SystemConfig.h +++ b/src/shared/SystemConfig.h @@ -1,5 +1,8 @@ /* - * Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/> +/* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * * * 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 @@ -8,18 +11,18 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // THIS FILE IS DEPRECATED -#ifndef MANGOS_SYSTEMCONFIG_H -#define MANGOS_SYSTEMCONFIG_H +#ifndef TRINITY_SYSTEMCONFIG_H +#define TRINITY_SYSTEMCONFIG_H #include "Platform/Define.h" diff --git a/src/shared/Timer.h b/src/shared/Timer.h index 61a42ecfc0e..cd00b5961e9 100644 --- a/src/shared/Timer.h +++ b/src/shared/Timer.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_TIMER_H -#define MANGOS_TIMER_H +#ifndef TRINITY_TIMER_H +#define TRINITY_TIMER_H #include "Platform/CompilerDefs.h" diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index c5e8284534d..7393b1fe965 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Util.h" diff --git a/src/shared/Util.h b/src/shared/Util.h index 1119414dd1e..066876667cf 100644 --- a/src/shared/Util.h +++ b/src/shared/Util.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UTIL_H @@ -41,24 +43,24 @@ inline uint32 secsToTimeBitFields(time_t secs) } /* Return a random number in the range min..max; (max-min) must be smaller than 32768. */ -MANGOS_DLL_SPEC int32 irand(int32 min, int32 max); +TRINITY_DLL_SPEC int32 irand(int32 min, int32 max); /* Return a random number in the range min..max (inclusive). For reliable results, the difference * between max and min should be less than RAND32_MAX. */ -MANGOS_DLL_SPEC uint32 urand(uint32 min, uint32 max); +TRINITY_DLL_SPEC uint32 urand(uint32 min, uint32 max); /* Return a random number in the range 0 .. RAND32_MAX. */ -MANGOS_DLL_SPEC int32 rand32(); +TRINITY_DLL_SPEC int32 rand32(); /* Return a random double from 0.0 to 1.0 (exclusive). Floats support only 7 valid decimal digits. * A double supports up to 15 valid decimal digits and is used internally (RAND32_MAX has 10 digits). * With an FPU, there is usually no difference in performance between float and double. */ -MANGOS_DLL_SPEC double rand_norm(void); +TRINITY_DLL_SPEC double rand_norm(void); /* Return a random double from 0.0 to 99.9999999999999. Floats support only 7 valid decimal digits. * A double supports up to 15 valid decimal digits and is used internaly (RAND32_MAX has 10 digits). * With an FPU, there is usually no difference in performance between float and double. */ -MANGOS_DLL_SPEC double rand_chance(void); +TRINITY_DLL_SPEC double rand_chance(void); /* Return true if a random roll fits in the specified chance (range 0-100). */ inline bool roll_chance_f(float chance) diff --git a/src/shared/WorldPacket.h b/src/shared/WorldPacket.h index aea9140045c..a26651c2922 100644 --- a/src/shared/WorldPacket.h +++ b/src/shared/WorldPacket.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOSSERVER_WORLDPACKET_H -#define MANGOSSERVER_WORLDPACKET_H +#ifndef TRINITYCORE_WORLDPACKET_H +#define TRINITYCORE_WORLDPACKET_H #include "Common.h" #include "ByteBuffer.h" diff --git a/src/shared/vmap/BaseModel.cpp b/src/shared/vmap/BaseModel.cpp index 9a1e9fd1002..d35fbb3cc45 100644 --- a/src/shared/vmap/BaseModel.cpp +++ b/src/shared/vmap/BaseModel.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "BaseModel.h" diff --git a/src/shared/vmap/BaseModel.h b/src/shared/vmap/BaseModel.h index 78ded7811b6..2985ae80aae 100644 --- a/src/shared/vmap/BaseModel.h +++ b/src/shared/vmap/BaseModel.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BASEMODEL_H_ diff --git a/src/shared/vmap/CoordModelMapping.cpp b/src/shared/vmap/CoordModelMapping.cpp index 0ea0261c894..247e911b43c 100644 --- a/src/shared/vmap/CoordModelMapping.cpp +++ b/src/shared/vmap/CoordModelMapping.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "CoordModelMapping.h" diff --git a/src/shared/vmap/CoordModelMapping.h b/src/shared/vmap/CoordModelMapping.h index 908c56e66dd..c5ec41bc81b 100644 --- a/src/shared/vmap/CoordModelMapping.h +++ b/src/shared/vmap/CoordModelMapping.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COORDMODELMAPPING_H_ diff --git a/src/shared/vmap/DebugCmdLogger.cpp b/src/shared/vmap/DebugCmdLogger.cpp index 56a5d3ffd2a..a520bd1ec70 100644 --- a/src/shared/vmap/DebugCmdLogger.cpp +++ b/src/shared/vmap/DebugCmdLogger.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DebugCmdLogger.h" diff --git a/src/shared/vmap/DebugCmdLogger.h b/src/shared/vmap/DebugCmdLogger.h index 8440707d75f..537954a2977 100644 --- a/src/shared/vmap/DebugCmdLogger.h +++ b/src/shared/vmap/DebugCmdLogger.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DEBUGCMDLOGGER_H diff --git a/src/shared/vmap/IVMapManager.h b/src/shared/vmap/IVMapManager.h index 67321f29e3d..8a2a5cd8a97 100644 --- a/src/shared/vmap/IVMapManager.h +++ b/src/shared/vmap/IVMapManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _IVMAPMANAGER_H diff --git a/src/shared/vmap/Makefile.am b/src/shared/vmap/Makefile.am index 5bca5b38b44..5ff9886e0f6 100644 --- a/src/shared/vmap/Makefile.am +++ b/src/shared/vmap/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -55,3 +55,4 @@ $(srcdir)/VMapManager.cpp \ $(srcdir)/VMapManager.h \ $(srcdir)/VMapTools.h + diff --git a/src/shared/vmap/ManagedModelContainer.cpp b/src/shared/vmap/ManagedModelContainer.cpp index bc3ba5ba3ec..8e42c2e848d 100644 --- a/src/shared/vmap/ManagedModelContainer.cpp +++ b/src/shared/vmap/ManagedModelContainer.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ManagedModelContainer.h" diff --git a/src/shared/vmap/ManagedModelContainer.h b/src/shared/vmap/ManagedModelContainer.h index 9766813d66c..facac33e288 100644 --- a/src/shared/vmap/ManagedModelContainer.h +++ b/src/shared/vmap/ManagedModelContainer.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MANAGEDMODELCONTAINER_H diff --git a/src/shared/vmap/ModelContainer.cpp b/src/shared/vmap/ModelContainer.cpp index 43a947b12dd..a13795e3900 100644 --- a/src/shared/vmap/ModelContainer.cpp +++ b/src/shared/vmap/ModelContainer.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <iostream> diff --git a/src/shared/vmap/ModelContainer.h b/src/shared/vmap/ModelContainer.h index 636be1713b4..c64800a59be 100644 --- a/src/shared/vmap/ModelContainer.h +++ b/src/shared/vmap/ModelContainer.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MODELCONTAINER_H diff --git a/src/shared/vmap/NodeValueAccess.h b/src/shared/vmap/NodeValueAccess.h index fb7a771baf0..1d746786b84 100644 --- a/src/shared/vmap/NodeValueAccess.h +++ b/src/shared/vmap/NodeValueAccess.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _NODEVALUEACCESS_H diff --git a/src/shared/vmap/ShortBox.h b/src/shared/vmap/ShortBox.h index d43bc61caa7..8e833fb95bb 100644 --- a/src/shared/vmap/ShortBox.h +++ b/src/shared/vmap/ShortBox.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SHORTBOX_H diff --git a/src/shared/vmap/ShortVector.h b/src/shared/vmap/ShortVector.h index 642f5b53c1b..cedf362b5a9 100644 --- a/src/shared/vmap/ShortVector.h +++ b/src/shared/vmap/ShortVector.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SHORTVECTOR_H diff --git a/src/shared/vmap/SubModel.cpp b/src/shared/vmap/SubModel.cpp index 2a46b3c6a1f..645f955a2a7 100644 --- a/src/shared/vmap/SubModel.cpp +++ b/src/shared/vmap/SubModel.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "SubModel.h" diff --git a/src/shared/vmap/SubModel.h b/src/shared/vmap/SubModel.h index d72b603e298..03950e5d827 100644 --- a/src/shared/vmap/SubModel.h +++ b/src/shared/vmap/SubModel.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SUBMODEL_H diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index a51e2c86d63..aed1a0ae969 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <G3D/Vector3.h> diff --git a/src/shared/vmap/TileAssembler.h b/src/shared/vmap/TileAssembler.h index afcce24c664..53eb5130e0c 100644 --- a/src/shared/vmap/TileAssembler.h +++ b/src/shared/vmap/TileAssembler.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TILEASSEMBLER_H_ diff --git a/src/shared/vmap/TreeNode.cpp b/src/shared/vmap/TreeNode.cpp index 97846d6c992..77e72e22928 100644 --- a/src/shared/vmap/TreeNode.cpp +++ b/src/shared/vmap/TreeNode.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "TreeNode.h" diff --git a/src/shared/vmap/TreeNode.h b/src/shared/vmap/TreeNode.h index c034b3c88f3..867cba9dc0b 100644 --- a/src/shared/vmap/TreeNode.h +++ b/src/shared/vmap/TreeNode.h @@ -1,5 +1,7 @@ /* -* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> +* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> +* +* Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 +* 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 +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TREENODE_H diff --git a/src/shared/vmap/VMapDefinitions.h b/src/shared/vmap/VMapDefinitions.h index ec7858b0cc1..358bf1bd0ef 100644 --- a/src/shared/vmap/VMapDefinitions.h +++ b/src/shared/vmap/VMapDefinitions.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _VMAPDEFINITIONS_H diff --git a/src/shared/vmap/VMapFactory.cpp b/src/shared/vmap/VMapFactory.cpp index 15454533c8b..35f771b6a16 100644 --- a/src/shared/vmap/VMapFactory.cpp +++ b/src/shared/vmap/VMapFactory.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <sys/types.h> diff --git a/src/shared/vmap/VMapFactory.h b/src/shared/vmap/VMapFactory.h index d63f10d94b4..838deb8914a 100644 --- a/src/shared/vmap/VMapFactory.h +++ b/src/shared/vmap/VMapFactory.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _VMAPFACTORY_H diff --git a/src/shared/vmap/VMapManager.cpp b/src/shared/vmap/VMapManager.cpp index a4427060184..9ad8c54a056 100644 --- a/src/shared/vmap/VMapManager.cpp +++ b/src/shared/vmap/VMapManager.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "VMapManager.h" @@ -64,7 +66,7 @@ namespace VMAP //========================================================= - Vector3 VMapManager::convertPositionToMangosRep(float x, float y, float z) const + Vector3 VMapManager::convertPositionToTrinityRep(float x, float y, float z) const { float pos[3]; pos[0] = z; @@ -431,7 +433,7 @@ namespace VMAP Vector3 resultPos; MapTree* mapTree = iInstanceMapTrees.get(pMapId); result = mapTree->getObjectHitPos(pos1, pos2, resultPos, pModifyDist); - resultPos = convertPositionToMangosRep(resultPos.x,resultPos.y,resultPos.z); + resultPos = convertPositionToTrinityRep(resultPos.x,resultPos.y,resultPos.z); rx = resultPos.x; ry = resultPos.y; rz = resultPos.z; diff --git a/src/shared/vmap/VMapManager.h b/src/shared/vmap/VMapManager.h index aef9e0fa8f1..e0bb4aecb77 100644 --- a/src/shared/vmap/VMapManager.h +++ b/src/shared/vmap/VMapManager.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _VMAPMANAGER_H @@ -143,7 +145,7 @@ namespace VMAP public: // public for debug G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const; - G3D::Vector3 convertPositionToMangosRep(float x, float y, float z) const; + G3D::Vector3 convertPositionToTrinityRep(float x, float y, float z) const; std::string getDirFileName(unsigned int pMapId) const; std::string getDirFileName(unsigned int pMapId, int x, int y) const; MapTree* getInstanceMapTree(int pMapId) { return(iInstanceMapTrees.get(pMapId)); } diff --git a/src/shared/vmap/VMapTools.h b/src/shared/vmap/VMapTools.h index b368b18ee86..9b45c83d069 100644 --- a/src/shared/vmap/VMapTools.h +++ b/src/shared/vmap/VMapTools.h @@ -1,5 +1,7 @@ /* -* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> +* Copyright (C) 2008 Trinity <http://www.trinitycore.org/> +* +* Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 +* 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 +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _VMAPTOOLS_H diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp index 7e4c0e2eeb7..b94176178f8 100644 --- a/src/trinitycore/CliRunnable.cpp +++ b/src/trinitycore/CliRunnable.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/// \addtogroup mangosd +/// \addtogroup Trinityd /// @{ /// \file @@ -36,7 +38,6 @@ #include "MapManager.h" #include "PlayerDump.h" #include "Player.h" -#include "IRCClient.h" //CliCommand and CliCommandHolder are defined in World.h to avoid cyclic deps @@ -314,14 +315,6 @@ void CliBroadcast(char *text,pPrintf zprintf) sWorld.SendWorldText(LANG_SYSTEMMESSAGE,textUtf8.c_str()); zprintf("Broadcasting to the world: %s\r\n",textUtf8.c_str()); - - if((sIRC.BOTMASK & 256) != 0) - { - std::string ircchan = "#"; - ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); - sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s", "%s", text), true); - } - } /// Print the list of commands and associated description @@ -640,7 +633,7 @@ void CliBan(char*command,pPrintf zprintf) } } -/// Display %MaNGOS version +/// Display %TrinIty version void CliVersion(char*,pPrintf zprintf) { //<--maybe better append to info cmd @@ -947,7 +940,7 @@ void CliTele(char*command,pPrintf zprintf) QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM game_tele WHERE name = '%s'",location.c_str()); if (!result) { - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_COMMAND_TELE_NOTFOUND),"\r\n"); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_COMMAND_TELE_NOTFOUND),"\r\n"); return; } @@ -961,7 +954,7 @@ void CliTele(char*command,pPrintf zprintf) if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) { - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_INVALID_TARGET_COORD),"\r\n",x,y,mapid); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_INVALID_TARGET_COORD),"\r\n",x,y,mapid); return; } @@ -971,17 +964,17 @@ void CliTele(char*command,pPrintf zprintf) if(chr->IsBeingTeleported()==true) { - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_IS_TELEPORTED),"\r\n",chr->GetName()); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_IS_TELEPORTED),"\r\n",chr->GetName()); return; } if(chr->isInFlight()) { - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_CHAR_IN_FLIGHT),"\r\n",chr->GetName()); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_CHAR_IN_FLIGHT),"\r\n",chr->GetName()); return; } - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_TELEPORTING_TO),"\r\n",chr->GetName(),"", location.c_str()); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_TELEPORTING_TO),"\r\n",chr->GetName(),"", location.c_str()); chr->SaveRecallPosition(); @@ -989,11 +982,11 @@ void CliTele(char*command,pPrintf zprintf) } else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str())) { - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_TELEPORTING_TO),"\r\n",name.c_str(), objmgr.GetMangosStringForDBCLocale(LANG_OFFLINE), location.c_str()); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_TELEPORTING_TO),"\r\n",name.c_str(), objmgr.GetTrinityStringForDBCLocale(LANG_OFFLINE), location.c_str()); Player::SavePositionInDB(mapid,x,y,z,ort,MapManager::Instance().GetZoneId(mapid,x,y),guid); } else - zprintf(objmgr.GetMangosStringForDBCLocale(LANG_NO_PLAYER),"\r\n",name.c_str()); + zprintf(objmgr.GetTrinityStringForDBCLocale(LANG_NO_PLAYER),"\r\n",name.c_str()); } /// Display/Define the 'Message of the day' for the realm @@ -1097,7 +1090,7 @@ void CliSave(char*,pPrintf zprintf) { ///- Save players ObjectAccessor::Instance().SaveAllPlayers(); - zprintf( objmgr.GetMangosStringForDBCLocale(LANG_PLAYERS_SAVED) ); + zprintf( objmgr.GetTrinityStringForDBCLocale(LANG_PLAYERS_SAVED) ); ///- Send a message sWorld.SendWorldText(LANG_PLAYERS_SAVED); diff --git a/src/trinitycore/CliRunnable.h b/src/trinitycore/CliRunnable.h index 2dc4a51d89a..5f2806156fb 100644 --- a/src/trinitycore/CliRunnable.h +++ b/src/trinitycore/CliRunnable.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/// \addtogroup mangosd +/// \addtogroup Trinityd /// @{ /// \file diff --git a/src/trinitycore/Main.cpp b/src/trinitycore/Main.cpp index 1c3ec6fea6e..5f2f95d81d5 100644 --- a/src/trinitycore/Main.cpp +++ b/src/trinitycore/Main.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/// \addtogroup mangosd Mangos Daemon +/// \addtogroup Trinityd Trinity Daemon /// @{ /// \file @@ -25,8 +27,6 @@ #include "Config/ConfigEnv.h" #include "Log.h" #include "Master.h" -#include "../game/IRCConf.h" -#include "../game/IRCClient.h" #ifndef _TRINITY_CORE_CONFIG # define _TRINITY_CORE_CONFIG "trinitycore.conf" @@ -40,8 +40,8 @@ #ifdef WIN32 #include "ServiceWin32.h" -char serviceName[] = "mangosd"; -char serviceLongName[] = "MaNGOS world service"; +char serviceName[] = "Trinityd"; +char serviceLongName[] = "Trinity core service"; char serviceDescription[] = "Massive Network Game Object Server"; /* * -1 - not in service mode @@ -72,12 +72,11 @@ void usage(const char *prog) ,prog); } -/// Launch the mangos server +/// Launch the Trinity server extern int main(int argc, char **argv) { ///- Command line parsing to get the configuration file name char const* cfg_file = _TRINITY_CORE_CONFIG; - char const* mc_cfg_file = _TRINITY_CORE_CONFIG; int c=1; while( c < argc ) { @@ -139,7 +138,6 @@ extern int main(int argc, char **argv) return 1; } - sIRC.SetCfg(mc_cfg_file); sLog.outString("Using configuration file %s.", cfg_file); uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0); @@ -162,7 +160,7 @@ extern int main(int argc, char **argv) // at sMaster return function exist with codes // 0 - normal shutdown // 1 - shutdown at error - // 2 - restart command used, this code can be used by restarter for restart mangosd + // 2 - restart command used, this code can be used by restarter for restart Trinityd } /// @} diff --git a/src/trinitycore/Makefile.am b/src/trinitycore/Makefile.am index 654cc71be95..38a8e8bf9b1 100644 --- a/src/trinitycore/Makefile.am +++ b/src/trinitycore/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -82,3 +82,4 @@ install-data-hook: fi; \ done + diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index 216a48c59c0..ffc6d930483 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file - \ingroup mangosd + \ingroup Trinityd */ #include <ace/OS_NS_signal.h> @@ -38,7 +40,6 @@ #include "RASocket.h" #include "ScriptCalls.h" #include "Util.h" -#include "IRCClient.h" #include "sockets/TcpSocket.h" #include "sockets/Utility.h" @@ -155,9 +156,9 @@ public: std::string stringip = sConfig.GetStringDefault ("Ra.IP", "0.0.0.0"); ipaddr_t raip; if (!Utility::u2ip (stringip, raip)) - sLog.outError ("MaNGOS RA can not bind to ip %s", stringip.c_str ()); + sLog.outError ("Trinity RA can not bind to ip %s", stringip.c_str ()); else if (RAListenSocket.Bind (raip, raport)) - sLog.outError ("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str ()); + sLog.outError ("Trinity RA can not bind to port %d on %s", raport, stringip.c_str ()); else { h.Add (&RAListenSocket); @@ -227,9 +228,6 @@ int Master::Run() if (!_StartDB()) return 1; - ///- Load IRC Config (need DB for gm levels, AutoBroadcast uses world timers) - sIRC.LoadConfig(sIRC.CfgFile); - ///- Initialize the World sWorld.SetInitialWorldSettings(); @@ -243,11 +241,6 @@ int Master::Run() // set server online loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID); - // Create table: has_logged_in_before - used for certain custom options - sLog.outBasic("ImpConfig: Creating/Checking table 'has_logged_in_before'..."); - CharacterDatabase.PExecute("CREATE TABLE IF NOT EXISTS `has_logged_in_before` (`guid` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`guid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='ImpConfig check';"); - sLog.outBasic("ImpConfig: Done..."); - #ifdef WIN32 if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) #else @@ -277,7 +270,7 @@ int Master::Run() if(!curAff ) { - sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for mangosd. Accessible processors bitmask (hex): %x",Aff,appAff); + sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for Trinityd. Accessible processors bitmask (hex): %x",Aff,appAff); } else { @@ -298,7 +291,7 @@ int Master::Run() if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS)) sLog.outString("TrinityCore process priority class set to HIGH"); else - sLog.outError("ERROR: Can't set mangosd process priority class."); + sLog.outError("ERROR: Can't set Trinityd process priority class."); sLog.outString(); } } @@ -313,12 +306,6 @@ int Master::Run() uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime)); uint32 loopCounter = 0; - // Start up IRC bot - ZThread::Thread irc(new IRCClient); - irc.setPriority ((ZThread::Priority )2); - - - ///- Start up freeze catcher thread uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0); if(freeze_delay) diff --git a/src/trinitycore/Master.h b/src/trinitycore/Master.h index ce756545720..7b850a30971 100644 --- a/src/trinitycore/Master.h +++ b/src/trinitycore/Master.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/// \addtogroup mangosd +/// \addtogroup Trinityd /// @{ /// \file @@ -45,6 +47,6 @@ class Master void clearOnlineAccounts(); }; -#define sMaster MaNGOS::Singleton<Master>::Instance() +#define sMaster Trinity::Singleton<Master>::Instance() #endif /// @} diff --git a/src/trinitycore/RASocket.cpp b/src/trinitycore/RASocket.cpp index 04f2cca4261..64ef40dfb33 100644 --- a/src/trinitycore/RASocket.cpp +++ b/src/trinitycore/RASocket.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file - \ingroup mangosd + \ingroup Trinityd */ #include "Common.h" diff --git a/src/trinitycore/RASocket.h b/src/trinitycore/RASocket.h index d082c45112a..e90ba7a3352 100644 --- a/src/trinitycore/RASocket.h +++ b/src/trinitycore/RASocket.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/// \addtogroup mangosd +/// \addtogroup Trinityd /// @{ /// \file diff --git a/src/trinitycore/WorldRunnable.cpp b/src/trinitycore/WorldRunnable.cpp index 35d643727c6..05926d7ec9b 100644 --- a/src/trinitycore/WorldRunnable.cpp +++ b/src/trinitycore/WorldRunnable.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,16 +10,16 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file - \ingroup mangosd + \ingroup Trinityd */ #include "WorldSocketMgr.h" diff --git a/src/trinitycore/WorldRunnable.h b/src/trinitycore/WorldRunnable.h index 2fec658f5d1..7a8b5af245d 100644 --- a/src/trinitycore/WorldRunnable.h +++ b/src/trinitycore/WorldRunnable.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,15 +10,15 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/// \addtogroup mangosd +/// \addtogroup Trinityd /// @{ /// \file diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index 0c23e97610f..eab2af94eeb 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -299,7 +299,7 @@ AddonChannel = 1 LogSQL = 1 PidFile = "" -LogLevel = 3 +LogLevel = 1 LogTime = 0 LogFile = "server.log" LogTimestamp = 0 @@ -807,7 +807,7 @@ GM.LogTrade = 1 # Visibility.Distance.Grey.Unit # Visibility grey distance for creatures/players (fast changing objects) # addition to appropriate object type Visibility.Distance.* use in case visibility removing to -# object (except corpse around distences) If � is distance and G is grey distance then object +# object (except corpse around distences) If ? is distance and G is grey distance then object # make visible if distance to it <= D but make non visible if distance > D+G # Default: 1 (yard) # @@ -1133,10 +1133,6 @@ Network.TcpNodelay = 1 # PlayerStart.AllFlightPaths # Players will start with all flight paths (Note: ALL flight paths, not only player's team) # -# AntiCheat.GMIsland -# If a player enters GM island, he will get teleported away. This will prevent cheaters from buying GM stuff -# on servers with a GM mall. GM's will not get teleported away. -# # GamemasterStartLevel # GM starting level # Default: 70 Min,max: 1 - 255 @@ -1149,12 +1145,6 @@ Network.TcpNodelay = 1 # MusicInBattleground # If enabled, "L70ETC - Power of the horde" will be played when BG starts ;) # -# EnableQueueForGMs -# NOTE: This option currently does not work due to ACE patch -# GMs will also be added to the login queue (not gmlvl 3+) if enabled. Useful for GM servers. -# Default: 0 - off -# 1 - on -# # HonorPointsAfterDuel # The amount of honor points the duel winner will get after a duel. # Default: 0 - disable @@ -1162,9 +1152,6 @@ Network.TcpNodelay = 1 # DisableWaterBreath # Disable/enable waterbreathing for players # -# DisableResurrectSickness -# Players wont get any resurrect sickness when speaking with a spirit healer if this is enabled+ -# # AlwaysMaxWeaponSkill # Players will automatically gain max weapon/defense skill when logging in, leveling up etc. # @@ -1188,6 +1175,12 @@ Network.TcpNodelay = 1 # NoResetTalentsCost # Enable or disable no cost when reseting talents # +# ForbiddenMaps +# map ids that users below SEC_GAMEMASTER cannot enter, with delimiter ',' +# Default: "" +# example: "538,90" +# Note that it's HIGHLY DISCOURAGED to forbid starting maps (0, 1, 530)! +# ################################################################################################################### PlayerStart.Gold = 0 @@ -1197,14 +1190,11 @@ PlayerStart.AllReputation = 0 PlayerStart.AllSpells = 0 PlayerStart.MapsExplored = 0 PlayerStart.AllFlightPaths = 0 -AntiCheat.GMIsland = 0 GamemasterStartLevel = 70 PlayerInstantLogout = 0 MusicInBattleground = 0 -EnableQueueForGMs = 0 HonorPointsAfterDuel = 0 DisableWaterBreath = 0 -DisableResurrectSickness = 0 AlwaysMaxWeaponSkill = 0 PvPToken.Enable = 0 PvPToken.MapAllowType = 4 @@ -1212,190 +1202,3 @@ PvPToken.ItemID = 29434 PvPToken.ItemCount = 1 NoResetTalentsCost = 0 -################################################################################################################### -# IRC SYSTEM CONFIG -# -# irc.active -# Enable IRC bot/system -# Default: 0 - Disable -# 0 - Enable -# irc.icc -# IRC connect code -# Default: 001 - Welcome To Network msg -# 375 - Beginning Of MOTD -# 376 - End Of MOTD -# -# irc.host -# IRC server to connect to -# -# irc.port -# IRC server port to use -# Default: "6667" - Semi-standard IRC port -# -# irc.user -# The username/ident to use when connecting to the IRC server -# -# irc.nick -# IRC nickname to be used by the bot -# -# irc.pass -# The password to be used to identify to NickServ -# -# irc.auth -# IRC Authentication Method -# Default: 0 - Disable -# 1 - NickServ - Normal Method - PRIVMSG NickServ :IDENTIFY Password -# 2 - NickServ - Alternate Method To Identify To A Different Nick - PRIVMSG NickServ :IDENTIFY irc.auth.nick Password -# 3 - QuakeNet - Normal Method - PRIVMSG Q@CServe.quakenet.org :AUTH irc.nick Password -# 4 - QuakeNet - Alternate Method To Identify To A Different Nick - PRIVMSG Q@CServe.quakenet.org :AUTH irc.auth.nick Password -# -# irc.auth.nick -# IRC Nickname to use if Auth method 2 or 4 is used -# -# irc.ldef -# Leave a defined IRC channel on server connect -# Default: 0 - Disable -# 1 - Enable -# irc.defchan -# IRC channel to leave on server connect if irc.ldef is on -# -# irc.wct -# Time to wait before (re)attemptimg connection to IRC server -# Default: 30000 - (30 Seconds) -# -# irc.maxattempt -# Maximum attempts to try IRC server -# Default: 20 -# -# irc.auto.announce -# Time to wait in Minutes to announce random messages from database. -# Default: 30 - (30 Minutes) -# -# irc.autojoin_kick -# Autojoin IRC channel if kicked -# Default: 1 - Enable -# 0 - Disable -# -# irc.command_prefix -# IRC command prefix -# Example: (.)online all -# -# irc.joinmsg -# irc.rstmsg -# irc.kickmsg -# Bot join/restart/kick messages -# -# irc.chan_# -# wow.chan_# -# IRC and WOW channels to link. Leave # out of IRC channel. Both channels _ARE_ case sensitive -# Example: irc.chan_1 = "Trinity" -# irc.chan_2 = "trinity2" -# wow.chan_1 = "world" -# wow.chan_2 = "LookingForGroup" -# -# irc.StatusChannel -# Channel Number To Display Status Messages In (AuctionHouse, Levels, Deaths, Etc) -# Default: 1 - Channel ID 1 -# -# irc.AnnounceChannel -# Channel Number To Display Announcements In (Announces, Notifies, Event) -# Default: 1 - Channel ID 1 -# -# irc.op_gm_login -# Op The GM In All Channels The Bot Is On When They Log In -# Default: 0 - Disable -# 1 - Enable -# -# irc.op_gm_level -# The Minimum GM Level Required To Have The Bot Op The User -# Default: 5 - GM Level 5 -# -# irc.ajoin (Experimental/Under Development) -# Force players to autojoin an in game channel -# Atleast one player must be in the channel on server start, and atleast one person online for invite to work -# Default: 0 - Disable -# 1 - Enable -# irc.ajchan -# Channel to join if above is Enabled. -# -# irc.online.result -# Maximum number of results per line for the online command -# -# chat.*** (Defineable Strings) -# wow_* - String is displayed in IRC channel -# irc_* - String is displayed in WOW channel -# Options: $Name, $Level, $Msg, $GM (not all options work in every string) -# -# Botmask -# This defines what the bot announces, if its 0 everything is disabled -# simply add the values of the elements you want to create this mask. -# Example: WoW join/leaves are 1 and IRC join/leaves are 2, if you want both of these active then the BotMask is 3. -# (1)Display WoW Chan Join/Leaves In IRC -# (2)Display IRC Chan Join/Leaves/NickChanges In WoW -# (4)Display Unknown Command Message When Trigger Is Used And No Command Exists -# (8)Announce Security Level > 0 As GM At Login -# (16)Announce GM In GM ON State AS GM At Login -# (32)Return Errors To Notice. (If disabled then default is Private Message) -# (64)Display WoW Status Messages (Levels/Deaths) -# (128)Display Nick Changes From IRC In WOW -# (256)Display WoW Announces/Notifies In IRC -# (512)Do Not Let Players Use Commands On Higher GM Level Players -# (1024)Enable AuctionHouse Announcements -# -# irc.gmlog -# Minimum GM level to not show login/pass info in IRC logs -# -# irc.logfile.prefix -# The prefix of the IRC logfile. Directories can be added here. -# Example: "IRC/IRC_" outputs IRC_YYYY-MM-DD.log to the IRC subdirectory in your logs dir -# -# irc.fun.games (Experimental/Under Development) -# Enable IRC games -# Default: 0 - Disable -# 1 - Enable -# irc.gm# -# GM tag to append to (GM onjoin / online command) IRC color codes are acceptable -# -################################################################################################################### - -irc.active = 0 -irc.icc = 001 -irc.host = "" -irc.port = "6667" -irc.user = "TC" -irc.nick = "TrinityCoreBot" -irc.pass = "" -irc.auth = 0 -irc.auth.nick = "TrinityCoreBot" -irc.ldef = 0 -irc.defchan = "lobby" -irc.wct = 30000 -irc.maxattempt = 20 -irc.auto.announce = 30 -irc.autojoin_kick = 1 -irc.command_prefix = "-" -irc.joinmsg = "Trinity Core running. Command trigger is $Trigger." -irc.rstmsg = "Trinity Core is restarting..." -irc.kickmsg = "Do not kick me." -irc.chan_1 = "mangos" -wow.chan_1 = "world" -irc.StatusChannel = 1 -irc.AnnounceChannel = 1 -irc.op_gm_login = 0 -irc.op_gm_level = 3 -irc.ajoin = 1 -irc.ajchan = "World" -irc.online.result = 30 -chat.wow_irc = "-WoW-$Name [$Level]: $Msg" -chat.irc_wow = "-IRC-$Name: $Msg" -chat.join_wow = "[$GM] $Name has joined IRC." -chat.leave_wow = "[$GM] $Name has left IRC." -Botmask = 1023 -irc.gmlog = 1 -irc.logfile.prefix = "irc_" -irc.fun.games = 0 -irc.gm1 = "[Moderator]" -irc.gm2 = "[Game Master]" -irc.gm3 = "[BugTracker]" -irc.gm4 = "[DevTeam Admin]" -irc.gm5 = "[SysOP]" diff --git a/src/trinityrealm/AuthCodes.h b/src/trinityrealm/AuthCodes.h index c33acc51c47..f9e599eb851 100644 --- a/src/trinityrealm/AuthCodes.h +++ b/src/trinityrealm/AuthCodes.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -68,6 +70,6 @@ enum LoginResult // others will not and opposite // will only support WoW and WoW:TBC 2.4.3 client build 8606... -//#define EXPECTED_MANGOS_CLIENT_BUILD {8606, 0} // - commented as builds are set in config +#define EXPECTED_TRINITY_CLIENT_BUILD {8606, 0} #endif diff --git a/src/trinityrealm/AuthSocket.cpp b/src/trinityrealm/AuthSocket.cpp index 55e65a79052..b06ac605e4f 100644 --- a/src/trinityrealm/AuthSocket.cpp +++ b/src/trinityrealm/AuthSocket.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file @@ -369,14 +371,13 @@ bool AuthSocket::_HandleLogonChallenge() ///- Check if the client has one of the expected version numbers bool valid_version=false; - int MinBuild = sConfig.GetIntDefault("MinBuild", 8606); - int MaxBuild = sConfig.GetIntDefault("MaxBuild", 8606); - - if(ch->build >= MinBuild && ch->build <= MaxBuild) { + int accepted_versions[]=EXPECTED_TRINITY_CLIENT_BUILD; + for(int i=0;accepted_versions[i];i++) + if(ch->build==accepted_versions[i]) + { valid_version=true; - } else { - valid_version=false; - }; + break; + } /// <ul><li> if this is a valid version if(valid_version) @@ -683,7 +684,7 @@ bool AuthSocket::_HandleLogonProof() if(WrongPassBanType) { uint32 acc_id = fields[0].GetUInt32(); - dbRealmServer.PExecute("INSERT INTO account_banned VALUES ('%u',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','MaNGOS realmd','Failed login autoban',1)", + dbRealmServer.PExecute("INSERT INTO account_banned VALUES ('%u',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','Trinity realm','Failed login autoban',1)", acc_id, WrongPassBanTime); sLog.outBasic("[AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", _login.c_str(), WrongPassBanTime, failed_logins); @@ -692,7 +693,7 @@ bool AuthSocket::_HandleLogonProof() { std::string current_ip = GetRemoteAddress(); dbRealmServer.escape_string(current_ip); - dbRealmServer.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','MaNGOS realmd','Failed login autoban')", + dbRealmServer.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','Trinity realm','Failed login autoban')", current_ip.c_str(), WrongPassBanTime); sLog.outBasic("[AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", current_ip.c_str(), WrongPassBanTime, _login.c_str(), failed_logins); diff --git a/src/trinityrealm/AuthSocket.h b/src/trinityrealm/AuthSocket.h index c63b944cdf4..b58f1d79eec 100644 --- a/src/trinityrealm/AuthSocket.h +++ b/src/trinityrealm/AuthSocket.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup realmd diff --git a/src/trinityrealm/Main.cpp b/src/trinityrealm/Main.cpp index 6255a1b031c..3be531fd4f2 100644 --- a/src/trinityrealm/Main.cpp +++ b/src/trinityrealm/Main.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup realmd Realm Daemon @@ -44,7 +46,7 @@ #ifdef WIN32 #include "ServiceWin32.h" char serviceName[] = "realmd"; -char serviceLongName[] = "MaNGOS realmd service"; +char serviceLongName[] = "Trinity realm service"; char serviceDescription[] = "Massive Network Game Object Server"; /* * -1 - not in service mode @@ -197,7 +199,7 @@ extern int main(int argc, char **argv) ListenSocket<AuthSocket> authListenSocket(h); if ( authListenSocket.Bind(bind_ip.c_str(),rmport)) { - sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport ); + sLog.outError( "Trinity realm can not bind to %s:%d",bind_ip.c_str(), rmport ); return 1; } diff --git a/src/trinityrealm/Makefile.am b/src/trinityrealm/Makefile.am index a80b0ddf49e..82e59b6e879 100644 --- a/src/trinityrealm/Makefile.am +++ b/src/trinityrealm/Makefile.am @@ -4,7 +4,7 @@ # # 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 3 of the License, or +# 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, @@ -69,3 +69,4 @@ install-data-hook: ## Additional files to include when running 'make dist' EXTRA_DIST = trinityrealm.conf.dist + diff --git a/src/trinityrealm/RealmList.cpp b/src/trinityrealm/RealmList.cpp index 091b8f95d88..f5dae403a5e 100644 --- a/src/trinityrealm/RealmList.cpp +++ b/src/trinityrealm/RealmList.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** \file diff --git a/src/trinityrealm/RealmList.h b/src/trinityrealm/RealmList.h index 6d19a673a95..8e9bc1df7ec 100644 --- a/src/trinityrealm/RealmList.h +++ b/src/trinityrealm/RealmList.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * + * Thanks to the original authors: MaNGOS <http://www.mangosproject.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 @@ -8,12 +10,12 @@ * * 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 + * 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /// \addtogroup realmd diff --git a/src/trinityrealm/trinityrealm.conf.dist b/src/trinityrealm/trinityrealm.conf.dist index 2ca543e4224..72ef1c9012e 100644 --- a/src/trinityrealm/trinityrealm.conf.dist +++ b/src/trinityrealm/trinityrealm.conf.dist @@ -114,19 +114,3 @@ RealmsStateUpdateDelay = 20 WrongPass.MaxCount = 0 WrongPass.BanTime = 600 WrongPass.BanType = 0 - -################################################################################################################### -# CLIENT BUILD OPTIONS -# -# Client Builds: -# -# MinBuild -# The minium client build allowed to connect -# -# MaxBuild -# The maximum client build allowed to connect -# -################################################################################################################### - -MinBuild = 8606 -MaxBuild = 8606 |