Update to Trinity 863.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-16 14:32:47 -06:00
36 changed files with 781 additions and 95 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
return;//maybe we should log this, cause this must be a cheater or a big bug
uint8 team = GetTeamIndexByTeamId(player->GetTeam());
//TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor
sLog.outError("BG_AV Quest %i completed",questid);
sLog.outDebug("BG_AV Quest %i completed",questid);
switch(questid)
{
case AV_QUEST_A_SCRAPS1:
+2 -2
View File
@@ -473,7 +473,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
SendPacket( &data );
std::string IP_str = GetRemoteAddress();
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
sLog.outDetail("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
}
@@ -523,7 +523,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
return;
std::string IP_str = GetRemoteAddress();
sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
if(sLog.IsOutCharDump()) // optimize GetPlayerDump call
+1
View File
@@ -443,6 +443,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL },
{ "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL },
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL },
{ "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL },
//{ TODO: fix or remove this commands
{ "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL },
+1
View File
@@ -205,6 +205,7 @@ class ChatHandler
bool HandleNpcUnFollowCommand(const char* args);
bool HandleNpcWhisperCommand(const char* args);
bool HandleNpcYellCommand(const char* args);
bool HandleNpcAddFormationCommand(const char* args);
bool HandleReloadAllCommand(const char* args);
bool HandleReloadAllAreaCommand(const char* args);
+1 -1
View File
@@ -1016,7 +1016,7 @@ uint32 GameEvent::Update() // return the next e
nextEventDelay = 0;
for(std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
StopEvent(*itr);
sLog.outBasic("Next game event check in %u seconds.", nextEventDelay + 1);
sLog.outDetail("Next game event check in %u seconds.", nextEventDelay + 1);
return (nextEventDelay + 1) * 1000; // Add 1 second to be sure event has started/stopped at next call
}
+20 -1
View File
@@ -295,12 +295,14 @@ bool Group::AddMember(const uint64 &guid, const char* name)
uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
{
BroadcastGroupUpdate();
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
if(GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
{
bool leaderChanged = _removeMember(guid);
Player *player = objmgr.GetPlayer( guid );
Player *player = objmgr.GetPlayer( guid ); // FG: TODO: could be removed, its just here for consistency
if (player)
{
WorldPacket data;
@@ -1521,3 +1523,20 @@ void Group::_homebindIfInstance(Player *player)
player->m_InstanceValid = false;
}
}
void Group::BroadcastGroupUpdate(void)
{
// FG: HACK: force flags update on group leave - for values update hack
// -- not very efficient but safe
for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
Player *pp = objmgr.GetPlayer(citr->guid);
if(pp && pp->IsInWorld())
{
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
DEBUG_LOG("-- Forced group value update for '%s'", pp->GetName());
}
}
}
+3
View File
@@ -331,6 +331,9 @@ class TRINITY_DLL_SPEC Group
InstanceGroupBind* GetBoundInstance(uint32 mapid, uint8 difficulty);
BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; }
// FG: evil hacks
void BroadcastGroupUpdate(void);
protected:
bool _addMember(const uint64 &guid, const char* name, bool isAssistant=false);
bool _addMember(const uint64 &guid, const char* name, bool isAssistant, uint8 group);
+8 -4
View File
@@ -216,6 +216,8 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
uint8 subgroup = group->GetMemberGroup(GetPlayer()->GetGUID());
GetPlayer()->SetGroup(group, subgroup);
group->BroadcastGroupUpdate();
}
void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
@@ -724,8 +726,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
uint32 updatedAura = player->GetVisibleAura(i);
*data << uint32(updatedAura);
*data << uint8(1);
if(!updatedAura)
player->UnsetAuraUpdateMask(i);
//TODO: find a safe place to do this cleanup
//if(!updatedAura)
//player->UnsetAuraUpdateMask(i);
}
}
}
@@ -808,8 +811,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
uint32 updatedAura = pet->GetVisibleAura(i);
*data << uint32(updatedAura);
*data << uint8(1);
if(!updatedAura)
pet->UnsetAuraUpdateMask(i);
//TODO: find a safe place to do this cleanup
//if(!updatedAura)
//pet->UnsetAuraUpdateMask(i);
}
}
}
+4 -4
View File
@@ -645,14 +645,14 @@ void Item::AddToUpdateQueueOf(Player *player)
player = GetOwner();
if (!player)
{
sLog.outError("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID()));
sLog.outDebug("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID()));
return;
}
}
if (player->GetGUID() != GetOwnerGUID())
{
sLog.outError("Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
sLog.outDebug("Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
return;
}
@@ -671,14 +671,14 @@ void Item::RemoveFromUpdateQueueOf(Player *player)
player = GetOwner();
if (!player)
{
sLog.outError("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID()));
sLog.outDebug("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID()));
return;
}
}
if (player->GetGUID() != GetOwnerGUID())
{
sLog.outError("Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
sLog.outDebug("Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow());
return;
}
+46
View File
@@ -4366,3 +4366,49 @@ bool ChatHandler::HandleTempGameObjectCommand(const char* args)
return true;
}
bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
{
if (!*args)
return false;
uint32 leaderGUID = (uint32) atoi((char*)args);
Creature *pCreature = getSelectedCreature();
if(!pCreature || !pCreature->GetDBTableGUIDLow())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
uint32 lowguid = pCreature->GetDBTableGUIDLow();
if(pCreature->GetFormationID())
{
PSendSysMessage("Selected creature is already member of group %u", pCreature->GetFormationID());
return false;
}
if (!lowguid)
return false;
Player *chr = m_session->GetPlayer();
FormationMember *group_member;
group_member = new FormationMember;
group_member->follow_angle = pCreature->GetAngle(chr) - chr->GetOrientation();
group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(),int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(),int(2)));
group_member->memberGUID = lowguid;
group_member->leaderGUID = leaderGUID;
group_member->groupAI = 0;
CreatureGroupMap[lowguid] = group_member;
pCreature->SearchFormation();
WorldDatabase.PExecuteLog("INSERT INTO `creature_formations` (`leaderGUID`, `memberGUID`, `dist`, `angle`, `groupAI`) VALUES ('%u','%u','%f', '%f', '%u')",
leaderGUID, lowguid, group_member->follow_dist, group_member->follow_angle, group_member->groupAI);
PSendSysMessage("Creature %u added to formation with leader %u", lowguid, leaderGUID);
return true;
}
+2 -2
View File
@@ -328,9 +328,9 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
{
// recheck
CHECK_PACKET_SIZE(recv_data,8+4+1);
sLog.outBasic("reading string");
sLog.outDebug("reading string");
recv_data >> code;
sLog.outBasic("string read: %s", code.c_str());
sLog.outDebug("string read: %s", code.c_str());
}
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_NONE);
+45
View File
@@ -653,6 +653,38 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
else
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_OTHER_TAGGER);
}
// FG: pretend that OTHER players in own group are friendly ("blue")
else if(index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
{
bool ch = false;
if(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER && target != this)
{
if(target->IsInSameGroupWith((Player*)this) || target->IsInSameRaidWith((Player*)this))
{
if(index == UNIT_FIELD_BYTES_2)
{
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Player*)this)->GetName());
*data << ( m_uint32Values[ index ] & (UNIT_BYTE2_FLAG_SANCTUARY << 8) ); // this flag is at uint8 offset 1 !!
ch = true;
}
else if(index == UNIT_FIELD_FACTIONTEMPLATE)
{
FactionTemplateEntry const *ft1, *ft2;
ft1 = ((Player*)this)->getFactionTemplateEntry();
ft2 = ((Player*)target)->getFactionTemplateEntry();
if(ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
{
uint32 faction = ((Player*)target)->getFaction(); // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Player*)this)->GetName(), faction);
*data << uint32(faction);
ch = true;
}
}
}
}
if(!ch)
*data << m_uint32Values[ index ];
}
else
{
// send in current format (float as float, uint32 as uint32)
@@ -1324,6 +1356,19 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf)
SendMessageToSet( &data, true ); // ToSelf ignored in this case
}
void Object::ForceValuesUpdateAtIndex(uint32 i)
{
m_uint32Values_mirror[i] = GetUInt32Value(i) + 1; // makes server think the field changed
if(m_inWorld)
{
if(!m_objectUpdated)
{
ObjectAccessor::Instance().AddUpdateObject(this);
m_objectUpdated = true;
}
}
}
namespace Trinity
{
class MessageChatLocaleCacheDo
+4
View File
@@ -302,6 +302,10 @@ class TRINITY_DLL_SPEC Object
virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
protected:
Object ( );
+2 -2
View File
@@ -736,10 +736,10 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
}
uint32 guid=objmgr.GenerateLowGuid(HIGHGUID_PET);
sLog.outBasic("SetInstanceID()");
sLog.outDebug("SetInstanceID()");
SetInstanceId(creature->GetInstanceId());
sLog.outBasic("Create pet");
sLog.outDebug("Create pet");
uint32 pet_number = objmgr.GeneratePetNumber();
if(!Create(guid, creature->GetMap(), creature->GetEntry(), pet_number))
return false;
+1 -1
View File
@@ -3371,7 +3371,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
Unit::AuraList const& mDummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellIconID == 2114)
if ((*i)->GetSpellProto()->SpellIconID == 2114 && Real)
{
if (apply)
{
+1 -1
View File
@@ -536,7 +536,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
if(pOther->GetTeam() !=_player->GetTeam() )
if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeam() !=_player->GetTeam() )
{
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
return;
+20 -15
View File
@@ -382,9 +382,9 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z,
float combat_reach = GetCombatReach();
if(combat_reach < 0.1) // sometimes bugged for players
{
sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach);
if(GetTypeId() == TYPEID_UNIT)
sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry());
//sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach);
// if(GetTypeId() == TYPEID_UNIT)
// sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry());
combat_reach = DEFAULT_COMBAT_REACH;
}
uint32 attacker_number = getAttackers().size();
@@ -3927,6 +3927,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
Aura* Aur = i->second;
SpellEntry const* AurSpellInfo = Aur->GetSpellProto();
// some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura
// remove aura from list before to prevent deleting it before
m_Auras.erase(i);
++m_removedAuras; // internal count used by unit update
Unit* caster = NULL;
if (IsSingleTargetSpell(AurSpellInfo))
{
@@ -3946,22 +3951,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
// remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
if (Aur->GetModifier()->m_auraname < TOTAL_AURAS)
{
m_modAuras[(*i).second->GetModifier()->m_auraname].remove((*i).second);
if((*i).second->GetSpellProto()->AuraInterruptFlags)
m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur);
if(Aur->GetSpellProto()->AuraInterruptFlags)
{
m_interruptableAuras.remove((*i).second);
m_interruptableAuras.remove(Aur);
UpdateInterruptMask();
}
if((*i).second->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE)
m_ccAuras.remove((*i).second);
if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE)
m_ccAuras.remove(Aur);
}
// Set remove mode
Aur->SetRemoveMode(mode);
// some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura
// remove aura from list before to prevent deleting it before
m_Auras.erase(i);
++m_removedAuras; // internal count used by unit update
// Statue unsummoned at aura remove
Totem* statue = NULL;
@@ -3982,12 +3985,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id))
{
for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
{
if(spell_triggered < 0)
RemoveAurasDueToSpell(-(*i));
RemoveAurasDueToSpell(-(*itr));
else if(Unit* caster = Aur->GetCaster())
CastSpell(this, *i, true, 0, 0, caster->GetGUID());
CastSpell(this, *itr, true, 0, 0, caster->GetGUID());
}
}
@@ -11251,6 +11254,8 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura )
void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo)
{
uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT);
if(target_guid == GetGUID())
return;
if(!IS_UNIT_GUID(target_guid))
return;
+4 -3
View File
@@ -612,6 +612,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Mail",false);
m_configs[CONFIG_ALLOW_TWO_SIDE_WHO_LIST] = sConfig.GetBoolDefault("AllowTwoSide.WhoList", false);
m_configs[CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND] = sConfig.GetBoolDefault("AllowTwoSide.AddFriend", false);
m_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfig.GetBoolDefault("AllowTwoSide.trade", false);
m_configs[CONFIG_STRICT_PLAYER_NAMES] = sConfig.GetIntDefault("StrictPlayerNames", 0);
m_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfig.GetIntDefault("StrictCharterNames", 0);
m_configs[CONFIG_STRICT_PET_NAMES] = sConfig.GetIntDefault("StrictPetNames", 0);
@@ -736,7 +737,7 @@ void World::LoadConfigSettings(bool reload)
{
sLog.outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_configs[CONFIG_START_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS],0);
m_configs[CONFIG_MAX_ARENA_POINTS] = 0;
m_configs[CONFIG_START_ARENA_POINTS] = 0;
}
else if(m_configs[CONFIG_START_ARENA_POINTS] > m_configs[CONFIG_MAX_ARENA_POINTS])
{
@@ -1360,7 +1361,7 @@ void World::SetInitialWorldSettings()
exit(1);
///- Initialize game time and timers
sLog.outString( "DEBUG:: Initialize game time and timers" );
sLog.outDebug( "DEBUG:: Initialize game time and timers" );
m_gameTime = time(NULL);
m_startTime=m_gameTime;
@@ -1505,7 +1506,7 @@ void World::Update(time_t diff)
{
if(m_updateTimeSum > m_configs[CONFIG_INTERVAL_LOG_UPDATE])
{
sLog.outString("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
sLog.outBasic("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
m_updateTimeSum = m_updateTime;
m_updateTimeCount = 1;
}
+1
View File
@@ -96,6 +96,7 @@ enum WorldConfigs
CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL,
CONFIG_ALLOW_TWO_SIDE_WHO_LIST,
CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND,
CONFIG_ALLOW_TWO_SIDE_TRADE,
CONFIG_STRICT_PLAYER_NAMES,
CONFIG_STRICT_CHARTER_NAMES,
CONFIG_STRICT_PET_NAMES,
+1 -1
View File
@@ -939,7 +939,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket (packet);
sLog.outBasic ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
sLog.outDetail ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1;
}