*Move summon water elemental handler to correct place.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-02-20 20:28:31 +01:00
45 changed files with 50623 additions and 49317 deletions
+86 -74
View File
@@ -176,87 +176,93 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
return true;
}
bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId)
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult)
{
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId);
if(!result)
if(!arenaTeamDataResult)
return false;
Field *fields = result->Fetch();
Field *fields = arenaTeamDataResult->Fetch();
m_TeamId = fields[0].GetUInt32();
m_Name = fields[1].GetCppString();
m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
m_Type = fields[3].GetUInt32();
m_BackgroundColor = fields[4].GetUInt32();
m_EmblemStyle = fields[5].GetUInt32();
m_EmblemColor = fields[6].GetUInt32();
m_BorderStyle = fields[7].GetUInt32();
m_BorderColor = fields[8].GetUInt32();
m_TeamId = fields[0].GetUInt32();
m_Name = fields[1].GetCppString();
m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
m_Type = fields[3].GetUInt32();
m_BackgroundColor = fields[4].GetUInt32();
m_EmblemStyle = fields[5].GetUInt32();
m_EmblemColor = fields[6].GetUInt32();
m_BorderStyle = fields[7].GetUInt32();
m_BorderColor = fields[8].GetUInt32();
//load team stats
m_stats.rating = fields[9].GetUInt32();
m_stats.games_week = fields[10].GetUInt32();
m_stats.wins_week = fields[11].GetUInt32();
m_stats.games_season = fields[12].GetUInt32();
m_stats.wins_season = fields[13].GetUInt32();
m_stats.rank = fields[14].GetUInt32();
return true;
}
// only load here, so additional checks can be made
LoadStatsFromDB(ArenaTeamId);
LoadMembersFromDB(ArenaTeamId);
bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult)
{
if(!arenaTeamMembersResult)
return false;
if(Empty())
bool captainPresentInTeam = false;
do
{
// arena team is empty, delete from db
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", ArenaTeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId);
CharacterDatabase.CommitTransaction();
Field *fields = arenaTeamMembersResult->Fetch();
//prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
if (!fields)
break;
uint32 arenaTeamId = fields[0].GetUInt32();
if (arenaTeamId < m_TeamId)
{
//there is in table arena_team_member record which doesn't have arenateamid in arena_team table, report error
sLog.outErrorDb("ArenaTeam %u does not exist but it has record in arena_team_member table, deleting it!", arenaTeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", arenaTeamId);
continue;
}
if (arenaTeamId > m_TeamId)
//we loaded all members for this arena_team already, break cycle
break;
ArenaTeamMember newmember;
newmember.guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
newmember.games_week = fields[2].GetUInt32();
newmember.wins_week = fields[3].GetUInt32();
newmember.games_season = fields[4].GetUInt32();
newmember.wins_season = fields[5].GetUInt32();
newmember.personal_rating = fields[6].GetUInt32();
newmember.name = fields[7].GetCppString();
newmember.Class = fields[8].GetUInt8();
//check if member exists in characters table
if (newmember.name.empty())
{
sLog.outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newmember.guid));
this->DelMember(newmember.guid);
continue;
}
if (newmember.guid == GetCaptain())
captainPresentInTeam = true;
m_members.push_back(newmember);
}while (arenaTeamMembersResult->NextRow());
if(Empty() || !captainPresentInTeam)
{
// arena team is empty or captain is not in team, delete from db
sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId);
return false;
}
return true;
}
void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId)
{
// 0 1 2 3 4 5
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rating,games,wins,played,wins2,rank FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId);
if(!result)
return;
Field *fields = result->Fetch();
m_stats.rating = fields[0].GetUInt32();
m_stats.games_week = fields[1].GetUInt32();
m_stats.wins_week = fields[2].GetUInt32();
m_stats.games_season = fields[3].GetUInt32();
m_stats.wins_season = fields[4].GetUInt32();
m_stats.rank = fields[5].GetUInt32();
}
void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId)
{
// 0 1 2 3 4 5 6 7
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class "
"FROM arena_team_member member "
"INNER JOIN characters chars on member.guid = chars.guid "
"WHERE member.arenateamid = '%u'", ArenaTeamId);
if(!result)
return;
do
{
Field *fields = result->Fetch();
ArenaTeamMember newmember;
newmember.guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
newmember.games_week = fields[1].GetUInt32();
newmember.wins_week = fields[2].GetUInt32();
newmember.games_season = fields[3].GetUInt32();
newmember.wins_season = fields[4].GetUInt32();
newmember.personal_rating = fields[5].GetUInt32();
newmember.name = fields[6].GetCppString();
newmember.Class = fields[7].GetUInt8();
m_members.push_back(newmember);
}while( result->NextRow() );
}
void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
@@ -304,18 +310,24 @@ void ArenaTeam::DelMember(uint64 guid)
void ArenaTeam::Disband(WorldSession *session)
{
// event
WorldPacket data;
session->BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_DISBANDED_S, 2, session->GetPlayerName(), GetName(), "");
BroadcastPacket(&data);
if (session)
{
WorldPacket data;
session->BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_DISBANDED_S, 2, session->GetPlayerName(), GetName(), "");
BroadcastPacket(&data);
}
while (!m_members.empty())
{
// Removing from members is done in DelMember.
DelMember(m_members.front().guid);
}
if(Player *player = session->GetPlayer())
sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
if (session)
{
if(Player *player = session->GetPlayer())
sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId);
+2 -2
View File
@@ -173,8 +173,8 @@ class ArenaTeam
bool IsFighting() const;
bool LoadArenaTeamFromDB(uint32 ArenaTeamId);
void LoadMembersFromDB(uint32 ArenaTeamId);
bool LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult);
bool LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult);
void LoadStatsFromDB(uint32 ArenaTeamId);
void SaveToDB();
+3 -29
View File
@@ -24,24 +24,9 @@
#include "ObjectMgr.h"
#include "WorldPacket.h"
/*
The crap needs shitload of DB data fixed, will paste it here:
Cannons:
update creature_template set IconName = "Gunner" where entry = 27894;
UPDATE `creature_template` SET `vehicleid`=160 WHERE `entry`=27894;
^^ Sniffed by el manuel, should be good.
UPDATE `creature_template` SET `spell1`=49872 WHERE `entry`=27894;
UPDATE `creature_template` set `unit_flags`=`unit_flags`|4 WHERE `entry`=27894;
UPDATE `creature_template` SET `vehicleid`=158 WHERE `entry`=28781;
UPDATE `creature_template` set `spell1=49872 where `entry`=32795;
UPDATE `creature_template` set `spell1=52338,`spell2`=60206 where `entry`=32796;
*/
BattleGroundSA::BattleGroundSA()
{
//TODO FIX ME!
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE;
@@ -53,7 +38,7 @@ BattleGroundSA::BattleGroundSA()
BattleGroundSA::~BattleGroundSA()
{
sLog.outError("SOTA ZDYCHA: \n%u %u\n %u %u",BG_SA_MAXOBJ,m_BgObjects.size(),BG_SA_MAXNPC,m_BgCreatures.size());
}
void BattleGroundSA::Reset()
@@ -79,7 +64,7 @@ bool BattleGroundSA::ResetObjs()
uint32 atF = BG_SA_Factions[attackers];
uint32 defF = BG_SA_Factions[attackers ? TEAM_ALLIANCE : TEAM_HORDE];
sLog.outError("SOTA: Attacking team: %u %u %u",attackers,atF,defF);
for(uint8 i = 0; i <BG_SA_MAXOBJ; i++)
DelObject(i);
@@ -100,8 +85,7 @@ bool BattleGroundSA::ResetObjs()
BG_SA_ObjSpawnlocs[i][2],BG_SA_ObjSpawnlocs[i][3],
0,0,0,0,RESPAWN_ONE_DAY))
return false;
else
sLog.outError("SOTA: object %u spawned",i);
}
GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
@@ -159,7 +143,6 @@ bool BattleGroundSA::ResetObjs()
else
{
GraveyardStatus[i] = ((attackers == TEAM_HORDE )? TEAM_ALLIANCE : TEAM_HORDE);
sLog.outError("SOTA: Spawning GY %u %f %f %f team %u",i,sg->x,sg->y,sg->z,GraveyardStatus[i]);
if(!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE )? ALLIANCE : HORDE) ))
{
sLog.outError("SOTA: couldn't spawn GY: %u",i);
@@ -231,7 +214,6 @@ void BattleGroundSA::StartShips()
{
if(ShipsStarted)
return;
sLog.outError("SOTA: Starting boats!");
DoorOpen(BG_SA_BOAT_ONE);
DoorOpen(BG_SA_BOAT_TWO);
@@ -322,9 +304,6 @@ void BattleGroundSA::FillInitialWorldStates(WorldPacket& data)
uint32 ally_attacks = uint32(attackers == TEAM_ALLIANCE ? 1 : 0);
uint32 horde_attacks = uint32(attackers == TEAM_HORDE ? 1 : 0);
for(uint8 i = 0; i < BG_SA_MAX_GY; i++)
sLog.outError("UWS: %u",GraveyardStatus[i]);
data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]);
data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]);
data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]);
@@ -441,7 +420,6 @@ void BattleGroundSA::TeleportPlayers()
void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint32 event)
{
sLog.outError("SOTA: EventGO %u",event);
switch(event)
{
@@ -540,7 +518,6 @@ void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
if(i < 5)
DelObject(i+9);
sLog.outError("SOTA: gate %u destroyed!",i+1);
UpdateWorldState(uws, GateStatus[i]);
UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1);
}
@@ -625,7 +602,6 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i)
switch(i)
{
case BG_SA_LEFT_CAPTURABLE_GY:
sLog.outError("LEFT GY");
SpawnBGObject(BG_SA_LEFT_FLAG,RESPAWN_ONE_DAY);
npc = BG_SA_NPC_RIGSPARK;
AddCreature(BG_SA_NpcEntries[npc], npc, attackers,
@@ -635,7 +611,6 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i)
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
break;
case BG_SA_RIGHT_CAPTURABLE_GY:
sLog.outError("RIGHT GY");
SpawnBGObject(BG_SA_RIGHT_FLAG, RESPAWN_ONE_DAY);
npc = BG_SA_NPC_SPARKLIGHT;
AddCreature(BG_SA_NpcEntries[npc], npc, attackers,
@@ -662,7 +637,6 @@ void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
if(object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC])
{
sLog.outError("SOTA: Match ended.");
if(Source->GetTeamId() == attackers)
{
+1 -1
View File
@@ -815,7 +815,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
TrainerSpellData const* trainer_spells = GetTrainerSpells();
if(!trainer_spells || trainer_spells->spellList.empty())
if((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS)
{
sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
GetGUIDLow(),GetEntry());
+1 -1
View File
@@ -218,7 +218,7 @@ void LoadDBCStores(const std::string& dataPath)
{
std::string dbcPath = dataPath+"dbc/";
const uint32 DBCFilesCount = 84;
const uint32 DBCFilesCount = 85;
barGoLink bar(DBCFilesCount);
+112 -99
View File
@@ -207,59 +207,43 @@ void Guild::SetGINFO(std::string ginfo)
CharacterDatabase.PExecute("UPDATE guild SET info='%s' WHERE guildid='%u'", ginfo.c_str(), m_Id);
}
bool Guild::LoadGuildFromDB(uint32 GuildId)
bool Guild::LoadGuildFromDB(QueryResult_AutoPtr guildDataResult)
{
//set m_Id in case guild data are broken in DB and Guild will be Disbanded (deleted from DB)
m_Id = GuildId;
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(TabId) FROM guild_bank_tab WHERE guildid='%u'", GuildId);
if (result)
{
Field *fields = result->Fetch();
m_PurchasedTabs = fields[0].GetUInt32();
if (m_PurchasedTabs > GUILD_BANK_MAX_TABS)
m_PurchasedTabs = GUILD_BANK_MAX_TABS;
}
if (!LoadRanksFromDB(GuildId))
if (!guildDataResult)
return false;
if (!LoadMembersFromDB(GuildId))
return false;
Field *fields = guildDataResult->Fetch();
LoadBankRightsFromDB(GuildId); // Must be after LoadRanksFromDB because it populates rank struct
m_Id = fields[0].GetUInt32();
m_Name = fields[1].GetCppString();
m_LeaderGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
m_EmblemStyle = fields[3].GetUInt32();
m_EmblemColor = fields[4].GetUInt32();
m_BorderStyle = fields[5].GetUInt32();
m_BorderColor = fields[6].GetUInt32();
m_BackgroundColor = fields[7].GetUInt32();
GINFO = fields[8].GetCppString();
MOTD = fields[9].GetCppString();
time_t time = fields[10].GetUInt64();
m_GuildBankMoney = fields[11].GetUInt64();
m_PurchasedTabs = fields[12].GetUInt32();
// 0 1 2 3 4 5
result = CharacterDatabase.PQuery("SELECT name, leaderguid, EmblemStyle, EmblemColor, BorderStyle, BorderColor,"
// 6 7 8 9 10
"BackgroundColor, info, motd, createdate, BankMoney FROM guild WHERE guildid = '%u'", GuildId);
if (!result)
return false;
Field *fields = result->Fetch();
m_Name = fields[0].GetCppString();
m_LeaderGuid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
m_EmblemStyle = fields[2].GetUInt32();
m_EmblemColor = fields[3].GetUInt32();
m_BorderStyle = fields[4].GetUInt32();
m_BorderColor = fields[5].GetUInt32();
m_BackgroundColor = fields[6].GetUInt32();
GINFO = fields[7].GetCppString();
MOTD = fields[8].GetCppString();
time_t time = fields[9].GetUInt64();
m_GuildBankMoney = fields[10].GetUInt64();
if (m_PurchasedTabs > GUILD_BANK_MAX_TABS)
m_PurchasedTabs = GUILD_BANK_MAX_TABS;
if (time > 0)
{
tm local = *(localtime(&time)); // dereference and assign
tm local = *(localtime(&time)); // dereference and assign
m_CreatedDay = local.tm_mday;
m_CreatedMonth = local.tm_mon + 1;
m_CreatedYear = local.tm_year + 1900;
}
return true;
}
bool Guild::CheckGuildStructure()
{
// Repair the structure of guild
// If the guildmaster doesn't exist or isn't the member of guild
// attempt to promote another member
@@ -280,24 +264,19 @@ bool Guild::LoadGuildFromDB(uint32 GuildId)
if (itr->second.RankId == GR_GUILDMASTER && GUID_LOPART(m_LeaderGuid) != itr->first) // Allow only 1 guildmaster
ChangeRank(itr->first, GR_OFFICER); // set right of member to officer
sLog.outDebug("Guild %u Creation time Loaded day: %u, month: %u, year: %u", GuildId, m_CreatedDay, m_CreatedMonth, m_CreatedYear);
return true;
}
bool Guild::LoadRanksFromDB(uint32 GuildId)
bool Guild::LoadRanksFromDB(QueryResult_AutoPtr guildRanksResult)
{
Field *fields;
// 0 1 2 3
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rid,rname,rights,BankMoneyPerDay FROM guild_rank WHERE guildid = '%u' ORDER BY rid ASC", GuildId);
if (!result)
if (!guildRanksResult)
{
sLog.outError("Guild %u has broken `guild_rank` data, creating new...",GuildId);
sLog.outError("Guild %u has broken `guild_rank` data, creating new...",m_Id);
CreateDefaultGuildRanks(0);
return true;
}
Field *fields;
bool broken_ranks = false;
//GUILD RANKS are sequence starting from 0 = GUILD_MASTER (ALL PRIVILEGES) to max 9 (lowest privileges)
@@ -307,12 +286,27 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
do
{
fields = result->Fetch();
fields = guildRanksResult->Fetch();
//condition that would be true when all ranks in QueryResult will be processed and guild without ranks is being processed
if (!fields)
break;
uint32 rankID = fields[0].GetUInt32();
std::string rankName = fields[1].GetCppString();
uint32 rankRights = fields[2].GetUInt32();
uint32 rankMoney = fields[3].GetUInt32();
uint32 guildId = fields[0].GetUInt32();
if (guildId < m_Id)
{
//there is in table guild_rank record which doesn't have guildid in guild table, report error
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_rank table, deleting it!", guildId);
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", guildId);
continue;
}
if (guildId > m_Id)
//we loaded all ranks for this guild already, break cycle
break;
uint32 rankID = fields[1].GetUInt32();
std::string rankName = fields[2].GetCppString();
uint32 rankRights = fields[3].GetUInt32();
uint32 rankMoney = fields[4].GetUInt32();
if (rankID != m_Ranks.size()) // guild_rank.ids are sequence 0,1,2,3..
broken_ranks = true;
@@ -322,27 +316,27 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
rankRights |= GR_RIGHT_ALL;
AddRank(rankName,rankRights,rankMoney);
}while (result->NextRow());
}while( guildRanksResult->NextRow() );
if (m_Ranks.size() < GUILD_RANKS_MIN_COUNT) // if too few ranks, renew them
{
m_Ranks.clear();
sLog.outError("Guild %u has broken `guild_rank` data, creating new...",GuildId);
sLog.outError("Guild %u has broken `guild_rank` data, creating new...", m_Id);
CreateDefaultGuildRanks(0); // 0 is default locale_idx
broken_ranks = false;
}
// guild_rank have wrong numbered ranks, repair
if (broken_ranks)
{
sLog.outError("Guild %u has broken `guild_rank` data, repairing...",GuildId);
sLog.outError("Guild %u has broken `guild_rank` data, repairing...", m_Id);
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", GuildId);
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", m_Id);
for (size_t i = 0; i < m_Ranks.size(); ++i)
{
std::string name = m_Ranks[i].Name;
uint32 rights = m_Ranks[i].Rights;
CharacterDatabase.escape_string(name);
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", GuildId, uint32(i), name.c_str(), rights);
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights);
}
CharacterDatabase.CommitTransaction();
}
@@ -350,46 +344,53 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
return true;
}
bool Guild::LoadMembersFromDB(uint32 GuildId)
bool Guild::LoadMembersFromDB(QueryResult_AutoPtr guildMembersResult)
{
// 0 1 2 3 4 5
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guild_member.guid,rank, pnote, offnote, BankResetTimeMoney,BankRemMoney,"
// 6 7 8 9 10 11
"BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2,"
// 12 13 14 15 16 17
"BankResetTimeTab3, BankRemSlotsTab3, BankResetTimeTab4, BankRemSlotsTab4, BankResetTimeTab5, BankRemSlotsTab5,"
// 18 19 20 21 22
"characters.name, characters.level, characters.zone, characters.class, characters.logout_time "
"FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid WHERE guildid = '%u'", GuildId);
if (!result)
if (!guildMembersResult)
return false;
do
{
Field *fields = result->Fetch();
Field *fields = guildMembersResult->Fetch();
//this condition will be true when all rows in QueryResult are processed and new guild without members is going to be loaded - prevent crash
if (!fields)
break;
uint32 guildId = fields[0].GetUInt32();
if (guildId < m_Id)
{
//there is in table guild_member record which doesn't have guildid in guild table, report error
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_member table, deleting it!", guildId);
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid = '%u'", guildId);
continue;
}
if (guildId > m_Id)
//we loaded all members for this guild already, break cycle
break;
MemberSlot newmember;
uint64 guid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
newmember.RankId = fields[1].GetUInt32();
uint64 guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
newmember.RankId = fields[2].GetUInt32();
//don't allow member to have not existing rank!
if (newmember.RankId >= m_Ranks.size())
newmember.RankId = GetLowestRank();
newmember.Pnote = fields[2].GetCppString();
newmember.OFFnote = fields[3].GetCppString();
newmember.BankResetTimeMoney = fields[4].GetUInt32();
newmember.BankRemMoney = fields[5].GetUInt32();
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
newmember.Pnote = fields[3].GetCppString();
newmember.OFFnote = fields[4].GetCppString();
newmember.BankResetTimeMoney = fields[5].GetUInt32();
newmember.BankRemMoney = fields[6].GetUInt32();
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
newmember.BankResetTimeTab[i] = fields[6+(2*i)].GetUInt32();
newmember.BankRemSlotsTab[i] = fields[7+(2*i)].GetUInt32();
newmember.BankResetTimeTab[i] = fields[7+(2*i)].GetUInt32();
newmember.BankRemSlotsTab[i] = fields[8+(2*i)].GetUInt32();
}
newmember.Name = fields[18].GetCppString();
newmember.Level = fields[19].GetUInt8();
newmember.ZoneId = fields[20].GetUInt32();
newmember.Name = fields[19].GetCppString();
newmember.Level = fields[20].GetUInt8();
newmember.Class = fields[21].GetUInt8();
newmember.LogoutTime = fields[22].GetUInt64();
newmember.ZoneId = fields[22].GetUInt32();
newmember.LogoutTime = fields[23].GetUInt64();
//this code will remove unexisting character guids from guild
if (newmember.Level < 1 || newmember.Level > STRONG_MAX_LEVEL) // can be at broken `data` field
@@ -414,7 +415,7 @@ bool Guild::LoadMembersFromDB(uint32 GuildId)
members[GUID_LOPART(guid)] = newmember;
}while (result->NextRow());
}while (guildMembersResult->NextRow());
if (members.empty())
return false;
@@ -1372,27 +1373,39 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
// *************************************************
// Rights per day related
void Guild::LoadBankRightsFromDB(uint32 GuildId)
bool Guild::LoadBankRightsFromDB(QueryResult_AutoPtr guildBankTabRightsResult)
{
// 0 1 2 3
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT TabId, rid, gbright, SlotPerDay FROM guild_bank_right WHERE guildid = '%u' ORDER BY TabId", GuildId);
if (!result)
return;
if (!guildBankTabRightsResult)
return true;
do
{
Field *fields = result->Fetch();
uint8 TabId = fields[0].GetUInt8();
uint32 rankId = fields[1].GetUInt32();
uint16 right = fields[2].GetUInt16();
uint16 SlotPerDay = fields[3].GetUInt16();
Field *fields = guildBankTabRightsResult->Fetch();
//prevent crash when all rights in result are already processed
if (!fields)
break;
uint32 guildId = fields[0].GetUInt32();
if (guildId < m_Id)
{
//there is in table guild_bank_right record which doesn't have guildid in guild table, report error
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_bank_right table, deleting it!", guildId);
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid = '%u'", guildId);
continue;
}
if (guildId > m_Id)
//we loaded all ranks for this guild bank already, break cycle
break;
uint8 TabId = fields[1].GetUInt8();
uint32 rankId = fields[2].GetUInt32();
uint16 right = fields[3].GetUInt16();
uint16 SlotPerDay = fields[4].GetUInt16();
SetBankRightsAndSlots(rankId, TabId, right, SlotPerDay, false);
}while (result->NextRow());
}while (guildBankTabRightsResult->NextRow());
return;
return true;
}
// *************************************************
+5 -4
View File
@@ -327,9 +327,10 @@ class Guild
uint32 GetMemberSize() const { return members.size(); }
bool LoadGuildFromDB(uint32 GuildId);
bool LoadRanksFromDB(uint32 GuildId);
bool LoadMembersFromDB(uint32 GuildId);
bool LoadGuildFromDB(QueryResult_AutoPtr guildDataResult);
bool CheckGuildStructure();
bool LoadRanksFromDB(QueryResult_AutoPtr guildRanksResult);
bool LoadMembersFromDB(QueryResult_AutoPtr guildMembersResult);
void SetMemberStats(uint64 guid);
@@ -421,7 +422,7 @@ class Guild
uint32 GetBankMoneyPerDay(uint32 rankId);
uint32 GetBankSlotPerDay(uint32 rankId, uint8 TabId);
// rights per day
void LoadBankRightsFromDB(uint32 GuildId);
bool LoadBankRightsFromDB(QueryResult_AutoPtr guildBankTabRightsResult);
// Guild Bank Event Logs
void LoadGuildBankEventLogFromDB();
void DisplayGuildBankLogs(WorldSession *session, uint8 TabId);
+70 -18
View File
@@ -730,6 +730,13 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
}
if (cInfo->VehicleId)
{
VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId);
if (!vehId)
sLog.outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
}
if(cInfo->PetSpellDataId)
{
CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
@@ -3216,10 +3223,14 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play
void ObjectMgr::LoadGuilds()
{
Guild *newguild;
Guild *newGuild;
uint32 count = 0;
QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT guildid FROM guild" );
// 0 1 2 3 4 5 6
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT guild.guildid,guild.name,leaderguid,EmblemStyle,EmblemColor,BorderStyle,BorderColor,"
// 7 8 9 10 11 12
"BackgroundColor,info,motd,createdate,BankMoney,COUNT(guild_bank_tab.guildid) "
"FROM guild LEFT JOIN guild_bank_tab ON guild.guildid = guild_bank_tab.guildid GROUP BY guild.guildid ORDER BY guildid ASC");
if (!result)
{
@@ -3233,26 +3244,50 @@ void ObjectMgr::LoadGuilds()
return;
}
// load guild ranks
// 0 1 2 3 4
QueryResult_AutoPtr guildRanksResult = CharacterDatabase.Query("SELECT guildid,rid,rname,rights,BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");
// load guild members
// 0 1 2 3 4 5 6
QueryResult_AutoPtr guildMembersResult = CharacterDatabase.Query("SELECT guildid,guild_member.guid,rank,pnote,offnote,BankResetTimeMoney,BankRemMoney,"
// 7 8 9 10 11 12
"BankResetTimeTab0,BankRemSlotsTab0,BankResetTimeTab1,BankRemSlotsTab1,BankResetTimeTab2,BankRemSlotsTab2,"
// 13 14 15 16 17 18
"BankResetTimeTab3,BankRemSlotsTab3,BankResetTimeTab4,BankRemSlotsTab4,BankResetTimeTab5,BankRemSlotsTab5,"
// 19 20 21 22 23
"characters.name, characters.level, characters.class, characters.zone, characters.logout_time "
"FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid ORDER BY guildid ASC");
// load guild bank tab rights
// 0 1 2 3 4
QueryResult_AutoPtr guildBankTabRightsResult = CharacterDatabase.Query("SELECT guildid,TabId,rid,gbright,SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC");
barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
//Field *fields = result->Fetch();
bar.step();
++count;
newguild = new Guild;
if (!newguild->LoadGuildFromDB(fields[0].GetUInt32()))
{
newguild->Disband();
delete newguild;
newGuild = new Guild;
if (!newGuild->LoadGuildFromDB(result) ||
!newGuild->LoadRanksFromDB(guildRanksResult) ||
!newGuild->LoadMembersFromDB(guildMembersResult) ||
!newGuild->LoadBankRightsFromDB(guildBankTabRightsResult) ||
!newGuild->CheckGuildStructure()
)
{
newGuild->Disband();
delete newGuild;
continue;
}
newguild->LoadGuildEventLogFromDB();
newguild->LoadGuildBankEventLogFromDB();
newguild->LoadGuildBankFromDB();
AddGuild(newguild);
newGuild->LoadGuildEventLogFromDB();
newGuild->LoadGuildBankEventLogFromDB();
newGuild->LoadGuildBankFromDB();
AddGuild(newGuild);
} while (result->NextRow());
@@ -3269,7 +3304,11 @@ void ObjectMgr::LoadArenaTeams()
{
uint32 count = 0;
QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT arenateamid FROM arena_team" );
// 0 1 2 3 4 5
QueryResult_AutoPtr result = CharacterDatabase.Query( "SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,"
// 6 7 8 9 10 11 12 13 14
"EmblemColor,BorderStyle,BorderColor, rating,games,wins,played,wins2,rank "
"FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" );
if( !result )
{
@@ -3283,6 +3322,12 @@ void ObjectMgr::LoadArenaTeams()
return;
}
// load arena_team members
QueryResult_AutoPtr arenaTeamMembersResult = CharacterDatabase.Query(
// 0 1 2 3 4 5 6 7 8
"SELECT arenateamid,member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class "
"FROM arena_team_member member LEFT JOIN characters chars on member.guid = chars.guid ORDER BY member.arenateamid ASC");
barGoLink bar( result->GetRowCount() );
do
@@ -3292,13 +3337,15 @@ void ObjectMgr::LoadArenaTeams()
bar.step();
++count;
ArenaTeam *newarenateam = new ArenaTeam;
if(!newarenateam->LoadArenaTeamFromDB(fields[0].GetUInt32()))
ArenaTeam *newArenaTeam = new ArenaTeam;
if (!newArenaTeam->LoadArenaTeamFromDB(result) ||
!newArenaTeam->LoadMembersFromDB(arenaTeamMembersResult))
{
delete newarenateam;
newArenaTeam->Disband(NULL);
delete newArenaTeam;
continue;
}
AddArenaTeam(newarenateam);
AddArenaTeam(newArenaTeam);
}while( result->NextRow() );
sLog.outString();
@@ -7612,6 +7659,11 @@ bool PlayerCondition::Meets(Player const * player) const
QuestStatus status = player->GetQuestStatus(value1);
return (status == QUEST_STATUS_INCOMPLETE);
}
case CONDITION_QUEST_NONE:
{
QuestStatus status = player->GetQuestStatus(value1);
return (status == QUEST_STATUS_NONE);
}
case CONDITION_AD_COMMISSION_AURA:
{
Unit::AuraApplicationMap const& auras = player->GetAppliedAuras();
+2 -1
View File
@@ -311,9 +311,10 @@ enum ConditionType
CONDITION_NO_AURA = 11, // spell_id effindex
CONDITION_ACTIVE_EVENT = 12, // event_id
CONDITION_INSTANCE_DATA = 13, // entry data
CONDITION_QUEST_NONE = 14, // quest_id 0
};
#define MAX_CONDITION 14 // maximum value in ConditionType enum
#define MAX_CONDITION 15 // maximum value in ConditionType enum
struct PlayerCondition
{
+23138 -23125
View File
File diff suppressed because it is too large Load Diff
+2637 -2636
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -238,6 +238,7 @@ void AddSC_boss_ptheradras();
void AddSC_boss_onyxia(); //Onyxia's Lair
void AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs
void AddSC_razorfen_downs();
void AddSC_instance_razorfen_downs();
void AddSC_razorfen_kraul(); //Razorfen Kraul
void AddSC_boss_kurinnaxx(); //Ruins of ahn'qiraj
void AddSC_boss_rajaxx();
@@ -702,6 +703,7 @@ void AddScripts()
AddSC_boss_onyxia(); //Onyxia's Lair
AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs
AddSC_razorfen_downs();
AddSC_instance_razorfen_downs();
AddSC_razorfen_kraul(); //Razorfen Kraul
AddSC_boss_kurinnaxx(); //Ruins of ahn'qiraj
AddSC_boss_rajaxx();
+6955 -6955
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1381,7 +1381,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
{
// Not listed as any effect, only base points set
int32 basePoints0 = unholyPresenceAura->GetSpellProto()->EffectBasePoints[1];
//target->CastCustomSpell(target,63622,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura);
target->CastCustomSpell(target,63622,&basePoints0 ,&basePoints0,&basePoints0,true,0,unholyPresenceAura);
target->CastCustomSpell(target,65095,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura);
}
target->CastSpell(target,49772, true);
@@ -1403,7 +1403,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
{
if(presence == 48265 && unholyPresenceAura)
{
//target->RemoveAurasDueToSpell(63622);
target->RemoveAurasDueToSpell(63622);
target->RemoveAurasDueToSpell(65095);
}
target->RemoveAurasDueToSpell(49772);
+9 -1
View File
@@ -6836,7 +6836,15 @@ void Spell::EffectPlayerPull(uint32 i)
if(!unitTarget)
return;
unitTarget->GetMotionMaster()->MoveJump(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), float(damage ? damage : unitTarget->GetDistance2d(m_caster)), float(m_spellInfo->EffectMiscValue[i])/10);
float speedZ;
if(m_spellInfo->EffectMiscValue[i])
speedZ = float(m_spellInfo->EffectMiscValue[i])/10;
else if(m_spellInfo->EffectMiscValueB[i])
speedZ = float(m_spellInfo->EffectMiscValueB[i])/10;
else
speedZ = 10.0f;
float speedXY = m_caster->GetExactDist2d(unitTarget) * 10.0f / speedZ;
unitTarget->GetMotionMaster()->MoveJump(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), speedXY, speedZ);
}
void Spell::EffectDispelMechanic(uint32 i)
+16290 -16277
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -253,6 +253,8 @@ SET(scripts_STAT_SRCS
kalimdor/onyxias_lair/boss_onyxia.cpp
kalimdor/razorfen_downs/boss_amnennar_the_coldbringer.cpp
kalimdor/razorfen_downs/razorfen_downs.cpp
kalimdor/razorfen_downs/instance_razorfen_downs.cpp
kalimdor/razorfen_downs/razorfen_downs.h
kalimdor/razorfen_kraul/razorfen_kraul.h
kalimdor/razorfen_kraul/instance_razorfen_kraul.cpp
kalimdor/razorfen_kraul/razorfen_kraul.cpp
@@ -327,6 +329,7 @@ SET(scripts_STAT_SRCS
northrend/draktharon_keep/boss_tharon_ja.cpp
northrend/draktharon_keep/drak_tharon_keep.h
northrend/frozen_halls/forge_of_souls/instance_forge_of_souls.cpp
northrend/frozen_halls/forge_of_souls/boss_bronjahm.cpp
northrend/frozen_halls/forge_of_souls/forge_of_souls.h
northrend/frozen_halls/halls_of_reflection/instance_halls_of_reflection.cpp
northrend/frozen_halls/halls_of_reflection/halls_of_reflection.h
@@ -0,0 +1,215 @@
/*
* Copyright (C) 2010 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ScriptedPch.h"
#include "razorfen_downs.h"
#define MAX_ENCOUNTER 1
struct instance_razorfen_downs : public ScriptedInstance
{
instance_razorfen_downs(Map* pMap) : ScriptedInstance(pMap)
{
Initialize();
};
uint64 uiGongGUID;
uint32 m_auiEncounter[MAX_ENCOUNTER];
uint8 uiGongWaves;
std::string str_data;
void Initialize()
{
uiGongGUID = 0;
uiGongWaves = 0;
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
}
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "T C " << m_auiEncounter[0]
<< " " << uiGongWaves;
str_data = saveStream.str();
OUT_SAVE_INST_DATA_COMPLETE;
return str_data;
}
void Load(const char* in)
{
if (!in)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
uint16 data0, data1;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1;
if (dataHead1 == 'T' && dataHead2 == 'C')
{
m_auiEncounter[0] = data0;
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
if (m_auiEncounter[i] == IN_PROGRESS)
m_auiEncounter[i] = NOT_STARTED;
uiGongWaves = data1;
} else OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
void OnGameObjectCreate(GameObject* pGo, bool bAdd)
{
switch(pGo->GetEntry())
{
case GO_GONG:
uiGongGUID = pGo->GetGUID();
if (m_auiEncounter[0] == DONE)
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
break;
default:
break;
}
}
void SetData(uint32 uiType, uint32 uiData)
{
if (uiType == DATA_GONG_WAVES)
{
uiGongWaves = uiData;
switch(uiGongWaves)
{
case 9:
case 14:
if (GameObject* pGo = instance->GetGameObject(uiGongGUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
break;
case 1:
case 10:
case 16:
{
GameObject* pGo = instance->GetGameObject(uiGongGUID);
if (!pGo)
return;
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
uint32 uiCreature = 0;
uint8 uiSummonTimes = 0;
switch(uiGongWaves)
{
case 1:
uiCreature = CREATURE_TOMB_FIEND;
uiSummonTimes = 7;
break;
case 10:
uiCreature = CREATURE_TOMB_REAVER;
uiSummonTimes = 3;
break;
case 16:
uiCreature = CREATURE_TUTEN_KASH;
break;
default:
break;
}
if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633))
{
if (uiGongWaves == 10 || uiGongWaves == 1)
{
for (uint8 i = 0; i < uiSummonTimes; ++i)
{
if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633))
pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678);
}
}
pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678);
}
break;
}
default:
break;
}
}
if (uiType == BOSS_TUTEN_KASH)
{
m_auiEncounter[0] = uiData;
if (uiData == DONE)
SaveToDB();
}
}
uint32 GetData(uint32 uiType)
{
switch(uiType)
{
case DATA_GONG_WAVES:
return uiGongWaves;
}
return 0;
}
uint64 GetData64(uint32 uiType)
{
switch(uiType)
{
case DATA_GONG: return uiGongGUID;
}
return 0;
}
};
InstanceData* GetInstanceData_instance_razorfen_downs(Map* pMap)
{
return new instance_razorfen_downs(pMap);
}
void AddSC_instance_razorfen_downs()
{
Script* newscript;
newscript = new Script;
newscript->Name = "instance_razorfen_downs";
newscript->GetInstanceData = &GetInstanceData_instance_razorfen_downs;
newscript->RegisterSelf();
}
@@ -26,6 +26,7 @@ npc_henry_stern
EndContentData */
#include "ScriptedPch.h"
#include "razorfen_downs.h"
/*###
# npc_henry_stern
@@ -73,6 +74,75 @@ bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32
return true;
}
/*######
## go_gong
######*/
bool GOHello_go_gong(Player* pPlayer, GameObject* pGO)
{
//basic support, not blizzlike data is missing...
ScriptedInstance* pInstance = pGO->GetInstanceData();
if (pInstance)
{
pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1);
return true;
}
return false;
}
enum eTombCreature
{
SPELL_WEB = 745
};
struct npc_tomb_creatureAI : public ScriptedAI
{
npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature)
{
pInstance = pCreature->GetInstanceData();
}
ScriptedInstance* pInstance;
uint32 uiWebTimer;
void Reset()
{
uiWebTimer = urand(5000,8000);
}
void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;
//from acid
if (m_creature->GetEntry() == CREATURE_TOMB_REAVER)
{
if (uiWebTimer <= uiDiff)
{
DoCast(m_creature->getVictim(), SPELL_WEB);
uiWebTimer = urand(7000,16000);
} else uiWebTimer -= uiDiff;
}
DoMeleeAttackIfReady();
}
void JustDied(Unit* pKiller)
{
if (pInstance)
pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1);
}
};
CreatureAI* GetAI_npc_tomb_creature(Creature* pCreature)
{
return new npc_tomb_creatureAI (pCreature);
}
void AddSC_razorfen_downs()
{
Script* newscript;
@@ -82,4 +152,14 @@ void AddSC_razorfen_downs()
newscript->pGossipHello = &GossipHello_npc_henry_stern;
newscript->pGossipSelect = &GossipSelect_npc_henry_stern;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "go_gong";
newscript->pGOHello = &GOHello_go_gong;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_tomb_creature";
newscript->GetAI = &GetAI_npc_tomb_creature;
newscript->RegisterSelf();
}
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2010 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DEF_RAZORFEN_DOWNS_H
#define DEF_RAZORFEN_DOWNS_H
enum eData
{
BOSS_TUTEN_KASH,
DATA_GONG_WAVES
};
enum eData64
{
DATA_GONG
};
enum eGameObject
{
GO_GONG = 148917
};
enum eCreature
{
CREATURE_TOMB_FIEND = 7349,
CREATURE_TOMB_REAVER = 7351,
CREATURE_TUTEN_KASH = 7355
};
#endif
+134
View File
@@ -1987,6 +1987,135 @@ CreatureAI* GetAI_npc_bonker_togglevolt(Creature* pCreature)
return new npc_bonker_togglevoltAI(pCreature);
}
/*######
## Help Those That Cannot Help Themselves, Quest 11876
######*/
enum eHelpThemselves
{
QUEST_CANNOT_HELP_THEMSELVES = 11876,
GO_MAMMOTH_TRAP_1 = 188022,
GO_MAMMOTH_TRAP_2 = 188024,
GO_MAMMOTH_TRAP_3 = 188025,
GO_MAMMOTH_TRAP_4 = 188026,
GO_MAMMOTH_TRAP_5 = 188027,
GO_MAMMOTH_TRAP_6 = 188028,
GO_MAMMOTH_TRAP_7 = 188029,
GO_MAMMOTH_TRAP_8 = 188030,
GO_MAMMOTH_TRAP_9 = 188031,
GO_MAMMOTH_TRAP_10 = 188032,
GO_MAMMOTH_TRAP_11 = 188033,
GO_MAMMOTH_TRAP_12 = 188034,
GO_MAMMOTH_TRAP_13 = 188035,
GO_MAMMOTH_TRAP_14 = 188036,
GO_MAMMOTH_TRAP_15 = 188037,
GO_MAMMOTH_TRAP_16 = 188038,
GO_MAMMOTH_TRAP_17 = 188039,
GO_MAMMOTH_TRAP_18 = 188040,
GO_MAMMOTH_TRAP_19 = 188041,
GO_MAMMOTH_TRAP_20 = 188042,
GO_MAMMOTH_TRAP_21 = 188043,
GO_MAMMOTH_TRAP_22 = 188044,
};
struct npc_trapped_mammoth_calfAI : public ScriptedAI
{
npc_trapped_mammoth_calfAI(Creature* c) : ScriptedAI(c) {}
uint32 uiTimer;
bool bStarted;
void Reset()
{
GameObject *pTrap;
uiTimer = 1500;
bStarted = false;
if ((pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_1,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_2,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_3,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_4,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_5,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_6,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_7,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_8,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_9,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_10,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_11,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_12,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_13,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_14,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_15,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_16,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_17,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_18,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_19,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_20,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_21,1.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_22,1.0f)))
pTrap->SetGoState(GO_STATE_ACTIVE);
}
void UpdateAI(const uint32 diff)
{
if (bStarted)
{
if (uiTimer <= diff)
{
Position pos;
m_creature->GetRandomNearPosition(pos, 10.0f);
m_creature->GetMotionMaster()->MovePoint(0,pos);
bStarted = false;
}
else uiTimer -= diff;
}
}
void DoAction(const int32 param)
{
if (param == 1)
bStarted = true;
}
void MovementInform(uint32 uiType, uint32 uiId)
{
GameObject* pTrap;
if (uiType != POINT_MOTION_TYPE)
return;
m_creature->DisappearAndDie();
if ((pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_1,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_2,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_3,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_4,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_5,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_6,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_7,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_8,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_9,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_10,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_11,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_12,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_13,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_14,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_15,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_16,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_17,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_18,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_19,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_20,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_21,11.0f)) ||
(pTrap = m_creature->FindNearestGameObject(GO_MAMMOTH_TRAP_22,11.0f)))
pTrap->SetLootState(GO_JUST_DEACTIVATED);
}
};
CreatureAI* GetAI_npc_trapped_mammoth_calf(Creature* pCreature)
{
return new npc_trapped_mammoth_calfAI(pCreature);
}
void AddSC_borean_tundra()
{
Script *newscript;
@@ -2122,4 +2251,9 @@ void AddSC_borean_tundra()
newscript->GetAI = &GetAI_npc_bonker_togglevolt;
newscript->pQuestAccept=&QuestAccept_npc_bonker_togglevolt;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_trapped_mammoth_calf";
newscript->GetAI = &GetAI_npc_trapped_mammoth_calf;
newscript->RegisterSelf();
}
@@ -261,6 +261,12 @@ struct generic_vehicleAI_toc5AI : public npc_escortAI
//dosen't work at all
if (uiShieldBreakerTimer <= uiDiff)
{
if (!pVehicle)
{
pVehicle = m_creature->GetVehicleKit();
return;
}
if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0))
{
Map::PlayerList const& players = m_creature->GetMap()->GetPlayers();
@@ -0,0 +1,186 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ScriptedPch.h"
#include "forge_of_souls.h"
enum Spells
{
SPELL_MAGIC_S_BANE = 68793,
SPELL_MAGIC_S_BANE_H = 69050,
SPELL_CORRUPT_SOUL = 68839,
SPELL_CONSUME_SOUL = 68858,
SPELL_CONSUME_SOUL_H = 69047,
SPELL_TELEPORT = 68988,
SPELL_FEAR = 68950,
SPELL_SOULSTORM = 68872,
SPELL_SOULSTORM_H = 69049,
SPELL_SHADOW_BOLT = 70043
};
enum CombatPhases
{
PHASE_1,
PHASE_2
};
/*enum Adds
{
CREATURE_CORRUPTED_SOUL_FRAGMENT = 36535
};*/
struct boss_bronjahmAI : public ScriptedAI
{
boss_bronjahmAI(Creature *c) : ScriptedAI(c)
{
pInstance = m_creature->GetInstanceData();
}
uint32 uiFearTimer;
uint32 uiShadowBoltTimer;
uint32 uiMagicsBaneTimer;
uint32 uiCorruptSoulTimer;
CombatPhases Phase;
ScriptedInstance* pInstance;
void Reset()
{
Phase = PHASE_1;
uiFearTimer = urand(8000,12000);
uiShadowBoltTimer = 2000;
uiMagicsBaneTimer = urand(8000,15000);
uiCorruptSoulTimer = urand(15000,25000);
if (pInstance)
pInstance->SetData(DATA_BRONJAHM_EVENT, NOT_STARTED);
}
void EnterCombat(Unit* who)
{
//DoScriptText(SAY_AGGRO, m_creature);
if (pInstance)
pInstance->SetData(DATA_BRONJAHM_EVENT, IN_PROGRESS);
}
void JustDied(Unit* killer)
{
//DoScriptText(SAY_DEATH, m_creature);
if (pInstance)
pInstance->SetData(DATA_BRONJAHM_EVENT, DONE);
}
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
switch (Phase)
{
case PHASE_1:
if (uiCorruptSoulTimer <= diff)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1))
DoCast(pTarget,SPELL_CORRUPT_SOUL);
uiCorruptSoulTimer = urand(15000,25000);
} else uiCorruptSoulTimer -= diff;
break;
case PHASE_2:
if (!me->HasAura(SPELL_SOULSTORM) || !me->HasAura(SPELL_SOULSTORM_H))
DoCast(m_creature, DUNGEON_MODE(SPELL_SOULSTORM,SPELL_SOULSTORM_H));
if (uiFearTimer <= diff)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1))
DoCast(m_creature->getVictim(),SPELL_FEAR);
uiFearTimer = urand(8000,12000);
} else uiFearTimer -= diff;
break;
}
if (HealthBelowPct(30))
DoCast(m_creature,SPELL_TELEPORT);
if (uiShadowBoltTimer <= diff)
{
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
DoCastVictim(SPELL_SHADOW_BOLT);
uiShadowBoltTimer = 2000;
} else uiShadowBoltTimer -= diff;
if (uiMagicsBaneTimer <= diff)
{
DoCastVictim(DUNGEON_MODE(SPELL_MAGIC_S_BANE,SPELL_MAGIC_S_BANE_H));
uiMagicsBaneTimer = urand(8000,15000);
} else uiMagicsBaneTimer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_bronjahm(Creature* pCreature)
{
return new boss_bronjahmAI(pCreature);
}
struct mob_corrupted_soul_fragmentAI : public ScriptedAI
{
mob_corrupted_soul_fragmentAI(Creature *c) : ScriptedAI(c)
{
pInstance = m_creature->GetInstanceData();
}
ScriptedInstance* pInstance;
void Reset()
{
SetCombatMovement(false);
if (pInstance)
if (Creature* pBronjham = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_BRONJAHM)))
m_creature->GetMotionMaster()->MoveChase(pBronjham);
}
void MovementInform(uint32 type, uint32 id)
{
if (pInstance)
if (Creature* pBronjham = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_BRONJAHM)))
DoCast(pBronjham,DUNGEON_MODE(SPELL_CONSUME_SOUL,SPELL_CONSUME_SOUL_H));
}
void UpdateAI(const uint32 diff) {}
};
CreatureAI* GetAI_mob_corrupted_soul_fragment(Creature* pCreature)
{
return new mob_corrupted_soul_fragmentAI(pCreature);
}
void AddSC_boss_bronjahm()
{
Script *newscript;
newscript = new Script;
newscript->Name = "mob_corruptel_soul_fragment";
newscript->GetAI = &GetAI_mob_corrupted_soul_fragment;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "boss_bronjahm";
newscript->GetAI = &GetAI_boss_bronjahm;
newscript->RegisterSelf();
}
@@ -1,3 +1,19 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DEF_FORGE_OF_SOULS_H
#define DEF_FORGE_OF_SOULS_H
enum Data
@@ -5,6 +21,10 @@ enum Data
DATA_BRONJAHM_EVENT,
DATA_DEVOURER_EVENT
};
enum Data64
{
DATA_BRONJAHM
};
enum Creatures
{
CREATURE_BRONJAHM = 36497,
@@ -1,3 +1,19 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ScriptedPch.h"
#include "forge_of_souls.h"
@@ -72,16 +88,17 @@ struct instance_forge_of_souls : public ScriptedInstance
return 0;
}
/*
uint64 GetData64(uint32 identifier)
{
switch(identifier)
{
case DATA_BRONJAHM: return uiBronjahm;
}
return 0;
}
*/
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
@@ -1,3 +1,19 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DEF_HALLS_OF_REFLECTION_H
#define DEF_HALLS_OF_REFLECTION_H
enum Data
@@ -1,3 +1,19 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ScriptedPch.h"
#include "halls_of_reflection.h"
@@ -1,3 +1,19 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ScriptedPch.h"
#include "pit_of_saron.h"
@@ -1,3 +1,19 @@
/* Copyright (C) 2006 - 2010 TrinityCore <https://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DEF_PIT_OF_SARON_H
#define DEF_PIT_OF_SARON_H
enum Data
+252
View File
@@ -26,6 +26,7 @@ npc_orsonn_and_kodian
EndContentData */
#include "ScriptedPch.h"
#include "ScriptedEscortAI.h"
#define GOSSIP_ITEM1 "You're free to go Orsonn, but first tell me what's wrong with the furbolg."
#define GOSSIP_ITEM2 "What happened then?"
@@ -115,6 +116,246 @@ bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, ui
return true;
}
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure
######*/
enum eFloppy
{
NPC_MRFLOPPY = 26589,
NPC_HUNGRY_WORG = 26586,
NPC_RAVENOUS_WORG = 26590, //RWORG
NPC_EMILY = 26588,
QUEST_PERILOUS_ADVENTURE = 12027,
SPELL_MRFLOPPY = 47184, //vehicle aura
SAY_WORGHAGGRO1 = -1800001, //Um... I think one of those wolves is back...
SAY_WORGHAGGRO2 = -1800002, //He's going for Mr. Floppy!
SAY_WORGRAGGRO3 = -1800003, //Oh, no! Look, it's another wolf, and it's a biiiiiig one!
SAY_WORGRAGGRO4 = -1800004, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
SAY_RANDOMAGGRO = -1800005, //There's a big meanie attacking Mr. Floppy! Help!
SAY_VICTORY1 = -1800006, //Let's get out of here before more wolves find us!
SAY_VICTORY2 = -1800007, //Don't go toward the light, Mr. Floppy!
SAY_VICTORY3 = -1800008, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
SAY_VICTORY4 = -1800009, //I think I see the camp! We're almost home, Mr. Floppy! Let's go!
TEXT_EMOTE_WP1 = -1800010, //Mr. Floppy revives
TEXT_EMOTE_AGGRO = -1800011, //The Ravenous Worg chomps down on Mr. Floppy
SAY_QUEST_ACCEPT = -1800012, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
SAY_QUEST_COMPLETE = -1800013 //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
};
//emily
struct npc_emilyAI : public npc_escortAI
{
npc_emilyAI(Creature* pCreature) : npc_escortAI(pCreature) { }
uint32 m_uiChatTimer;
uint64 RWORGGUID;
uint64 MrfloppyGUID;
Creature* Mrfloppy;
Creature* RWORG;
bool Completed;
void JustSummoned(Creature* pSummoned)
{
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 50.0f))
pSummoned->AI()->AttackStart(Mrfloppy);
else
pSummoned->AI()->AttackStart(m_creature->getVictim());
}
void WaypointReached(uint32 i)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
switch (i)
{
case 9:
Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f);
break;
case 10:
if (Mrfloppy)
{
DoScriptText(SAY_WORGHAGGRO1, m_creature);
m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
}
break;
case 11:
Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
break;
case 17:
Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
DoScriptText(SAY_WORGRAGGRO3, m_creature);
RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
RWORG->setFaction(35);
break;
case 18:
if (Mrfloppy)
{
RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
DoCast(Mrfloppy,SPELL_MRFLOPPY);
}
break;
case 19:
if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
Mrfloppy->EnterVehicle(RWORG);
break;
case 20:
if (Mrfloppy)
RWORG->HandleEmoteCommand(34);
break;
case 21:
if (Mrfloppy)
{
RWORG->Kill(Mrfloppy);
Mrfloppy->ExitVehicle();
RWORG->setFaction(14);
RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ());
DoScriptText(SAY_VICTORY2, m_creature);
}
break;
case 22:
if (Mrfloppy && Mrfloppy->isDead())
{
RWORG->DisappearAndDie();
m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE);
Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
DoScriptText(SAY_VICTORY3, m_creature);
}
break;
case 24:
if (pPlayer)
{
Completed = true;
pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, m_creature);
DoScriptText(SAY_QUEST_COMPLETE, m_creature, pPlayer);
}
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
break;
case 25:
DoScriptText(SAY_VICTORY4, m_creature);
break;
case 27:
m_creature->DisappearAndDie();
if (Mrfloppy)
Mrfloppy->DisappearAndDie();
break;
}
}
void EnterCombat(Unit* Who)
{
DoScriptText(SAY_RANDOMAGGRO, m_creature);
}
void Reset()
{
m_uiChatTimer = 4000;
Mrfloppy = NULL;
RWORG = NULL;
}
void UpdateAI(const uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (m_uiChatTimer <= uiDiff)
{
m_uiChatTimer = 12000;
}
else
m_uiChatTimer -= uiDiff;
}
}
};
bool QuestAccept_npc_emily(Player* pPlayer, Creature* pCreature, Quest const* quest)
{
if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE)
{
DoScriptText(SAY_QUEST_ACCEPT, pCreature);
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(pCreature, NPC_MRFLOPPY, 180.0f))
{
Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI())))
pEscortAI->Start(true, false, pPlayer->GetGUID());
}
return true;
}
CreatureAI* GetAI_npc_emily(Creature* pCreature)
{
return new npc_emilyAI(pCreature);
}
//mrfloppy
struct npc_mrfloppyAI : public ScriptedAI
{
npc_mrfloppyAI(Creature *c) : ScriptedAI(c) {}
uint64 EmilyGUID;
uint64 RWORGGUID;
uint64 HWORGGUID;
Creature* HWORG;
Creature* RWORG;
Creature* Emily;
void Reset()
{
HWORG = NULL;
RWORG = NULL;
Emily = NULL;
}
void EnterCombat(Unit* Who)
{
if (Creature* Emily = GetClosestCreatureWithEntry(m_creature, NPC_EMILY, 50.0f))
{
switch(Who->GetEntry())
{
case NPC_HUNGRY_WORG:
DoScriptText(SAY_WORGHAGGRO2, Emily);
break;
case NPC_RAVENOUS_WORG:
DoScriptText(SAY_WORGRAGGRO4, Emily);
break;
default:
DoScriptText(SAY_RANDOMAGGRO, Emily);
}
}
}
void EnterEvadeMode() {}
void MoveInLineOfSight(Unit *who) {}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
}
};
CreatureAI* GetAI_npc_mrfloppy(Creature* pCreature)
{
return new npc_mrfloppyAI(pCreature);
}
void AddSC_grizzly_hills()
{
Script* newscript;
@@ -124,4 +365,15 @@ void AddSC_grizzly_hills()
newscript->pGossipHello = &GossipHello_npc_orsonn_and_kodian;
newscript->pGossipSelect = &GossipSelect_npc_orsonn_and_kodian;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_emily";
newscript->GetAI = &GetAI_npc_emily;
newscript->pQuestAccept = &QuestAccept_npc_emily;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_mrfloppy";
newscript->GetAI = &GetAI_npc_mrfloppy;
newscript->RegisterSelf();
}
+29
View File
@@ -736,6 +736,30 @@ bool GOHello_go_soulwell(Player *pPlayer, GameObject* pGO)
return true;
}
/*######
## Quest 11560: Oh Noes, the Tadpoles!
## go_tadpole_cage
######*/
enum eTadpoles
{
QUEST_OH_NOES_THE_TADPOLES = 11560,
NPC_WINTERFIN_TADPOLE = 25201
};
bool GOHello_go_tadpole_cage(Player *pPlayer, GameObject *pGO)
{
Creature *pTadpole;
if (pPlayer->GetQuestStatus(QUEST_OH_NOES_THE_TADPOLES) == QUEST_STATUS_INCOMPLETE &&
(pTadpole = pGO->FindNearestCreature(NPC_WINTERFIN_TADPOLE,1.0f)))
{
pGO->UseDoorOrButton();
pTadpole->DisappearAndDie();
pPlayer->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE,0);
//FIX: Summon minion tadpole
}
return true;
}
void AddSC_go_scripts()
{
@@ -891,4 +915,9 @@ void AddSC_go_scripts()
newscript->Name = "go_soulwell";
newscript->pGOHello = &GOHello_go_soulwell;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "go_tadpole_cage";
newscript->pGOHello = &GOHello_go_tadpole_cage;
newscript->RegisterSelf();
}
+75
View File
@@ -316,6 +316,76 @@ bool ItemUse_item_petrov_cluster_bombs(Player* pPlayer, Item* pItem, const Spell
return false;
}
/*######
# item_dehta_trap_smasher
# For quest 11876, Help Those That Cannot Help Themselves
######*/
enum eHelpThemselves
{
QUEST_CANNOT_HELP_THEMSELVES = 11876,
NPC_TRAPPED_MAMMOTH_CALF = 25850,
GO_MAMMOTH_TRAP_1 = 188022,
GO_MAMMOTH_TRAP_2 = 188024,
GO_MAMMOTH_TRAP_3 = 188025,
GO_MAMMOTH_TRAP_4 = 188026,
GO_MAMMOTH_TRAP_5 = 188027,
GO_MAMMOTH_TRAP_6 = 188028,
GO_MAMMOTH_TRAP_7 = 188029,
GO_MAMMOTH_TRAP_8 = 188030,
GO_MAMMOTH_TRAP_9 = 188031,
GO_MAMMOTH_TRAP_10 = 188032,
GO_MAMMOTH_TRAP_11 = 188033,
GO_MAMMOTH_TRAP_12 = 188034,
GO_MAMMOTH_TRAP_13 = 188035,
GO_MAMMOTH_TRAP_14 = 188036,
GO_MAMMOTH_TRAP_15 = 188037,
GO_MAMMOTH_TRAP_16 = 188038,
GO_MAMMOTH_TRAP_17 = 188039,
GO_MAMMOTH_TRAP_18 = 188040,
GO_MAMMOTH_TRAP_19 = 188041,
GO_MAMMOTH_TRAP_20 = 188042,
GO_MAMMOTH_TRAP_21 = 188043,
GO_MAMMOTH_TRAP_22 = 188044,
};
bool ItemUse_item_dehta_trap_smasher(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
Creature* pMammoth;
GameObject* pTrap;
if (pPlayer->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) == QUEST_STATUS_INCOMPLETE &&
(pMammoth = pPlayer->FindNearestCreature(NPC_TRAPPED_MAMMOTH_CALF,5.0f)) &&
((pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_1,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_2,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_3,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_4,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_5,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_6,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_7,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_8,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_9,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_10,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_11,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_12,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_13,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_14,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_15,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_16,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_17,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_18,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_19,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_20,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_21,5.0f)) ||
(pTrap = pPlayer->FindNearestGameObject(GO_MAMMOTH_TRAP_22,5.0f))))
{
pMammoth->AI()->DoAction(1);
pTrap->SetGoState(GO_STATE_READY);
pPlayer->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF,0);
}
return false;
}
void AddSC_item_scripts()
{
Script *newscript;
@@ -374,4 +444,9 @@ void AddSC_item_scripts()
newscript->Name = "item_petrov_cluster_bombs";
newscript->pItemUse = &ItemUse_item_petrov_cluster_bombs;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "item_dehta_trap_smasher";
newscript->pItemUse = &ItemUse_item_dehta_trap_smasher;
newscript->RegisterSelf();
}