PvP kill reward system for healers [Need help] menu

User Tag List

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

    PvP kill reward system for healers [Need help]

    Hey qt so im looking for a scripter to help me script a system to reward dps and healers for a kill in pvp outside a group.

    I found this I just need to convert it to reward gold and use a different hook than onpvpkill as that only is for killing blows. The cooldown system looks ok. Maybe if someone helped make a onheal and ondamage container or something. Or just reward the money when honor is gained. Not sure how to do either. Thanks.

    Code:
    // Made by Sinistah @Ac-Web / Taco @ Lordcraft / TheEpicLazyTaco @BitBucket :) It would be nice if you did not remove this when you repost this years from now.
    
    class PvPRewards : PlayerScript
    {
    public:
    	PvPRewards() : PlayerScript("PvPRewards") {}
    
    	// ~ Setting Variables "Not Ideal But it will have to do."  ~
    	
    	// The item you want to give players.
    	uint32 itemID = 45978;
    	// Ammount of items to give.
    	uint32 ammount = 1;
    	// Time in seconds 60 = 1 Minute
    	uint32 cooldown = 60;
    	// This is the message that is sent when a player does recieve a reward.
    	std::string rewardMessage = "|cffff0000[System]|r You recieved a reward and are now on a cooldown.";
    	// Thhis is the message that is sent when a player is on cooldown.
    	std::string cooldownMessage = "|cffff0000[System]|r You are still on a cooldown and can not recieve a reward.";
    
    	//IMPORTANT! Unless you know what your doing I do not recommend editing anything below this comment.
    
    	// This is the map that is going to store all of our player's cooldowns during game play.
    	std::unordered_map <uint32, uint32>  cooldownList;
    
    	// Returns our cooldown from the map if it has one.
    	uint32 GetPlayerCD(std::unordered_map<uint32, uint32> m, uint32 key)
    	{
    		//This gets our player's cooldown from the map and returns it to us in a uint32 form.
    		auto itr = m.find(key);
    
    		if (itr != m.end())
    			return itr->second;
    
    		//This is mainly to make the compiler happy about not all paths returning a value but also serves 
    		return NULL;
    	}
    
    	//Updates/Inserts our players unique identifier and their cooldown.
    	void UpdatePlayerCD(std::unordered_map<uint32, uint32>& m, uint32 key, uint32 newValue)
    	{
    		//If it finds a value update it with new value
    		auto itr = m.find(key);
    		if (itr != m.end()) {
    			m[key] = newValue;
    		}
    		//If that character is not in the map add it.
    		else
    			m.insert(std::make_pair(key, newValue));
    	}
    
    	//This is where we add our item and send a mssg to our player and then we update the map.
    	void AddReward(Player * killer, uint32 itemId, uint32 ammount, uint32 cooldown)
    	{
    		//Add the item to the player.
    		killer->AddItem(itemId, ammount);
    		//Send Message.
    		ChatHandler(killer->GetSession()).PSendSysMessage(rewardMessage.c_str());
    		//Inset Data into map.
    		UpdatePlayerCD(cooldownList, killer->GetGUID().GetCounter(), killer->GetTotalPlayedTime() + cooldown);
    	}
    
    	//This is called when a player kills another player.
    	void OnPVPKill(Player* killer, Player* /*killed*/)
    	{
    		//Variable to store the saved cooldown value we get from our map.
    		uint32 mapCD;
    
    		//If the map is empty.
    		if (cooldownList.empty())
    			mapCD = NULL;
    		//Get the cd from the map and stores it in mapCD.
    		else
    			mapCD = GetPlayerCD(cooldownList, killer->GetGUID().GetCounter());
    		
    		//If mapCD has no value.
    		if (mapCD == NULL)
    		{
    			AddReward(killer, itemID, ammount, cooldown);
    		}
    		//If mapCD has a value.
    		else
    		{
    			// If player's played time is higher then the cooldown time.
    			if (killer->GetTotalPlayedTime() >= mapCD) {
    				// Add items, Send Message, and Update Map. ~ See Function For More Info ~
    				AddReward(killer, itemID, ammount, cooldown);
    			}
    			else {
    				// If you are still on cooldown send cooldownMessage.
    				ChatHandler(killer->GetSession()).PSendSysMessage(cooldownMessage.c_str());
    			}
    		}
    	}
    };
    
    void AddSC_PvPRewards()
    {
    	new PvPRewards();
    }

    PvP kill reward system for healers [Need help]
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Code:
    void OnPVPKill(Player* killer, Player* /*killed*/)
    You need to call the code in this function from another hook that also handles killing blows. Both hooks should call the same code passing in the required parameters.

    It looks like these hooks are defined here: TrinityCore/ScriptMgr.h at master . TrinityCore/TrinityCore . GitHub
    Code:
            // Called when a player kills another player
            virtual void OnPVPKill(Player* /*killer*/, Player* /*killed*/) { }
    
            // Called when a player kills a creature
            virtual void OnCreatureKill(Player* /*killer*/, Creature* /*killed*/) { }
    
            // Called when a player is killed by a creature
            virtual void OnPlayerKilledByCreature(Creature* /*killer*/, Player* /*killed*/) { }
    
            // Called when a player's level changes (after the level is applied)
            virtual void OnLevelChanged(Player* /*player*/, uint8 /*oldLevel*/) { }
    
            // Called when a player's free talent points change (right before the change is applied)
            virtual void OnFreeTalentPointsChanged(Player* /*player*/, uint32 /*points*/) { }
    
            // Called when a player's talent points are reset (right before the reset is done)
            virtual void OnTalentsReset(Player* /*player*/, bool /*noCost*/) { }
    
            // Called when a player's money is modified (before the modification is done)
            virtual void OnMoneyChanged(Player* /*player*/, int64& /*amount*/) { }
    
            // Called when a player's money is at limit (amount = money tried to add)
            virtual void OnMoneyLimit(Player* /*player*/, int64 /*amount*/) { }
    
            // Called when a player gains XP (before anything is given)
            virtual void OnGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/) { }
    
            // Called when a player's reputation changes (before it is actually changed)
            virtual void OnReputationChange(Player* /*player*/, uint32 /*factionId*/, int32& /*standing*/, bool /*incremental*/) { }
    
            // Called when a duel is requested
            virtual void OnDuelRequest(Player* /*target*/, Player* /*challenger*/) { }
    
            // Called when a duel starts (after 3s countdown)
            virtual void OnDuelStart(Player* /*player1*/, Player* /*player2*/) { }
    
            // Called when a duel ends
            virtual void OnDuelEnd(Player* /*winner*/, Player* /*loser*/, DuelCompleteType /*type*/) { }
    
            // The following methods are called when a player sends a chat message.
            virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/) { }
    
            virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Player* /*receiver*/) { }
    
            virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Group* /*group*/) { }
    
            virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Guild* /*guild*/) { }
    
            virtual void OnChat(Player* /*player*/, uint32 /*type*/, uint32 /*lang*/, std::string& /*msg*/, Channel* /*channel*/) { }
    
            // Both of the below are called on emote opcodes.
            virtual void OnClearEmote(Player* /*player*/) { }
    
            virtual void OnTextEmote(Player* /*player*/, uint32 /*textEmote*/, uint32 /*emoteNum*/, ObjectGuid /*guid*/) { }
    
            // Called in Spell::Cast.
            virtual void OnSpellCast(Player* /*player*/, Spell* /*spell*/, bool /*skipCheck*/) { }
    
            // Called when a player logs in.
            virtual void OnLogin(Player* /*player*/, bool /*firstLogin*/) { }
    
            // Called when a player logs out.
            virtual void OnLogout(Player* /*player*/) { }
    
            // Called when a player is created.
            virtual void OnCreate(Player* /*player*/) { }
    
            // Called when a player is deleted.
            virtual void OnDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
    
            // Called when a player delete failed
            virtual void OnFailedDelete(ObjectGuid /*guid*/, uint32 /*accountId*/) { }
    
            // Called when a player is about to be saved.
            virtual void OnSave(Player* /*player*/) { }
    
            // Called when a player is bound to an instance
            virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/, uint8 /*extendState*/) { }
    
            // Called when a player switches to a new zone
            virtual void OnUpdateZone(Player* /*player*/, uint32 /*newZone*/, uint32 /*newArea*/) { }
    
            // Called when a player changes to a new map (after moving to new map)
            virtual void OnMapChanged(Player* /*player*/) { }
    
            // Called after a player's quest status has been changed
            virtual void OnQuestStatusChange(Player* /*player*/, uint32 /*questId*/) { }
    
            // Called when a player completes a movie
            virtual void OnMovieComplete(Player* /*player*/, uint32 /*movieId*/) { }
    
            // Called when a player choose a response from a PlayerChoice
            virtual void OnPlayerChoiceResponse(Player* /*player*/, uint32 /*choiceId*/, uint32 /*responseId*/) { }
    There are no more hooks for PvP available so you will need to either expose your own hook or modify the existing hook to also get called when world PvP kills occur. This is a relatively straight forward matter but not something I can do for you.

Similar Threads

  1. [Trinity] Mini (companion) Teleporter for Trinity need help
    By dragic in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 03-20-2013, 11:58 PM
  2. Laptop Upgrade for WoW (Need Help Fast!)
    By bugler18 in forum World of Warcraft General
    Replies: 11
    Last Post: 03-20-2013, 05:00 AM
  3. A quest for Love! Need help finding someone threw a picture!
    By Sariam1992 in forum Community Chat
    Replies: 1
    Last Post: 03-30-2011, 04:18 PM
  4. Need help c++ pvp system
    By atersi in forum World of Warcraft General
    Replies: 1
    Last Post: 08-14-2008, 03:31 AM
  5. NEED HELP: 60 Hunter gearing for PvP
    By Eskiimo in forum WoW Items & Quests
    Replies: 5
    Last Post: 12-30-2007, 05:42 AM
All times are GMT -5. The time now is 02:39 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search