[svn] * Proper SVN structure

--HG--
branch : trunk
This commit is contained in:
Neo2003
2008-10-02 16:23:55 -05:00
commit 9b1c0e006f
2564 changed files with 621124 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
# Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
#
# This 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
## Process this file with automake to produce Makefile.in
## Sub-directories to parse
## Build MaNGOS script library as shared library.
# libmangosscript shared library will later be reused by world server daemon.
lib_LTLIBRARIES = libtrinityscript.la
libtrinityscript_la_CPPFLAGS = \
$(MYSQL_INCLUDES) \
$(POSTGRE_INCLUDES) \
-I$(top_srcdir)/dep/include \
-I$(top_srcdir)/src/shared \
-I$(top_srcdir)/src/framework \
-I$(top_srcdir)/src/game
libtrinityscript_la_SOURCES = \
ScriptMgr.cpp \
ScriptMgr.h \
config.h \
system.cpp \
Scripts/sc_default.cpp \
Scripts/sc_defines.cpp \
Scripts/sc_defines.h
## libtool settings
# API versioning
libtrinityscript_la_LIBFLAGS = -version-info 0:0:1
libtrinityscript_la_LIBADD = $(MYSQL_LIBS) $(POSTGRE_LIBS)
## Additional files to include when running 'make dist'
# Scripts defaults.
EXTRA_DIST = \
Scripts/sc_default.cpp \
Scripts/sc_defines.cpp \
Scripts/sc_defines.h
+32
View File
@@ -0,0 +1,32 @@
** HOW TO SCRIPT IN C++ **
1 - create a file myscript.cpp in scripts folder.
2 - copy the content of script_default.cpp, it as the structure on how the scripting fuctions are organized.
dont forget to change the name of fuctions, like GossipHello_default to GossipHello_myscript.
3 - in fuction AddSC_default change to AddSC_myscript.
4 - newscript->Name="default"; change the string to "myscript" this name is the one to be called from the db
5 - dont forget to change the name in here to newscript->pGossipHello = &GossipHello_default; this is where the scripted fuctions are stored.
6 - and last thing is in ScriptMgr.cpp
add your AddSC_myscript in here
// -- Scripts to be added --
extern void AddSC_default();
// -------------------
and here
// -- Inicialize the Scripts to be Added --
AddSC_default();
// ----------------------------------------
now start using the player fuctions to script ;)
see the sc_defines.h for some fuctions to use.
hope it helps, any question use our forum.
copy libscript.so and libscript.a to your server/lib path
made by: mmcs.
+328
View File
@@ -0,0 +1,328 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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 "config.h"
#include "ScriptMgr.h"
#include "../../game/GossipDef.h"
#include "../../game/GameObject.h"
#include "../../game/Player.h"
#include "../../game/Map.h"
#include "../../game/ObjectMgr.h"
//uint8 loglevel = 0;
int nrscripts;
Script *m_scripts[MAX_SCRIPTS];
InstanceDataScript* m_instance_scripts[MAX_INSTANCE_SCRIPTS];
int num_inst_scripts;
// -- Scripts to be added --
extern void AddSC_default();
// -------------------
MANGOS_DLL_EXPORT
void ScriptsFree()
{ // Free resources before library unload
for(int i=0;i<nrscripts;i++)
delete m_scripts[i];
for(int i=0;i<num_inst_scripts;i++)
delete m_instance_scripts[i];
nrscripts = 0;
num_inst_scripts = 0;
}
MANGOS_DLL_EXPORT
void ScriptsInit()
{
nrscripts = 0;
num_inst_scripts = 0;
for(int i=0;i<MAX_SCRIPTS;i++)
{
m_scripts[i]=NULL;
m_instance_scripts[i]=NULL;
}
// -- Inicialize the Scripts to be Added --
AddSC_default();
// ----------------------------------------
}
Script* GetScriptByName(std::string Name)
{
if(Name.empty())
return NULL;
for(int i=0;i<MAX_SCRIPTS;i++)
{
if( m_scripts[i] && m_scripts[i]->Name == Name )
return m_scripts[i];
}
return NULL;
}
MANGOS_DLL_EXPORT
bool GossipHello ( Player * player, Creature *_Creature )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pGossipHello) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGossipHello(player,_Creature);
}
MANGOS_DLL_EXPORT
bool GossipSelect( Player *player, Creature *_Creature,uint32 sender, uint32 action )
{
debug_log("DEBUG: Gossip selection, sender: %d, action: %d",sender, action);
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pGossipSelect) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGossipSelect(player,_Creature,sender,action);
}
MANGOS_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);
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pGossipSelectWithCode) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGossipSelectWithCode(player,_Creature,sender,action,sCode);
}
MANGOS_DLL_EXPORT
bool QuestAccept( Player *player, Creature *_Creature, Quest *_Quest )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pQuestAccept) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pQuestAccept(player,_Creature,_Quest);
}
MANGOS_DLL_EXPORT
bool QuestSelect( Player *player, Creature *_Creature, Quest *_Quest )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pQuestSelect) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pQuestSelect(player,_Creature,_Quest);
}
MANGOS_DLL_EXPORT
bool QuestComplete( Player *player, Creature *_Creature, Quest *_Quest )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pQuestComplete) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pQuestComplete(player,_Creature,_Quest);
}
MANGOS_DLL_EXPORT
bool ChooseReward( Player *player, Creature *_Creature, Quest *_Quest, uint32 opt )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pChooseReward) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pChooseReward(player,_Creature,_Quest,opt);
}
MANGOS_DLL_EXPORT
uint32 NPCDialogStatus( Player *player, Creature *_Creature )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pNPCDialogStatus) return 100;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pNPCDialogStatus(player,_Creature);
}
MANGOS_DLL_EXPORT
uint32 GODialogStatus( Player *player, GameObject *_GO )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName);
if(!tmpscript || !tmpscript->pGODialogStatus) return 100;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGODialogStatus(player,_GO);
}
MANGOS_DLL_EXPORT
bool ItemHello( Player *player, Item *_Item, Quest *_Quest )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_Item->GetProto()->ScriptName);
if(!tmpscript || !tmpscript->pItemHello) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pItemHello(player,_Item,_Quest);
}
MANGOS_DLL_EXPORT
bool ItemQuestAccept( Player *player, Item *_Item, Quest *_Quest )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_Item->GetProto()->ScriptName);
if(!tmpscript || !tmpscript->pItemQuestAccept) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pItemQuestAccept(player,_Item,_Quest);
}
MANGOS_DLL_EXPORT
bool GOHello( Player *player, GameObject *_GO )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName);
if(!tmpscript || !tmpscript->pGOHello) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGOHello(player,_GO);
}
MANGOS_DLL_EXPORT
bool GOQuestAccept( Player *player, GameObject *_GO, Quest *_Quest )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName);
if(!tmpscript || !tmpscript->pGOQuestAccept) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGOQuestAccept(player,_GO,_Quest);
}
MANGOS_DLL_EXPORT
bool GOChooseReward( Player *player, GameObject *_GO, Quest *_Quest, uint32 opt )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName);
if(!tmpscript || !tmpscript->pGOChooseReward) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pGOChooseReward(player,_GO,_Quest,opt);
}
MANGOS_DLL_EXPORT
bool AreaTrigger ( Player *player, AreaTriggerEntry* atEntry )
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(GetAreaTriggerScriptNameById(atEntry->id));
if(!tmpscript || !tmpscript->pAreaTrigger) return false;
return tmpscript->pAreaTrigger(player, atEntry);
}
MANGOS_DLL_EXPORT
bool ReceiveEmote ( Player *player, Creature *_Creature, uint32 emote )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->pReceiveEmote) return false;
return tmpscript->pReceiveEmote(player,_Creature, emote);
}
MANGOS_DLL_EXPORT
bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets)
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_Item->GetProto()->ScriptName);
if(!tmpscript || !tmpscript->pItemUse) return false;
return tmpscript->pItemUse(player,_Item,targets);
}
MANGOS_DLL_EXPORT
CreatureAI* GetAI(Creature *_Creature )
{
Script *tmpscript = GetScriptByName(_Creature->GetScriptName());
if(!tmpscript || !tmpscript->GetAI) return NULL;
return tmpscript->GetAI(_Creature);
}
MANGOS_DLL_EXPORT
InstanceData* CreateInstanceData(Map *map)
{
if(!map->IsDungeon()) return NULL;
std::string name = ((InstanceMap*)map)->GetScript();
if(!name.empty())
for(int i=0;i<num_inst_scripts;i++)
if(m_instance_scripts[i] && m_instance_scripts[i]->name == name)
return m_instance_scripts[i]->GetInstanceData(map);
return NULL;
}
void ScriptedAI::UpdateAI(const uint32)
{
//Check if we have a current target
if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim())
{
//If we are within range melee the target
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
{
if( m_creature->isAttackReady() )
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}
}
}
void ScriptedAI::EnterEvadeMode()
{
if( m_creature->isAlive() )
DoGoHome();
}
void ScriptedAI::DoStartAttack(Unit* victim)
{
if( m_creature->Attack(victim, true) )
m_creature->GetMotionMaster()->MoveChase(victim);
}
void ScriptedAI::DoStopAttack()
{
if( m_creature->getVictim() != NULL )
{
m_creature->AttackStop();
}
}
void ScriptedAI::DoGoHome()
{
if( !m_creature->getVictim() && m_creature->isAlive() )
m_creature->GetMotionMaster()->MoveTargetedHome();
}
+159
View File
@@ -0,0 +1,159 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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 SCRIPTMGR_H
#define SCRIPTMGR_H
//Only required includes
#include "../../game/CreatureAI.h"
#include "../../game/Creature.h"
#include "../../game/InstanceData.h"
class Player;
class Creature;
class Quest;
class Item;
class GameObject;
class SpellCastTargets;
class Map;
#define MAX_SCRIPTS 1000
#define MAX_INSTANCE_SCRIPTS 1000
struct Script
{
Script() :
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL),
pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
pGOChooseReward(NULL), pReceiveEmote(NULL), pItemUse(NULL), GetAI(NULL)
{}
std::string Name;
// -- Quest/gossip Methods to be scripted --
bool (*pGossipHello )(Player *player, Creature *_Creature);
bool (*pQuestAccept )(Player *player, Creature *_Creature, Quest const*_Quest );
bool (*pGossipSelect )(Player *player, Creature *_Creature, uint32 sender, uint32 action );
bool (*pGossipSelectWithCode)(Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode );
bool (*pQuestSelect )(Player *player, Creature *_Creature, Quest const*_Quest );
bool (*pQuestComplete )(Player *player, Creature *_Creature, Quest const*_Quest );
uint32 (*pNPCDialogStatus )(Player *player, Creature *_Creature );
uint32 (*pGODialogStatus )(Player *player, GameObject * _GO );
bool (*pChooseReward )(Player *player, Creature *_Creature, Quest const*_Quest, uint32 opt );
bool (*pItemHello )(Player *player, Item *_Item, Quest const*_Quest );
bool (*pGOHello )(Player *player, GameObject *_GO );
bool (*pAreaTrigger )(Player *player, AreaTriggerEntry* at);
bool (*pItemQuestAccept )(Player *player, Item *_Item, Quest const*_Quest );
bool (*pGOQuestAccept )(Player *player, GameObject *_GO, Quest const*_Quest );
bool (*pGOChooseReward )(Player *player, GameObject *_GO, Quest const*_Quest, uint32 opt );
bool (*pReceiveEmote )(Player *player, Creature *_Creature, uint32 emote );
bool (*pItemUse )(Player *player, Item* _Item, SpellCastTargets const& targets);
CreatureAI* (*GetAI)(Creature *_Creature);
// -----------------------------------------
};
class InstanceDataScript
{
public:
InstanceDataScript() : GetInstanceData(NULL) {};
std::string name;
InstanceData* (*GetInstanceData)(Map *_Map);
};
extern int nrscripts;
extern Script *m_scripts[MAX_SCRIPTS];
extern InstanceDataScript *m_instance_scripts[MAX_INSTANCE_SCRIPTS];
extern int num_inst_scripts;
#define VISIBLE_RANGE (50.0f)
struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI
{
ScriptedAI(Creature* creature) : m_creature(creature) {}
~ScriptedAI() {}
// Called if IsVisible(Unit *who) is true at each *who move
void MoveInLineOfSight(Unit *) {}
// Called at each attack of m_creature by any victim
void AttackStart(Unit *) {}
// Called at stopping attack by any attacker
void EnterEvadeMode();
// Called at any heal cast/item used (call non implemented)
void HealBy(Unit* /*healer*/, uint32 /*amount_healed*/) {}
// Called at any Damage to any victim (before damage apply)
void DamageDeal(Unit* /*done_to*/, uint32& /*damage*/) {}
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/) {}
// Is unit visible for MoveInLineOfSight
bool IsVisible(Unit* who) const
{
return !who->HasStealthAura() && m_creature->GetDistance(who) <= VISIBLE_RANGE;
}
// Called at World update tick
void UpdateAI(const uint32);
// Called when the creature is killed
void JustDied(Unit *){}
// Called when the creature kills a unit
void KilledUnit(Unit *){}
// Called when hit by a spell
void SpellHit(Unit *, const SpellEntry*){}
Creature* m_creature;
//= Some useful helpers =========================
// Start attack of victim and go to him
void DoStartAttack(Unit* victim);
// Stop attack of current victim
void DoStopAttack();
// Cast spell
void DoCast(Unit* victim, uint32 spelId)
{
m_creature->CastSpell(victim,spelId,true);
}
void DoCastSpell(Unit* who,SpellEntry *spellInfo)
{
m_creature->CastSpell(who,spellInfo,true);
}
void DoSay(char const* text, uint32 language)
{
m_creature->Say(text,language,0);
}
void DoGoHome();
};
#endif
@@ -0,0 +1,119 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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 "sc_defines.h"
bool GossipHello_default(Player* /*player*/, Creature* /*_Creature*/)
{
return false;
}
bool GossipSelect_default(Player* /*player*/, Creature* /*_Creature*/, uint32 /*sender*/, uint32 /*action*/ )
{
return false;
}
bool GossipSelectWithCode_default( Player* /*player*/, Creature* /*_Creature*/, uint32 /*sender*/, uint32 /*action*/, const char* /*sCode*/ )
{
return false;
}
bool QuestAccept_default(Player* /*player*/, Creature* /*_Creature*/, Quest const* /*_Quest*/ )
{
return false;
}
bool QuestSelect_default(Player* /*player*/, Creature* /*_Creature*/, Quest const* /*_Quest*/ )
{
return false;
}
bool QuestComplete_default(Player* /*player*/, Creature* /*_Creature*/, Quest const* /*_Quest*/ )
{
return false;
}
bool ChooseReward_default(Player* /*player*/, Creature* /*_Creature*/, Quest const* /*_Quest*/, uint32 /*opt*/ )
{
return false;
}
uint32 NPCDialogStatus_default(Player* /*player*/, Creature* /*_Creature*/ )
{
return 128;
}
uint32 GODialogStatus_default(Player* /*player*/, GameObject* /*_Creature*/ )
{
return 128;
}
bool ItemHello_default(Player* /*player*/, Item* /*_Item*/, Quest const* /*_Quest*/ )
{
return false;
}
bool ItemQuestAccept_default(Player* /*player*/, Item* /*_Item*/, Quest const* /*_Quest*/ )
{
return false;
}
bool GOHello_default(Player* /*player*/, GameObject* /*_GO*/ )
{
return false;
}
bool GOQuestAccept_default(Player* /*player*/, GameObject* /*_GO*/, Quest const* /*_Quest*/ )
{
return false;
}
bool GOChooseReward_default(Player* /*player*/, GameObject* /*_GO*/, Quest const* /*_Quest*/, uint32 /*opt*/ )
{
return false;
}
bool AreaTrigger_default(Player* /*player*/, AreaTriggerEntry* /*atEntry*/ )
{
return false;
}
void AddSC_default()
{
Script *newscript;
newscript = new Script;
newscript->Name="default";
newscript->pGossipHello = &GossipHello_default;
newscript->pQuestAccept = &QuestAccept_default;
newscript->pGossipSelect = &GossipSelect_default;
newscript->pGossipSelectWithCode = &GossipSelectWithCode_default;
newscript->pQuestSelect = &QuestSelect_default;
newscript->pQuestComplete = &QuestComplete_default;
newscript->pNPCDialogStatus = &NPCDialogStatus_default;
newscript->pGODialogStatus = &GODialogStatus_default;
newscript->pChooseReward = &ChooseReward_default;
newscript->pItemHello = &ItemHello_default;
newscript->pGOHello = &GOHello_default;
newscript->pAreaTrigger = &AreaTrigger_default;
newscript->pItemQuestAccept = &ItemQuestAccept_default;
newscript->pGOQuestAccept = &GOQuestAccept_default;
newscript->pGOChooseReward = &GOChooseReward_default;
m_scripts[nrscripts++] = newscript;
}
@@ -0,0 +1,152 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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 "sc_defines.h"
#include "../../game/Player.h"
uint32 GetSkillLevel(Player *player,uint32 trskill)
{
// Returns the level of some tradetrskill known by player
// Need to add missing spells
uint32 spell_apprentice = 0;
uint32 spell_journeyman = 0;
uint32 spell_expert = 0;
uint32 spell_artisan = 0;
uint32 spell_master = 0;
switch(trskill)
{
case TRADESKILL_ALCHEMY:
spell_apprentice = 2259;
spell_journeyman = 3101;
spell_expert = 3464;
spell_artisan = 11611;
spell_master = 28596; // teached by 28597
break;
case TRADESKILL_BLACKSMITHING:
spell_apprentice = 2018;
spell_journeyman = 3100;
spell_expert = 8768;
spell_artisan = 11454;
spell_master = 29844; // teached by 29845
break;
case TRADESKILL_COOKING:
spell_apprentice = 2550;
spell_journeyman = 3102;
spell_expert = 3413;
spell_artisan = 18260;
spell_master = 33359; // teached by 33361
break;
case TRADESKILL_ENCHANTING:
spell_apprentice = 7411;
spell_journeyman = 7412;
spell_expert = 7413;
spell_artisan = 13920;
spell_master = 28029; // teached by 28030
break;
case TRADESKILL_ENGINEERING:
spell_apprentice = 4036;
spell_journeyman = 4037;
spell_expert = 4038;
spell_artisan = 12656;
spell_master = 30350; // teached by 30351
break;
case TRADESKILL_FIRSTAID:
spell_apprentice = 3273;
spell_journeyman = 3274;
spell_expert = 7924;
spell_artisan = 10846;
spell_master = 27028; // teached by 27029
break;
case TRADESKILL_HERBALISM:
spell_apprentice = 2372;
spell_journeyman = 2373;
spell_expert = 3571;
spell_artisan = 11994;
spell_master = 0;
break;
case TRADESKILL_LEATHERWORKING:
spell_apprentice = 2108;
spell_journeyman = 3104;
spell_expert = 20649;
spell_artisan = 10662;
spell_master = 32549; // teached by 32550
break;
case TRADESKILL_POISONS:
spell_apprentice = 0;
spell_journeyman = 0;
spell_expert = 0;
spell_artisan = 0;
spell_master = 0;
break;
case TRADESKILL_TAILORING:
spell_apprentice = 3908;
spell_journeyman = 3909;
spell_expert = 3910;
spell_artisan = 12180;
spell_master = 26790; // teached by 26791
break;
case TRADESKILL_MINING:
spell_apprentice = 2581;
spell_journeyman = 2582;
spell_expert = 3568;
spell_artisan = 10249;
spell_master = 29354; // teached by 29355
break;
case TRADESKILL_FISHING:
spell_apprentice = 7733;
spell_journeyman = 7734;
spell_expert = 7736;
spell_artisan = 18249;
spell_master = 33098; // teached by 33100
break;
case TRADESKILL_SKINNING:
spell_apprentice = 8615;
spell_journeyman = 8619;
spell_expert = 8620;
spell_artisan = 10769;
spell_master = 32679; // teached by 32678
break;
case TRADESKILL_JEWELCRAFTING:
spell_apprentice = 25229; // teached by 25245
spell_journeyman = 25230; // teached by 25246
spell_expert = 28894; // teached by 28896
spell_artisan = 28895; // teached by 28899
spell_master = 28897; // teached by 28901
break;
}
if (player->HasSpell(spell_master))
return TRADESKILL_LEVEL_MASTER;
if (player->HasSpell(spell_artisan))
return TRADESKILL_LEVEL_ARTISAN;
if (player->HasSpell(spell_expert))
return TRADESKILL_LEVEL_EXPERT;
if (player->HasSpell(spell_journeyman))
return TRADESKILL_LEVEL_JOURNEYMAN;
if (player->HasSpell(spell_apprentice))
return TRADESKILL_LEVEL_APPRENTICE;
return TRADESKILL_LEVEL_NONE;
}
@@ -0,0 +1,96 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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 SC_DEFINES_H
#define SC_DEFINES_H
#include "../ScriptMgr.h"
// Skill defines
#define TRADESKILL_ALCHEMY 1
#define TRADESKILL_BLACKSMITHING 2
#define TRADESKILL_COOKING 3
#define TRADESKILL_ENCHANTING 4
#define TRADESKILL_ENGINEERING 5
#define TRADESKILL_FIRSTAID 6
#define TRADESKILL_HERBALISM 7
#define TRADESKILL_LEATHERWORKING 8
#define TRADESKILL_POISONS 9
#define TRADESKILL_TAILORING 10
#define TRADESKILL_MINING 11
#define TRADESKILL_FISHING 12
#define TRADESKILL_SKINNING 13
#define TRADESKILL_JEWELCRAFTING 14
#define TRADESKILL_LEVEL_NONE 0
#define TRADESKILL_LEVEL_APPRENTICE 1
#define TRADESKILL_LEVEL_JOURNEYMAN 2
#define TRADESKILL_LEVEL_EXPERT 3
#define TRADESKILL_LEVEL_ARTISAN 4
#define TRADESKILL_LEVEL_MASTER 5
// Gossip defines
#define GOSSIP_ACTION_TRADE 1
#define GOSSIP_ACTION_TRAIN 2
#define GOSSIP_ACTION_TAXI 3
#define GOSSIP_ACTION_GUILD 4
#define GOSSIP_ACTION_BATTLE 5
#define GOSSIP_ACTION_BANK 6
#define GOSSIP_ACTION_INN 7
#define GOSSIP_ACTION_HEAL 8
#define GOSSIP_ACTION_TABARD 9
#define GOSSIP_ACTION_AUCTION 10
#define GOSSIP_ACTION_INN_INFO 11
#define GOSSIP_ACTION_UNLEARN 12
#define GOSSIP_ACTION_INFO_DEF 1000
#define GOSSIP_SENDER_MAIN 1
#define GOSSIP_SENDER_INN_INFO 2
#define GOSSIP_SENDER_INFO 3
#define GOSSIP_SENDER_SEC_PROFTRAIN 4
#define GOSSIP_SENDER_SEC_CLASSTRAIN 5
#define GOSSIP_SENDER_SEC_BATTLEINFO 6
#define DEFAULT_GOSSIP_MESSAGE 0xffffff
extern uint32 GetSkillLevel(Player *player,uint32 skill);
// Defined functions to use with player.
#define ADD_GOSSIP_ITEM(a,b,c,d,e,f) PlayerTalkClass->GetGossipMenu()->AddMenuItem(a,b,c,d,e,f)
#define SEND_GOSSIP_MENU(a,b) PlayerTalkClass->SendGossipMenu(a,b)
#define SEND_POI(a,b,c,d,e,f) PlayerTalkClass->SendPointOfInterest(a,b,c,d,e,f)
#define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip();
#define QUEST_DIALOG_STATUS(a,b,c) GetSession()->getDialogStatus(a,b,c)
#define SEND_QUEST_DETAILS(a,b,c) PlayerTalkClass->SendQuestDetails(a,b,c)
#define SEND_REQUESTEDITEMS(a,b,c,d) PlayerTalkClass->SendRequestedItems(a,b,c,d)
#define SEND_VENDORLIST(a) GetSession()->SendListInventory(a)
#define SEND_TRAINERLIST(a) GetSession()->SendTrainerList(a)
#define SEND_BANKERLIST(a) GetSession()->SendShowBank(a)
#define SEND_TABARDLIST(a) GetSession()->SendTabardVendorActivate(a)
#define SEND_AUCTIONLIST(a) GetSession()->SendAuctionHello(a)
#define SEND_TAXILIST(a) GetSession()->SendTaxiStatus(a)
#define SEND_SPRESURRECT() GetSession()->SendSpiritResurrect()
#define GET_HONORRANK() GetHonorRank()
// -----------------------------------
#endif
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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 CONFIG_H
#define CONFIG_H
#endif
//#define WIN32
#ifdef WIN32
//#include <windows.h>
#define MANGOS_DLL_EXPORT extern "C" __declspec(dllexport)
#elif defined( __GNUC__ )
#define MANGOS_DLL_EXPORT extern "C"
#else
#define MANGOS_DLL_EXPORT extern "C" export
#endif
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
*
* This 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
*/
#ifdef WIN32
#include <windows.h>
BOOL APIENTRY DllMain( HANDLE /*hModule*/, DWORD /*ul_reason_for_call*/, LPVOID /*lpReserved*/)
{
return true;
}
#endif