[HELP] Tokebn System menu

Shout-Out

User Tag List

Results 1 to 8 of 8
  1. #1
    Mizuki90's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [HELP] Tokebn System

    Ok ... so im using ACDB's token system with some modifications ... now I need some help ... I dont knwo how to make badge of justice Add to every person in the party can someone help me with it please ...
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    void onPvpKill(Player* plr, Player* victim)
    {
        int itemID;
        uint32 tokenItem = Config.MainConfig.GetInt("NCDB", "PvPTokenID", &itemID);
    
        //sLog.outColor(TGREEN,"n[NCDB] (%u)%s killed (%u)%s", plr->getLevel(), plr->GetName(), victim->getLevel(), victim->GetName());
        char onkill[1024];
        snprintf((char*)onkill, 1024, "[PVP] %s has killed %s", plr->GetName(), victim->GetName());
        //sWorld.SendWorldWideScreenText(onkill);
    
    	if(plr->getLevel() >= 70 && victim->getLevel() >= 70 && plr->GetGUID() != victim->GetGUID() && plr->GetZoneId() != 357)
        {
    		sWorld.SendWorldWideScreenText(onkill);
            //sLog.outColor(TGREEN,"n[NCDB] Adding token to %s", plr->GetName());
            //sLog.outColor(TNORMAL,"n");
            ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(itemID);
            if(!proto) return;
            SlotResult slotresult;
            slotresult = plr->GetItemInterface()->FindFreeInventorySlot(proto);
    
            if(!slotresult.Result)
            {
                plr->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
            }
            else
            {
                Item *itm = objmgr.CreateItem(itemID, plr);
                plr->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
                itm->m_isDirty = true;
            }
        }
        else
        {
            //sLog.outColor(TGREEN,"n[NCDB] Not adding token since they both are not level 80");
            //sLog.outColor(TNORMAL,"n");
        }
    }
    
    
    void SetupPvPToken(ScriptMgr * mgr)
    {
        mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, onPvpKill);
    }
    As you can see the item just gets added to 1 person :S ... I need it to add to the whole group Hope someoen can help ... I already tried checking the HonorManager.cpp but I cant get anything to work

    OMG : TOKEBN >.>
    Last edited by Mizuki90; 06-10-2008 at 12:14 PM.

    [HELP] Tokebn System
  2. #2
    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)
    You'll need to iterate over all party members. Check how it's done in the core
    (Hint: The core iterates over party members when you join a BG as a group. Also, when you get gold from a mob while in a party)

    Good luck

  3. #3
    Mizuki90's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked the core in the Honor Handler section -.- I dint get very far
    LOL With my knowledge of C++ I should think u need a loop to check every party member ... and thats where I get terribly confused :s .. First gotta google iterate ^.^' -> OHNOOOZ I HATE LOOPS!

    Spidey ... would it be this ?
    Ok this is what I made ... it dompiled successfully *Dint expect it to* and now ima test it

    If you see something wrong please tell me ... goin onto a live serevr with 100 + ppl ... dun want crashes xD

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    void onPvpKill(Player* plr, Player* victim)
    {
        int itemID;
        uint32 tokenItem = Config.MainConfig.GetInt("NCDB", "PvPTokenID", &itemID);
    
        //sLog.outColor(TGREEN,"n[NCDB] (%u)%s killed (%u)%s", plr->getLevel(), plr->GetName(), victim->getLevel(), victim->GetName());
        char onkill[1024];
        snprintf((char*)onkill, 1024, "[PVP] %s has killed %s", plr->GetName(), victim->GetName());
        //sWorld.SendWorldWideScreenText(onkill);
    
    	if(plr->getLevel() >= 70 && victim->getLevel() >= 70 && plr->GetGUID() != victim->GetGUID() && plr->GetZoneId() != 357)
        {
    
    		sWorld.SendWorldWideScreenText(onkill);
            //sLog.outColor(TGREEN,"n[NCDB] Adding token to %s", plr->GetName());
            //sLog.outColor(TNORMAL,"n");
            ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(itemID);
    
    
            if(!proto) return;
            SlotResult slotresult;
            slotresult = plr->GetItemInterface()->FindFreeInventorySlot(proto);
    
            if(!slotresult.Result)
            {
                plr->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
            }
            else
            {
                Item *itm = objmgr.CreateItem(itemID, plr);
                plr->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
    
    			set<Player*> contributors;
    			for(set<Player*>::iterator itr = contributors.begin(); itr != contributors.end(); itr++)
    			{
    				Player * pAffectedPlayer = (*itr);
    				if(!pAffectedPlayer) continue;
    					Item *itm = objmgr.CreateItem(itemID, plr);
    					pAffectedPlayer->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
    			}
    
    
    
                itm->m_isDirty = true;
            }
        }
        else
        {
            //sLog.outColor(TGREEN,"n[NCDB] Not adding token since they both are not level 80");
            //sLog.outColor(TNORMAL,"n");
        }
    }
    
    
    void SetupPvPToken(ScriptMgr * mgr)
    {
        mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, onPvpKill);
    }


    Still doesnt work -.- I need help here can soemoen plz fix it :S It gives tokens to individuals ... but it doesnt work when givin tokens to a party ... Even though I added the part from the honor handler /cry
    Last edited by Fault; 06-10-2008 at 11:31 PM.

  4. #4
    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)
    Almost there mate!
    [qupte]Item *itm = objmgr.CreateItem(itemID, plr); pAffectedPlayer->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);[/quote]

    The new item you make for each player has plr as its owner instead of pAffectedPlayer.
    Also, slotresult comes from plr's inventory, not from pAffectedPlayer

  5. #5
    Mizuki90's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah I see Il try again

    Trying again ...

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    void onPvpKill(Player* plr, Player* victim)
    {
        int itemID;
        uint32 tokenItem = Config.MainConfig.GetInt("NCDB", "PvPTokenID", &itemID);
    
        //sLog.outColor(TGREEN,"n[NCDB] (%u)%s killed (%u)%s", plr->getLevel(), plr->GetName(), victim->getLevel(), victim->GetName());
        char onkill[1024];
        snprintf((char*)onkill, 1024, "[PVP] %s has killed %s", plr->GetName(), victim->GetName());
        //sWorld.SendWorldWideScreenText(onkill);
    
    	if(plr->getLevel() >= 70 && victim->getLevel() >= 70 && plr->GetGUID() != victim->GetGUID() && plr->GetZoneId() != 357)
        {
    
    		sWorld.SendWorldWideScreenText(onkill);
            //sLog.outColor(TGREEN,"n[NCDB] Adding token to %s", plr->GetName());
            //sLog.outColor(TNORMAL,"n");
            ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(itemID);
    
    
            if(!proto) return;
            SlotResult slotresult;
            slotresult = plr->GetItemInterface()->FindFreeInventorySlot(proto);
    
            if(!slotresult.Result)
            {
                plr->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
            }
            else
            {
                Item *itm = objmgr.CreateItem(itemID, plr);
                plr->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
    
    			set<Player*> contributors;
    			for(set<Player*>::iterator itr = contributors.begin(); itr != contributors.end(); itr++)
    			{
    				Player * pAffectedPlayer = (*itr);
    
    				Item *itmG = objmgr.CreateItem(itemID, pAffectedPlayer);
    				slotresult = plr->GetItemInterface()->FindFreeInventorySlot(proto);
    				
    
    				if(!pAffectedPlayer) continue;
    					Item *itm = objmgr.CreateItem(itemID, plr);
    					pAffectedPlayer->GetItemInterface()->SafeAddItem(itmG,slotresult.ContainerSlot, slotresult.Slot);
    			}
    
    
    
                itm->m_isDirty = true;
            }
        }
        else
        {
            //sLog.outColor(TGREEN,"n[NCDB] Not adding token since they both are not level 80");
            //sLog.outColor(TNORMAL,"n");
        }
    }
    
    
    void SetupPvPToken(ScriptMgr * mgr)
    {
        mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, onPvpKill);
    }
    Still not ... How do I make the lotresult come from pAffectedPlayer ? coz Then I cant put it where it is in the script coz of " if(!slotresult.Result)" that could make problems :S
    Last edited by Mizuki90; 06-10-2008 at 05:24 PM.

  6. #6
    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)
    Well now you got too far away.
    Here's the pseudocode:
    Code:
    When Plr kills Victim:
    Check for honorable kill, Plr's level as opposed to Victim's one.
    If the kill was dishonorable, return.
    Find a free slot in Plr's inventory.
    If there's a free slot:
        Create Item pItem with Plr as owner.
        Add pItem to Plr's inventory using the slot we found.
    For each pMember in Plr's group:
        Find a free slot in pMember's inventory.
        If there's a free slot:
            Create Item pItem with pMember as owner.
            Add pItem to pMember's inventory using the slot we found
    end.

  7. #7
    Mizuki90's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Trying this ... LOL :
    Code:
    set<Player*> contributors;
    			for(set<Player*>::iterator itr = contributors.begin(); itr != contributors.end(); itr++)
    			{
    				Player * pAffectedPlayer = (*itr);
    			
    				slotresult = pAffectedPlayer->GetItemInterface()->FindFreeInventorySlot(proto);
    			
    				if(!slotresult.Result)
    				 {
    					  pAffectedPlayer->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
    				 }
    
    				
    				else
    				{
    				
    
    					if(!pAffectedPlayer) continue;
    					Item *itm = objmgr.CreateItem(itemID, pAffectedPlayer);
    					pAffectedPlayer->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
    				}
    Still ..... not .... :s
    Last edited by Mizuki90; 06-11-2008 at 04:12 AM.

  8. #8
    Mizuki90's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    10
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok now that works but I need some help on the following ... coz that adds to every player in the group ... wether he helped or not ... so heres this I need to know if im doing this right ... I dunno how to check if the player was healing :s
    Code:
    if(pAffectedPlayer->GetZoneId() != 357)
    				{	
    					int itemID = 29434;
    					ItemPrototype *proto = ItemPrototypeStorage.LookupEntry(itemID);
    					SlotResult slotresult;
    
    					if(pAffectedPlayer->GetTarget() == pPlayer->GetTarget())
    					{
    					//PVP Token
    				    slotresult = pAffectedPlayer->GetItemInterface()->FindFreeInventorySlot(proto);
    					Item *itm = objmgr.CreateItem(itemID, pAffectedPlayer);
    				    pAffectedPlayer->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
    					}else if (pAffectedPlayer->GetTarget() == pPlayer->GetGUID()) //..How do I check if someone was healing the killer ... ?
    					{
    				    slotresult = pAffectedPlayer->GetItemInterface()->FindFreeInventorySlot(proto);
    					Item *itm = objmgr.CreateItem(itemID, pAffectedPlayer);
    				    pAffectedPlayer->GetItemInterface()->SafeAddItem(itm,slotresult.ContainerSlot, slotresult.Slot);
    					}
    Theres my code ...could someone plz fix it for me or HELP me fix it ? Please ... The person must only get a token IF he helped kill or helped heal :s

Similar Threads

  1. [HELP]Anti PvP System
    By Mizuki90 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 06-09-2008, 12:05 PM
  2. [Help] Can't compile ascent on x64 system!
    By reeveerx in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 05-19-2008, 12:15 PM
  3. DKP System, Help Wanted!
    By Jotunheim in forum WoW Instances & Raiding
    Replies: 3
    Last Post: 09-28-2007, 11:18 PM
  4. System Help[!]
    By Londas in forum World of Warcraft General
    Replies: 10
    Last Post: 02-02-2007, 02:05 AM
All times are GMT -5. The time now is 08:33 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