Jump to content

[PATCH] Horde & Alliance grouping/trade


Recommended Posts

  • Replies 115
  • Created
  • Last Reply

Top Posters In This Topic

Patro Your patch works on 7817 as well. not that I'll be updating anytime soon. Just a personal thing. Anyway for all those who can't figure out why I coded that the way I did. I could not program in C++ a "Hello world" program without looking up instruction on the net. I try not to ask for help so I just do it myself usually. I'm more of a puzzle guy. All the pieces were there. I just kept re-arranging them until it worked. As I said for my server version 7464. So yea.. I don't code C++.. but I can re-arrange yours. :) Anyway.. just glad it works now for more people. And on a side note.. I couldn't apply the patch using any tools of any kind. each time I had to cut and paste into the c files for it to work.

Have fun everybody! :)

P.S. Thanks Patro (not for the patch.. the other thing)

Link to comment
Share on other sites

This patch allows you to interact with any player horde or alliance as if they were your own faction. Only while in a group or a raid. This means trades, grouping, healing, enchanting in trade window and rez's work. I attempted to change the code so you could turn it on and off based on the mangosd.conf twoside options but for some reason I'm stuck. Anyway, here's the completed patch without conf checks. This patch was originated by False.Genesis. The ability to trade was possible due to help from Prefect, one of my server admin. Onwards to the patch. It is a git patch and my server version is 7464.

Hi there,

No offence for Frozen-In-Time, but i released a similar patch for my server [7693] which seem to be fully functional now.

Just few mofications of the core needed and no crash return on our test server (running for 1 month now). What we did :

When a group or raid is made, all the members of the group/raid takes the faction of their leader.

If group is disband or a member is removed, members take back their faction. Easy as 1-2-3.

Here is my branch : git://github.com/missproject/mangos.git interfactionpatch

http://github.com/missproject/mangos/tree/interfactionpatch

For those who wants the little changes :

------------------------------ src/game/Group.cpp ------------------------------
index e6e01aa..1e70bc5 100644
@@ -296,6 +296,16 @@ bool Group::AddMember(const uint64 &guid, const char* name)
                player->SetDifficulty(m_difficulty);
                player->SendDungeonDifficulty(true);
            }
+            // Group Interfactions interactions (test)
+            if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+            {
+                Group *group = player->GetGroup();
+                if(Player *leader = objmgr.GetPlayer(group->GetLeaderGUID()))
+                {
+                    player->setFactionForRace(leader->getRace());
+                    sLog.outDebug( "WORLD: Group Interfaction Interactions - Faction changed (AddMember)" );
+                }
+            }            
        }
        player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
        UpdatePlayerOutOfRange(player);
@@ -340,7 +350,12 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
                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);
        }

@@ -411,6 +411,12 @@ void Group::Disband(bool hideDestroy)
                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

Again, it's not for blaming or anything else, just if we can share each other knowledge, it could be a better patch.

Good Job FIT. ^_^

Link to comment
Share on other sites

Just few mofications of the core needed and no crash return on our test server (running for 1 month now). What we did :

When a group or raid is made, all the members of the group/raid takes the faction of their leader.

If group is disband or a member is removed, members take back their faction. Easy as 1-2-3.

While this may not crash, there will be other complications.

There are numerous quest start items that only drop for one faction, as well as many quests inside instance that are only meant for one faction.

If you start changing players' factions, you're going to mess this up. If you let players change their faction at will (by joining a group of the opposite faction) pretty soon they're going to figure out they can exploit this to access extra quests.

Not to mention strolling through the opposite faction's capital cities unmolested.

Link to comment
Share on other sites

While this may not crash, there will be other complications.

There are numerous quest start items that only drop for one faction, as well as many quests inside instance that are only meant for one faction.

If you start changing players' factions, you're going to mess this up. If you let players change their faction at will (by joining a group of the opposite faction) pretty soon they're going to figure out they can exploit this to access extra quests.

Not to mention strolling through the opposite faction's capital cities unmolested.

WOW! :eek: So the code is not taking the faction back after getting out of the raid/group. that is very bad.

Link to comment
Share on other sites

Hi there,

No offence for Frozen-In-Time, but i released a similar patch for my server [7693] which seem to be fully functional now.

With 7825 rev it doesn't work. The console give me this error:

fatal: patch fragment without header at line 3  (ecc...)

Anyway... I am grateful with you for your works, but I ask: Why you don't relase the patches for the latests rev of MaNGOS?

Frozen-In-Time relased a patch for 7464, and it doesn't work on the latest rev

patro relased a patch for 7776, and it doesn't work on the latest rev

thorazi relased a patch for 7693, and it doesn't work on the latest rev

nobody relase something for the latest rev?

Link to comment
Share on other sites

With 7825 rev it doesn't work. The console give me this error:

Anyway... I am grateful with you for your works, but I ask: Why you don't relase the patches for the latests rev of MaNGOS?

Cuz we <3 to stick with a stable version :P

J/k, i just don't wanna update my server everytime. If i get things sorted out, i'll update it. But untill then you can always add one of the 4 patches given manually. It's not that much work, and we gotta do it aswell ;)

Link to comment
Share on other sites

Especialy for Shin Darth ;) :

Try with this one for rev7835 :

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
@@ -296,6 +296,16 @@ bool Group::AddMember(const uint64 &guid, const char* name)
                player->SetDifficulty(m_difficulty);
                player->SendDungeonDifficulty(true);
            }
+   // Group Interfactions interactions (test)
+   if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+   {
+    Group *group = player->GetGroup();
+    if(Player *leader = objmgr.GetPlayer(group->GetLeaderGUID()))
+    {
+     player->setFactionForRace(leader->getRace());
+     sLog.outDebug( "WORLD: Group Interfaction Interactions - Faction changed (AddMember)" );
+    }
+   }   
        }
        player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
        UpdatePlayerOutOfRange(player);
@@ -340,7 +350,12 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
                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);
        }

@@ -396,6 +411,12 @@ void Group::Disband(bool hideDestroy)
                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

While this may not crash, there will be other complications.

There are numerous quest start items that only drop for one faction, as well as many quests inside instance that are only meant for one faction.

If you start changing players' factions, you're going to mess this up. If you let players change their faction at will (by joining a group of the opposite faction) pretty soon they're going to figure out they can exploit this to access extra quests.

Not to mention strolling through the opposite faction's capital cities unmolested.

Totally agree with you, subhuman_bob but it's the only way we found for now (and players appreciate it and not for exploits :lol:).

I'll be glad if someone (who said Vladimir ?) find another way/tips ...

That's why this patch has not been submitted to be merge in the core... ;)

Link to comment
Share on other sites

OK this works without errors, and thank you all a lot for your work.

now I have a question: Why, after that i apply this patch, when i try to update the mangos sources, git give me this error:

You are in the middle of a change.

File Object.h is modified.

You should complete the current commit before starting a merge. Doing so will help you abort a failed merge, should the need arise

I don't know what it means

Link to comment
Share on other sites

While this may not crash, there will be other complications.

There are numerous quest start items that only drop for one faction, as well as many quests inside instance that are only meant for one faction.

If you start changing players' factions, you're going to mess this up. If you let players change their faction at will (by joining a group of the opposite faction) pretty soon they're going to figure out they can exploit this to access extra quests.

yes but there are more advantages than disadvantages, for example, the only file that this patch modify is Group.cpp and the changes are very few. This means that it's too easy to update, also rewriting manually the changes (if the patch is out of date).

Not to mention strolling through the opposite faction's capital cities unmolested.

You are wrong. The reputation with factions such as Stormwind, Orgrimmar, Darnassus, ecc.. is not changed, always remains the same.

I use this patch in my server since 2-3 days and all work very well. The player are happy and having fun.

Thank you thorazi.

Link to comment
Share on other sites

thorazi's patch isn't really nice.

Well, we can trade, this way work as well but..

If you're the leader of a group and in Alliance/Horde's team, then your members can be hit/killed by players in their own faction (and not in same group).

Link to comment
Share on other sites

  • 4 weeks later...

I use this patch in my server since 2-3 days and all work very well. The player are happy and having fun.

Thank you thorazi.

Please someone help me! With 8052 this patch no longer works, but the latest modify of the file Group.cpp (wich is the only file that the patch modify) was on 7918 and in this rev the patch worked, why now it doesn't work? the file group.cpp was not modified!

sorry my english

Link to comment
Share on other sites

Try this one for rev 8068+:

diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 0e4cb4e..a625bba 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -296,6 +296,16 @@ bool Group::AddMember(const uint64 &guid, const char* name)
                player->SetDifficulty(m_difficulty);
                player->SendDungeonDifficulty(true);
            }
+            // Group Interfactions interactions (test)
+            if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+            {
+                Group *group = player->GetGroup();
+                if(Player *leader = objmgr.GetPlayer(group->GetLeaderGUID()))
+                {
+                    player->setFactionForRace(leader->getRace());
+                    sLog.outDebug( "WORLD: Group Interfaction Interactions - Faction changed (AddMember)" );
+                }
+            }            
        }
        player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
        UpdatePlayerOutOfRange(player);
@@ -340,7 +350,12 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
                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);
        }

@@ -396,6 +411,12 @@ void Group::Disband(bool hideDestroy)
                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

Branch git://github.com/missproject/mangos.git interfactionpatch updated ;)

Link to comment
Share on other sites

And this another style code is working to. Tested on 8076.

diff -r -u mangos/src/game//Group.cpp mangos_group1/src/game//Group.cpp
--- mangos/src/game//Group.cpp    2009-06-25 08:43:06.000000000 +0200
+++ mangos_group1/src/game//Group.cpp    2009-06-25 09:12:28.000000000 +0200
@@ -310,6 +310,8 @@

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
    {
@@ -1595,3 +1597,18 @@
            player->m_InstanceValid = false;
    }
}
+
+void Group::BroadcastGroupUpdate(void)
+{
+    // Group Hack: force flags update on group leave - for values update hack
+    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());
+        }
+    }
+}
\\ Pas de fin de ligne à la fin du fichier.
diff -r -u mangos/src/game//Group.h mangos_group1/src/game//Group.h
--- mangos/src/game//Group.h    2009-06-25 08:43:06.000000000 +0200
+++ mangos_group1/src/game//Group.h    2009-06-25 09:13:18.000000000 +0200
@@ -330,6 +330,10 @@
        InstanceGroupBind* GetBoundInstance(uint32 mapid, uint8 difficulty);
        BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; }

+
+        //Group hack.
+        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 -r -u mangos/src/game//GroupHandler.cpp mangos_group1/src/game//GroupHandler.cpp
--- mangos/src/game//GroupHandler.cpp    2009-06-25 08:43:06.000000000 +0200
+++ mangos_group1/src/game//GroupHandler.cpp    2009-06-25 09:14:03.000000000 +0200
@@ -196,6 +196,8 @@
    if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
        return;

+    group->BroadcastGroupUpdate();
+
}

void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
diff -r -u mangos/src/game//Object.cpp mangos_group1/src/game//Object.cpp
--- mangos/src/game//Object.cpp    2009-06-25 08:43:06.000000000 +0200
+++ mangos_group1/src/game//Object.cpp    2009-06-25 09:16:35.000000000 +0200
@@ -652,6 +652,40 @@
                    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)
@@ -1629,6 +1663,19 @@
    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)
+        {
+            ObjectAccessor::Instance().AddUpdateObject(this);
+            m_objectUpdated = true;
+        }
+    }
+}
+
namespace MaNGOS
{
    class NearUsedPosDo
diff -r -u mangos/src/game//Object.h mangos_group1/src/game//Object.h
--- mangos/src/game//Object.h    2009-06-25 08:43:06.000000000 +0200
+++ mangos_group1/src/game//Object.h    2009-06-25 09:17:09.000000000 +0200
@@ -297,6 +297,9 @@

        virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
        virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
+
+        void ForceValuesUpdateAtIndex(uint32);
+
    protected:

        Object ( );
diff -r -u mangos/src/game//TradeHandler.cpp mangos_group1/src/game//TradeHandler.cpp
--- mangos/src/game//TradeHandler.cpp    2009-06-25 08:43:06.000000000 +0200
+++ mangos_group1/src/game//TradeHandler.cpp    2009-06-25 09:17:51.000000000 +0200
@@ -534,11 +534,11 @@
        return;
    }

-    if (pOther->GetTeam() !=_player->GetTeam() )
+    /*if (pOther->GetTeam() !=_player->GetTeam() )
    {
        SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
        return;
-    }
+    }*/

    if (!pOther->IsWithinDistInMap(_player,10.0f,false))
    {

group8076.patch

Link to comment
Share on other sites

  • 1 month later...
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