Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Threat From Above
- #define CN_CHILLMAW 33687
- #define CN_CULTIST_BOMBARDIER 33695
- // Threat From Above - Chillmaw
- class Chillmaw : public MoonScriptCreatureAI
- {
- MOONSCRIPT_FACTORY_FUNCTION(Chillmaw, MoonScriptCreatureAI);
- uint32 spawnstate;
- Chillmaw(Creature *pCreature) : MoonScriptCreatureAI(pCreature){}
- void OnCombatStart(Unit *pAttacker)
- {
- spawnstate = 1;
- RegisterAIUpdateEvent(10*1000);
- ParentClass::OnCombatStart(pAttacker);
- }
- void OnCombatStop(Unit *pTarget)
- {
- DespawnInRangeCreatures(CN_CULTIST_BOMBARDIER);
- ParentClass::OnCombatStop(pTarget);
- }
- void AIUpdate()
- {
- if (GetHealthPercent() <= 25 && spawnstate == 3)
- {
- SpawnBombardier();
- spawnstate = 0;
- RemoveAIUpdateEvent();
- }
- else
- {
- if (GetHealthPercent() <= 50 && spawnstate == 2)
- {
- SpawnBombardier();
- spawnstate = 3;
- }
- else
- {
- if (GetHealthPercent() <= 75 && spawnstate == 1)
- {
- SpawnBombardier();
- spawnstate = 2;
- }
- }
- }
- }
- void SpawnBombardier()
- {
- MoonScriptCreatureAI *creat = SpawnCreature(CN_CULTIST_BOMBARDIER, true);
- if (creat == NULL)
- return;
- creat->AggroNearestPlayer();
- }
- };
- // Threat From Above - Cultist Bombardier TODO: still needs to cast spells. but bored atm
- class CultistBombardier : public MoonScriptCreatureAI
- {
- MOONSCRIPT_FACTORY_FUNCTION(CultistBombardier, MoonScriptCreatureAI);
- CultistBombardier(Creature *pCreature) : MoonScriptCreatureAI(pCreature)
- {
- _unit->SetSelectable(true);
- _unit->EnableCombat(true);
- _unit->SetAttackable(true);
- }
- };
- // Jack Me Some Lumber
- class ChopTree : public SpellScript
- {
- public:
- void OnInit(SpellEntry *sp)
- {
- sSpellMgr.fixRequiresAreaId(sp, 4549);
- }
- bool OnEffect(Spell *spell, uint32 i)
- {
- Player *plr = spell->p_caster;
- if (plr == NULL)
- return false;
- ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(45045);
- if (proto == NULL)
- return false;
- SlotResult slotresult = plr->GetItemInterface()->FindFreeInventorySlot(proto);
- if (slotresult.Result == false)
- {
- plr->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
- return false;
- }
- else
- {
- if (plr->GetItemInterface()->GetItemCount(45045, false) == 12)
- return false;
- else
- {
- Item *item = objmgr.CreateItem(45045, plr);
- plr->GetItemInterface()->SafeAddItem(item, slotresult.ContainerSlot, slotresult.Slot);
- return true;
- }
- }
- }
- };
- // What Do You Feed a Yeti. Anyway? //TODO: need proper function to check if plr is underwater instead of using the z-axis
- #define CN_NORTH_SEA_BLUE_SHARK 35061
- #define CN_NORTH_SEA_MAKO 35071
- #define CN_NORTH_SEA_THRESHER 35060
- #define CN_ANGRY_KVALDIR 35072
- class FreshChum : public SpellScript
- {
- public:
- uint8 CanCast(Spell *spell, Unit *target)
- {
- Player *plr = spell->p_caster;
- if (plr == NULL)
- return SPELL_FAILED_BAD_TARGETS;
- if (plr->GetPositionZ() > 0.0f)
- return SPELL_FAILED_ONLY_UNDERWATER;
- // check so players can't abuse it. Only useable near the boats
- GameObject *go = plr->GetGameObjectNearestObject(plr, 195352);
- if (go == NULL)
- {
- go = plr->GetGameObjectNearestObject(plr, 195353);
- if (go == NULL)
- return SPELL_FAILED_OUT_OF_RANGE;
- }
- return SPELL_CANCAST_OK;
- }
- void ExtraEffect(Spell *spell)
- {
- Player *plr = spell->p_caster;
- if (plr == NULL)
- return;
- uint32 randomMob = RandomUInt(3);
- uint32 randomShark = RandomUInt(2);
- switch(randomMob)
- {
- case 0:
- switch (randomShark)
- {
- case 0:
- plr->SpawnCreature(CN_NORTH_SEA_BLUE_SHARK, plr->GetPositionX()+5, plr->GetPositionY()+5, plr->GetPositionZ(), plr->GetOrientation(), 2*60*1000);
- break;
- case 1:
- plr->SpawnCreature(CN_NORTH_SEA_MAKO, plr->GetPositionX()+5, plr->GetPositionY()+5, plr->GetPositionZ(), plr->GetOrientation(), 2*60*1000);
- break;
- case 2:
- plr->SpawnCreature(CN_NORTH_SEA_THRESHER, plr->GetPositionX()+5, plr->GetPositionY()+5, plr->GetPositionZ(), plr->GetOrientation(), 2*60*1000);
- break;
- }
- break;
- default:
- plr->SpawnCreature(CN_ANGRY_KVALDIR, plr->GetPositionX()+5, plr->GetPositionY()+5, plr->GetPositionZ(), plr->GetOrientation(), 2*60*1000);
- break;
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement