aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/FULL/world_scripts_full.sql9
-rw-r--r--sql/updates/6091_world_scripts.sql8
-rw-r--r--src/bindings/scripts/include/precompiled.h1
-rw-r--r--src/bindings/scripts/scripts/world/npc_innkeeper.cpp134
-rw-r--r--src/bindings/scripts/system/ScriptLoader.cpp2
-rw-r--r--src/game/ConfusedMovementGenerator.cpp21
6 files changed, 91 insertions, 84 deletions
diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql
index fe07029ef3b..afd96fcc3d3 100644
--- a/sql/FULL/world_scripts_full.sql
+++ b/sql/FULL/world_scripts_full.sql
@@ -64,6 +64,15 @@ UPDATE `creature_template` SET `ScriptName`='guard_shattrath' WHERE `entry`=1968
UPDATE `creature_template` SET `ScriptName`='guard_shattrath_aldor' WHERE `entry`=18549;
UPDATE `creature_template` SET `ScriptName`='guard_shattrath_scryer' WHERE `entry`=18568;
+/* INNKEEPER */
+UPDATE `creature_template` SET `ScriptName`='npc_innkeeper' WHERE `entry` IN
+(32418,32411,29926,30308,31433,32413,30005,29963,31115,31557,29971,18649,15397,6806,6778,16542,17553,19046,16739,16553,11116,9501,
+6740,2352,6739,1247,3934,6727,7714,15433,16458,295,5111,7733,7737,6928,6929,6734,8931,1464,6272,7731,17630,6930,6747,12196,6736,
+6738,11103,6741,6746,5688,6735,6737,2388,9356,7736,11106,5814,7744,6790,16618,11118,6791,23995,24208,6807,14731,16256,15174,16826,
+19531,16602,19470,19232,21088,18245,18906,18905,18251,18907,18908,27148,18914,27187,21746,19352,19319,18957,19571,19495,18913,21744,
+23731,21110,23143,23937,25278,25245,26596,24149,24033,25036,24057,27950,27042,22922,27066,27027,27052,26709,24342,26985,27125,26680,
+29532,28687,28686,27174,28791,29583,26375,28038,29904);
+
/* ITEM */
UPDATE `item_template` SET `ScriptName`='item_draenei_fishing_net' WHERE `entry`=23654;
UPDATE `item_template` SET `ScriptName`='item_flying_machine' WHERE `entry` IN (34060,34061);
diff --git a/sql/updates/6091_world_scripts.sql b/sql/updates/6091_world_scripts.sql
new file mode 100644
index 00000000000..0420a508f3a
--- /dev/null
+++ b/sql/updates/6091_world_scripts.sql
@@ -0,0 +1,8 @@
+
+UPDATE `creature_template` SET `ScriptName`='npc_innkeeper' WHERE `entry` IN
+(32418,32411,29926,30308,31433,32413,30005,29963,31115,31557,29971,18649,15397,6806,6778,16542,17553,19046,16739,16553,11116,9501,
+6740,2352,6739,1247,3934,6727,7714,15433,16458,295,5111,7733,7737,6928,6929,6734,8931,1464,6272,7731,17630,6930,6747,12196,6736,
+6738,11103,6741,6746,5688,6735,6737,2388,9356,7736,11106,5814,7744,6790,16618,11118,6791,23995,24208,6807,14731,16256,15174,16826,
+19531,16602,19470,19232,21088,18245,18906,18905,18251,18907,18908,27148,18914,27187,21746,19352,19319,18957,19571,19495,18913,21744,
+23731,21110,23143,23937,25278,25245,26596,24149,24033,25036,24057,27950,27042,22922,27066,27027,27052,26709,24342,26985,27125,26680,
+29532,28687,28686,27174,28791,29583,26375,28038,29904);
diff --git a/src/bindings/scripts/include/precompiled.h b/src/bindings/scripts/include/precompiled.h
index 3f5bc7e7265..c533aade45f 100644
--- a/src/bindings/scripts/include/precompiled.h
+++ b/src/bindings/scripts/include/precompiled.h
@@ -8,6 +8,7 @@
#include "../ScriptMgr.h"
#include "Cell.h"
#include "CellImpl.h"
+#include "GameEventMgr.cpp"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Unit.h"
diff --git a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp
index da124eeb720..43ba02b79df 100644
--- a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp
+++ b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp
@@ -1,4 +1,6 @@
-/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+/*
+ * Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -16,8 +18,9 @@
/* ScriptData
SDName: Npc_Innkeeper
-SD%Complete: 50
-SDComment: This script are currently not in use. EventSystem cannot be used on Windows build of SD2
+SDAuthor: WarHead
+SD%Complete: 99% - SendBindPoint(pCreature); needs question if you really want to bind before the real bind is done (don't know how atm)
+SDComment: Complete
SDCategory: NPCs
EndScriptData */
@@ -32,48 +35,39 @@ EndScriptData */
#define LOCALE_TRICK_OR_TREAT_3 "Süßes oder Saures!"
#define LOCALE_TRICK_OR_TREAT_6 "¡Truco o trato!"
-bool isEventActive()
+#define LOCALE_INNKEEPER_0 "Make this inn my home."
+#define LOCALE_INNKEEPER_3 "Ich möchte dieses Gasthaus zu meinem Heimatort machen."
+
+bool GossipHello_npc_innkeeper(Player *pPlayer, Creature *pCreature)
{
- /*
- const GameEvent::ActiveEvents *ActiveEventsList = gameeventmgr.GetActiveEventList();
- GameEvent::ActiveEvents::const_iterator itr;
- for (itr = ActiveEventsList->begin(); itr != ActiveEventsList->end(); ++itr)
- {
- if (*itr==HALLOWEEN_EVENTID)
- {
- return true;
- }
- }*/
- return false;
-}
+ if (gameeventmgr.IsActiveEvent(HALLOWEEN_EVENTID) && !pPlayer->HasAura(SPELL_TRICK_OR_TREATED))
+ {
+ char* localizedEntry;
+ switch (pPlayer->GetSession()->GetSessionDbcLocale())
+ {
+ case LOCALE_frFR: localizedEntry = LOCALE_TRICK_OR_TREAT_2; break;
+ case LOCALE_deDE: localizedEntry = LOCALE_TRICK_OR_TREAT_3; break;
+ case LOCALE_esES: localizedEntry = LOCALE_TRICK_OR_TREAT_6; break;
+ case LOCALE_enUS: default: localizedEntry = LOCALE_TRICK_OR_TREAT_0;
+ }
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID);
+ }
-bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature)
-{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
- if (isEventActive()&& !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID()))
+ if (pCreature->isVendor())
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
+
+ if (pCreature->isInnkeeper())
{
char* localizedEntry;
- switch (pPlayer->GetSession()->GetSessionDbLocaleIndex())
+ switch (pPlayer->GetSession()->GetSessionDbcLocale())
{
- case 0:
- localizedEntry=LOCALE_TRICK_OR_TREAT_0;
- break;
- case 2:
- localizedEntry=LOCALE_TRICK_OR_TREAT_2;
- break;
- case 3:
- localizedEntry=LOCALE_TRICK_OR_TREAT_3;
- break;
- case 6:
- localizedEntry=LOCALE_TRICK_OR_TREAT_6;
- break;
- default:
- localizedEntry=LOCALE_TRICK_OR_TREAT_0;
+ case LOCALE_deDE: localizedEntry = LOCALE_INNKEEPER_3; break;
+ case LOCALE_enUS: default: localizedEntry = LOCALE_INNKEEPER_0;
}
-
- pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID);
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INN);
}
pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
@@ -83,54 +77,46 @@ bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature)
bool GossipSelect_npc_innkeeper(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
- if (uiAction == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && isEventActive() && !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID()))
+ if (uiAction == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && gameeventmgr.IsActiveEvent(HALLOWEEN_EVENTID) && !pPlayer->HasAura(SPELL_TRICK_OR_TREATED))
{
- pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->CastSpell(pPlayer, SPELL_TRICK_OR_TREATED, true);
-
- // either trick or treat, 50% chance
- if (rand()%2)
- {
+
+ if (urand(0, 1))
pPlayer->CastSpell(pPlayer, SPELL_TREAT, true);
- }
else
{
- int32 trickspell=0;
- switch (rand()%9) // note that female characters can get male costumes and vice versa
+ uint32 trickspell = 0;
+ switch (urand(0, 13))
{
- case 0:
- trickspell=24753; // cannot cast, random 30sec
- break;
- case 1:
- trickspell=24713; // lepper gnome costume
- break;
- case 2:
- trickspell=24735; // male ghost costume
- break;
- case 3:
- trickspell=24736; // female ghostcostume
- break;
- case 4:
- trickspell=24710; // male ninja costume
- break;
- case 5:
- trickspell=24711; // female ninja costume
- break;
- case 6:
- trickspell=24708; // male pirate costume
- break;
- case 7:
- trickspell=24709; // female pirate costume
- break;
- case 8:
- trickspell=24723; // skeleton costume
- break;
+ case 0: trickspell = 24753; break; // cannot cast, random 30sec
+ case 1: trickspell = 24713; break; // lepper gnome costume
+ case 2: trickspell = 24735; break; // male ghost costume
+ case 3: trickspell = 24736; break; // female ghostcostume
+ case 4: trickspell = 24710; break; // male ninja costume
+ case 5: trickspell = 24711; break; // female ninja costume
+ case 6: trickspell = 24708; break; // male pirate costume
+ case 7: trickspell = 24709; break; // female pirate costume
+ case 8: trickspell = 24723; break; // skeleton costume
+ case 9: trickspell = 24753; break; // Trick
+ case 10: trickspell = 24924; break; // Hallow's End Candy
+ case 11: trickspell = 24925; break; // Hallow's End Candy
+ case 12: trickspell = 24926; break; // Hallow's End Candy
+ case 13: trickspell = 24927; break; // Hallow's End Candy
}
pPlayer->CastSpell(pPlayer, trickspell, true);
}
- return true; // prevent Trinity core handling
+ pPlayer->CLOSE_GOSSIP_MENU();
+ return true;
}
- return false; // the player didn't select "trick or treat" or cheated, normal core handling
+
+ pPlayer->CLOSE_GOSSIP_MENU();
+
+ switch (uiAction)
+ {
+ case GOSSIP_ACTION_TRADE: pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); break;
+ case GOSSIP_ACTION_INN: pPlayer->GetSession()->SendBindPoint(pCreature); break;
+ }
+ return true;
}
void AddSC_npc_innkeeper()
diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp
index cd3e1d8dc80..02ee9cdf5bc 100644
--- a/src/bindings/scripts/system/ScriptLoader.cpp
+++ b/src/bindings/scripts/system/ScriptLoader.cpp
@@ -22,6 +22,7 @@ extern void AddSC_go_scripts();
extern void AddSC_guards();
extern void AddSC_item_scripts();
extern void AddSC_npc_professions();
+extern void AddSC_npc_innkeeper();
extern void AddSC_npcs_special();
extern void AddSC_npc_taxi();
@@ -465,6 +466,7 @@ void AddScripts()
AddSC_guards();
AddSC_item_scripts();
AddSC_npc_professions();
+ AddSC_npc_innkeeper();
AddSC_npcs_special();
AddSC_npc_taxi();
diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp
index 24308dd6c36..9d07d0986ef 100644
--- a/src/game/ConfusedMovementGenerator.cpp
+++ b/src/game/ConfusedMovementGenerator.cpp
@@ -34,7 +34,7 @@ template<class T>
void
ConfusedMovementGenerator<T>::Initialize(T &unit)
{
- const float wander_distance=11;
+ const float wander_distance = 11;
float x,y,z;
x = unit.GetPositionX();
y = unit.GetPositionY();
@@ -49,21 +49,22 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
VMAP::IVMapManager *vMaps = VMAP::VMapFactory::createOrGetVMapManager();
- for (unsigned int idx=0; idx < MAX_CONF_WAYPOINTS+1; ++idx)
+ for (uint8 idx = 0; idx <= MAX_CONF_WAYPOINTS; ++idx)
{
- const float wanderX=wander_distance*rand_norm() - wander_distance/2;
- const float wanderY=wander_distance*rand_norm() - wander_distance/2;
-
const bool isInLoS = vMaps->isInLineOfSight(unit.GetMapId(), x, y, z + 2.0f, i_waypoints[idx][0], i_waypoints[idx][1], z + 2.0f);
- if (!isInLoS)
+ if (isInLoS)
+ {
+ const float wanderX = wander_distance*rand_norm() - wander_distance/2;
+ const float wanderY = wander_distance*rand_norm() - wander_distance/2;
+ i_waypoints[idx][0] = x + wanderX;
+ i_waypoints[idx][1] = y + wanderY;
+ }
+ else
{
i_waypoints[idx][0] = x;
i_waypoints[idx][1] = y;
}
- i_waypoints[idx][0] = x + wanderX;
- i_waypoints[idx][1] = y + wanderY;
-
// prevent invalid coordinates generation
Trinity::NormalizeMapCoord(i_waypoints[idx][0]);
Trinity::NormalizeMapCoord(i_waypoints[idx][1]);
@@ -77,7 +78,7 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
}
unit.UpdateGroundPositionZ(i_waypoints[idx][0],i_waypoints[idx][1],z);
- i_waypoints[idx][2] = z;
+ i_waypoints[idx][2] = z;
}
unit.SetUInt64Value(UNIT_FIELD_TARGET, 0);