Core/Script: Code style.

Signed-off-by: Gyx <2359980687@qq.com>
This commit is contained in:
Gyx
2012-03-16 20:31:23 +08:00
parent bef1b0c402
commit cd38e7df2b
11 changed files with 59 additions and 48 deletions

View File

@@ -221,7 +221,8 @@ class boss_janalai : public CreatureScript
dy = float(irand(-area_dy/2, area_dy/2));
Creature* bomb = DoSpawnCreature(MOB_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
if (bomb) FireBombGUIDs[i] = bomb->GetGUID();
if (bomb)
FireBombGUIDs[i] = bomb->GetGUID();
}
BombCount = 0;
}

View File

@@ -120,24 +120,29 @@ static uint32 ChestEntry[] = {186648, 187021, 186672, 186667};
class npc_zulaman_hostage : public CreatureScript
{
public:
npc_zulaman_hostage()
: CreatureScript("npc_zulaman_hostage")
{
}
npc_zulaman_hostage() : CreatureScript("npc_zulaman_hostage") { }
struct npc_zulaman_hostageAI : public ScriptedAI
{
npc_zulaman_hostageAI(Creature* creature) : ScriptedAI(creature) {IsLoot = false;}
npc_zulaman_hostageAI(Creature* creature) : ScriptedAI(creature)
{
IsLoot = false;
}
bool IsLoot;
uint64 PlayerGUID;
void Reset() {}
void EnterCombat(Unit* /*who*/) {}
void JustDied(Unit* /*who*/)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player) player->SendLoot(me->GetGUID(), LOOT_CORPSE);
if (player)
player->SendLoot(me->GetGUID(), LOOT_CORPSE);
}
void UpdateAI(const uint32 /*diff*/)
{
if (IsLoot)
@@ -160,11 +165,13 @@ class npc_zulaman_hostage : public CreatureScript
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
player->CLOSE_GOSSIP_MENU();
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
return true;
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
InstanceScript* instance = creature->GetInstanceScript();

View File

@@ -111,7 +111,7 @@ public:
instance->SetData(TYPE_MEDIVH, IN_PROGRESS);
DoCast(me, SPELL_CHANNEL, false);
Check_Timer = 5000;
}
}
else if (who->GetTypeId() == TYPEID_UNIT && me->IsWithinDistInMap(who, 15.0f))
{
if (instance->GetData(TYPE_MEDIVH) != IN_PROGRESS)
@@ -170,7 +170,7 @@ public:
{
if (SpellCorrupt_Timer <= diff)
{
instance->SetData(TYPE_MEDIVH, SPECIAL);
instance->SetData(TYPE_MEDIVH, SPECIAL);
if (me->HasAura(SPELL_CORRUPT_AEONUS))
SpellCorrupt_Timer = 1000;

View File

@@ -308,7 +308,8 @@ public:
}
}
void SpawnPyramidWave(uint32 wave){
void SpawnPyramidWave(uint32 wave)
{
for (int i = 0; i < pyramidSpawnTotal; i++)
{
if (pyramidSpawns[i][0] == (float)wave)
@@ -321,7 +322,8 @@ public:
}
}
bool IsWaveAllDead(){
bool IsWaveAllDead()
{
for (std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr)
{
if (Creature* add = instance->GetCreature((*itr)))

View File

@@ -234,7 +234,6 @@ public:
void WaypointReached(uint32 i)
{
Player* player = GetPlayerForEscort();
if (!player)
return;

View File

@@ -53,12 +53,12 @@ public:
bool OnGossipHello(Player* player, Creature* creature)
{
uint32 eCreature = creature->GetEntry();
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (eCreature == 9528)
uint32 creatureId = creature->GetEntry();
if (creatureId == 9528)
{
if (player->GetQuestRewardStatus(4101))
{
@@ -70,7 +70,7 @@ public:
player->SEND_GOSSIP_MENU(2844, creature->GetGUID());
}
if (eCreature == 9529)
if (creatureId == 9529)
{
if (player->GetQuestRewardStatus(4102))
{
@@ -84,7 +84,6 @@ public:
return true;
}
};
void AddSC_felwood()

View File

@@ -194,9 +194,7 @@ public:
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (m_uiChatTimer <= uiDiff)
{
m_uiChatTimer = 12000;
}
else
m_uiChatTimer -= uiDiff;
}
@@ -209,9 +207,7 @@ public:
{
DoScriptText(SAY_QUEST_ACCEPT, creature);
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(creature, NPC_MRFLOPPY, 180.0f))
{
Mrfloppy->GetMotionMaster()->MoveFollow(creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
if (npc_escortAI* pEscortAI = CAST_AI(npc_emily::npc_emilyAI, (creature->AI())))
pEscortAI->Start(true, false, player->GetGUID());
@@ -318,7 +314,7 @@ public:
void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_OUTHOUSE_GROANS)
{
{
++m_counter;
if (m_counter < 5)
DoCast(pCaster, SPELL_CAMERA_SHAKE, true);
@@ -503,7 +499,6 @@ public:
me->SetStandState(UNIT_STAND_STATE_STAND);
me->DespawnOrUnsummon(DespawnTimer);
}
}
}
@@ -511,6 +506,7 @@ public:
{
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
};
@@ -695,12 +691,12 @@ public:
void AddSC_grizzly_hills()
{
new npc_emily;
new npc_mrfloppy;
new npc_outhouse_bunny;
new npc_tallhorn_stag;
new npc_amberpine_woodsman;
new npc_wounded_skirmisher;
new npc_emily();
new npc_mrfloppy();
new npc_outhouse_bunny();
new npc_tallhorn_stag();
new npc_amberpine_woodsman();
new npc_wounded_skirmisher();
new npc_lightning_sentry();
new npc_venture_co_straggler();
}

View File

@@ -430,7 +430,10 @@ public:
}
}
void SetGlaiveGUID(uint64 guid){ GlaiveGUID = guid; }
void SetGlaiveGUID(uint64 guid)
{
GlaiveGUID = guid;
}
void UpdateAI(const uint32 diff)
{

View File

@@ -663,7 +663,8 @@ public:
me->CombatStart(Shade);
Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
Shade->SetTarget(me->GetGUID());
if (player) Shade->AddThreat(player, 1.0f);
if (player)
Shade->AddThreat(player, 1.0f);
DoZoneInCombat(Shade);
EventBegun = true;
}
@@ -676,17 +677,19 @@ public:
switch (id)
{
case 0: ++WayPointId; break;
case 0:
++WayPointId;
break;
case 1:
if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID))
{
me->SetTarget(ShadeGUID);
DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE);
EndingTalkCount = 0;
SoulRetrieveTimer = 16000;
}
break;
case 1:
if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID))
{
me->SetTarget(ShadeGUID);
DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE);
EndingTalkCount = 0;
SoulRetrieveTimer = 16000;
}
break;
}
}
@@ -879,7 +882,6 @@ public:
DoMeleeAttackIfReady();
}
};
};
void AddSC_boss_shade_of_akama()

View File

@@ -112,9 +112,11 @@ public:
return;
}
void SetTeronGUID(uint64 guid){ TeronGUID = guid; }
void SetTeronGUID(uint64 guid)
{
TeronGUID = guid;
}
};
};
class mob_shadowy_construct : public CreatureScript

View File

@@ -544,11 +544,11 @@ public:
if (creature->isTrainer())
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
uint32 eCreature = creature->GetEntry();
uint32 creatureId = creature->GetEntry();
//WEAPONSMITH & ARMORSMITH
if (player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225)
{
switch (eCreature)
switch (creatureId)
{
case 11145: //Myolor Sunderfury
case 11176: //Krathok Moltenfist
@@ -572,7 +572,7 @@ public:
//WEAPONSMITH SPEC
if (player->HasSpell(S_WEAPON) && player->getLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250)
{
switch (eCreature)
switch (creatureId)
{
case 11191: //Lilith the Lithe
if (!HasWeaponSub(player))