Jump to content

[PATCH] Ally&Horde in the same group (Updated)


Recommended Posts

  • Replies 127
  • Created
  • Last Reply

Top Posters In This Topic

The patch is still for 3.2.2a, when I'll update it for 3.3.x I'll post it

Im running 3.2.2a build 9131 is still 3.2.2a and no matter what I try I get "fatal: patch with only garbage at line 5"

So its not an issue with version type

diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 484e5fd..b1ecfdc 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp@@ -322,10 +322,20 @@ bool Group::AddMember(const uint64 &guid, const char* name)
                {
                    player->SetRaidDifficulty(GetRaidDifficulty());
                    player->SendRaidDifficulty(true);
                }
            }
+        // Group Interfactions interactions (test)
+            if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+            {
+                Group *group = player->GetGroup();
+                if(Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID()))
+                {
+                    player->setFactionForRace(leader->getRace());
+                    sLog.outDebug( "WORLD: Group Interfaction Interactions - Faction changed (AddMember)" );
+                }
+            }
        }
        player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
        UpdatePlayerOutOfRange(player);

        // quest related GO state dependent from raid membership
@@ -422,10 +432,16 @@ void Group::Disband(bool hideDestroy)
            //we can remove player who is in battleground from his original group
            if( player->GetOriginalGroup() == this )
                player->SetOriginalGroup(NULL);
            else
                player->SetGroup(NULL);
+            // Restore original faction if needed
+            if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+            {
+                player->setFactionForRace(player->getRace());
+                sLog.outDebug( "WORLD: Group Interfaction Interactions - Restore original faction (Disband)" );
+            }
        }

        // quest related GO state dependent from raid membership
        if(isRaidGroup())
            player->UpdateForQuestWorldObjects();
@@ -449,11 +465,16 @@ void Group::Disband(bool hideDestroy)
        {
            data.Initialize(SMSG_GROUP_LIST, 24);
            data << uint64(0) << uint64(0) << uint64(0);
            player->GetSession()->SendPacket(&data);
        }
-
+        // Restore original faction if needed
+        if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+        {
+                player->setFactionForRace(player->getRace());
+                sLog.outDebug( "WORLD: Group Interfaction Interactions - Restore original faction (RemoveMember)" );
+        }
        _homebindIfInstance(player);
    }
    RollId.clear();
    m_memberSlots.clear();

As you can see all line 5 contains is {

Link to comment
Share on other sites

  • 2 weeks later...

here you are critical issues for pets totems fixed

note this patch is a hack but better than the one in this topic ;)

diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 316d333..5b6f624 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -304,6 +304,9 @@ bool Group::AddMember(const uint64 &guid, const char* name)

uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
{
+    // FG/NetSky 2 Sided Groups
+    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
    {
@@ -1689,3 +1692,35 @@ void Group::_homebindIfInstance(Player *player)
            player->m_InstanceValid = false;
    }
}
+
+//FG/NetSky 2sided groups
+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 = sObjectMgr.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());
+            if(Pet* p_pet = pp->GetPet())
+            {
+                p_pet->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
+                p_pet->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
+                DEBUG_LOG("-- Forced group value update for '%s' pet '%s'", pp->GetName(), pp->GetPet()->GetName());
+            }
+            for(uint32 i = 0; i < MAX_TOTEM; ++i)
+            {
+                if(Unit *totem = Unit::GetUnit(*pp, pp->m_TotemSlot[i]))
+                {
+                    totem->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
+                    totem->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
+                    DEBUG_LOG("-- Forced group value update for '%s' totem #%u", pp->GetName(), i);
+                }
+            }
+        }
+    }
+}
diff --git a/src/game/Group.h b/src/game/Group.h
index 88eda30..96701d2 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -345,6 +345,9 @@ class MANGOS_DLL_SPEC Group
        InstanceGroupBind* GetBoundInstance(Map* aMap);
        BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }

+        //FG/Netsky 2sided groups
+        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);
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index 5215867..9b2d02a 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -201,6 +201,8 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
    // everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
    if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
        return;
+    
+    group->BroadcastGroupUpdate(); // 2sided groups FG/NetSky

}

diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index b79e157..79a5b19 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -664,6 +664,52 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
                    else
                        *data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_TAPPED);
                }
+                // FG/NetSky: 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((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)
+                        {
+                            if(((Creature*)this)->isTotem() || ((Creature*)this)->isPet())
+                            {
+                                Unit* P_Owner = ((Creature*)this)->GetOwner();
+                                if(P_Owner && P_Owner->GetTypeId() == TYPEID_PLAYER && P_Owner->IsFriendlyTo(target) 
+                                   && P_Owner != target && (target->IsInSameGroupWith((Player*)P_Owner) || target->IsInSameRaidWith((Player*)P_Owner)))
+                                   forcefriendly = true;
+                            }
+                        }
+
+                        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("-- 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 !!
+                                ch = 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()))
+                                {
+                                    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(), ((Unit*)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)

Link to comment
Share on other sites

here you are critical issues for pets totems fixed

note this patch is a hack but better than the one in this topic ;)

-Zip-

This patch seems a better way of handling the interaction between ally/horde groups. Nice :)

I don't want to hijack this thread...but maybe Netsky you can start a new thread with title 'Advanced Ally/Horde Group patch'? If you are willing ofcourse to update the code from time to time.

Quick question though, you mentioned Blueflags. Does this mean that it is not possible anymore that you can kill a player from own faction outside of the group when you join a group with opposite faction?

Link to comment
Share on other sites

Indeed, but Thorazi's patch is imho simpler than NetSky's patch, becouse it modify only 1 file and is easer to update. For this reason I'll continue to update that

Completely agree with you. Thats why your patch is very handy for many people. Just because the ease of it. Many people will still use your patch Shin, that's why I think it is better to post a seperate thread so people don't get confused about the different patches for the mixed group patch ;)

Link to comment
Share on other sites

Quick question though, you mentioned Blueflags. Does this mean that it is not possible anymore that you can kill a player from own faction outside of the group when you join a group with opposite faction?

Exactly there are no such exploits possible pets/totems are also friendly in same group

Link to comment
Share on other sites

That's pretty awesome netsky! I did try to implement your patch and the compiler didn't like the IsSpoofSamePlayerFaction function and another one which I guess was ForceValuesUpdateAtIndex. Are you sure your patch is complete? Probbaly I need some declaration in some header files...(?)

Link to comment
Share on other sites

+ Group *group = player->GetGroup();

I think

+ // Group Interfactions interactions (test)

+ if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))

+ {

+ Group *group = player->GetGroup();

+ if (group)

+ {

+ if (Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID()))

+ player->setFactionForRace(leader->getRace());

+ }

+ }

Link to comment
Share on other sites

rev 9407. Applying of patch from the first post of this topic causes some errors:

Error    1    error C2065: 'CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP' : undeclared identifier    d:\\Servers\\Server_WoW\\MaNGOS\\src\\mangos_latest\\Mangos_r9407+SD2r1583\\src\\game\\Group.cpp    294    game
Error    2    error C2065: 'CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP' : undeclared identifier    d:\\Servers\\Server_WoW\\MaNGOS\\src\\mangos_latest\\Mangos_r9407+SD2r1583\\src\\game\\Group.cpp    349    game
Error    3    error C2065: 'CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP' : undeclared identifier    d:\\Servers\\Server_WoW\\MaNGOS\\src\\mangos_latest\\Mangos_r9407+SD2r1583\\src\\game\\Group.cpp    410    game

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use