How to make players drop Badges when killed menu

User Tag List

Results 1 to 10 of 10
  1. #1
    Strupantwn's Avatar Contributor
    Reputation
    115
    Join Date
    Apr 2007
    Posts
    1,045
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to make players drop Badges when killed

    When you kill a person pvping and he dies, the person who killed the dead
    player creates a badge(item) is that possible? If so how is this done so?

    How to make players drop Badges when killed
  2. #2
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look for the PvP token script in the Ascent/ArcEmu SVN

  3. #3
    Strupantwn's Avatar Contributor
    Reputation
    115
    Join Date
    Apr 2007
    Posts
    1,045
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Um, you want to get on Msn for a second, you can help me through that

  4. #4
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PvPststem.cpp
    Code:
    /* PvPSystem
     * Copyright (C) 2008 Spectre
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #include "PvPMgr.h"
    
    #define REWARD_ITEM_ID 95084
    #define REWARD_ITEM_AMT 1
    
    PvPStorage *Storage;
    
    void SysTrigger(Player* attacker, Player* victim)
    {
        PvPMgr *aMgr = Storage->GetMgr(attacker->GetLowGUID(), true);
        PvPMgr *vMgr = Storage->GetMgr(victim->GetLowGUID(), true);
        
        if(aMgr == NULL || vMgr == NULL)
            return;
    
        if(aMgr->ChecksPassed(attacker, victim) == false)
        {
            vMgr->CurrentKills = 0;
            vMgr->TotalDeaths++;
            return;
        }
    
        aMgr->CurrentKills++;
        aMgr->AddItem(REWARD_ITEM_ID, REWARD_ITEM_AMT, true);
        
        vMgr->CurrentKills = 0;
        vMgr->TotalDeaths++;
        
        attacker->BroadcastMessage("%sCurrent Kills: %u", MSG_COLOR_GOLD, aMgr->CurrentKills);
        
        victim->BroadcastMessage("%sStats Reset", MSG_COLOR_GOLD);
    
    }
    
    
    void SetupPvPSystem(ScriptMgr *mgr)
    {
        Storage = PvPStorage::GetInstance();
        mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void*)SysTrigger);
    }

    PvpMgr.cpp
    Code:
    /* PvPSystem
     * Copyright (C) 2008 Spectre
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #include "PvPMgr.h"
    
    PvPMgr::PvPMgr()
    {
        Index = 0;
        CurrentKills = 0;
        TotalDeaths = 0;
        LastGuid = 0;
        VP = 0;
        IsInTurny = false;
    }
    
    bool PvPMgr::ChecksPassed(Player *Attcker, Player *Vct)
    {
        string Aip;
        string Vip;
    
        if(Attcker->GetSession()->HasGMPermissions() || Vct->GetSession()->HasGMPermissions())
            return true; // gm over-ride for testing
    
        if(Attcker == Vct)
            return false;
    
        if(Attcker->GetSession()->GetSocket() == NULL || Vct->GetSession()->GetSocket() == NULL)
            return false;
    
        Aip = Attcker->GetSession()->GetSocket()->GetRemoteIP();
        Vip = Vct->GetSession()->GetSocket()->GetRemoteIP();
    
        if(Aip == "" || Vip == "" || Aip == Vip)
            return false;
    
        if(Attcker->GetLowGUID() == LastGuid)
            return false;
    
        return true;
    }
    void PvPMgr::AddItem(const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
    {
        Item *ItemToAdd;
        SlotResult Slot;
        Player *Plr = objmgr.GetPlayer(Index);
        
        if(Plr == NULL)
            return;
        if(Stack)
        {
            ItemToAdd = Plr->GetItemInterface()->FindItemLessMax(ItemID, Amt, false);
            if(ItemToAdd != NULL)
            {
                ItemToAdd->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
                ItemToAdd->m_isDirty = true;
                Plr->BroadcastMessage("%s%s x%u Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1, Amt);
                return;
            }
                
        }
        for(uint32 i = 1;i <= Amt;i++)
        {
            ItemToAdd = objmgr.CreateItem(ItemID, Plr);
            
            if(ItemToAdd == NULL)
                return; // failed creation, no memory to allocate, or invalid item id
    
            Slot = Plr->GetItemInterface()->FindFreeInventorySlot(ItemToAdd->GetProto());
    
            if(Slot.Result)
            {
                Plr->GetItemInterface()->SafeAddItem(ItemID, Slot.ContainerSlot, Slot.Slot);
                Plr->BroadcastMessage("%s%s x1 Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1);
            }
            else
                Plr->BroadcastMessage("No free inventory slots could be located, aborting");
        }
    
    }
    
    PvPStorage *PvPStorage::Instance = NULL;
    
    PvPStorage::PvPStorage()
    {
    
    }
    
    PvPStorage *PvPStorage::GetInstance()
    {
        if(Instance == NULL)
            Instance = new PvPStorage();
        return Instance;
    }
    
    PvPMgr *PvPStorage::CreateMgr(const uint32 &Index)
    {
        PvPMgr *Mgr = new PvPMgr();
    
        if(Mgr == NULL)
            return NULL; // no memory to allocate
    
        Mgr->Index = Index;
        
        StorageLock.Acquire();
            Vect.push_back(Mgr);
        StorageLock.Release();
        return Mgr;
    }
    
    PvPMgr *PvPStorage::GetMgr(const uint32 &Index, const bool Create)
    {
        StorageLock.Acquire();
        for(Itr = Vect.begin();Itr != Vect.end();Itr++)
        {
            if((*Itr)->Index == Index)
            {
                StorageLock.Release();
                return (*Itr);
            }
    
        }
        StorageLock.Release();
    
        if(Create)
            return CreateMgr(Index);
        return NULL;
    }
    
    void PvPStorage::CleanVect()
    {
        vector<PvPMgr*> CleanVect;
        uint32 Pos = 0;
    
        if(Vect.empty())
            return;
    
        StorageLock.Acquire();
        for(Itr = Vect.begin();Itr != Vect.end();Itr++)
        {
            Player *Eraser = objmgr.GetPlayer((*Itr)->Index);
            if(Eraser == NULL || Eraser->IsInWorld() == false || Eraser->GetSession() == NULL)
            {
                (*Itr)->VP = Pos;
                CleanVect.push_back((*Itr));
        
            }
            Pos++;
        }
    
        for(Itr = CleanVect.begin();Itr != CleanVect.end();Itr++)
        {
            Vect.erase(Vect.begin()+(*Itr)->VP);
            delete (*Itr);
    
        }
        StorageLock.Release();
        CleanVect.clear();
    
    }
    
    void PvPStorage::StartTimer()
    {
        CleanTimer = TimedEvent::Allocate(this, new CallbackP0<PvPStorage>(this, &PvPStorage::CleanVect), 1, CLEAN_DELAY, 0);
        sWorld.event_AddEvent(CleanTimer);
    }

    PvpMgr.h
    Code:
    /* PvPSystem
     * Copyright (C) 2008 Spectre
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #ifndef PvPMgr_H
    #define PvPMgr_h
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    #define CLEAN_DELAY 20000
    
    class PvPMgr
    {
        private:
            bool IsInTurny;
        
        public:
            uint32 Index; // Player GUID
            uint32 VP;
            uint32 CurrentKills;
            uint32 TotalDeaths;
            uint32 LastGuid;
            
            PvPMgr();
            bool ChecksPassed(Player *Attcker, Player *Vct);
            void AddItem(const uint32 &ItemID, const uint32 &Amt, const bool &Stack = false);
    
    };
    
    class PvPStorage
    {
        private:
            static PvPStorage *Instance;
            vector<PvPMgr*> Vect;
            vector<PvPMgr*>::iterator Itr;
            Mutex StorageLock;
            TimedEvent *CleanTimer;
            
            PvPStorage();
            void CleanVect();
    
        public:
            static PvPStorage *GetInstance();
            PvPMgr *CreateMgr(const uint32 &Index);
            PvPMgr *GetMgr(const uint32 &Index, const bool Create);
            void StartTimer();
            vector<PvPMgr*> GetVect() 
            {
                return Vect;
            }
    };
    
    #endif
    All credit go's to Spectre
    Thanks to Aspire Dev
    Cheese Cake?

  5. #5
    Vindicated's Avatar Contributor
    Reputation
    226
    Join Date
    Aug 2008
    Posts
    1,067
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you need a guide on compiling, I've seen SectorSeven's and his looks really good


  6. #6
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didn't you just said in the emu expert thread that you just needed Contri to get expert? Compiling is one of them

    But use Sectors, it's the best

  7. #7
    Strupantwn's Avatar Contributor
    Reputation
    115
    Join Date
    Apr 2007
    Posts
    1,045
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Snailz View Post
    PvPststem.cpp
    Code:
    /* PvPSystem
     * Copyright (C) 2008 Spectre
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #include "PvPMgr.h"
    
    #define REWARD_ITEM_ID 95084
    #define REWARD_ITEM_AMT 1
    
    PvPStorage *Storage;
    
    void SysTrigger(Player* attacker, Player* victim)
    {
        PvPMgr *aMgr = Storage->GetMgr(attacker->GetLowGUID(), true);
        PvPMgr *vMgr = Storage->GetMgr(victim->GetLowGUID(), true);
        
        if(aMgr == NULL || vMgr == NULL)
            return;
    
        if(aMgr->ChecksPassed(attacker, victim) == false)
        {
            vMgr->CurrentKills = 0;
            vMgr->TotalDeaths++;
            return;
        }
    
        aMgr->CurrentKills++;
        aMgr->AddItem(REWARD_ITEM_ID, REWARD_ITEM_AMT, true);
        
        vMgr->CurrentKills = 0;
        vMgr->TotalDeaths++;
        
        attacker->BroadcastMessage("%sCurrent Kills: %u", MSG_COLOR_GOLD, aMgr->CurrentKills);
        
        victim->BroadcastMessage("%sStats Reset", MSG_COLOR_GOLD);
    
    }
    
    
    void SetupPvPSystem(ScriptMgr *mgr)
    {
        Storage = PvPStorage::GetInstance();
        mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void*)SysTrigger);
    }
    PvpMgr.cpp
    Code:
    /* PvPSystem
     * Copyright (C) 2008 Spectre
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #include "PvPMgr.h"
    
    PvPMgr::PvPMgr()
    {
        Index = 0;
        CurrentKills = 0;
        TotalDeaths = 0;
        LastGuid = 0;
        VP = 0;
        IsInTurny = false;
    }
    
    bool PvPMgr::ChecksPassed(Player *Attcker, Player *Vct)
    {
        string Aip;
        string Vip;
    
        if(Attcker->GetSession()->HasGMPermissions() || Vct->GetSession()->HasGMPermissions())
            return true; // gm over-ride for testing
    
        if(Attcker == Vct)
            return false;
    
        if(Attcker->GetSession()->GetSocket() == NULL || Vct->GetSession()->GetSocket() == NULL)
            return false;
    
        Aip = Attcker->GetSession()->GetSocket()->GetRemoteIP();
        Vip = Vct->GetSession()->GetSocket()->GetRemoteIP();
    
        if(Aip == "" || Vip == "" || Aip == Vip)
            return false;
    
        if(Attcker->GetLowGUID() == LastGuid)
            return false;
    
        return true;
    }
    void PvPMgr::AddItem(const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
    {
        Item *ItemToAdd;
        SlotResult Slot;
        Player *Plr = objmgr.GetPlayer(Index);
        
        if(Plr == NULL)
            return;
        if(Stack)
        {
            ItemToAdd = Plr->GetItemInterface()->FindItemLessMax(ItemID, Amt, false);
            if(ItemToAdd != NULL)
            {
                ItemToAdd->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
                ItemToAdd->m_isDirty = true;
                Plr->BroadcastMessage("%s%s x%u Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1, Amt);
                return;
            }
                
        }
        for(uint32 i = 1;i <= Amt;i++)
        {
            ItemToAdd = objmgr.CreateItem(ItemID, Plr);
            
            if(ItemToAdd == NULL)
                return; // failed creation, no memory to allocate, or invalid item id
    
            Slot = Plr->GetItemInterface()->FindFreeInventorySlot(ItemToAdd->GetProto());
    
            if(Slot.Result)
            {
                Plr->GetItemInterface()->SafeAddItem(ItemID, Slot.ContainerSlot, Slot.Slot);
                Plr->BroadcastMessage("%s%s x1 Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1);
            }
            else
                Plr->BroadcastMessage("No free inventory slots could be located, aborting");
        }
    
    }
    
    PvPStorage *PvPStorage::Instance = NULL;
    
    PvPStorage::PvPStorage()
    {
    
    }
    
    PvPStorage *PvPStorage::GetInstance()
    {
        if(Instance == NULL)
            Instance = new PvPStorage();
        return Instance;
    }
    
    PvPMgr *PvPStorage::CreateMgr(const uint32 &Index)
    {
        PvPMgr *Mgr = new PvPMgr();
    
        if(Mgr == NULL)
            return NULL; // no memory to allocate
    
        Mgr->Index = Index;
        
        StorageLock.Acquire();
            Vect.push_back(Mgr);
        StorageLock.Release();
        return Mgr;
    }
    
    PvPMgr *PvPStorage::GetMgr(const uint32 &Index, const bool Create)
    {
        StorageLock.Acquire();
        for(Itr = Vect.begin();Itr != Vect.end();Itr++)
        {
            if((*Itr)->Index == Index)
            {
                StorageLock.Release();
                return (*Itr);
            }
    
        }
        StorageLock.Release();
    
        if(Create)
            return CreateMgr(Index);
        return NULL;
    }
    
    void PvPStorage::CleanVect()
    {
        vector<PvPMgr*> CleanVect;
        uint32 Pos = 0;
    
        if(Vect.empty())
            return;
    
        StorageLock.Acquire();
        for(Itr = Vect.begin();Itr != Vect.end();Itr++)
        {
            Player *Eraser = objmgr.GetPlayer((*Itr)->Index);
            if(Eraser == NULL || Eraser->IsInWorld() == false || Eraser->GetSession() == NULL)
            {
                (*Itr)->VP = Pos;
                CleanVect.push_back((*Itr));
        
            }
            Pos++;
        }
    
        for(Itr = CleanVect.begin();Itr != CleanVect.end();Itr++)
        {
            Vect.erase(Vect.begin()+(*Itr)->VP);
            delete (*Itr);
    
        }
        StorageLock.Release();
        CleanVect.clear();
    
    }
    
    void PvPStorage::StartTimer()
    {
        CleanTimer = TimedEvent::Allocate(this, new CallbackP0<PvPStorage>(this, &PvPStorage::CleanVect), 1, CLEAN_DELAY, 0);
        sWorld.event_AddEvent(CleanTimer);
    }
    PvpMgr.h
    Code:
    /* PvPSystem
     * Copyright (C) 2008 Spectre
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #ifndef PvPMgr_H
    #define PvPMgr_h
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    #define CLEAN_DELAY 20000
    
    class PvPMgr
    {
        private:
            bool IsInTurny;
        
        public:
            uint32 Index; // Player GUID
            uint32 VP;
            uint32 CurrentKills;
            uint32 TotalDeaths;
            uint32 LastGuid;
            
            PvPMgr();
            bool ChecksPassed(Player *Attcker, Player *Vct);
            void AddItem(const uint32 &ItemID, const uint32 &Amt, const bool &Stack = false);
    
    };
    
    class PvPStorage
    {
        private:
            static PvPStorage *Instance;
            vector<PvPMgr*> Vect;
            vector<PvPMgr*>::iterator Itr;
            Mutex StorageLock;
            TimedEvent *CleanTimer;
            
            PvPStorage();
            void CleanVect();
    
        public:
            static PvPStorage *GetInstance();
            PvPMgr *CreateMgr(const uint32 &Index);
            PvPMgr *GetMgr(const uint32 &Index, const bool Create);
            void StartTimer();
            vector<PvPMgr*> GetVect() 
            {
                return Vect;
            }
    };
    
    #endif
    All credit go's to Spectre
    Thanks to Aspire Dev
    Umm, mind giving a full TuT or something on what to do with these configs
    or where they are found etc/. Greatly appreciated

    Maybe you can make a thread on it afterwards!

  8. #8
    Exacute's Avatar Active Member
    Reputation
    67
    Join Date
    Mar 2008
    Posts
    337
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe giv dl to them..
    [/COLOR]

  9. #9
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #define REWARD_ITEM_ID 95084

    Edit the green in Pvpsystem.cpp. Theres loadsmore options you can edit bt i wont go through that.
    Cheese Cake?

  10. #10
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spectre's PVP manager is truly the best one around.

    OP: There are plenty of guides on how to compile modules, search for them

Similar Threads

  1. [Question] How to make players recieve token for honorable kill?
    By darknight22 in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 01-05-2009, 06:18 PM
  2. Make player drop badges of justice in bg ??
    By Galadios in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 07-06-2008, 04:34 PM
  3. [GUIDE]:How to make npc drop item!
    By Kazard123 in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 03-06-2008, 05:32 PM
  4. [Question] How to make players start with gear/money/items?
    By hukabuka in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 02-23-2008, 08:13 PM
  5. How to make Chest drop what you want YES THIS POST SAY CHEST :D
    By Dee2001 in forum WoW EMU Guides & Tutorials
    Replies: 7
    Last Post: 12-02-2007, 11:42 AM
All times are GMT -5. The time now is 05:46 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search