rendered paste body/* A huge THANK YOU to Burlex from the Ascent developer team for sharing this script with us
© 2006-2007 DotA-WoW Team with assistance of Ascent developers */
#include "DotA-WoW.h"
Guild * m_allianceGuilds[1000];
Guild * m_hordeGuilds[1000];
void LoadGuilds()
{
ObjectMgr::GuildMap::iterator itr = objmgr.GetGuildsBegin();
ObjectMgr::GuildMap::iterator ite = objmgr.GetGuildsEnd();
memset(m_allianceGuilds, 0, sizeof(Guild*) * 1000);
memset(m_hordeGuilds, 0, sizeof(Guild*) * 1000);
Guild * g;
const char * name;
char buf1[1000];
int i;
for(; itr != ite ; ++itr)
{
g = itr->second;
name = g->GetGuildNameC();
if(sscanf(name, "The %s %u", buf1, &i) == 2)
{
if(!strcmp(buf1, "Horde"))
m_hordeGuilds[i] = g;
else if(!strcmp(buf1, "Alliance"))
m_allianceGuilds[i] = g;
}
}
}
// First we handle what happens to everyone who enters the world
void OnFirstEnterWorld(Player * pPlayer)
{
// Full HP and Mana
pPlayer->SetUInt32Value(UNIT_FIELD_HEALTH, pPlayer->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
if(pPlayer->GetPowerType() == POWER_TYPE_MANA)
pPlayer->SetUInt32Value(UNIT_FIELD_POWER1, pPlayer->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
}
void OnEnterWorld(Player * pPlayer)
{
if(pPlayer->GetMapId() != 529) // If the player isnt in Arathi...
{
if(pPlayer->GetTeam()) {
pPlayer->SetPosition(LocationVector(668.181824f, 679.506348f, -11.554810f, 2.210880f), false); // Move horde players to their base.
}
else {
pPlayer->SetPosition(LocationVector(1329.929565f, 1310.452271f, -7.649003f, 3.089727f), false); // Move alliance players to their base.
}
pPlayer->SetMapId(529); // MapID of Arathi Basin
WorldPacket data(SMSG_NEW_WORLD, 10);
data << uint32(30) << pPlayer->GetPosition() << pPlayer->GetOrientation(); // Function to get player pos + orientation
pPlayer->GetSession()->SendPacket(&data);
}
Map * pMap = sWorldCreator.GetMap(529); // Arathi Basin - DotA-WoW
MapMgr * pMapMgr = pMap->GetFirstInstance();
if(!pMapMgr)
{
pMapMgr = pMap->CreateMapMgrInstance(0);
}
pPlayer->SetInstanceID(pMapMgr->GetInstanceID());
pPlayer->SetMapId(pMapMgr->GetMapId());
}
bool OnCastSpell(Player * pPlayer, SpellEntry * sp)
{
if(sp->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS ||
sp->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS ||
sp->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS)
return false;
return true;
}
void OnKillPlayer(Player * pPlayer, Player * pVictim)
{
if(pPlayer == pVictim)
return;
pPlayer->ModUInt32Value(PLAYER_FIELD_COINAGE, 10000);
pPlayer->BroadcastMessage("You have been awarded 1 gold for slaying %s.", pVictim->GetName());
pVictim->BroadcastMessage("You have been slain by %s!", pPlayer->GetName());
}
void OnDeath(Player* plr)
{
if(plr->GetTeam() == 0) // Alliance
plr->SafeTeleport(529, plr->GetInstanceID(), 643.510010, 47.111, 69.884003, 4.9283);
else // For horde players
plr->SafeTeleport(529, plr->GetInstanceID(), -1496.25, -333.73, 101.135, 0);
plr->ResurrectPlayer();
plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
}
void OnEnterCombat(Player * pPlayer, Unit * pTarget)
{
// Shitty AI script for creatures
if(pTarget->IsPlayer() || pTarget->IsPet())
return;
}