• 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

Optimus

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

Line 1082 to 1111:
Code:
+void AddSC_Grumboz_VIP_Core();
 #endif
 
 void AddScripts()
@@ -49,5 +50,6 @@ void AddScripts()
     AddPetScripts();
     AddOutdoorPvPScripts();
     AddCustomScripts();
+	AddSC_Grumboz_VIP_Core();
 #endif
 }
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index b320a85..b2c8526 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -3572,3 +3572,91 @@ PacketSpoof.BanDuration = 86400
 
 #
 ###################################################################################################
+###################################################################################################
+# Grumbo'z VIP System
+#
+# These settings provide a flexibility to the system.
+#
+# 	
+#	VIP.MAX
+#		Description: Max VIP Level for VIP System. max Uint32 value.
+#		Default:     6
+#
+
Are you sure?
 

Optimus

Emulation Addict
ugh lol your right I looked at the wrong diffff... ugh

k line 1042 to 1072

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.

warning: squelched 655 whitespace errors
warning: 660 lines add whitespace errors.
 

slp13at420

Mad Scientist
lol I see what happened. I updated it for item vip but never changed the link in the first post lol

- - - Updated - - -

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.

warning: squelched 655 whitespace errors
warning: 660 lines add whitespace errors.

k where are you getting this diff? cuz those are like lines 10 to 13..

this is the LATEST -> http://pastebin.com/et2RTMtD


what you are looking for is this line:
Code:
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e4a2918..cd76f10 100644
 

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: tab in indent.
        LOGIN_LOAD_VIP,
fatal: corrupt patch at line 1226
 

slp13at420

Mad Scientist
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: tab in indent.
        LOGIN_LOAD_VIP,
fatal: corrupt patch at line 1226

lol those have nothing to do with player.cpp those are the edits to logindatabase.cpp

scroll down thru the diff file and find line 1082:
Code:
[COLOR="#808080"]diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp[/COLOR]

this is where we are editing player.cpp

it will look like this:
Code:
[COLOR="#808080"]diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e4a2918..cd76f10 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -43,6 +43,7 @@
 #include "GridNotifiers.h"
 #include "GridNotifiersImpl.h"
 #include "Group.h"
+#include "Grumboz_VIP_Core.h"
 #include "GroupMgr.h"
 #include "Guild.h"
 #include "GuildMgr.h"
@@ -11129,6 +11130,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
 {
+	// 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;
+	}
+
     dest = 0;
     if (pItem)
     {[/COLOR]

but just replace all those lines with :
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"
+#include "Grumboz_VIP_Core.h"
 #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
 {
+	// 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;
+	}
+	
     dest = 0;
     if (pItem)
     {
[/COLOR]
 

Tommy

Founder
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: tab in indent.
        LOGIN_LOAD_VIP,
fatal: corrupt patch at line 1226

Add a new line at the end of the diff file. If it still doesn't work (which new line is mandatory at the end) slp probably needs to get a fresh TC source, apply the changes and generate a new diff that way, if that's not what he did. It isn't recommended to retrieve specific changes and replace content in a major diff file that was generated the way I mentioned. I know from experience. :/
 

slp13at420

Mad Scientist
Add a new line at the end of the diff file. If it still doesn't work (which new line is mandatory at the end) slp probably needs to get a fresh TC source, apply the changes and generate a new diff that way, if that's not what he did. It isn't recommended to retrieve specific changes and replace content in a major diff file that was generated the way I mentioned. I know from experience. :/

yea n I did lol ugh

TrinityCore rev. fdc8b7b38a2a 2016-03-13 --> http://pastebin.com/MDv8Mw4y

I didn't test since again the db is so changed in under a month that columns are different and it wont load .... getting tired quick there TrinityCore guyz
 
Last edited:

Alexunder

Enthusiast
Solved, i must insert #include "Grumboz_VIP_Core.h" in player.cpp, in the tutorial i dont see that line, you must edit please because it will give the "::" error with name space name
 
Last edited:

slp13at420

Mad Scientist
Updated 04-02-2016

Added Eluna Creature Getters/Setters methods.
Add a CPP drop script for creatures.
update your world.creature_template with:
Code:
[COLOR="#808080"]
ALTER TABLE `creature_template`
	ADD COLUMN `vip` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER `VerifiedBuild`;
	ADD COLUMN `mg` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `vip`;
[/COLOR]

a value of 'o' for mg will result in no dropping.
any value above 0 will then be multiplied by the players VIP rank or each players VIP rank will apply to there drop if they are in a group.
the `vip` will be for later mod'z. unused atm.

just change the `mg` value for any creature and restart the server and they will start dropping `Magic Gold`.
if it cannot add the custom currency to the players inventory then it will deposit into the players VIP account bank.

This requires:
Updating `Grumboz_VIP_Core.cpp`
Updating `Grumboz_VIP_Core.h`
updating your `worldDatabase.cpp`
updating your `worldDatabase.h`
Updating your ElunaEngine `LuaFunctions.cpp`.
Updating your ElunaEngine `CreatureMethods.h`.

I updated both diff files in my main post.



If there is anything I missed adding from the Eluna VIP System you want added, just let me know and I will see about converting it over.
 
Last edited:

64516232

Member
1 IntelliSense: return type is not identical to nor covariant with return type "ChatCommand *" of overridden virtual function "CommandScript::GetCommands" d:\332\src\server\game\Entities\Player\Grumboz_VIP_Core.cpp 573 27 game
2 IntelliSense: no instance of constructor "std::vector<_Ty, _Alloc>::vector [with _Ty=ChatCommand, _Alloc=std::allocator<ChatCommand>]" matches the argument list
argument types are: ({...}, {...}, {...}, {...}, {...}, {...}) d:\332\src\server\game\Entities\Player\Grumboz_VIP_Core.cpp 590 3 game
3 IntelliSense: no instance of constructor "std::vector<_Ty, _Alloc>::vector [with _Ty=ChatCommand, _Alloc=std::allocator<ChatCommand>]" matches the argument list
argument types are: ({...}) d:\332\src\server\game\Entities\Player\Grumboz_VIP_Core.cpp 600 3 game
4 IntelliSense: object of abstract class type "VIP_commands" is not allowed:
pure virtual function "CommandScript::GetCommands" has no overrider d:\332\src\server\game\Entities\Player\Grumboz_VIP_Core.cpp 1036 6 game
:RpS_bored:
 

slp13at420

Mad Scientist
What rev are you using ?
which diff are you using ?

those errors are from adding the custom VIP commands:

Code:
[COLOR="#808080"]
	std::vector<ChatCommand> GetCommands() const
	{
		static std::vector<ChatCommand> vipCommandChangeTable =
		{
			{ "race", rbac::RBAC_IN_GRANTED_LIST, true, &HandleChangeRaceCommand, "allows the player to change there race during next login." },
			{ "faction", rbac::RBAC_IN_GRANTED_LIST, true, &HandleChangeFactionCommand, "allows the player to change there faction during next login." },
			{ "custom", rbac::RBAC_IN_GRANTED_LIST, true, &HandleCustomizeCommand, "allows the player to re-costumize there character during next login." },
		};

		static std::vector<ChatCommand> vipCommandSetTable =
		{
			{ "hearthstone", rbac::RBAC_IN_GRANTED_LIST, true, &HandleVipSetHearthstoneCommand, "stores players current gps to VIP hearthstone command." },
		};

		std::string repair_info = "repairs all the players items. Requires the player to possess a " + VIP_COIN_NAME + ".";

		static std::vector<ChatCommand> vipCommandTable =
		{
			{ "mall",		rbac::RBAC_IN_GRANTED_LIST, true, &HandleVipMallCommand, "Teleports the player to a VIP mall." },
			{ "home",		rbac::RBAC_IN_GRANTED_LIST, true, &HandleHomeCommand, "Teleports the player to there faction home mall." },
			{ "hearthstone",rbac::RBAC_IN_GRANTED_LIST, true, &HandleHearthStoneCommand, "Teleports a player to there custom pre-set location." },
			{ "repair",		rbac::RBAC_IN_GRANTED_LIST, true, &HandleRepairCommand, repair_info },
			{ "set",		rbac::RBAC_IN_GRANTED_LIST, true, NULL, "Player customizable commands.", vipCommandSetTable },
			{ "change",		rbac::RBAC_IN_GRANTED_LIST, true, NULL, "Character customizing commands.", vipCommandChangeTable },
		};

		static std::vector<ChatCommand> commandTable =
		{
			{ "vip", rbac::RBAC_IN_GRANTED_LIST, true, NULL, "custom VIP commands by Grumbo. Some commands may require player has an item.", vipCommandTable },
		};
		return commandTable;
	}
[/COLOR]

and they changed the way it was wrote not to long ago.

as you can see in this example of `.guild` commands from an older core:
Code:
[COLOR="#808080"]
    ChatCommand* GetCommands() const override
    {
        static ChatCommand guildCommandTable[] =
        {
            { "create",   rbac::RBAC_PERM_COMMAND_GUILD_CREATE,   true, &HandleGuildCreateCommand,           "", NULL },
            { "delete",   rbac::RBAC_PERM_COMMAND_GUILD_DELETE,   true, &HandleGuildDeleteCommand,           "", NULL },
            { "invite",   rbac::RBAC_PERM_COMMAND_GUILD_INVITE,   true, &HandleGuildInviteCommand,           "", NULL },
            { "uninvite", rbac::RBAC_PERM_COMMAND_GUILD_UNINVITE, true, &HandleGuildUninviteCommand,         "", NULL },
            { "rank",     rbac::RBAC_PERM_COMMAND_GUILD_RANK,     true, &HandleGuildRankCommand,             "", NULL },
            { "rename",   rbac::RBAC_PERM_COMMAND_GUILD_RENAME,   true, &HandleGuildRenameCommand,           "", NULL },
            { "info",     rbac::RBAC_PERM_COMMAND_GUILD_INFO,     true, &HandleGuildInfoCommand,             "", NULL },
            { NULL,       0,                               false, NULL,                                "", NULL }
        };
        static ChatCommand commandTable[] =
        {
            { "guild", rbac::RBAC_PERM_COMMAND_GUILD,  true, NULL, "", guildCommandTable },
            { NULL,    0,                       false, NULL, "", NULL }
        };
        return commandTable;
    }
[/COLOR]

the older style didn't use a std::vector.

so somethings different in your core and I will need you to share your \src\server\scripts\Commands\cs_guild.cpp file so I can cross reference to fix .
 
Last edited:

slp13at420

Mad Scientist
update 10-30-2016:
added a buff command:
  • `.vip buff` will buff a player based on the players VIP rank.
added an hp boost:
  • at login a players hp will get boosted based on the players VIP rank and the VIP OffSet value (float) set in the config.
 
Last edited:

slp13at420

Mad Scientist
Update 11-29-2016:
During our down time I went ahead and updated the System making it a little more efficient and now able to be #includ'd in any other scripts.
 
Last edited:

Marko

Enthusiast
Howdy Grumbo, my scriptloader.cpp looks like this:
#include "Define.h"
#include <vector>
#include <string>

void AddCommandsScripts();
void AddCustomScripts();
void AddEasternKingdomsScripts();
void AddEventsScripts();
void AddKalimdorScripts();
void AddNorthrendScripts();
void AddOutdoorPvPScripts();
void AddOutlandScripts();
void AddPetScripts();
void AddSpellsScripts();
void AddWorldScripts();

#ifdef TRINITY_IS_DYNAMIC_SCRIPTLOADER
# include "revision_data.h"
# define TC_SCRIPT_API TC_API_EXPORT
extern "C" {

/// Exposed in script modules to return the script module revision hash.
TC_SCRIPT_API char const* GetScriptModuleRevisionHash()
{
return _HASH;
}

/// Exposed in script module to return the name of the script module
/// contained in this shared library.
TC_SCRIPT_API char const* GetScriptModule()
{
return "static";
}

#else
# include "ScriptLoader.h"
# define TC_SCRIPT_API
#endif

/// Exposed in script modules to register all scripts to the ScriptMgr.
TC_SCRIPT_API void AddScripts()
{
AddCommandsScripts();
AddCustomScripts();
AddEasternKingdomsScripts();
AddEventsScripts();
AddKalimdorScripts();
AddNorthrendScripts();
AddOutdoorPvPScripts();
AddOutlandScripts();
AddPetScripts();
AddSpellsScripts();
AddWorldScripts();
}

/// Exposed in script modules to get the build directive of the module.
TC_SCRIPT_API char const* GetBuildDirective()
{
return _BUILD_DIRECTIVE;
}

#ifdef TRINITY_IS_DYNAMIC_SCRIPTLOADER
} // extern "C"
#endif

:dafuq:

Where to add custom scripts there? as can be seen, there is just
#ifdef TRINITY_IS_DYNAMIC_SCRIPTLOADER
} // extern "C"
#endif
at the end of file
 

slp13at420

Mad Scientist
ok at the very bottom of your ScriptLoader.cpp very very end:
Code:
[COLOR="#808080"]
[/COLOR]
#ifdef SCRIPTS
/* This is where custom scripts' loading functions should be declared. */
	void AddSC_WorldChat();
	void AddSC_Grumboz_World_Ctf();
	[COLOR="#DAA520"]void AddSC_Grumboz_VIP_Core();[/COLOR]
#endif

void AddCustomScripts()
{
#ifdef SCRIPTS
    /* This is where custom scripts should be added. */
	AddSC_WorldChat();
	AddSC_Grumboz_World_Ctf();
	[COLOR="#DAA520"]AddSC_Grumboz_VIP_Core();[/COLOR]
#endif
}

hmmm i thought i added instructions on how to add this to entities dir as a standalone dir.....
 
Last edited:

slp13at420

Mad Scientist
Ohh lol :homerdoh: :doh: there is an instruction file for setting the whole system up in your core.

Allways refer to the supplied instruction sheet `if provided` . allthough all my work is EmuDevs only releases , some one may link my repo or a project on another forum so i will allways keep any instructional file as up to date as possible.
 
Last edited:
Top