Core/Script: Code style and remove unused core.

Signed-off-by: Gyx <2359980687@qq.com>
This commit is contained in:
Gyx
2012-03-28 11:13:37 +08:00
parent 63c4d2b96e
commit e050945c91
24 changed files with 95 additions and 97 deletions

View File

@@ -203,16 +203,16 @@ public:
pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
float angle = me->GetAngle(pAttumen);
float distance = me->GetDistance2d(pAttumen);
float newX = me->GetPositionX() + cos(angle)*(distance/2) ;
float newY = me->GetPositionY() + sin(angle)*(distance/2) ;
float newX = me->GetPositionX() + cos(angle)*(distance/2);
float newY = me->GetPositionY() + sin(angle)*(distance/2);
float newZ = 50;
//me->Relocate(newX, newY, newZ, angle);
//me->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
distance += 10;
newX = me->GetPositionX() + cos(angle)*(distance/2) ;
newY = me->GetPositionY() + sin(angle)*(distance/2) ;
newX = me->GetPositionX() + cos(angle)*(distance/2);
newY = me->GetPositionY() + sin(angle)*(distance/2);
pAttumen->GetMotionMaster()->Clear();
pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
//pAttumen->Relocate(newX, newY, newZ, -angle);

View File

@@ -201,7 +201,7 @@ public:
void DeSpawnAdds()
{
for (uint8 i = 0; i < 4 ; ++i)
for (uint8 i = 0; i < 4; ++i)
{
Creature* Temp = NULL;
if (AddGUID[i])

View File

@@ -1011,8 +1011,7 @@ public:
if (fLichPositionX && fLichPositionY)
{
Unit* temp;
temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED);
temp->SetWalk(false);
temp->SetSpeed(MOVE_RUN, 2.0f);

View File

@@ -301,7 +301,7 @@ class boss_hexlord_malacrass : public CreatureScript
me->MonsterYell(YELL_DEATH, LANG_UNIVERSAL, 0);
DoPlaySoundToSet(me, SOUND_YELL_DEATH);
for (uint8 i = 0; i < 4 ; ++i)
for (uint8 i = 0; i < 4; ++i)
{
Unit* Temp = Unit::GetUnit((*me), AddGUID[i]);
if (Temp && Temp->isAlive())

View File

@@ -198,7 +198,7 @@ class boss_venoxis : public CreatureScript
case EVENT_HOLY_NOVA:
_inMeleeRange = 0;
for (uint8 i = 0; i < 10 ; ++i)
for (uint8 i = 0; i < 10; ++i)
{
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, i))
// check if target is within melee-distance

View File

@@ -85,6 +85,7 @@ public:
{
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (creature->isVendor())
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
@@ -95,7 +96,8 @@ public:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
player->SEND_GOSSIP_MENU(3985, creature->GetGUID());
}else
}
else
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;

View File

@@ -52,7 +52,7 @@ class npc_henry_stern : public CreatureScript
public:
npc_henry_stern() : CreatureScript("npc_henry_stern") { }
bool OnGossipSelect (Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
@@ -70,7 +70,7 @@ public:
return true;
}
bool OnGossipHello (Player* player, Creature* creature)
bool OnGossipHello(Player* player, Creature* creature)
{
if (player->GetBaseSkillValue(SKILL_COOKING) >= 175 && !player->HasSpell(SPELL_GOLDTHORN_TEA))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
@@ -81,7 +81,6 @@ public:
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
};
/*######

View File

@@ -399,9 +399,9 @@ public:
enum
{
ZOMBIE = 7286,
DEAD_HERO = 7276,
ZOMBIE_CHANCE = 65,
ZOMBIE = 7286,
DEAD_HERO = 7276,
ZOMBIE_CHANCE = 65,
DEAD_HERO_CHANCE = 10
};
@@ -419,13 +419,12 @@ public:
if (randomchance < ZOMBIE_CHANCE)
go->SummonCreature(ZOMBIE, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
else
if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
if ((randomchance - ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
go->SummonCreature(DEAD_HERO, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
}
go->AddUse();
return false;
}
};
/*######

View File

@@ -602,7 +602,7 @@ public:
ravager->AI()->AttackStart(player);
}
}
return true ;
return true;
}
};

View File

@@ -277,7 +277,6 @@ public:
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
}
};
};
/*#####
@@ -316,6 +315,7 @@ public:
{
if (player->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(738, creature->GetGUID());
return true;
@@ -410,7 +410,6 @@ public:
bool OnGossipHello(Player* player, GameObject* go)
{
if (player->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE)
{
if (Creature* panther = go->FindNearestCreature(ENRAGED_PANTHER, 5, true))
@@ -421,7 +420,7 @@ public:
}
}
return true ;
return true;
}
};

View File

@@ -161,12 +161,12 @@ public:
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(3377, creature->GetGUID());
}else
}
else
player->SEND_GOSSIP_MENU(3375, creature->GetGUID());
return true;
}
};
void AddSC_winterspring()

View File

@@ -105,7 +105,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
bool IsEncounterInProgress() const
{
for (uint8 i = 0; i < MAX_ENCOUNTERS ; ++i)
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
if (EncounterStatus[i] == IN_PROGRESS)
return true;
return false;

View File

@@ -457,7 +457,7 @@ public:
{
if (HealthBelowPct(45))
{
Phase = 3 ;
Phase = 3;
DoScriptText(SAY_REQUEST_AID, me);
//here Lich King should respond to KelThuzad but I don't know which Creature to make talk
//so for now just make Kelthuzad says it.

View File

@@ -465,7 +465,6 @@ public:
playerDied = buff2;
}
};
};
void AddSC_instance_naxxramas()

View File

@@ -203,7 +203,7 @@ public:
if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2)
return;
for (uint8 i = 0; i < 4 ; i++)
for (uint8 i = 0; i < 4; i++)
{
SetPosition(i);
me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation());

View File

@@ -308,7 +308,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
for (std::list<Unit*>::iterator itr = targetList.begin() ; itr != targetList.end();)
for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
{
Position pos;
(*itr)->GetPosition(&pos);
@@ -355,7 +355,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
for (std::list<Unit*>::iterator itr = targetList.begin() ; itr != targetList.end();)
for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
{
Position pos;
(*itr)->GetPosition(&pos);

View File

@@ -48,65 +48,77 @@ public:
void Reset()
{
if (fm_Type == 0) fm_Type = GetForgeMasterType();
if (fm_Type == 0)
fm_Type = GetForgeMasterType();
CheckForge();
}
void CheckForge()
{
if (instance)
if (instance)
{
switch (fm_Type)
{
case 1:
instance->SetData(EVENT_FORGE_1, me->isAlive() ? NOT_STARTED : DONE);
break;
case 2:
instance->SetData(EVENT_FORGE_2, me->isAlive() ? NOT_STARTED : DONE);
break;
case 3:
instance->SetData(EVENT_FORGE_3, me->isAlive() ? NOT_STARTED : DONE);
break;
case 1:
instance->SetData(EVENT_FORGE_1, me->isAlive() ? NOT_STARTED : DONE);
break;
case 2:
instance->SetData(EVENT_FORGE_2, me->isAlive() ? NOT_STARTED : DONE);
break;
case 3:
instance->SetData(EVENT_FORGE_3, me->isAlive() ? NOT_STARTED : DONE);
break;
}
}
}
void JustDied(Unit* /*killer*/)
{
if (fm_Type == 0) fm_Type = GetForgeMasterType();
if (fm_Type == 0)
fm_Type = GetForgeMasterType();
if (instance)
{
switch (fm_Type)
{
case 1:
instance->SetData(EVENT_FORGE_1, DONE);
break;
case 2:
instance->SetData(EVENT_FORGE_2, DONE);
break;
case 3:
instance->SetData(EVENT_FORGE_3, DONE);
break;
case 1:
instance->SetData(EVENT_FORGE_1, DONE);
break;
case 2:
instance->SetData(EVENT_FORGE_2, DONE);
break;
case 3:
instance->SetData(EVENT_FORGE_3, DONE);
break;
}
}
}
void EnterCombat(Unit* /*who*/)
{
if (fm_Type == 0) fm_Type = GetForgeMasterType();
if (fm_Type == 0)
fm_Type = GetForgeMasterType();
if (instance)
{
switch (fm_Type)
{
case 1:
instance->SetData(EVENT_FORGE_1, IN_PROGRESS);
break;
case 2:
instance->SetData(EVENT_FORGE_2, IN_PROGRESS);
break;
case 3:
instance->SetData(EVENT_FORGE_3, IN_PROGRESS);
break;
case 1:
instance->SetData(EVENT_FORGE_1, IN_PROGRESS);
break;
case 2:
instance->SetData(EVENT_FORGE_2, IN_PROGRESS);
break;
case 3:
instance->SetData(EVENT_FORGE_3, IN_PROGRESS);
break;
}
}
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
@@ -115,29 +127,26 @@ public:
uint8 GetForgeMasterType()
{
float diff = 30.0f;
int near_f = 0;
uint8 near_f = 0;
for (uint8 i = 0; i < 3 ; ++i)
for (uint8 i = 0; i < 3; ++i)
{
GameObject* temp;
temp = me->FindNearestGameObject(entry_search[i], 30);
if (temp)
if (GameObject* go = me->FindNearestGameObject(entry_search[i], 30))
{
if (me->IsWithinDist(temp, diff, false))
if (me->IsWithinDist(go, diff, false))
{
near_f = i + 1;
diff = me->GetDistance2d(temp);
diff = me->GetDistance2d(go);
}
}
}
switch (near_f)
{
case 1: return 1;
case 2: return 2;
case 3: return 3;
default: return 0;
case 1: return 1;
case 2: return 2;
case 3: return 3;
default: return 0;
}
}
@@ -152,7 +161,6 @@ public:
DoMeleeAttackIfReady();
}
};
};
void AddSC_utgarde_keep()

View File

@@ -1071,7 +1071,7 @@ public:
SummonList.clear();
for (uint8 uiI = 0; uiI < 16 ; uiI++)
for (uint8 uiI = 0; uiI < 16; uiI++)
{
if (Creature* summon = me->SummonCreature(Boss[uiBossRandom].uiAdd, AddSpawnPosition[uiI]))
{

View File

@@ -236,8 +236,8 @@ class boss_warchief_kargath_bladefist : public CreatureScript
float x, y, randx, randy;
randx = 0.0f + rand()%40;
randy = 0.0f + rand()%40;
x = 210+ randx ;
y = -60- randy ;
x = 210+ randx;
y = -60- randy;
me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ());
Wait_Timer = 0;
}

View File

@@ -90,7 +90,6 @@ public:
player->AreaExploredOrEventHappens(10044);
player->CLOSE_GOSSIP_MENU();
break;
case GOSSIP_ACTION_INFO_DEF + 10:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
@@ -135,12 +134,10 @@ public:
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
}
else
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
};
/*#####
@@ -235,7 +232,6 @@ public:
DoScriptText(SAY_MAG_MORE_REPLY, temp);
me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
@@ -311,7 +307,6 @@ public:
DoMeleeAttackIfReady();
}
};
};
/*######
@@ -356,7 +351,6 @@ public:
}
}
};
};
/*######
@@ -401,6 +395,7 @@ public:
player->KilledMonsterCredit(NPC_CORKI_CREDIT_1, 0);
}
}
if (go->GetEntry() == GO_CORKIS_PRISON_2)
{
if (Creature* corki = go->FindNearestCreature(NPC_CORKI_2, 25, true))
@@ -411,6 +406,7 @@ public:
player->KilledMonsterCredit(NPC_CORKI_2, 0);
}
}
if (go->GetEntry() == GO_CORKIS_PRISON_3)
{
if (Creature* corki = go->FindNearestCreature(NPC_CORKI_3, 25, true))
@@ -689,15 +685,11 @@ class go_warmaul_prison : public GameObjectScript
if (Creature* prisoner = go->FindNearestCreature(NPC_MAGHAR_PRISONER, 5.0f))
{
if (prisoner)
{
go->UseDoorOrButton();
if (player)
player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
go->UseDoorOrButton();
player->KilledMonsterCredit(NPC_MAGHAR_PRISONER, 0);
prisoner->AI()->Talk(SAY_FREE, player->GetGUID());
prisoner->ForcedDespawn(6000);
}
prisoner->AI()->Talk(SAY_FREE, player->GetGUID());
prisoner->ForcedDespawn(6000);
}
return true;
}

View File

@@ -56,6 +56,7 @@ public:
{
if (creature->GetEntry() == 17900)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
if (creature->GetEntry() == 17901)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
}

View File

@@ -337,7 +337,7 @@ class spell_dk_death_pact : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& unitList)
{
Unit* unit_to_add = NULL;
for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end(); ++itr)
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
if ((*itr)->GetTypeId() == TYPEID_UNIT
&& (*itr)->GetOwnerGUID() == GetCaster()->GetGUID()

View File

@@ -1589,15 +1589,15 @@ class spell_item_brewfest_mount_transformation : public SpellScriptLoader
{
case SPELL_BREWFEST_MOUNT_TRANSFORM:
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ;
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
else
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ;
spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
break;
case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE:
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ;
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100;
else
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ;
spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60;
break;
default:
return;

View File

@@ -371,7 +371,7 @@ class boss_ysondre : public CreatureScript
{
Talk(SAY_YSONDRE_SUMMON_DRUIDS);
for (uint8 i = 0 ; i < 10 ; ++i)
for (uint8 i = 0; i < 10; ++i)
DoCast(me, SPELL_SUMMON_DRUID_SPIRITS, true);
++_stage;
}