Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
Merge with rsa script to Scriptdev Version 2080
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp.dallig committed May 10, 2011
1 parent d988150 commit 6aa54b0
Show file tree
Hide file tree
Showing 652 changed files with 19,031 additions and 5,301 deletions.
55 changes: 40 additions & 15 deletions ScriptMgr.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2006 - 2011 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */

Expand All @@ -13,15 +13,18 @@
#include "../system/system.h"
#include "../../../game/ScriptMgr.h"

typedef std::vector<Script*> SDScriptVec;
int num_sc_scripts;
Script *m_scripts[MAX_SCRIPTS];
SDScriptVec m_scripts;

Config SD2Config;

QueryResult* strSD2Pquery(char* str)
{
return SD2Database.Query(str);
}
// Not registered scripts storage
std::map<std::string, Script*> m_scriptStorage;

void FillSpellSummary();

Expand All @@ -36,7 +39,7 @@ void LoadDatabase()
return;
}

//Initialize connection to DB
// Initialize connection to DB
if (SD2Database.Initialize(strSD2DBinfo.c_str()))
{
outstring_log("SD2: ScriptDev2 database at %s initialized.", strSD2DBinfo.c_str());
Expand Down Expand Up @@ -68,8 +71,13 @@ void FreeScriptLibrary()
delete []SpellSummary;

// Free resources before library unload
for(int i=0; i<MAX_SCRIPTS; ++i)
delete m_scripts[i];
for (SDScriptVec::const_iterator itr = m_scripts.begin(); itr != m_scripts.end(); ++itr)
delete *itr;

m_scripts.clear();

for (std::map<std::string, Script*>::iterator itr = m_scriptStorage.begin(); itr != m_scriptStorage.end(); ++itr)
delete itr->second;

num_sc_scripts = 0;
SD2Database.HaltDelayThread();
Expand All @@ -78,7 +86,7 @@ void FreeScriptLibrary()
MANGOS_DLL_EXPORT
void InitScriptLibrary()
{
//ScriptDev2 startup
// ScriptDev2 startup
outstring_log("");
outstring_log(" MMM MMM MM");
outstring_log("M MM M M M M");
Expand All @@ -89,33 +97,42 @@ void InitScriptLibrary()
outstring_log(" MMM MMM http://www.scriptdev2.com");
outstring_log("");

//Get configuration file
// Get configuration file
if (!SD2Config.SetSource(_SCRIPTDEV2_CONFIG))
error_log("SD2: Unable to open configuration file. Database will be unaccessible. Configuration values will use default.");
else
outstring_log("SD2: Using configuration file %s",_SCRIPTDEV2_CONFIG);

//Check config file version
// Check config file version
if (SD2Config.GetIntDefault("ConfVersion", 0) != SD2_CONF_VERSION)
error_log("SD2: Configuration file version doesn't match expected version. Some config variables may be wrong or missing.");

outstring_log("");

//Load database (must be called after SD2Config.SetSource).
// Load database (must be called after SD2Config.SetSource).
LoadDatabase();

outstring_log("SD2: Loading C++ scripts");
barGoLink bar(1);
bar.step();
outstring_log("");

for(int i=0; i<MAX_SCRIPTS; ++i)
m_scripts[i]=NULL;
// Resize script ids to needed ammount of assigned ScriptNames (from core)
m_scripts.resize(GetScriptIdsCount(), NULL);

m_scriptStorage.clear();

FillSpellSummary();

AddScripts();

// Check existance scripts for all registered by core script names
for (uint32 i = 1; i < GetScriptIdsCount(); ++i)
{
if (!m_scripts[i])
error_log("SD2: No script found for ScriptName '%s'.", GetScriptName(i));
}

outstring_log(">> Loaded %i C++ Scripts.", num_sc_scripts);
}

Expand Down Expand Up @@ -210,18 +227,17 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)

void Script::RegisterSelf(bool bReportError)
{
int id = GetScriptId(Name.c_str());
if (id != 0)
if (uint32 id = GetScriptId(Name.c_str()))
{
m_scripts[id] = this;
++num_sc_scripts;
}
else
{
if (bReportError)
error_log("SD2: Script registering but ScriptName %s is not assigned in database. Script will not be used.", (this)->Name.c_str());
error_log("SD2: Script registering but ScriptName %s is not assigned in database. Script will not be used.", Name.c_str());

delete this;
m_scriptStorage.insert(std::make_pair(Name.c_str(), this));
}
}

Expand Down Expand Up @@ -523,3 +539,12 @@ InstanceData* CreateInstanceData(Map* pMap)

return tmpscript->GetInstanceData(pMap);
}

Script* GetScriptByName(std::string scriptName)
{
std::map<std::string, Script*>::const_iterator itr = m_scriptStorage.find(scriptName);
if (itr != m_scriptStorage.end())
return itr->second;
else
return NULL;
}
6 changes: 4 additions & 2 deletions ScriptMgr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2006 - 2011 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */

Expand All @@ -23,7 +23,6 @@ class WorldObject;
class Aura;
class Object;

#define MAX_SCRIPTS 5000 //72 bytes each (approx 351kb)
#define VISIBLE_RANGE (166.0f) //MAX visible range (size of grid)
#define DEFAULT_TEXT "<ScriptDev2 Text Entry Missing!>"

Expand Down Expand Up @@ -76,6 +75,9 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget = NULL);
//DB query
QueryResult* strSD2Pquery(char*);

// Not registered scripts storage
Script* GetScriptByName(std::string scriptName);

#if COMPILER == COMPILER_GNU
#define FUNC_PTR(name,callconvention,returntype,parameters) typedef returntype(*name)parameters __attribute__ ((callconvention));
#else
Expand Down
88 changes: 76 additions & 12 deletions VC90/90ScriptDev2.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,10 @@
RelativePath="..\scripts\kalimdor\razorfen_kraul\instance_razorfen_kraul.cpp"
>
</File>
<File
RelativePath="..\scripts\kalimdor\razorfen_kraul\razorfen_kraul.cpp"
>
</File>
<File
RelativePath="..\scripts\kalimdor\razorfen_kraul\razorfen_kraul.h"
>
Expand Down Expand Up @@ -2473,10 +2477,6 @@
RelativePath="..\scripts\northrend\icecrown_citadel\icecrown_citadel\instance_icecrown_citadel.cpp"
>
</File>
<File
RelativePath="..\scripts\northrend\icecrown_citadel\icecrown_citadel\instance_icecrown_spire.cpp"
>
</File>
</Filter>
<Filter
Name="frozen_halls"
Expand Down Expand Up @@ -2548,10 +2548,6 @@
RelativePath="..\scripts\northrend\icecrown_citadel\frozen_halls\forge_of_souls\boss_devourer_of_souls.cpp"
>
</File>
<File
RelativePath="..\scripts\northrend\icecrown_citadel\frozen_halls\forge_of_souls\def_forge.h"
>
</File>
<File
RelativePath="..\scripts\northrend\icecrown_citadel\frozen_halls\forge_of_souls\forge_of_souls.cpp"
>
Expand All @@ -2560,10 +2556,6 @@
RelativePath="..\scripts\northrend\icecrown_citadel\frozen_halls\forge_of_souls\instance_forge_of_souls.cpp"
>
</File>
<File
RelativePath="..\scripts\northrend\icecrown_citadel\frozen_halls\forge_of_souls\trash_forge_of_souls.cpp"
>
</File>
</Filter>
</Filter>
</Filter>
Expand Down Expand Up @@ -3080,6 +3072,70 @@
>
</File>
</Filter>
<Filter
Name="outdoor_pvp"
>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_eastern_kingdoms.cpp"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_eastern_kingdoms.h"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_kalimdor.cpp"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_kalimdor.h"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_northrend.cpp"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_northrend.h"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_outland.cpp"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_outland.h"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\outdoor_pvp_zone_selector.h"
>
</File>
<Filter
Name="eastern_kingdoms"
>
<File
RelativePath="..\scripts\outdoor_pvp\eastern_kingdoms\outdoor_pvp_eastern_plaguelands.cpp"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\eastern_kingdoms\outdoor_pvp_eastern_plaguelands.h"
>
</File>
</Filter>
<Filter
Name="kalimdor"
>
<File
RelativePath="..\scripts\outdoor_pvp\kalimdor\outdoor_pvp_silithus.cpp"
>
</File>
<File
RelativePath="..\scripts\outdoor_pvp\kalimdor\outdoor_pvp_silithus.h"
>
</File>
</Filter>
</Filter>
</Filter>
<Filter
Name="include"
Expand Down Expand Up @@ -3168,6 +3224,14 @@
RelativePath="..\include\sc_instance.h"
>
</File>
<File
RelativePath="..\include\sc_outdoor_pvp.cpp"
>
</File>
<File
RelativePath="..\include\sc_outdoor_pvp.h"
>
</File>
</Filter>
<Filter
Name="system"
Expand Down
5 changes: 5 additions & 0 deletions addition/1_mangos_naxxramass.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UPDATE `creature_template` SET `ScriptName`='mob_loatheb_spores' WHERE `entry`=16286;
UPDATE `creature_template` SET `ScriptName`='boss_gothik' WHERE `entry`=16060;
UPDATE `creature_template` SET `ScriptName`='mob_gothik_trainee' WHERE `entry` IN (16124,16127);
UPDATE `creature_template` SET `ScriptName`='mob_gothik_dk' WHERE `entry` IN (16125,16148);
UPDATE `creature_template` SET `ScriptName`='mob_gothik_rider' WHERE `entry` IN (16126,16150);
9 changes: 9 additions & 0 deletions addition/1_mangos_vault_of_archavon.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
UPDATE `creature_template` SET `ScriptName`='boss_archavon' WHERE `entry`=31125;
UPDATE `creature_template` SET `ScriptName`='boss_emalon' WHERE `entry`=33993;
UPDATE `creature_template` SET `ScriptName`='npc_tempest_minion' WHERE `entry`=33998;
UPDATE `creature_template` SET `ScriptName`='npc_tempest_warder' WHERE `entry`=34015;
UPDATE `creature_template` SET `ScriptName`='boss_koralon' WHERE `entry`=35013;
UPDATE `creature_template` SET `AIName`='', ScriptName='boss_toravon' WHERE `entry`=38433;
UPDATE `instance_template` SET `ScriptName`='instance_vault_of_archavon' WHERE `map`=624;
DELETE FROM `spell_script_target` WHERE `entry` IN (72034,72096);
INSERT INTO `spell_script_target` VALUES (72034,1,38433),(72096,1,38433);
3 changes: 3 additions & 0 deletions addition/3_mangos_teleguy.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DELETE FROM `creature_template` WHERE `entry`=99001;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid_1`, `modelid_2`, `modelid_3`, `modelid_4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `PowerType`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `vehicle_id`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `unk16`, `unk17`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
(99001, 0, 0, 0, 0, 0, 18, 0, 18, 0, 'Slappy McFry', 'The Teleport Guy', NULL, 0, 59, 61, 6700, 24000, 0, 5598, 5875, 4049, 35, 35, 1, 1.48, 1.14286, 1, 0, 98, 147, 0, 37, 1.4, 1400, 1400, 2, 0, 0, 0, 0, 0, 0, 0, 78, 118, 30, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'mob_teleguy');
4 changes: 4 additions & 0 deletions addition/4_mangos_arena_honor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- npc arena-honor exchange
DELETE FROM `creature_template` WHERE `entry` = 7;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid_1`, `modelid_2`, `modelid_3`, `modelid_4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `PowerType`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `vehicle_id`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `unk16`, `unk17`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
(7, 0, 0, 0, 0, 0, 17858, 0, 17858, 0, 'Besdoban Durnoye', 'Arena-Honor Exchange', NULL, 0, 59, 61, 6700, 24000, 0, 5598, 5875, 4009, 35, 35, 1, 1.48, 1.14286, 1, 0, 91, 137, 0, 34, 1.4, 1400, 1400, 2, 0, 0, 0, 0, 0, 0, 0, 73, 110, 27, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'npc_arena_honor');
14 changes: 14 additions & 0 deletions addition/4_scriptdev2_arena_honor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- npc arena-honor exchange

DELETE FROM `script_texts` WHERE `entry` in (-1001007, -1001008);
INSERT INTO `script_texts` (`entry`,`content_loc8`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES
('-1001007','Недостаточно ХонорПойнтов!','Your not has enough HonorPoints!','','0','0','0','Unsuccesfull - honorpoint.'),
('-1001008','Недостаточно АренаПойнтов!','Your not has enough AranaPoints!','','0','0','0','Unsuccesfull - arenapoint.');

-- Gossips
DELETE FROM `gossip_texts` WHERE `entry` BETWEEN -3000774 AND -3000769;
INSERT INTO `gossip_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `comment`) VALUES
('-3000770', "Exchange 100 ArenaPoints to 2000 HonorPoints", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Обменять 100 АренаПойнтов на 2000 ХонорПойнтов", "npc_arena_honor gossip 1"),
('-3000771', "Exchange 1000 ArenaPoints to 20000 HonorPoints", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Обменять 1000 АренаПойнтов на 20000 ХонорПойнтов", "npc_arena_honor gossip 2"),
('-3000772', "Exchange 1000 HonorPoints to 50 ArenaPoints", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Обменять 1000 ХонорПойнтов на 50 АренаПойнтов", "npc_arena_honor gossip 3"),
('-3000773', "Exchange 10000 HonorPoints to 500 ArenaPoints", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Обменять 10000 ХонорПойнтов на 500 АренаПойнтов", "npc_arena_honor gossip 4");
6 changes: 6 additions & 0 deletions addition/4_scriptdev2_sapphiron.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DELETE FROM `script_texts` where entry in ('-1533082','-1533083');
INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES
(-1533082,'%s takes in a deep breath.',0,3,0,0,'sapphiron EMOTE_BREATH'),
(-1533083,'%s lifts off into the air!',0,3,0,0,'sapphiron EMOTE_FLY'),
(-1533160,'%s resumes hit attacks!',0,3,0,0,'sapphiron EMOTE_GROUND'),
(-1533161,'%s enrages!',0,3,0,0,'sapphiron EMOTE_ENRAGE');
Loading

0 comments on commit 6aa54b0

Please sign in to comment.