Jump to content

[PATCH] Horde & Alliance grouping/trade


Recommended Posts

  • Replies 115
  • Created
  • Last Reply

Top Posters In This Topic

rrtn, what is the difference between False.Genesis & patro patch and patch from this topic?

well none apparently. i just gave thanks to patro for posting it here and he credited False.Genesis for the original patch. i didnt get it from False.Genesis repo cause i didnt know it existed(i got it from this thread) but thx to LouisePalmer he posted False.Genesis repo which seems to have an improved version of this patch :)

Link to comment
Share on other sites

Today compiled this patch with 10280. Normal...

I recommend use patch from 74 post of this topic: http://getmangos.eu/community/viewtopic.php?id=7910&p=117127&viewfull=1#post117127

If it's don't help you I can post my patch (that I compiled today) again later...

For 10283:

diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index aa3cc94..393692e 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -346,6 +346,10 @@ bool Group::AddMember(const uint64 &guid, const char* name)

uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
{
+    // Frozen Mod
+    BroadcastGroupUpdate();
+    // Frozen Mod
+    
    // 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
    {
@@ -1810,6 +1814,36 @@ void Group::_homebindIfInstance(Player *player)
        }
    }
}
+//Frozen Mod
+void Group::BroadcastGroupUpdate(void)
+{
+    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(pp->GetPet())
+            {
+                pp->GetPet()->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
+                pp->GetPet()->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_SLOT; ++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);
+                }
+            }
+        }
+    }
+}
+// Frozen Mod

static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp )
{
diff --git a/src/game/Group.h b/src/game/Group.h
index 85efa1c..2f436a3 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -375,6 +375,10 @@ class MANGOS_DLL_SPEC Group
        InstanceGroupBind* GetBoundInstance(uint32 mapId, Player* player);
        InstanceGroupBind* GetBoundInstance(Map* aMap, Difficulty difficulty);
        BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
+        
+        // Frozen Mod
+        void BroadcastGroupUpdate(void);
+        // Frozen Mod

    protected:
        bool _addMember(const uint64 &guid, const char* name, bool isAssistant=false);
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index c432d4a..2f6df07 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -207,6 +207,10 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
    // everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
    if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
        return;
+    
+    // Frozen Mod
+    group->BroadcastGroupUpdate();
+    // Frozen Mod
}

void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 9b25096..1e90052 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -662,6 +662,54 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
                    else
                        *data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_TAPPED);
                }
+                
+                // Frozen Mod
+                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)
+                        {
+                            forcefriendly = (((Creature*)this)->isTotem() || ((Creature*)this)->isPet())
+                            && ((Creature*)this)->GetOwner()->GetTypeId() == TYPEID_PLAYER
+                            && ((Creature*)this)->GetOwner()->IsFriendlyTo(target) // pet owner must be friendly to target
+                            && ((Creature*)this)->GetOwner() != target // no need to send hackfix to pet owner
+                            && (target->IsInSameGroupWith((Player*)((Creature*)this)->GetOwner()) || target->IsInSameRaidWith((Player*)((Creature*)this)->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("-- 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 ];
+                }
+                // Frozen Mod
                else
                {
                    // send in current format (float as float, uint32 as uint32)
@@ -1664,6 +1712,21 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
    return pCreature;
}

+// Frozen Mod
+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;
+        }
+    }
+}
+// Frozen Mod
+
namespace MaNGOS
{
    class NearUsedPosDo
diff --git a/src/game/Object.h b/src/game/Object.h
index c900e4d..4e8063a 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -288,6 +288,11 @@ class MANGOS_DLL_SPEC Object

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

        Object ( );
diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp
index 6abb061..8fb7f64 100644
--- a/src/game/TradeHandler.cpp
+++ b/src/game/TradeHandler.cpp
@@ -604,11 +604,13 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
        return;
    }

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

    if (!pOther->IsWithinDistInMap(_player,10.0f,false))
    {
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 1d38c35..309c474 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -242,6 +242,10 @@ Unit::Unit()
    // remove aurastates allowing special moves
    for(int i=0; i < MAX_REACTIVE; ++i)
        m_reactiveTimer[i] = 0;
+        
+    // Frozen Mod
+    m_spoofSamePlayerFaction = false;
+    // Frozen Mod
}

Unit::~Unit()
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 37cb495..9508fb9 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1885,6 +1885,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
        PetAuraSet m_petAuras;
        void AddPetAura(PetAura const* petSpell);
        void RemovePetAura(PetAura const* petSpell);
+        
+        // Frozen Mod
+        inline void SetSpoofSamePlayerFaction(bool b) { m_spoofSamePlayerFaction = b; }
+        inline bool IsSpoofSamePlayerFaction(void) {return m_spoofSamePlayerFaction; }
+        // Frozen Mod

        // Movement info
        MovementInfo m_movementInfo;
@@ -1937,8 +1942,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
        uint32 m_reactiveTimer[MAX_REACTIVE];
        uint32 m_regenTimer;
        uint32 m_lastManaUseTimer;
+        
+        // Frozen Mod
+        bool m_spoofSamePlayerFaction : 1;
+        // Frozen Mod

-    private:
+    public:
        void CleanupDeletedAuras();

        // player or player's pet

Link to comment
Share on other sites

hmm tyed it but getting

3>..\\..\\src\\game\\Group.cpp(1847) : error C2248: 'Unit::m_TotemSlot' : cannot access private member declared in class 'Unit'

3> c:\\mangos1\\src\\game\\Unit.h(2020) : see declaration of 'Unit::m_TotemSlot'

3> c:\\mangos1\\src\\game\\Unit.h(1119) : see declaration of 'Unit'

mabye you know whats wrong?

Yes, I know... Use patch from 86 post...

Link to comment
Share on other sites

  • 39 years later...

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.

Patch posted below.

[uPDATE - NEW PATCH JUNE 9 2010 - WORKING MaNGOS/0.16.0 (* * Revision 10044 - *) ]

src/game/Group.cpp | 33 ++++++++++++++++++++++++

src/game/Group.h | 3 ++

src/game/GroupHandler.cpp | 3 ++

src/game/Object.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++-

src/game/Object.h | 3 ++

src/game/TradeHandler.cpp | 6 +++-

src/game/Unit.cpp | 3 ++

src/game/Unit.h | 9 ++++++-

8 files changed, 118 insertions(+), 4 deletions(-)

diff --git a/src/game/Group.cpp b/src/game/Group.cpp

index 7aa97e1..ea9756c 100644

--- a/src/game/Group.cpp

+++ b/src/game/Group.cpp

@@ -308,6 +308,9 @@ bool Group::AddMember(const uint64 &guid, const char* name)

uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)

{

+// Frozen Mod

+BroadcastGroupUpdate();

+// Frozen Mod

// 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

{

@@ -1742,6 +1745,36 @@ void Group::_homebindIfInstance(Player *player)

player->m_InstanceValid = false;

}

}

+//Frozen Mod

+void Group::BroadcastGroupUpdate(void)

+{

+ 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(pp->GetPet())

+ {

+ pp->GetPet()->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);

+ pp->GetPet()->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_SLOT; ++i)

+ {

+ if(Unit *totem = Unit::GetUnit(*pp, pp->m_TotemSlot))

+ {

+ totem->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);

+ totem->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);

+ DEBUG_LOG("-- Forced group value update for '%s' totem #%u", pp->GetName(), i);

+ }

+ }

+ }

+ }

+}

+// Frozen Mod

static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp )

{

diff --git a/src/game/Group.h b/src/game/Group.h

index c9cffe3..93c090f 100644

--- a/src/game/Group.h

+++ b/src/game/Group.h

@@ -357,6 +357,9 @@ class MANGOS_DLL_SPEC Group

InstanceGroupBind* GetBoundInstance(Player* player);

InstanceGroupBind* GetBoundInstance(Map* aMap, Difficulty difficulty);

BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }

+// Frozen Mod

+ void BroadcastGroupUpdate(void);

+// Frozen Mod

protected:

bool _addMember(const uint64 &guid, const char* name, bool isAssistant=false);

diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp

index d73b233..e2bbf39 100644

--- a/src/game/GroupHandler.cpp

+++ b/src/game/GroupHandler.cpp

@@ -207,6 +207,9 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )

// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!

if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))

return;

+// Frozen Mod

+group->BroadcastGroupUpdate();

+// Frozen Mod

}

void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )

diff --git a/src/game/Object.cpp b/src/game/Object.cpp

index 55fc2d0..d842d50 100644

--- a/src/game/Object.cpp

+++ b/src/game/Object.cpp

@@ -657,6 +657,52 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *

else

*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_TAPPED);

}

+// Frozen Mod

+

+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)

+{

+forcefriendly = (((Creature*)this)->isTotem() || ((Creature*)this)->isPet())

+&& ((Creature*)this)->GetOwner()->GetTypeId() == TYPEID_PLAYER

+&& ((Creature*)this)->GetOwner()->IsFriendlyTo(target) // pet owner must be friendly to target

+&& ((Creature*)this)->GetOwner() != target // no need to send hackfix to pet owner

+&& (target->IsInSameGroupWith((Player*)((Creature*)this)->GetOwner()) || target->IsInSameRaidWith((Player*)((Creature*)this)->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("-- 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 ];

+

+}

+// Frozen Mod

else

{

// send in current format (float as float, uint32 as uint32)

@@ -1662,7 +1708,21 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa

// return the creature therewith the summoner has access to it

return pCreature;

+ }

+// Frozen Mod

+void Object::ForceValuesUpdateAtIndex(uint32 i)

+{

+ m_uint32Values_mirror = GetUInt32Value(i) + 1; // makes server think the field changed

+ if(m_inWorld)

+ {

+ if(!m_objectUpdated)

+ {

+ AddToClientUpdateList();

+ m_objectUpdated = true;

+ }

+ }

}

+// Frozen Mod

namespace MaNGOS

{

@@ -1945,4 +2005,4 @@ bool WorldObject::IsControlledByPlayer() const

default:

return false;

}

-}

\\ No newline at end of file

+}

diff --git a/src/game/Object.h b/src/game/Object.h

index 04c31f0..055e2d5 100644

--- a/src/game/Object.h

+++ b/src/game/Object.h

@@ -276,6 +276,9 @@ class MANGOS_DLL_SPEC Object

virtual bool hasQuest(uint32 /* quest_id */) const { return false; }

virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }

+// Frozen Mod

+ void ForceValuesUpdateAtIndex(uint32);

+// Frozen Mod

protected:

Object ( );

diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp

index e9c636f..719986e 100644

--- a/src/game/TradeHandler.cpp

+++ b/src/game/TradeHandler.cpp

@@ -531,12 +531,14 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)

SendTradeStatus(TRADE_STATUS_IGNORE_YOU);

return;

}

-

- if (pOther->GetTeam() !=_player->GetTeam() )

+// Frozen Mod

+/* if (pOther->GetTeam() !=_player->GetTeam() )

{

SendTradeStatus(TRADE_STATUS_WRONG_FACTION);

return;

}

+*/

+// Frozen Mod

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

{

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp

index f54cca2..47272ab 100644

--- a/src/game/Unit.cpp

+++ b/src/game/Unit.cpp

@@ -251,6 +251,9 @@ Unit::Unit()

// remove aurastates allowing special moves

for(int i=0; i < MAX_REACTIVE; ++i)

m_reactiveTimer = 0;

+// Frozen Mod

+ m_spoofSamePlayerFaction = false;

+// Frozen Mod

}

Unit::~Unit()

diff --git a/src/game/Unit.h b/src/game/Unit.h

index b4b4077..b059fc1 100644

--- a/src/game/Unit.h

+++ b/src/game/Unit.h

@@ -1822,6 +1822,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject

PetAuraSet m_petAuras;

void AddPetAura(PetAura const* petSpell);

void RemovePetAura(PetAura const* petSpell);

+// Frozen Mod

+ inline void SetSpoofSamePlayerFaction(bool b) { m_spoofSamePlayerFaction = b; }

+ inline bool IsSpoofSamePlayerFaction(void) {return m_spoofSamePlayerFaction; }

+// Frozen Mod

// Movement info

MovementInfo m_movementInfo;

@@ -1873,8 +1877,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject

uint32 m_reactiveTimer[MAX_REACTIVE];

uint32 m_regenTimer;

uint32 m_lastManaUseTimer;

+// Frozen Mod

+ bool m_spoofSamePlayerFaction : 1;

+// Frozen Mod

- private:

+ public:

void CleanupDeletedAuras();

bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );

Link to comment
Share on other sites

I have not tested still (Cause am at work and just noticed this) but just a couple of questions:

1. Did you test out al you are mentioning here. I mean trade, enchant, healing in a group or raid. Well basically everything before the change in 3.0.3.

2. Did you test it out with latest version since there has been MANY changes from your 7464 up to now.

3. Any crashes or mangos system stability issues that we should worry about?

Link to comment
Share on other sites

1. Did you test out al you are mentioning here. I mean trade, enchant, healing in a group or raid. Well basically everything before the change in 3.0.3.

Yea it all works.

2. Did you test it out with latest version since there has been MANY changes from your 7464 up to now.

No. I don't run the latest version ever. I am always behind. I find a stable and stick with it until I find the next stable.

3. Any crashes or mangos system stability issues that we should worry about?

Other than me typing Ctrl-C by accident in the server window today, my server has not crashed in months.

Link to comment
Share on other sites

+ if(target->getRace() == RACE_HUMAN)

+ *data << uint32(1);

+ else if(target->getRace() == RACE_ORC)

+ *data << uint32(2);

+ else if(target->getRace() == RACE_DWARF)

+ *data << uint32(3);

+ else if(target->getRace() == RACE_NIGHTELF)

+ *data << uint32(4);

+ else if(target->getRace() == RACE_UNDEAD_PLAYER)

+ *data << uint32(5);

+ else if(target->getRace() == RACE_TAUREN)

+ *data << uint32(6);

+ else if(target->getRace() == RACE_GNOME)

+ *data << uint32(115);

+ else if(target->getRace() == RACE_TROLL)

+ *data << uint32(116);

+ else if(target->getRace() == RACE_BLOODELF)

+ *data << uint32(1610);

+ else if(target->getRace() == RACE_DRAENEI)

+ *data << uint32(1629);

There has to be a more efficient way of doing this. That's a lot of CPU time tied up right there.

Link to comment
Share on other sites

Thx for your patch.

but i have errors

error: patch failed: src/game/GroupHandler.cpp:197

error: src/game/GroupHandler.cpp: patch does not apply

can you help me ?

if i change your patch

by

diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp

old mode 100644

new mode 100755

index d1de13a..0778c92

--- a/src/game/GroupHandler.cpp

+++ b/src/game/GroupHandler.cpp

@@ -197,6 +197,14 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )

return;

+ uint8 subgroup = group->GetMemberGroup(GetPlayer()->GetGUID());

+// Monkey

+ bool allowTwoSideGroup = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP);

+ if ( allowTwoSideGroup )

+ {

+ GetPlayer()->SetGroup(group, subgroup); // Defunct line added for test

+ group->BroadcastGroupUpdate();

+ }

+// Monkey

}

fatal: corrupt patch at line 91

Link to comment
Share on other sites

There has to be a more efficient way of doing this. That's a lot of CPU time tied up right there.

Have not noticed. Running AMD dual core with 1g mem only on Ubuntu Linux with a 7megabit connection. Of course we never have more than 20-30 people on at once. Your more than welcome to come see it working on my server if you'd like, might save you compile time if you don't like the way it works. enchanted-arts.com. 3.09 client.

xoum89

Open group handler.cpp and add the changes manually. That's what I did with the original False.Genisis code.

Link to comment
Share on other sites

Have not noticed. Running AMD dual core with 1g mem only on Ubuntu Linux with a 7megabit connection. Of course we never have more than 20-30 people on at once. Your more than welcome to come see it working on my server if you'd like, might save you compile time if you don't like the way it works. enchanted-arts.com. 3.09 client.

Maybe this?

uint32 race_data = target->getRace();

if(race_data == RACE_HUMAN)

*data << uint32(1);

else if(race_data == RACE_ORC)

...................

do getRace() once

Link to comment
Share on other sites

uint32 race_data = target->getRace();

if(race_data == RACE_HUMAN)

*data << uint32(1);

else if(race_data == RACE_ORC)

That's a good start, and part of what I was thinking of. Yes, only doing getRace() one time is much more efficient.

The next logical improvement would be to use a switch.

Have not noticed. Running AMD dual core with 1g mem only on Ubuntu Linux with a 7megabit connection. Of course we never have more than 20-30 people on at once. Your more than welcome to come see it working on my server if you'd like, might save you compile time if you don't like the way it works.

Whether you can notice it or not is immaterial, looking up a player's race up to ten times in a row is inefficient- period.

Losing several hundred (or possibly thousands) of clock cycles on a multi-core multi-GHz CPU is not noticeable to a human. Those wasted CPU cycles occur far too quickly for us to notice.

Link to comment
Share on other sites

Thx for your patch.

but i have errors

can you help me ?

if i change your patch

by

Same error. for me line 197 is this

+    // Monkey
+    //    if(pOther->GetTeam() !=_player->GetTeam() )
+    //    {
+    //        SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
[b]+    //        return;[/b] <--- Line 197
+    //    }
+    // Monkey

I do not get it. This is a commented line.

Link to comment
Share on other sites

Maybe this?

uint32 race_data = target->getRace();

if(race_data == RACE_HUMAN)

*data << uint32(1);

else if(race_data == RACE_ORC)

...................

do getRace() once

I always used this from False.Genesis's GitHub:

2[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]22[/color][/size]2

It always worked for me :)

Link to comment
Share on other sites

For rev. 7776 (last one i made)

diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index b2b495c..a2b99f1 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -310,6 +310,8 @@ 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
    {
@@ -1595,3 +1597,18 @@ void Group::_homebindIfInstance(Player *player)
            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());
+  }
+ }
+}
\\ No newline at end of file
diff --git a/src/game/Group.h b/src/game/Group.h
index 478b7c5..17cfac9 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -330,6 +330,9 @@ class MANGOS_DLL_SPEC Group
        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 --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index b7c55e6..0373ab4 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -196,6 +196,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
    if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
        return;

+ group->BroadcastGroupUpdate();
}

void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 15963e8..35da227 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -637,6 +637,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)
@@ -1496,6 +1528,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)
+  {
+   ObjectAccessor::Instance().AddUpdateObject(this);
+   m_objectUpdated = true;
+  }
+ }
+}
+
namespace MaNGOS
{
    class NearUsedPosDo
diff --git a/src/game/Object.h b/src/game/Object.h
index fc01e3a..ab0fdbc 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -300,6 +300,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 aa323c9..df83656 100644
--- a/src/game/TradeHandler.cpp
+++ b/src/game/TradeHandler.cpp
@@ -534,11 +534,11 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
        return;
    }

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

    if( pOther->GetDistance2d( _player ) > 10.0f )
    {

Thnx to False.Genesis for the original patch

Thnx to Frozen-in-Time for the trading fix part

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