Skip to content

Commit

Permalink
Implemented new creature custom_flag (128) for ignoring just vmap dat…
Browse files Browse the repository at this point in the history
…a instead of vmap data and mmap data (32).
  • Loading branch information
stoneharry committed Aug 9, 2013
1 parent 4efd9aa commit 7c91078
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/arcemu-world/AIInterface.cpp
Expand Up @@ -622,7 +622,7 @@ void AIInterface::_UpdateCombat(uint32 p_time)

if(m_Unit->GetMapMgr() != NULL && getNextTarget() != NULL)
{
if(!Flying() && !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING))
if(!Flying() && (!m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING) || !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_VMAPS)))
{
float target_land_z = m_Unit->GetMapMgr()->GetLandHeight(getNextTarget()->GetPositionX(), getNextTarget()->GetPositionY(), getNextTarget()->GetPositionZ());

Expand Down Expand Up @@ -891,7 +891,7 @@ void AIInterface::_UpdateCombat(uint32 p_time)
float distance = m_Unit->CalcDistance(getNextTarget());
bool los = true;

if(sWorld.Collision && !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING))
if(sWorld.Collision && (!m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING) || !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_VMAPS)))
{
los = CollideInterface.CheckLOS(m_Unit->GetMapId(), m_Unit->GetPositionNC(), getNextTarget()->GetPositionNC());
}
Expand Down Expand Up @@ -1065,7 +1065,7 @@ void AIInterface::AttackReaction(Unit* pUnit, uint32 damage_dealt, uint32 spellI
{
if(m_Unit->GetMapMgr() != NULL)
{
if(!Flying() && !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING))
if(!Flying() && (!m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING) || !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_VMAPS)))
{
float target_land_z = m_Unit->GetMapMgr()->GetLandHeight(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ());

Expand Down Expand Up @@ -1277,7 +1277,7 @@ Unit* AIInterface::FindTarget()
continue;
if(distance > dist)
{
if(sWorld.Collision && !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING))
if(sWorld.Collision && (!m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING) || !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_VMAPS)))
{
if(CollideInterface.CheckLOS(m_Unit->GetMapId(), m_Unit->GetPositionNC(), tmpPlr->GetPositionNC()))
{
Expand Down Expand Up @@ -1325,7 +1325,7 @@ Unit* AIInterface::FindTarget()

if(dist <= _CalcAggroRange(pUnit))
{
if(sWorld.Collision && !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING))
if(sWorld.Collision && (!m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING) || !m_Unit->HasCreatureCustomFlag(CREATURE_CUSTOMFLAG_NO_ADV_VMAPS)))
{
if(m_Unit->GetMapMgr()->InLineOfSight(m_Unit->GetPositionX(), m_Unit->GetPositionY(), m_Unit->GetPositionZ() + 2, pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ() + 2))
{
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/Chat.cpp
Expand Up @@ -801,6 +801,7 @@ void CommandTableStorage::Init()
{ "taxi", 'b', &ChatHandler::HandleStartTaxiCommand, "Force starts a taxi of the id specificed.", NULL, 0, 0, 0 },
{ "camerashake", 'b', &ChatHandler::HandleCameraShakeCommand, "", NULL, 0, 0, 0 },
{ "lightoverride", 'b', &ChatHandler::HandleLightOverrideCommand, "", NULL, 0, 0, 0 },
{ "chatspy", 'a', &ChatHandler::HandleChatSpyCommand, "Toggles chat spy.", NULL, 0, 0, 0 },
{ NULL, '0', NULL, "", NULL, 0, 0, 0 }
};
dupe_command_table(commandTable, _commandTable);
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/Chat.h
Expand Up @@ -244,6 +244,7 @@ class SERVER_DECL ChatHandler : public Singleton<ChatHandler>
bool HandleRatingsCommand(const char* args , WorldSession* m_session);
bool HandleSimpleDistanceCommand(const char* args , WorldSession* m_session);
bool HandlePhaseCommand(const char* args , WorldSession* m_session);
bool HandleChatSpyCommand(const char* args, WorldSession* m_session);

// Level 1 commands
bool CmdSetValueField(WorldSession* m_session, uint32 field, uint32 fieldmax, const char* fieldname, const char* args);
Expand Down
27 changes: 22 additions & 5 deletions src/arcemu-world/ChatHandler.cpp
Expand Up @@ -137,23 +137,25 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
pMisc = 0;
if(sChatHandler.ParseCommands(msg.c_str(), this) > 0)
return;
if(lang != CHAT_MSG_ADDON)
if(type != CHAT_MSG_ADDON)
{
spy << "|cff00C78C[Chat Spy]";
spy << "<Public> " << GetPlayer()->GetName() << ": " << pMsg;
sWorld.SendGMWorldText(spy.str().c_str(), this);
spy << "\n";
spy << " \n";
printf(spy.str().c_str());
}
break;
case CHAT_MSG_WHISPER:
recv_data >> to >> msg;
pMsg = msg.c_str();
pMisc = to.c_str();
if(lang != CHAT_MSG_ADDON)
if(type != CHAT_MSG_ADDON)
{
spy << "|cff00C78C[Chat Spy]";
spy << "<Private> " << GetPlayer()->GetName() << " to " << pMisc << ": " << pMsg;
sWorld.SendGMWorldText(spy.str().c_str(), this);
spy << "\n";
spy << " \n";
printf(spy.str().c_str());
}
break;
Expand All @@ -164,6 +166,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
pMisc = channel.c_str();
if(sChatHandler.ParseCommands(msg.c_str(), this) > 0)
return;
if(type != CHAT_MSG_ADDON)
{
spy << "|cff00C78C[Chat Spy]";
spy << "<Channel> " << GetPlayer()->GetName() << " Channel " << pMisc << ": " << pMsg;
sWorld.SendGMWorldText(spy.str().c_str(), this);
spy << " \n";
printf(spy.str().c_str());
}
break;
case CHAT_MSG_AFK:
case CHAT_MSG_DND:
Expand All @@ -174,6 +184,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
pMsg = msg.c_str();
if(sChatHandler.ParseCommands(msg.c_str(), this) > 0)
return;
if(type != CHAT_MSG_ADDON)
{
spy << "<Battleground> " << GetPlayer()->GetName() << ": " << pMsg;
sWorld.SendGMWorldText(spy.str().c_str(), this);
spy << " \n";
printf(spy.str().c_str());
}
break;
default:
LOG_ERROR("CHAT: unknown msg type %u, lang: %u", type, lang);
Expand All @@ -182,7 +199,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
break;
}

if(lang != CHAT_MSG_ADDON)
if(type != CHAT_MSG_ADDON)
{
if(m_muted && m_muted >= (uint32)UNIXTIME)
{
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/Creature.h
Expand Up @@ -258,6 +258,7 @@ enum CustomFlags
CREATURE_CUSTOMFLAG_VEHICLE_COMBAT = 0x10, // 16
CREATURE_CUSTOMFLAG_NO_ADV_PATHFINDING = 0x20, // 32
CREATURE_CUSTOMFLAG_NO_RETURN_AFTER_COMBAT = 0x40, // 64
CREATURE_CUSTOMFLAG_NO_ADV_VMAPS = 0x80, // 128
};

enum FAMILY
Expand Down
8 changes: 8 additions & 0 deletions src/arcemu-world/Level0.cpp
Expand Up @@ -320,6 +320,14 @@ bool ChatHandler::HandleSaveCommand(const char* args, WorldSession* m_session)
return true;
}

bool ChatHandler::HandleChatSpyCommand(const char* args, WorldSession* m_session)
{
Player* p_target = m_session->GetPlayer();
p_target->chatspy = !p_target->chatspy;
RedSystemMessage(m_session, "Chat spy is now %s.", p_target->chatspy ? "enabled" : "disabled");
return true;
}

bool ChatHandler::HandleGMListCommand(const char* args, WorldSession* m_session)
{
WorldPacket data;
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/Player.cpp
Expand Up @@ -475,6 +475,7 @@ Player::Player(uint32 guid)
SaveBlocked = false;
for(i = 0; i < 1; i++)
HGTemps[i] = 0;
chatspy = false;
}

void Player::OnLogin()
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/Player.h
Expand Up @@ -2661,6 +2661,7 @@ class SERVER_DECL Player : public Unit
void ReloadSkills();
void _LoadSkills(QueryResult* result);
void __AddLanguages();
bool chatspy;
};


Expand Down
16 changes: 16 additions & 0 deletions src/arcemu-world/World.cpp
Expand Up @@ -750,6 +750,22 @@ void World::SendGamemasterMessage(WorldPacket* packet, WorldSession* self)
m_sessionlock.ReleaseReadLock();
}

void World::SendChatSpyMessage(WorldPacket* packet, WorldSession* self)
{
m_sessionlock.AcquireReadLock();
SessionMap::iterator itr;
for(itr = m_sessions.begin(); itr != m_sessions.end(); itr++)
{
if(itr->second->GetPlayer() &&
itr->second->GetPlayer()->IsInWorld()
&& itr->second != self && itr->second->GetPlayer()->chatspy) // don't send to self!
{
if(itr->second->CanUseCommand('u'))
itr->second->SendPacket(packet);
}
}
m_sessionlock.ReleaseReadLock();
}
void World::SendZoneMessage(WorldPacket* packet, uint32 zoneid, WorldSession* self)
{
m_sessionlock.AcquireReadLock();
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/World.h
Expand Up @@ -400,6 +400,7 @@ class SERVER_DECL World : public Singleton<World>, public EventableObject
void SendInstanceMessage(WorldPacket* packet, uint32 instanceid, WorldSession* self = 0);
void SendFactionMessage(WorldPacket* packet, uint8 teamId);
void SendGamemasterMessage(WorldPacket* packet, WorldSession* self = 0);
void SendChatSpyMessage(WorldPacket* packet, WorldSession* self = 0);
void SendGMWorldText(const char* text, WorldSession* self = 0);
void SendDamageLimitTextToGM(const char* playername, const char* dmglog);
void SendBCMessageByID(uint32 id);
Expand Down

0 comments on commit 7c91078

Please sign in to comment.