mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
refactor(Core/Scripts): restyle scripts lib with astyle (#3467)
This commit is contained in:
@@ -30,55 +30,55 @@ enum Mojo
|
||||
|
||||
class npc_pet_gen_mojo : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_gen_mojo() : CreatureScript("npc_pet_gen_mojo") { }
|
||||
public:
|
||||
npc_pet_gen_mojo() : CreatureScript("npc_pet_gen_mojo") { }
|
||||
|
||||
struct npc_pet_gen_mojoAI : public ScriptedAI
|
||||
struct npc_pet_gen_mojoAI : public ScriptedAI
|
||||
{
|
||||
npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
_victimGUID = 0;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
_victimGUID = 0;
|
||||
|
||||
if (Unit* owner = me->GetOwner())
|
||||
me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) { }
|
||||
void UpdateAI(uint32 /*diff*/) { }
|
||||
|
||||
void ReceiveEmote(Player* player, uint32 emote)
|
||||
{
|
||||
me->HandleEmoteCommand(emote);
|
||||
Unit* owner = me->GetOwner();
|
||||
if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TYPEID_PLAYER ||
|
||||
owner->ToPlayer()->GetTeamId(true) != player->GetTeamId(true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Talk(SAY_MOJO, player);
|
||||
|
||||
if (_victimGUID)
|
||||
if (Player* victim = ObjectAccessor::GetPlayer(*me, _victimGUID))
|
||||
victim->RemoveAura(SPELL_FEELING_FROGGY);
|
||||
|
||||
_victimGUID = player->GetGUID();
|
||||
|
||||
DoCast(player, SPELL_FEELING_FROGGY, true);
|
||||
DoCast(me, SPELL_SEDUCTION_VISUAL, true);
|
||||
me->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _victimGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_gen_mojoAI(creature);
|
||||
if (Unit* owner = me->GetOwner())
|
||||
me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) { }
|
||||
void UpdateAI(uint32 /*diff*/) { }
|
||||
|
||||
void ReceiveEmote(Player* player, uint32 emote)
|
||||
{
|
||||
me->HandleEmoteCommand(emote);
|
||||
Unit* owner = me->GetOwner();
|
||||
if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TYPEID_PLAYER ||
|
||||
owner->ToPlayer()->GetTeamId(true) != player->GetTeamId(true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Talk(SAY_MOJO, player);
|
||||
|
||||
if (_victimGUID)
|
||||
if (Player* victim = ObjectAccessor::GetPlayer(*me, _victimGUID))
|
||||
victim->RemoveAura(SPELL_FEELING_FROGGY);
|
||||
|
||||
_victimGUID = player->GetGUID();
|
||||
|
||||
DoCast(player, SPELL_FEELING_FROGGY, true);
|
||||
DoCast(me, SPELL_SEDUCTION_VISUAL, true);
|
||||
me->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _victimGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_gen_mojoAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
enum soulTrader
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
uint64 ownerGUID;
|
||||
EventMap events;
|
||||
npc_pet_gen_soul_trader_beaconAI(Creature *c) : ScriptedAI(c)
|
||||
npc_pet_gen_soul_trader_beaconAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_INITIAL_TALK, 0);
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_argent_pony_bridleAI : public ScriptedAI
|
||||
{
|
||||
npc_pet_gen_argent_pony_bridleAI(Creature *c) : ScriptedAI(c)
|
||||
npc_pet_gen_argent_pony_bridleAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
_state = ARGENT_PONY_STATE_NONE;
|
||||
_init = false;
|
||||
@@ -256,10 +256,10 @@ public:
|
||||
{
|
||||
if (player->GetTeamId(true) == TEAM_ALLIANCE)
|
||||
{
|
||||
if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S+i))
|
||||
if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S + i))
|
||||
{
|
||||
duration = cooldown;
|
||||
aura = SPELL_AURA_POSTMAN_S+i;
|
||||
aura = SPELL_AURA_POSTMAN_S + i;
|
||||
_state = argentPonyService[TEAM_ALLIANCE][i];
|
||||
me->ToTempSummon()->UnSummon(duration);
|
||||
break;
|
||||
@@ -267,10 +267,10 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_BANK_G+i))
|
||||
if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_BANK_G + i))
|
||||
{
|
||||
duration = cooldown*IN_MILLISECONDS;
|
||||
aura = SPELL_AURA_BANK_G+i;
|
||||
duration = cooldown * IN_MILLISECONDS;
|
||||
aura = SPELL_AURA_BANK_G + i;
|
||||
_state = argentPonyService[TEAM_HORDE][i];
|
||||
me->ToTempSummon()->UnSummon(duration);
|
||||
break;
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
// Generate Banners
|
||||
uint32 mask = player->GetTeamId(true) ? RACEMASK_HORDE : RACEMASK_ALLIANCE;
|
||||
for (uint8 i = 1; i < MAX_RACES; ++i)
|
||||
if (mask & (1 << (i-1)) && player->HasAchieved(argentBanners[i].achievement))
|
||||
if (mask & (1 << (i - 1)) && player->HasAchieved(argentBanners[i].achievement))
|
||||
_banners[i] = true;
|
||||
}
|
||||
|
||||
@@ -331,12 +331,12 @@ public:
|
||||
_state = param;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _init;
|
||||
uint8 _state;
|
||||
int32 _mountTimer;
|
||||
bool _banners[MAX_RACES];
|
||||
uint32 _lastAura;
|
||||
private:
|
||||
bool _init;
|
||||
uint8 _state;
|
||||
int32 _mountTimer;
|
||||
bool _banners[MAX_RACES];
|
||||
uint32 _lastAura;
|
||||
};
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
@@ -382,13 +382,13 @@ public:
|
||||
creature->AI()->DoAction(ARGENT_PONY_STATE_BANK);
|
||||
break;
|
||||
case GOSSIP_ACTION_MAILBOX:
|
||||
{
|
||||
creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_MAILBOX);
|
||||
player->GetSession()->SendShowMailBox(creature->GetGUID());
|
||||
spellId = player->GetTeamId(true) ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S;
|
||||
creature->AI()->DoAction(ARGENT_PONY_STATE_MAILBOX);
|
||||
break;
|
||||
}
|
||||
{
|
||||
creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_MAILBOX);
|
||||
player->GetSession()->SendShowMailBox(creature->GetGUID());
|
||||
spellId = player->GetTeamId(true) ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S;
|
||||
creature->AI()->DoAction(ARGENT_PONY_STATE_MAILBOX);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (action > 60000)
|
||||
{
|
||||
@@ -401,9 +401,9 @@ public:
|
||||
if (spellId && !creature->HasAura(spellId))
|
||||
{
|
||||
creature->CastSpell(creature, spellId, true);
|
||||
player->AddSpellCooldown(spellId, 0, 3*MINUTE*IN_MILLISECONDS);
|
||||
player->AddSpellCooldown(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3*MINUTE*IN_MILLISECONDS + 4*HOUR*IN_MILLISECONDS);
|
||||
creature->DespawnOrUnsummon(3*MINUTE*IN_MILLISECONDS);
|
||||
player->AddSpellCooldown(spellId, 0, 3 * MINUTE * IN_MILLISECONDS);
|
||||
player->AddSpellCooldown(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3 * MINUTE * IN_MILLISECONDS + 4 * HOUR * IN_MILLISECONDS);
|
||||
creature->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -433,16 +433,22 @@ public:
|
||||
|
||||
struct npc_pet_gen_target_following_bombAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_target_following_bombAI(Creature *c) : NullCreatureAI(c)
|
||||
npc_pet_gen_target_following_bombAI(Creature* c) : NullCreatureAI(c)
|
||||
{
|
||||
checkTimer = 0;
|
||||
bombSpellId = 0;
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_EXPLOSIVE_SHEEP: bombSpellId = SPELL_EXPLOSIVE_SHEEP; break;
|
||||
case NPC_GOBLIN_BOMB: bombSpellId = SPELL_EXPLOSIVE_GOBLIN; break;
|
||||
case NPC_HIGH_EXPLOSIVE_SHEEP: bombSpellId = SPELL_HIGH_EXPLOSIVE_SHEEP; break;
|
||||
case NPC_EXPLOSIVE_SHEEP:
|
||||
bombSpellId = SPELL_EXPLOSIVE_SHEEP;
|
||||
break;
|
||||
case NPC_GOBLIN_BOMB:
|
||||
bombSpellId = SPELL_EXPLOSIVE_GOBLIN;
|
||||
break;
|
||||
case NPC_HIGH_EXPLOSIVE_SHEEP:
|
||||
bombSpellId = SPELL_HIGH_EXPLOSIVE_SHEEP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +494,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_gnomish_flame_turretAI : public ScriptedAI
|
||||
{
|
||||
npc_pet_gen_gnomish_flame_turretAI(Creature *c) : ScriptedAI(c)
|
||||
npc_pet_gen_gnomish_flame_turretAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
checkTimer = 0;
|
||||
}
|
||||
@@ -535,7 +541,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_valkyr_guardianAI : public ScriptedAI
|
||||
{
|
||||
npc_pet_gen_valkyr_guardianAI(Creature *c) : ScriptedAI(c)
|
||||
npc_pet_gen_valkyr_guardianAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
me->SetReactState(REACT_DEFENSIVE);
|
||||
me->SetDisableGravity(true);
|
||||
@@ -590,34 +596,34 @@ public:
|
||||
|
||||
class spell_pet_gen_valkyr_guardian_smite : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pet_gen_valkyr_guardian_smite() : SpellScriptLoader("spell_pet_gen_valkyr_guardian_smite") { }
|
||||
public:
|
||||
spell_pet_gen_valkyr_guardian_smite() : SpellScriptLoader("spell_pet_gen_valkyr_guardian_smite") { }
|
||||
|
||||
class spell_pet_gen_valkyr_guardian_smite_SpellScript : public SpellScript
|
||||
class spell_pet_gen_valkyr_guardian_smite_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pet_gen_valkyr_guardian_smite_SpellScript);
|
||||
|
||||
void RecalculateDamage()
|
||||
{
|
||||
PrepareSpellScript(spell_pet_gen_valkyr_guardian_smite_SpellScript);
|
||||
|
||||
void RecalculateDamage()
|
||||
if (GetHitUnit() != GetCaster())
|
||||
{
|
||||
if (GetHitUnit() != GetCaster())
|
||||
{
|
||||
std::list<Spell::TargetInfo>* targetsInfo = GetSpell()->GetUniqueTargetInfo();
|
||||
for (std::list<Spell::TargetInfo>::iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit)
|
||||
if (ihit->targetGUID == GetCaster()->GetGUID())
|
||||
ihit->damage = -int32(GetHitDamage()*0.25f);
|
||||
}
|
||||
std::list<Spell::TargetInfo>* targetsInfo = GetSpell()->GetUniqueTargetInfo();
|
||||
for (std::list<Spell::TargetInfo>::iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit)
|
||||
if (ihit->targetGUID == GetCaster()->GetGUID())
|
||||
ihit->damage = -int32(GetHitDamage() * 0.25f);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnHit += SpellHitFn(spell_pet_gen_valkyr_guardian_smite_SpellScript::RecalculateDamage);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pet_gen_valkyr_guardian_smite_SpellScript();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnHit += SpellHitFn(spell_pet_gen_valkyr_guardian_smite_SpellScript::RecalculateDamage);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_pet_gen_valkyr_guardian_smite_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class npc_pet_gen_imp_in_a_bottle : public CreatureScript
|
||||
@@ -627,7 +633,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_imp_in_a_bottleAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_imp_in_a_bottleAI(Creature *c) : NullCreatureAI(c)
|
||||
npc_pet_gen_imp_in_a_bottleAI(Creature* c) : NullCreatureAI(c)
|
||||
{
|
||||
_talkTimer = 0;
|
||||
_ownerGUID = 0;
|
||||
@@ -661,7 +667,7 @@ public:
|
||||
_data << uint32(me->GetName().size() + 1);
|
||||
_data << me->GetName();
|
||||
_data << uint64(0);
|
||||
_data << uint32(text.size()+1);
|
||||
_data << uint32(text.size() + 1);
|
||||
_data << text.c_str();
|
||||
_data << uint8(0);
|
||||
}
|
||||
@@ -705,7 +711,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_wind_rider_cubAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_wind_rider_cubAI(Creature *c) : NullCreatureAI(c)
|
||||
npc_pet_gen_wind_rider_cubAI(Creature* c) : NullCreatureAI(c)
|
||||
{
|
||||
isFlying = true;
|
||||
checkTimer = 0;
|
||||
@@ -762,7 +768,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_plump_turkeyAI : public PassiveAI
|
||||
{
|
||||
npc_pet_gen_plump_turkeyAI(Creature *c) : PassiveAI(c)
|
||||
npc_pet_gen_plump_turkeyAI(Creature* c) : PassiveAI(c)
|
||||
{
|
||||
goGUID = 0;
|
||||
jumpTimer = 0;
|
||||
@@ -831,7 +837,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_toxic_wastelingAI : public PassiveAI
|
||||
{
|
||||
npc_pet_gen_toxic_wastelingAI(Creature *c) : PassiveAI(c)
|
||||
npc_pet_gen_toxic_wastelingAI(Creature* c) : PassiveAI(c)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -883,7 +889,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_fetch_ballAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_fetch_ballAI(Creature *c) : NullCreatureAI(c)
|
||||
npc_pet_gen_fetch_ballAI(Creature* c) : NullCreatureAI(c)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -940,7 +946,7 @@ public:
|
||||
|
||||
struct npc_pet_gen_mothAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_mothAI(Creature *c) : NullCreatureAI(c)
|
||||
npc_pet_gen_mothAI(Creature* c) : NullCreatureAI(c)
|
||||
{
|
||||
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
|
||||
me->SetCanFly(true);
|
||||
|
||||
Reference in New Issue
Block a user