• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[CPP] Grumbo'z VIP System

slp13at420

Mad Scientist
Grumbo'z VIP System


--Built Tested and Approved for TrinityCore C++--

Version 3.15

This is the VIP Engine PLUS+ many cool features :

  • This allows for an adjustable Max VIP level (default 6).
    • Can be adjusted in your worldserver.conf.
  • VIP can be increased by a one-time-use item.
    • a simple item that will increase a player's VIP level +1 then gets removed from there inventory. if the player has already reached the Max VIP Level then the item responds accordingly and does nothing else.
  • VIP can also be increased by Voting:
    • Can be turned on/off in the worldserver.conf.
  • An item that displays a players VIP stats `VIP Token`.
    • a simple item that displays a players VIP stats but also will allow them access to other features by just possessing one in there inventory.
  • Includes commands `.vip`:
    • 3 different teleports:
      • 2 mall teleports.(pre-stored faction mall, global mall)
        • Global mall `.vip mall`.
        • Faction mall `.vip home`.
      • 1 player stored teleport.(player storeable) `.vip hearthstone`.
    • scale command:
      • `.vip change scale x` where x is a size between 0.1 to 10.0.
    • morph command:
      • `.vip morph x` where x is an id.
    • demorph command:
      • `.vip demorph` demorphs a character.
    • repair command:
      • `.vip repair` (Player Requirement : VIP Token) sql included.
    • race, faction and char customizing commands:
      • `.vip change race` use to change race. Requires a re-log.
      • `.vip change faction` use to change character faction. Requires a re-log.
      • `.vip change custom` use to recustomize your character. Requires a re-log.
    • extra levels per VIP rank:
      • Can be turned on/off in the conf.
  • Creatures can drop mg:
    • Use the custom `mg` entry in `creature_template`. (sql entries posted below) Use to set a base value of `mg` drop for selected creatures. A creature with an `mg` value of 0 wont drop `Magic Gold`.
    • Use the custom `vip` entry in `creature_template`. The creature's VIP will be used as an added bonus, by using it as a random multiplier i.e (drop * urand(1, creature_vip)) the drop can be multiplied (1 to creature_vip) , after that the player's VIP level will be used as an added fixed multiplier i.e. (drop * urand(1, creature_vip) * player_vip_level) . setting a creatures VIP to 1 will allways produce a random 1 since its picking a random number from 1 to 1 lol.
  • Items can require a minimum VIP rank to use:
    • Use the custom `vip` entry in `item_template` to set a minimum required VIP level to equip the item.
  • easy to read colored installation instructions.
  • easy to edit config's.

If you haven't updated your DB AND core for big stats and have issues with stats going wacky and possibly loosing value. Here is a link to [MENTION=675]frost[/MENTION]'s tutorial for editing your core for big stats:
http://emudevs.com/showthread.php/2619-TC-255-server-stats-edit!









Eluna Methods

For those who enjoy the easy to use Eluna Engine I have added Methods for the Eluna Engine.

  • Global Methods:
    • Getters
      • GetVIPMAX(); returns uint8 max VIP rank value.
      • GetVIPVOTE_ENABLE(); returns bool value of ?can votes increase VIP rank?.
      • GetVIPVOTECOUNT(); returns uint32 value of ?how many votes change VIP rank?.
      • GetVIPCOINID(); returns the uint32 item id used for the VIP Coins.
      • GetVIPSTONEID(); returns the uint32 item id used for the VIP stone.
      • GetVIPMGID(); returns the uint32 item id used for the Magic Gold.
      • GetVIPOFFSET(); returns float value used to influence stats.
      • GetTALENTBONUS(); returns the uint8 values of how many extra TP per VIP rank.
      • GetLEVELBONUS(); returns the uint8 value of how many extra levels per VIP rank.
      • GetLEVELBONUS_ENABLE(); returns bool value of ?allow extra levels per VIP rank?.
    • Setters

      • No setters since all these values are set in the worldserver.conf file.
        I may add setters for these but understand they would be for testing
        purposes only since they are hard stored in the World conf file.
  • Player Methods:
    • Getters
      • player:GetPlayerVIP(); returns uint8 value of a player's VIP rank;
      • player:GetPlayerMG(); returns a uint32 value of a player's total stored mg.
      • player:GetPlayerVOTES(); returns uint32 value of a players total votes.
    • Setters
      • player:SetVIP(uint8_value); changes a players VIP rank to the provided uint8 value .
      • player:SetMG(uint32_value); sets a player's stored mg value to the provided uint32 value .
      • player:SetVOTES(uint32_value); changes a players total vote count to the provided uint32 value .
  • Item Methods:
    • Getters
      • item:GetItemVIP(); returns the uint8 value of an item's VIP
    • Setters
      • item:SetItemVIP(uint8_value); changes the item's VIP rank to the provided uint8 value .
  • Creature Methods:
    • Getters
      • creature:GetCreatureVIP(); returns the uint8 value of a creature's VIP
      • creature:GetCreatureMG(); returns the uint32 value of a creatures drop mg.
    • Setters
      • creature:SetCreatureVIP(uint8_value); changes the creature's VIP rank to the provided uint8 value .
      • creature:SetcreatureMG(uint32_value); changes the creatures drop mg count to the provided uint32 value .


>> Eluna Mod'z included <<

3.3.5a, CPP script, TrinityCore, Trinity Core, VIP System, VIP, wotlk
 
Last edited:

slp13at420

Mad Scientist
i havnt tried it on any other patch . the core should work but you may need to do the stat edits differently.
 

slp13at420

Mad Scientist
-Update 2-1-2016-

Added new features:

[1] Extra levels per VIP rank.
  • amount per VIP rank can be adjusted in the conf.
  • this can be turned off/on in the conf.
[2] Item VIP ranks.
  • Now items can require a minimum VIP rank to equip them.
 
Last edited:

slp13at420

Mad Scientist
Good release ;D. Isn't this in Lua too! So great release

Tnx :D
yea this is like the Eluna version :D
justa bigger-better-stronger version.

I just used my Eluna version for reference and wrote the CPP damn near verbatim:D
 
Last edited:

slp13at420

Mad Scientist
Update 02-28-2016:

I Added this to the Eluna Lua Engine so now you have a range of Eluna Methods to work with. :bump2:

This requires ofc you have the VIP Engine (ver 2.05+) completely installed.

demo script with these custom VIP methods in use:
Code:
[COLOR="#FFD700"]-- Global Eluna methods[/COLOR]
[COLOR="#808080"]
-- Global Eluna methods
local vip_max = GetVIPMAX();
local vote_cnt = GetVIPVOTECOUNT();
local coin_id = GetVIPCOINID();
local stone_id = GetVIPSTONEID();
local MG_id = GetVIPMGID();
local offset = GetVIPOFFSET();
local talent_bonus = GetTALENTBONUS();
local level_bonus = GetLEVELBONUS();

print("MAX VIP:"..vip_max);
print("VOTE COUNT:"..vote_cnt);
print("COIN ID:"..coin_id);
print("STONE ID:"..stone_id);
print("MG ID:"..MG_id);
print("VIP OFFSET:"..offset);
print("TALENT BONUS:"..talent_bonus);

	if(GetVIPVOTE_ENABLE() == true)then
		print("VOTE_ENABLE:TRUE");
	end
	if(GetVIPVOTE_ENABLE() == false)then
		print("VOTE_ENABLE:FALSE");
	end
	
if(GetLEVELBONUS_ENABLE())then
	print("LEVEL BONUS_ENABLE:TRUE");
end
if not(GetLEVELBONUS_ENABLE())then
	print("LEVEL BONUS_ENABLE:FALSE");
end

print("LEVEL BONUS:"..level_bonus);
	
function Player_Methods(event, player)-- Player Eluna methods

local vip = player:GetVIP();
local mg = player:GetMG();
local votes = player:GetVOTES();

	print(player:GetName()..":");
	print("VIP:"..vip);
	print("MG:"..mg);
	print("VOTES:"..votes);

-- mod VIP
	player:SetVIP(1);
	
	print("-VIP:"..player:GetVIP());

	player:SetVIP(vip);
	
	print("+VIP:"..player:GetVIP());

-- mod mg
	player:SetMG(1);
	
	print("-MG:"..player:GetMG());

	player:SetMG(mg);
	
	print("+MG:"..player:GetMG());

-- mod votes
	player:SetVOTES(1);
	
	print("-VOTES:"..player:GetVOTES());

	player:SetVOTES(votes);
	
	print("+VOTES:"..player:GetVOTES());
end

RegisterPlayerEvent(3, Player_Methods)

function ItemVIP(event, player, item, bag, slot)-- Item Eluna methods

local item_vip = item:GetItemVIP();

	print("");
	print("ITEM VIP:"..item_vip);
	
	item:SetItemVIP(1);
	print("-:"..item:GetItemVIP());
	
	item:SetItemVIP(4);
	print("+:"..item:GetItemVIP());
	
	item:SetItemVIP(item_vip);
	print("RESET VIP:"..item:GetItemVIP());
	
end

RegisterPlayerEvent(29, ItemVIP)
[/COLOR]

Also Added the DIFF link at the bottom of the main post. :D

  • Global Methods:
    • Getters
      • GetVIPMAX(); returns uint8 max VIP rank value.
      • GetVIPVOTE_ENABLE(); returns bool value of ?can votes increase VIP rank?.
      • GetVIPVOTECOUNT(); returns uint32 value of ?how many votes change VIP rank?.
      • GetVIPCOINID(); returns the uint32 item id used for the VIP Coins.
      • GetVIPSTONEID(); returns the uint32 item id used for the VIP stone.
      • GetVIPMGID(); returns the uint32 item id used for the Magic Gold.
      • GetVIPOFFSET(); returns float value used to influence stats.
      • GetTALENTBONUS(); returns the uint8 values of how many extra TP per VIP rank.
      • GetLEVELBONUS(); returns the uint8 value of how many extra levels per VIP rank.
      • GetLEVELBONUS_ENABLE(); returns bool value of ?allow extra levels per VIP rank?.
    • Setters
      • No setters since all these values are set in the worldserver.conf file.
  • Player Methods:
    • Getters
      • player:GetVIP(); returns uint8 value of a player's VIP rank;
      • player:GetMG(); returns a uint32 value of a player's total stored mg.
      • player:GetVOTES(); returns uint32 value of a players total votes.
    • Setters
      • player:SetVIP(uint8_value); changes a players VIP rank to the provided uint8 value .
      • player:SetMG(uint32_value); sets a player's stored mg value to the provided uint32 value .
      • player:SetVOTES(uint32_value); changes a players total vote count to the provided uint32 value .
  • Item Methods:
    • Getters
      • item:GetItemVIP(uint32_item_id); returns the uint8 value of an item's VIP
    • Setters
      • item:SetItemVIP(uint8 vip); changes the item's VIP rank to the provided uint8 value .

 
Last edited:

Optimus

Emulation Addict
Code:
git apply grumboz_vip_engine.diff
grumboz_vip_engine.diff:10: tab in indent.
        PrepareStatement(LOGIN_LOAD_VIP, "SELECT vip, mg, votes FROM account WHERE id = ?", CONNECTION_SYNCH);
grumboz_vip_engine.diff:11: tab in indent.
        PrepareStatement(LOGIN_SET_VIP, "UPDATE account SET `vip`=? WHERE `id`=?", CONNECTION_ASYNC);
grumboz_vip_engine.diff:12: tab in indent.
        PrepareStatement(LOGIN_SET_MG, "UPDATE account SET `mg`=? WHERE `id`=?", CONNECTION_ASYNC);
grumboz_vip_engine.diff:13: tab in indent.
        PrepareStatement(LOGIN_SET_VOTES, "UPDATE account SET `votes`=? WHERE `id`=?", CONNECTION_ASYNC);
grumboz_vip_engine.diff:24: trailing whitespace.

error: patch failed: src/server/game/Entities/Player/Player.cpp:11129
error: src/server/game/Entities/Player/Player.cpp: patch does not apply

This is what I am getting on the last rev of TrinityCore. Any idea how to fix these erros?
 

slp13at420

Mad Scientist
ok this should edit your player.cpp for the item VIP requiring:
Code:
[COLOR="#808080"]
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index c9db210..15b2831 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -44,6 +44,7 @@
 #include "GridNotifiersImpl.h"
 #include "Group.h"
 #include "GroupMgr.h"
[COLOR="#FFD700"]+#include "Grumboz_VIP_Core.h"[/COLOR]
 #include "Guild.h"
 #include "GuildMgr.h"
 #include "InstanceSaveMgr.h"
@@ -11160,6 +11161,17 @@ InventoryResult Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, b
 
 InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool swap, bool not_loading) const
 {[COLOR="#FFD700"]
+	// item VIP level 0 or 1 = all players can equip.
+	uint32 acctId = GetSession()->GetAccountId();
+	uint8 Pvip = VIP::GetVIP(acctId);
+	uint8 Ivip = VIP::GetItemVIP(pItem->GetEntry());
+
+	if (Pvip < Ivip)
+	{
+		ChatHandler(GetSession()).PSendSysMessage("|cffFF0000You Must be VIP%u or higher to equip this item.|r", Ivip);
+		return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
+	}
+	
[/COLOR]     dest = 0;
     if (pItem)
     {
[/COLOR]

all its doing is adding the include and editing an inventory check if player can equip an item.
 
Last edited:

Optimus

Emulation Addict
ok this should edit your player.cpp for the item VIP requiring:
Code:
[COLOR="#808080"]
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index c9db210..15b2831 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -44,6 +44,7 @@
 #include "GridNotifiersImpl.h"
 #include "Group.h"
 #include "GroupMgr.h"
[COLOR="#FFD700"]+#include "Grumboz_VIP_Core.h"[/COLOR]
 #include "Guild.h"
 #include "GuildMgr.h"
 #include "InstanceSaveMgr.h"
@@ -11160,6 +11161,17 @@ InventoryResult Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, b
 
 InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool swap, bool not_loading) const
 {[COLOR="#FFD700"]
+	// item VIP level 0 or 1 = all players can equip.
+	uint32 acctId = GetSession()->GetAccountId();
+	uint8 Pvip = VIP::GetVIP(acctId);
+	uint8 Ivip = VIP::GetItemVIP(pItem->GetEntry());
+
+	if (Pvip < Ivip)
+	{
+		ChatHandler(GetSession()).PSendSysMessage("|cffFF0000You Must be VIP%u or higher to equip this item.|r", Ivip);
+		return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
+	}
+	
[/COLOR]     dest = 0;
     if (pItem)
     {
[/COLOR]

all its doing is adding the include and editing an inventory check if player can equip an item.

So... I should first execute this, and afterwards the complete .diff? Or how?
 

slp13at420

Mad Scientist
I think you can replace line 1082 to 1111 of the diff with that part.
and it should run clean.

or it can be run by itself .
 
Last edited:
Top