Code:
//This Script is written by WHOS and TRONYC
//Credits go to Original Authors of the following:
//MounterNPC.CPP - ODIN//Scarface
//Mounter.CPP - ACDB SVN
// Each Mount automatically disables flying and resets speed back to normal
// Set up for funserver, so they give a +1 speed boost, if you want the speeds
// Blizz Like just mod it as you wish. - 7 is normal run speed
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
#define MOUNTER_ITEM_ID 70002 // Item ID
#define MOUNTER_TEXT_ID 2593
class SCRIPT_DECL ExoticMount : public GossipScript{
public:
void GossipHello(ObjectPointer pObject, PlayerPointer Plr, bool AutoSend);
void GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(ObjectPointer pObject, PlayerPointer Plr){ GossipScript::GossipEnd(pObject, Plr); }
void Destroy(){ delete this; }
};
void ExoticMount::GossipHello(ObjectPointer pObject, PlayerPointer Plr, bool AutoSend){
bool flytf = false;
uint32 eventid = 5;
WorldPacket fly(SMSG_MOVE_UNSET_CAN_FLY, 13);
Plr->m_setflycheat = flytf;
fly << Plr->GetNewGUID();
fly << uint32(eventid);
Plr->SendMessageToSet(&fly, true);
Plr->SetPlayerSpeed(RUN, 8);
Plr->SetPlayerSpeed(SWIM, 6);
Plr->SetPlayerSpeed(RUNBACK, 4);
Plr->SetPlayerSpeed(FLY, 12);
Plr->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
Plr->Gossip_Complete();
if(Plr->CombatStatus.IsInCombat()){
Plr->BroadcastMessage("You are in combat!");
}else{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), MOUNTER_TEXT_ID, Plr);
Menu->AddItem(0, "Da Plane Boss!", 1);
Menu->AddItem(0, "Orange Flying Carpet", 2);
Menu->AddItem(2, "Nevermind", 3);
if(AutoSend) Menu->SendTo(Plr);
}
};
void ExoticMount::GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code){
switch(IntId){
case 1:{
if(Plr->getLevel() >= 100){
if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
{
Plr->BroadcastMessage("You can't use that here!");
return;
}
bool flytf = true;
uint32 eventid = 2;
uint32 displayid = 26556; // Display ID
WorldPacket fly(SMSG_MOVE_SET_CAN_FLY, 13);
Plr->m_setflycheat = true;
fly << Plr->GetNewGUID();
fly << uint32(eventid);
Plr->SendMessageToSet(&fly, true);
Plr->SetPlayerSpeed(RUN, 12);
Plr->SetPlayerSpeed(SWIM, 7);
Plr->SetPlayerSpeed(RUNBACK, 7);
Plr->SetPlayerSpeed(FLY, 25);
Plr->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayid);
Plr->Gossip_Complete();
}else {
Plr->BroadcastMessage("You Must be level 100 to use this mount!");
}break;
}
case 2:{
if(Plr->getLevel() >= 100){
if(Plr->GetMapId() != 0 && Plr->GetMapId() != 1 && Plr->GetMapId() != 530 && Plr->GetMapId() != 571)
{
Plr->BroadcastMessage("You can't use that here!");
return;
}
bool flytf = true;
uint32 eventid = 2;
uint32 displayid = 28060; // Display ID
WorldPacket fly(SMSG_MOVE_SET_CAN_FLY, 13);
Plr->m_setflycheat = true;
fly << Plr->GetNewGUID();
fly << uint32(eventid);
Plr->SendMessageToSet(&fly, true);
Plr->SetPlayerSpeed(RUN, 12);
Plr->SetPlayerSpeed(SWIM, 7);
Plr->SetPlayerSpeed(RUNBACK, 7);
Plr->SetPlayerSpeed(FLY, 25);
Plr->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayid);
Plr->Gossip_Complete();
}else {
Plr->BroadcastMessage("You Must be level 100 to use this mount!");
}break;
}
case 3:{
Plr->Gossip_Complete();
}
}
}
void SetupExoticMount(ScriptMgr *mgr){
GossipScript * gs = (GossipScript*) new ExoticMount();
mgr->register_item_gossip_script(MOUNTER_ITEM_ID, gs);
}