le revoila mis à jour par Scmoozerd.
[code=diff]diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 80510b1..06bd2a1 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -346,6 +346,10 @@ bool Group::AddMember(ObjectGuid guid, const char* name)
uint32 Group::RemoveMember(ObjectGuid guid, uint8 method)
{
+ // Only spoofing required if enabled in config
+ if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_SPOOF_FACTIONS))
+ BroadcastGroupUpdate();
+
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
if (GetMembersCount() > uint32(isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
{
@@ -1916,3 +1920,32 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* player_tap)
}
}
}
+
+void Group::BroadcastGroupUpdate()
+{
+ for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
+ {
+ Player *pp = sObjectMgr.GetPlayer(citr->guid);
+ if (pp && pp->IsInWorld())
+ {
+ pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
+ pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
+ DEBUG_LOG("FACTION_SPOOFING- Forced group value update for '%s'", pp->GetName());
+ if (pp->GetPet())
+ {
+ pp->GetPet()->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
+ pp->GetPet()->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
+ DEBUG_LOG("FACTION_SPOOFING- Forced group value update for '%s' pet '%s'", pp->GetName(), pp->GetPet()->GetName());
+ }
+ for (uint32 i = 0; i < MAX_TOTEM_SLOT; ++i)
+ {
+ if (Unit *totem = pp->GetMap()->GetUnit(pp->m_TotemSlot[i]))
+ {
+ totem->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
+ totem->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
+ DEBUG_LOG("FACTION_SPOOFING- Forced group value update for '%s' totem #%u", pp->GetName(), i);
+ }
+ }
+ }
+ }
+}
diff --git a/src/game/Group.h b/src/game/Group.h
index a3264
..5c6150a 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -363,6 +363,8 @@ class MANGOS_DLL_SPEC Group
InstanceGroupBind* GetBoundInstance(Map* aMap, Difficulty difficulty);
BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
+ void BroadcastGroupUpdate();
+
protected:
bool _addMember(ObjectGuid guid, const char* name, bool isAssistant=false);
bool _addMember(ObjectGuid guid, const char* name, bool isAssistant, uint8 group);
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index 62dd59a..5a71b50 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -216,6 +216,10 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if(!group->AddMember(GetPlayer()->GetObjectGuid(), GetPlayer()->GetName()))
return;
+
+ // Spoof factions of other group members
+ if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_SPOOF_FACTIONS))
+ group->BroadcastGroupUpdate();
}
void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index b33aa2c..2602889 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -541,6 +541,57 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
*data << (m_uint32Values[index] & ~(UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER));
}
}
+ // Spoofing of faction if enabled by config
+ else if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_SPOOF_FACTIONS) && (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE))
+ {
+ bool spoofed = false;
+
+ if ((GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) && target != this)
+ {
+ bool forcefriendly = false; // bool for pets/totems to offload more code from the big if below
+
+ if (GetTypeId() == TYPEID_UNIT)
+ {
+ Creature* cme = (Creature*)this;
+ forcefriendly = (cme->IsTotem() || cme->IsPet())
+ // no need to send hackfix to pet owner
+ && cme->GetOwner() != target
+ // pet owner must be friendly to target
+ && cme->GetOwner()->IsFriendlyTo(target)
+ // They must be in the same group
+ && cme->GetOwner()->GetTypeId() == TYPEID_PLAYER
+ && (target->IsInSameGroupWith((Player*)cme->GetOwner()) || target->IsInSameRaidWith((Player*)cme->GetOwner()));
+ }
+
+ if (((Unit*)this)->IsSpoofSamePlayerFaction() || forcefriendly || (target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER && (target->IsInSameGroupWith((Player*)this) || target->IsInSameRaidWith((Player*)this))))
+ {
+ if (index == UNIT_FIELD_BYTES_2)
+ {
+ DEBUG_LOG("FACTION_SPOOFING- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Unit*)this)->GetName());
+ *data << ( m_uint32Values[ index ] & (UNIT_BYTE2_FLAG_SANCTUARY << 8) ); // this flag is at uint8 offset 1 !!
+ spoofed = true;
+ }
+ else if(index == UNIT_FIELD_FACTIONTEMPLATE)
+ {
+ FactionTemplateEntry const *ft1, *ft2;
+ ft1 = ((Unit*)this)->getFactionTemplateEntry();
+ ft2 = ((Unit*)target)->getFactionTemplateEntry();
+
+ if (ft1 && ft2 && (!ft1->IsFriendlyTo(*ft2) || ((Unit*)this)->IsSpoofSamePlayerFaction()))
+ {
+ // pretend that all other HOSTILE units in group have own faction, to allow follow, heal, rezz (trade wont work)
+ uint32 faction = ((Player*)target)->getFaction();
+ DEBUG_LOG("FACTION_SPOOFING- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Unit*)this)->GetName(), faction);
+ *data << uint32(faction);
+ spoofed = true;
+ }
+ }
+ }
+ }
+
+ if (!spoofed)
+ *data << m_uint32Values[index];
+ }
else
{
// send in current format (float as float, uint32 as uint32)
@@ -1575,6 +1626,19 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
return pCreature;
}
+void Object::ForceValuesUpdateAtIndex(uint32 i)
+{
+ m_uint32Values_mirror[i] = GetUInt32Value(i) + 1; // makes server think the field changed
+ if(m_inWorld)
+ {
+ if(!m_objectUpdated)
+ {
+ AddToClientUpdateList();
+ m_objectUpdated = true;
+ }
+ }
+}
+
namespace MaNGOS
{
class NearUsedPosDo
diff --git a/src/game/Object.h b/src/game/Object.h
index 000ebf8..0965ac9 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -356,6 +356,9 @@ class MANGOS_DLL_SPEC Object
virtual bool HasQuest(uint32 /* quest_id */) const { return false; }
virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
+
+ void ForceValuesUpdateAtIndex(uint32);
+
protected:
Object ( );
diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp
index 7da6476..9112320 100644
--- a/src/game/TradeHandler.cpp
+++ b/src/game/TradeHandler.cpp
@@ -603,7 +603,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
- if (pOther->GetTeam() !=_player->GetTeam() )
+ if (pOther->GetTeam() !=_player->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE) && !pOther->IsInSameGroupWith(_player))
{
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
return;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index dc46795..1695d56 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -264,6 +264,8 @@ Unit::Unit() :
// remove aurastates allowing special moves
for(int i=0; i < MAX_REACTIVE; ++i)
m_reactiveTimer[i] = 0;
+
+ m_spoofSamePlayerFaction = false;
}
Unit::~Unit()
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 197e08a..d4ae2df 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1949,6 +1949,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void AddPetAura(PetAura const* petSpell);
void RemovePetAura(PetAura const* petSpell);
+ inline void SetSpoofSamePlayerFaction(bool b) { m_spoofSamePlayerFaction = b; }
+ inline bool IsSpoofSamePlayerFaction(void) {return m_spoofSamePlayerFaction; }
+
// Movement info
MovementInfo m_movementInfo;
Movement::MoveSpline * movespline;
@@ -2008,8 +2011,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 m_lastManaUseTimer;
VehicleInfo* m_vehicleInfo;
+
void DisableSpline();
- private:
+
+ bool m_spoofSamePlayerFaction : 1;
+
+ public:
void CleanupDeletedAuras();
void UpdateSplineMovement(uint32 t_diff);
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 2f96f53..7b457da 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -552,8 +552,10 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD, "AllowTwoSide.Interaction.Guild", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION, "AllowTwoSide.Interaction.Auction", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_MAIL, "AllowTwoSide.Interaction.Mail", false);
+ setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE, "AllowTwoSide.Interaction.Trade", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST, "AllowTwoSide.WhoList", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ADD_FRIEND, "AllowTwoSide.AddFriend", false);
+ setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_SPOOF_FACTIONS, "AllowTwoSide.SpoofFactions", false);
setConfig(CONFIG_UINT32_STRICT_PLAYER_NAMES, "StrictPlayerNames", 0);
setConfig(CONFIG_UINT32_STRICT_CHARTER_NAMES, "StrictCharterNames", 0);
diff --git a/src/game/World.h b/src/game/World.h
index 840cf12..187b45d 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -290,8 +290,10 @@ enum eConfigBoolValues
CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD,
CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION,
CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_MAIL,
+ CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE,
CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST,
CONFIG_BOOL_ALLOW_TWO_SIDE_ADD_FRIEND,
+ CONFIG_BOOL_ALLOW_TWO_SIDE_SPOOF_FACTIONS,
CONFIG_BOOL_INSTANCE_IGNORE_LEVEL,
CONFIG_BOOL_INSTANCE_IGNORE_RAID,
CONFIG_BOOL_CAST_UNSTUCK,
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index 8003608..8a6aaeb 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -833,8 +833,9 @@ Raid.MinLevel = 10
# AllowTwoSide.Interaction.Guild
# AllowTwoSide.Interaction.Auction
# AllowTwoSide.Interaction.Mail
+# AllowTwoSide.Interaction.Trade
# Allow or not common :chat(say,yell);channel(chat)group(join)guild(join);merge all auction houses for players from
-# different teams, send mail to different team.
+# different teams, send mail to different team, trade with enemies (if in group).
# Default: 0 (Not allowed)
# 1 (Allowed)
#
@@ -848,6 +849,11 @@ Raid.MinLevel = 10
# Default: 0 (Not allowed)
# 1 (Allowed)
#
+# AllowTwoSide.SpoofFactions
+# Allow spoofing factions for enemy players within same group
+# Default: 0 (Not allowed)
+# 1 (Allowed - This enables hacks!)
+#
# TalentsInspecting
# Allow other players see character talents in inspect dialog (Characters in Gamemaster mode can
# inspect talents always)
@@ -863,8 +869,10 @@ AllowTwoSide.Interaction.Group = 0
AllowTwoSide.Interaction.Guild = 0
AllowTwoSide.Interaction.Auction = 0
AllowTwoSide.Interaction.Mail = 0
+AllowTwoSide.Interaction.Trade = 0
AllowTwoSide.WhoList = 0
AllowTwoSide.AddFriend = 0
+AllowTwoSide.SpoofFactions = 0
TalentsInspecting = 1
###################################################################################################################
[/code]
Amusez vous bien. Cette version de ah goup est incorporée dans les cores avec broadcast.