diff options
author | megamage <none@none> | 2008-11-21 19:45:49 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-11-21 19:45:49 -0600 |
commit | fa667cf4507e5635d597b878119ce20f2836cc8c (patch) | |
tree | 34a1b3a70db2d8ba86be680bb341f1e499b0d672 /src/game/BattleGround.cpp | |
parent | b2ba78e57a7c1895d1bacf950a3705eedd01c256 (diff) |
*Alterac Valley. By Bogie and Balrok. Note: some core contents are modified. Will fix them later. Some sql are disabled because of possible conflict with offical DB. Use them at your own risk.
--HG--
branch : trunk
Diffstat (limited to 'src/game/BattleGround.cpp')
-rw-r--r-- | src/game/BattleGround.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 67261b6ff20..772368841d1 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -362,6 +362,23 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) } } +void BattleGround::YellToAll(Creature* creature, const char* text, uint32 language) +{ + for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + WorldPacket data(SMSG_MESSAGECHAT, 200); + Player *plr = objmgr.GetPlayer(itr->first); + if(!plr) + { + sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + continue; + } + creature->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,text,language,creature->GetName(),itr->first); + plr->GetSession()->SendPacket(&data); + } +} + + void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) { for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) @@ -1218,6 +1235,22 @@ void BattleGround::DoorOpen(uint32 type) } } +GameObject* BattleGround::GetBGObject(uint32 type) +{ + GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]); + if(!obj) + sLog.outError("couldn't get gameobject %i",type); + return obj; +} + +Creature* BattleGround::GetBGCreature(uint32 type) +{ + Creature *creature = HashMapHolder<Creature>::Find(m_BgCreatures[type]); + if(!creature) + sLog.outError("couldn't get creature %i",type); + return creature; +} + void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime) { Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID()); @@ -1269,6 +1302,16 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f return NULL; } + CreatureData &data = objmgr.NewOrExistCreatureData(pCreature->GetDBTableGUIDLow()); + + data.id = entry; +// data.mapid = GetMapId(); + data.posX = x; + data.posY = y; + data.posZ = z; + data.orientation = o; + data.spawndist = 15; + pCreature->AIM_Initialize(); //pCreature->SetDungeonDifficulty(0); @@ -1287,6 +1330,7 @@ bool BattleGround::DelCreature(uint32 type) sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type])); return false; } + //TODO: only delete creature after not in combat cr->CleanupsBeforeDelete(); cr->AddObjectToRemoveList(); m_BgCreatures[type] = 0; @@ -1474,3 +1518,16 @@ void BattleGround::SetHoliday(bool is_holiday) else m_HonorMode = BG_NORMAL; } + +int32 BattleGround::GetObjectType(uint64 guid) +{ + for(uint32 i = 0;i <= m_BgObjects.size(); i++) + if(m_BgObjects[i] == guid) + return i; + sLog.outError("BattleGround: cheating? a player used a gameobject which isnt supposed to be a usable object!"); + return -1; +} + +void BattleGround::HandleKillUnit(Creature *creature, Player *killer) +{ +} |