aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-08-14 20:12:58 +0200
committerKudlaty <none@none>2009-08-14 20:12:58 +0200
commit686cd6eeffdad89e24407bbb816f48997cf3bb53 (patch)
tree1d589c6294f91a8654651f201cfc37e6ae5d1427 /src
parent4252c4cef0513397101203f46b916b21e80d7cd8 (diff)
Merge [SD2]
r1268 Check if faction pointer are valid before use. Patch by balrok r1269 Clean up one source file and apply code style. Patch by jotapdiez r1270 Fix code causing crash after log in, part revert rev 1267 r1271 Revert previous commit, and instead fix typo :) Patch by Apoc --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp2
-rw-r--r--src/bindings/scripts/scripts/go/go_scripts.cpp28
-rw-r--r--src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp106
3 files changed, 83 insertions, 53 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index fe81a68112f..1d423574f42 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -215,7 +215,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
//Using the extended script system we first create a list of viable spells
SpellEntry const* apSpell[CREATURE_MAX_SPELLS];
- memset(apSpell, 0, sizeof(SpellEntry)*CREATURE_MAX_SPELLS);
+ memset(apSpell, 0, sizeof(SpellEntry*)*CREATURE_MAX_SPELLS);
uint32 uiSpellCount = 0;
diff --git a/src/bindings/scripts/scripts/go/go_scripts.cpp b/src/bindings/scripts/scripts/go/go_scripts.cpp
index 006acdaacac..53b03164398 100644
--- a/src/bindings/scripts/scripts/go/go_scripts.cpp
+++ b/src/bindings/scripts/scripts/go/go_scripts.cpp
@@ -233,22 +233,24 @@ bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo)
if (!pCreature->IsHostileTo(pPlayer))
{
uint32 Spell = 0;
- FactionTemplateEntry const* pFaction = pCreature->getFactionTemplateEntry();
- switch(pFaction->faction)
+ if (FactionTemplateEntry const* pFaction = pCreature->getFactionTemplateEntry())
{
- case 1011: Spell = SPELL_REP_LC; break;
- case 935: Spell = SPELL_REP_SHAT; break;
- case 942: Spell = SPELL_REP_CE; break;
- case 933: Spell = SPELL_REP_CON; break;
- case 989: Spell = SPELL_REP_KT; break;
- case 970: Spell = SPELL_REP_SPOR; break;
+ switch(pFaction->faction)
+ {
+ case 1011: Spell = SPELL_REP_LC; break;
+ case 935: Spell = SPELL_REP_SHAT; break;
+ case 942: Spell = SPELL_REP_CE; break;
+ case 933: Spell = SPELL_REP_CON; break;
+ case 989: Spell = SPELL_REP_KT; break;
+ case 970: Spell = SPELL_REP_SPOR; break;
+ }
+
+ if (Spell)
+ pCreature->CastSpell(pPlayer, Spell, false);
+ else
+ error_log("TSCR: go_ethereum_prison summoned creature (entry %u) but faction (%u) are not expected by script.", pCreature->GetEntry(), pCreature->getFaction());
}
-
- if (Spell)
- pCreature->CastSpell(pPlayer, Spell, false);
- else
- error_log("TSCR: go_ethereum_prison summoned creature (entry %u) but faction (%u) are not expected by script.", pCreature->GetEntry(), pCreature->getFaction());
}
}
diff --git a/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp b/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp
index fed577cb4c8..3a186a855a1 100644
--- a/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp
+++ b/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp
@@ -17,7 +17,7 @@
/* ScriptData
SDName: Dustwallow_Marsh
SD%Complete: 95
-SDComment: Quest support: 11180, 558, 11126. Vendor Nat Pagle
+SDComment: Quest support: 11180, 558, 11126, 11142, Vendor Nat Pagle
SDCategory: Dustwallow Marsh
EndScriptData */
@@ -35,54 +35,67 @@ EndContentData */
## mobs_risen_husk_spirit
######*/
-#define SPELL_SUMMON_RESTLESS_APPARITION 42511
-#define SPELL_CONSUME_FLESH 37933 //Risen Husk
-#define SPELL_INTANGIBLE_PRESENCE 43127 //Risen Spirit
+enum
+{
+ QUEST_WHATS_HAUNTING_WITCH_HILL = 11180,
+ SPELL_SUMMON_RESTLESS_APPARITION = 42511,
+ SPELL_CONSUME_FLESH = 37933, //Risen Husk
+ SPELL_INTANGIBLE_PRESENCE = 43127, //Risen Spirit
+ NPC_RISEN_HUSK = 23555,
+ NPC_RISEN_SPIRIT = 23554
+};
struct TRINITY_DLL_DECL mobs_risen_husk_spiritAI : public ScriptedAI
{
mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {}
- uint32 ConsumeFlesh_Timer;
- uint32 IntangiblePresence_Timer;
+ uint32 m_uiConsumeFlesh_Timer;
+ uint32 m_uiIntangiblePresence_Timer;
void Reset()
{
- ConsumeFlesh_Timer = 10000;
- IntangiblePresence_Timer = 5000;
+ m_uiConsumeFlesh_Timer = 10000;
+ m_uiIntangiblePresence_Timer = 5000;
}
- void EnterCombat(Unit* who) { }
-
- void DamageTaken(Unit *done_by, uint32 &damage)
+ void DamageTaken(Unit* pDoneBy, uint32 &damage)
{
- if (done_by->GetTypeId() == TYPEID_PLAYER)
- if (damage >= m_creature->GetHealth() && CAST_PLR(done_by)->GetQuestStatus(11180) == QUEST_STATUS_INCOMPLETE)
- m_creature->CastSpell(done_by,SPELL_SUMMON_RESTLESS_APPARITION,false);
+ if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (damage >= m_creature->GetHealth() && CAST_PLR(pDoneBy)->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE)
+ m_creature->CastSpell(pDoneBy, SPELL_SUMMON_RESTLESS_APPARITION, false);
+ }
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;
- if (ConsumeFlesh_Timer < diff)
+ if (m_uiConsumeFlesh_Timer < uiDiff)
{
- if (m_creature->GetEntry() == 23555)
- DoCast(m_creature->getVictim(),SPELL_CONSUME_FLESH);
- ConsumeFlesh_Timer = 15000;
- } else ConsumeFlesh_Timer -= diff;
+ if (m_creature->GetEntry() == NPC_RISEN_HUSK)
+ DoCast(m_creature->getVictim(), SPELL_CONSUME_FLESH);
+
+ m_uiConsumeFlesh_Timer = 15000;
+ }
+ else
+ m_uiConsumeFlesh_Timer -= uiDiff;
- if (IntangiblePresence_Timer < diff)
+ if (m_uiIntangiblePresence_Timer < uiDiff)
{
- if (m_creature->GetEntry() == 23554)
- DoCast(m_creature->getVictim(),SPELL_INTANGIBLE_PRESENCE);
- IntangiblePresence_Timer = 20000;
- } else IntangiblePresence_Timer -= diff;
+ if (m_creature->GetEntry() == NPC_RISEN_SPIRIT)
+ DoCast(m_creature->getVictim(), SPELL_INTANGIBLE_PRESENCE);
+
+ m_uiIntangiblePresence_Timer = 20000;
+ }
+ else
+ m_uiIntangiblePresence_Timer -= uiDiff;
DoMeleeAttackIfReady();
}
};
+
CreatureAI* GetAI_mobs_risen_husk_spirit(Creature* pCreature)
{
return new mobs_risen_husk_spiritAI (pCreature);
@@ -97,7 +110,7 @@ bool GossipHello_npc_restless_apparition(Player* pPlayer, Creature* pCreature)
pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID());
pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
- pCreature->SetInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
return true;
}
@@ -106,16 +119,20 @@ bool GossipHello_npc_restless_apparition(Player* pPlayer, Creature* pCreature)
## npc_deserter_agitator
######*/
+enum
+{
+ QUEST_TRAITORS_AMONG_US = 11126,
+ FACTION_THER_DESERTER = 1883
+};
+
struct TRINITY_DLL_DECL npc_deserter_agitatorAI : public ScriptedAI
{
- npc_deserter_agitatorAI(Creature *c) : ScriptedAI(c) {}
+ npc_deserter_agitatorAI(Creature* pCreature) : ScriptedAI(pCreature) { }
void Reset()
{
- m_creature->setFaction(894);
+ me->RestoreFaction();
}
-
- void EnterCombat(Unit* who) {}
};
CreatureAI* GetAI_npc_deserter_agitator(Creature* pCreature)
@@ -125,9 +142,9 @@ CreatureAI* GetAI_npc_deserter_agitator(Creature* pCreature)
bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature)
{
- if (pPlayer->GetQuestStatus(11126) == QUEST_STATUS_INCOMPLETE)
+ if (pPlayer->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE)
{
- pCreature->setFaction(1883);
+ pCreature->setFaction(FACTION_THER_DESERTER);
pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
}
else
@@ -140,6 +157,12 @@ bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature)
## npc_lady_jaina_proudmoore
######*/
+enum
+{
+ QUEST_JAINAS_AUTOGRAPH = 558,
+ SPELL_JAINAS_AUTOGRAPH = 23122
+};
+
#define GOSSIP_ITEM_JAINA "I know this is rather silly but i have a young ward who is a bit shy and would like your autograph."
bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature)
@@ -147,7 +170,7 @@ bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature)
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
- if (pPlayer->GetQuestStatus(558) == QUEST_STATUS_INCOMPLETE)
+ if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO);
pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID());
@@ -155,12 +178,12 @@ bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature)
return true;
}
-bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action)
+bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
- if (action == GOSSIP_SENDER_INFO)
+ if (uiAction == GOSSIP_SENDER_INFO)
{
pPlayer->SEND_GOSSIP_MENU(7012, pCreature->GetGUID());
- pPlayer->CastSpell(pPlayer, 23122, false);
+ pPlayer->CastSpell(pPlayer, SPELL_JAINAS_AUTOGRAPH, false);
}
return true;
}
@@ -169,12 +192,17 @@ bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature
## npc_nat_pagle
######*/
+enum
+{
+ QUEST_NATS_MEASURING_TAPE = 8227
+};
+
bool GossipHello_npc_nat_pagle(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
- if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(8227))
+ if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE))
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
pPlayer->SEND_GOSSIP_MENU(7640, pCreature->GetGUID());
@@ -185,9 +213,9 @@ bool GossipHello_npc_nat_pagle(Player* pPlayer, Creature* pCreature)
return true;
}
-bool GossipSelect_npc_nat_pagle(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action)
+bool GossipSelect_npc_nat_pagle(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
- if (action == GOSSIP_ACTION_TRADE)
+ if (uiAction == GOSSIP_ACTION_TRADE)
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
return true;