Jump to content

PvPToken System?


Guest LightHades

Recommended Posts

  • 2 weeks later...

have this been updated to the latest mangos?

News file says it's updated for Version 3.0.9 :3

Can someone please update?

Error report:

../../../../src/bindings/ScriptDev2/../../game/Player.h:681: error: expected con

structor, destructor, or type conversion before 'const'

../../../../src/bindings/ScriptDev2/../../game/Player.h:688: error: expected con

structor, destructor, or type conversion before 'const'

../../../../src/bindings/ScriptDev2/../../game/Player.h: In member function 'boo

l Player::TeleportTo(const WorldLocation&, uint32)':

and it goes on, and on..

Edit: you think it will work, if I just dont copy all the files, I mean, I go type in changes in myself?

Edit: It worked. : )

Link to comment
Share on other sites

  • 5 months later...
  • 3 months later...
Have someone can update this PVPtoken System please ? :)

Found this thread...might as well share this:

http://github.com/Hellscream/Core/commit/43023770f04208b6933191b7ff20d8f7ac67d0f3

http://github.com/Hellscream/Core/commit/d24da97402ac167ee625ea5473d424cff1c42751

before you ask..no i'm not going to split the commit (it's both PvP announcer and PvP Token in one)

Link to comment
Share on other sites

In other words... you're saying the Hellscream commit is basically useless for those who have been asking for an updated PvP token patch.

Think it through. If they had the skills to pick out just the tokens part of your code, they wouldn't be asking others for an update.

Otherwise, it's a slick way of putting your custom server out there for everyone. :P

Link to comment
Share on other sites

In other words... you're saying the Hellscream commit is basically useless for those who have been asking for an updated PvP token patch.

Think it through. If they had the skills to pick out just the tokens part of your code, they wouldn't be asking others for an update.

Otherwise, it's a slick way of putting your custom server out there for everyone. :P

That was not my intention... sorry if i made it seem like it was...

the commits are commented and thus it's easy to see which piece you can cut out if you don't want it (at announcer parts.. "// PvP Announcer" is on top, in token part there's "// PvP Token" or smth on top... so even people who don't know what cherry-picking means should be able to figure it out IMO

Link to comment
Share on other sites

No such accusation was being made, Darkruler. Consider it a good-natured jab. :)

Although your idea for cherry-picking the commit is simple to those of us who have the experience, you have to bear in mind the greater part of the participants in these forums know just enough for the essential steps required to get a server up and running. Anything beyond the basic use of Git, like pull and automatic merge, and cranking the code through a compiler, just does not compute with the average user. I know MaNGOS is supposed to be a learning project, but there seems to be an inherent lack of interest among the majority in digging deeper and learning the more esoteric details.

Experience has taught me that 99% of the requests for an updated patch actually means it is preferred to have a 100% compatible patch that can be applied in one easy step with no hand-editing, whitespace errors, or even using git mergetool to resolve conflicts.

I'll readily admit I'm no genius with Git, but I do try to learn. Although I can forgive those whose requests are based on outdated or incompatible code. I'm equally as lost where it comes to C++ and hand-editing code to update a patch, but that's not the case with your PvP Token commit.

Those who refuse to learn will continue to post here with "Updated patch, plz."

Link to comment
Share on other sites

should work on "newest" sources

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index e482f7d..350a2ca 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -21409,6 +21409,37 @@ void Player::UpdateFallInformationIfNeed( MovementInfo const& minfo,uint16 opcod
        SetFallInformation(minfo.GetFallTime(), minfo.GetPos()->z);
}

+///PVP Token
+void Player::ReceiveToken()
+{
+    if(!sWorld.getConfig(CONFIG_PVP_TOKEN_ENABLE))
+        return;
+
+    uint8 MapRestriction = sWorld.getConfig(CONFIG_PVP_TOKEN_RESTRICTION);
+
+    if( MapRestriction == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) ||
+        MapRestriction == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) ||
+        MapRestriction == 3 && !InBattleGround())
+        return;
+
+    uint32 itemID = sWorld.getConfig(CONFIG_PVP_TOKEN_ITEMID);
+    uint32 itemCount = sWorld.getConfig(CONFIG_PVP_TOKEN_ITEMCOUNT);
+
+    ItemPosCountVec dest;
+    uint8 msg = CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemID, itemCount);
+    if( msg != EQUIP_ERR_OK )   // convert to possible store amount
+    {
+        SendEquipError( msg, NULL, NULL );
+        return;
+    }
+
+    Item* item = StoreNewItem( dest, itemID, true, Item::GenerateItemRandomPropertyId(itemID));
+    SendNewItem(item,itemCount,true,false);
+
+    ChatHandler(this).PSendSysMessage(LANG_YOU_RECEIVE_TOKEN);
+}
+ 
+
void Player::UnsummonPetTemporaryIfAny()
{
    Pet* pet = GetPet();
diff --git a/src/game/Player.h b/src/game/Player.h
index 299dd31..3876208 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1964,6 +1964,9 @@ class MANGOS_DLL_SPEC Player : public Unit
        void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply);
        void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply);

+        ///PVP Token
+        void ReceiveToken();
+
        void _ApplyItemMods(Item *item,uint8 slot,bool apply);
        void _RemoveAllItemMods();
        void _ApplyAllItemMods();
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 3d0d448..10f57ea 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -709,6 +709,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
            player->RewardPlayerAndGroupAtKill(pVictim);
            player->ProcDamageAndSpell(pVictim, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_EX_NONE, 0);

+            // PvP Token
+            int8 leveldiff = player->getLevel() - pVictim->getLevel();
+            if((pVictim->GetTypeId() == TYPEID_PLAYER) && leveldiff < 10)
+                player->ReceiveToken();
+
            WorldPacket data(SMSG_PARTYKILLLOG, (8+8)); //send event PARTY_KILL
            data << uint64(player->GetGUID()); //player with killing blow
            data << uint64(pVictim->GetGUID()); //victim
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 6bf92af..d55102a 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -757,6 +757,15 @@ void World::LoadConfigSettings(bool reload)
    setConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL,    "TimerBar.Fire.GMLevel", SEC_CONSOLE);
    setConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX,        "TimerBar.Fire.Max", 1);

+    /* PvP Token System */
+    setConfig(CONFIG_PVP_TOKEN_ENABLE,"PvPToken.Enable", true);
+    setConfig(CONFIG_PVP_TOKEN_ITEMID,"PvPToken.ItemID", 29434);
+    setConfig(CONFIG_PVP_TOKEN_ITEMCOUNT,"PvPToken.ItemCount", 1);
+    setConfig(CONFIG_PVP_TOKEN_RESTRICTION,"PvPToken.MapRestriction", 4);
+
+    if(getConfig(CONFIG_PVP_TOKEN_ITEMCOUNT) < 1)
+    setConfig(CONFIG_PVP_TOKEN_ITEMCOUNT,"PvPToken.ItemCount",1);
+
    m_VisibleUnitGreyDistance = sConfig.GetFloatDefault("Visibility.Distance.Grey.Unit", 1);
    if(m_VisibleUnitGreyDistance >  MAX_VISIBILITY_DISTANCE)
    {
diff --git a/src/game/World.h b/src/game/World.h
index 2cbaa40..4244156 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -261,6 +261,12 @@ enum eConfigFloatValues
    CONFIG_FLOAT_GROUP_XP_DISTANCE,
    CONFIG_FLOAT_THREAT_RADIUS,
    CONFIG_FLOAT_VALUE_COUNT
+
+    ///PVP Token
+    CONFIG_PVP_TOKEN_ENABLE,
+    CONFIG_PVP_TOKEN_ITEMID,
+    CONFIG_PVP_TOKEN_ITEMCOUNT,
+    CONFIG_PVP_TOKEN_RESTRICTION
};

/// Configuration elements
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index e330abe..7b2804a 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1452,6 +1452,36 @@ SOAP.IP = 127.0.0.1
SOAP.Port = 7878

###################################################################################################################
+# PvP Token System (custom patch)
+#
+#    PvPToken.Enable
+#         Enable/disable PvP Token system.
+#         Default: 1 (enabled)
+#                  0 (disabled)
+#
+#    PvPToken.ItemID
+#         The item ID of the token that players will receive after killing an enemy.
+#         Default: 29434 (Badge of Justice)
+#
+#    PvPToken.ItemCount
+#         The count amount of the ItemID
+#         Default: 1
+#
+#    PvPToken.MapRestriction
+#         The type of maps where players can receive the token
+#         Default: 4 - all maps
+#                  3 - battlegrounds only
+#                  2 - FFA areas only (both instanced and world arenas)
+#                  1 - battlegrounds and FFA areas only
+#
+###################################################################################################################
+
+PvPToken.Enable = 1
+PvPToken.ItemID = 29434
+PvPToken.ItemCount = 1
+PvPToken.MapRestriction = 4
+
+###################################################################################################################
#    CharDelete.Method
#        Character deletion behavior
#        Default: 0  - Completely remove the character from the database

Link to comment
Share on other sites

  • 4 weeks later...

Didnt you forget about "{" or "}" somewhere in unit.cpp? Could u look for any mistakes there? Maybe PvP Token code is in the wrong place or something?

Edit: When player is killed by creature server crash. When i removed

// PvP Token
       int8 leveldiff = player_tap->getLevel() - pVictim->getLevel();

if((pVictim->GetTypeId() == TYPEID_PLAYER) && leveldiff < 10)
       player_tap->ReceiveToken();

       WorldPacket data(SMSG_PARTYKILLLOG, (8+8)); //send event PARTY_KILL
       data << uint64(player_tap->GetGUID()); //player with killing blow
       data << uint64(pVictim->GetGUID()); //victim
       if (Group *group = player_tap->GetGroup())
           group->BroadcastPacket(&data, group->GetMemberGroup(player_tap->GetGUID

()));
       else
           player_tap->SendDirectMessage(&data);

from Unit.cpp everything was OK. Please fix it.

Link to comment
Share on other sites

×
×
  • 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