Jump to content

[request]Vip Teleports


Guest bobx

Recommended Posts

Someone could modify this code from another emulator for the Mangos please?

vipcommands.cpp i think now Level1.cpp

/* VIP Commands */

#include "StdAfx.h"

bool GetTeleLocation(const char* location, uint32 &map, LocationVector &v)

{

QueryResult *result = WorldDatabase.Query( "SELECT * FROM viptele ORDER BY name" );

if( result == NULL)

return false;

do

{

Field* fields = result->Fetch();

const char* locname = fields[1].GetString();

uint32 locmap = fields[2].GetUInt32();

float x = fields[3].GetFloat();

float y = fields[4].GetFloat();

float z = fields[5].GetFloat();

if( strnicmp( const_cast< char* >( location ), locname, strlen( location ) ) == 0 )

{

map = locmap;

v.x = x;

v.y = y;

v.z = z;

v.o = 0.0;

delete result;

return true;

}

}while (result->NextRow());

delete result;

return false;

}

bool ChatHandler::VipTeleCommand(const char* args, WorldSession *m_session)

{

if( args == NULL )

return false;

if( !*args )

return false;

if( m_session == NULL )

return false;

uint32 map;

LocationVector v;

if (GetTeleLocation(args, map, v))

{

if( m_session->GetPlayer()->CombatStatus.IsInCombat() )

{

m_session->GetPlayer()->BroadcastMessage("%sYou cannot teleport in combat.", MSG_COLOR_RED)

}

else if( m_session->GetPlayer() != NULL )

{

m_session->GetPlayer()->SafeTeleport(map, 0, v);

return true;

}

return false;

}

return false;

}

bool ChatHandler::VipTeleList(const char* args, WorldSession *m_session)

{

QueryResult *result = WorldDatabase.Query( "SELECT id,name FROM viptele ORDER BY name" );

if(!result)

return false;

std::string recout;

uint32 count = 0;

recout = "|cff00ff00VIP Teleport Locations|r:\\n\\n";

do

{

Field *fields = result->Fetch();

//float id = fields[0].GetFloat();

const char * locname = fields[1].GetString();

recout += "|cff00ccff";

recout += locname;

recout += "|r, ";

count++;

if(count == 5)

{

recout += "\\n";

count = 0;

}

}while (result->NextRow());

SendMultilineMessage(m_session, recout.c_str());

delete result;

return true;

}

Now the PATCH

Index: trunk/src/world/Chat.cpp

===================================================================

--- trunk/src/world/Chat.cpp (revision 2468)

+++ trunk/src/world/Chat.cpp (working copy)

@@ -35,6 +35,8 @@

return _modifyCommandTable;

else if(!stricmp(name, "waypoint"))

return _waypointCommandTable;

+ else if(!stricmp(name, "vip"))

+ return _vipCommandTable;

else if(!stricmp(name, "debug"))

return _debugCommandTable;

else if(!stricmp(name, "gmTicket"))

@@ -195,6 +197,7 @@

{

free( _modifyCommandTable );

free( _debugCommandTable );

+ free( _vipCommandTable );

free( _waypointCommandTable );

free( _GMTicketCommandTable );

free( _GuildCommandTable );

@@ -365,6 +368,14 @@

};

dupe_command_table(GuildCommandTable, _GuildCommandTable);

+ static ChatCommand VipCommandTable[] =

+ {

+ { "teleport", '5', &ChatHandler::VipTeleCommand, "Teleports you to locations.", NULL, 0, 0, 0 },

+ { "telelist", '5', &ChatHandler::VipTeleList, "List the available teleport locations for VIPs.", NULL, 0, 0, 0 },

+ { NULL, '0', NULL, "", NULL, 0, 0, 0 }

+ };

+ dupe_command_table(VipCommandTable, _vipCommandTable);

+

static ChatCommand GameObjectCommandTable[] =

{

{ "select", 'o', &ChatHandler::HandleGOSelect, "Selects the nearest GameObject to you", NULL, 0, 0, 0 },

@@ -545,15 +556,15 @@

{ "cancelshutdown",'z', &ChatHandler::HandleCancelShutdownCommand, "Cancels a Server Restart/Shutdown.", NULL, 0, 0, 0 },

{ "save", 's', &ChatHandler::HandleSaveCommand, "Save's target character", NULL, 0, 0, 0 },

{ "saveall", 's', &ChatHandler::HandleSaveAllCommand, "Save's all playing characters", NULL, 0, 0, 0 },

- { "info", '0', &ChatHandler::HandleInfoCommand, "Server info", NULL, 0, 0, 0 },

- { "netstatus", '0', &ChatHandler::HandleNetworkStatusCommand, "Shows network status.", NULL, 0, 0, 0 },

+ { "info", 't', &ChatHandler::HandleInfoCommand, "Server info", NULL, 0, 0, 0 },

+ { "netstatus", 't', &ChatHandler::HandleNetworkStatusCommand, "Shows network status.", NULL, 0, 0, 0 },

{ NULL, '0', NULL, "", NULL, 0, 0, 0 }

};

dupe_command_table(serverCommandTable, _serverCommandTable);

static ChatCommand gmCommandTable[] =

{

- { "list", '0', &ChatHandler::HandleGMListCommand, "Shows active GM's", NULL, 0, 0, 0 },

+ { "list", 't', &ChatHandler::HandleGMListCommand, "Shows active GM's", NULL, 0, 0, 0 },

{ "status", 't', &ChatHandler::HandleGMStatusCommand, "Shows status of your gm flags", NULL, 0, 0, 0 },

{ "off", 't', &ChatHandler::HandleGMOffCommand, "Sets GM tag off", NULL, 0, 0, 0 },

{ "on", 't', &ChatHandler::HandleGMOnCommand, "Sets GM tag on", NULL, 0, 0, 0 },

@@ -682,7 +693,7 @@

{

{ "commands", '0', &ChatHandler::HandleCommandsCommand, "Shows commands", NULL, 0, 0, 0 },

{ "help", '0', &ChatHandler::HandleHelpCommand, "Shows help for command", NULL, 0, 0, 0 },

- { "calcdist", '0', &ChatHandler::HandleSimpleDistanceCommand, "Display the distance between your current position and the specified point x y z", NULL, 0, 0, 0 },

+ { "calcdist", 't', &ChatHandler::HandleSimpleDistanceCommand, "Display the distance between your current position and the specified point x y z", NULL, 0, 0, 0 },

{ "announce", 'u', &ChatHandler::HandleAnnounceCommand, "Sends a normal chat message broadcast to all players.", NULL, 0, 0, 0 },

{ "wannounce", 'u', &ChatHandler::HandleWAnnounceCommand, "Sends a widescreen raid style announcement to all players.", NULL, 0, 0, 0 },

{ "appear", 'v', &ChatHandler::HandleAppearCommand, "Teleports to x's position.", NULL, 0, 0, 0 },

@@ -694,7 +705,7 @@

{ "demorph", 'm', &ChatHandler::HandleDeMorphCommand, "Demorphs from morphed model.", NULL, 0, 0, 0 },

{ "mount", 'm', &ChatHandler::HandleMountCommand, "Mounts into modelid x.", NULL, 0, 0, 0 },

{ "dismount", 'h', &ChatHandler::HandleDismountCommand, "Dismounts.", NULL, 0, 0, 0 },

- { "gps", '0', &ChatHandler::HandleGPSCommand, "Shows Position", NULL, 0, 0, 0 },

+ { "gps", 't', &ChatHandler::HandleGPSCommand, "Shows Position", NULL, 0, 0, 0 },

{ "worldport", 'v', &ChatHandler::HandleWorldPortCommand, "Teleports you to a location with mapid x y z", NULL, 0, 0, 0 },

{ "start", 'm', &ChatHandler::HandleStartCommand, "Teleports you to a starting location", NULL, 0, 0, 0 },

{ "invincible", 'j', &ChatHandler::HandleInvincibleCommand, ".invincible - Toggles INVINCIBILITY (mobs won't attack you)", NULL, 0, 0, 0 },

@@ -704,7 +715,7 @@

{ "modify", 'm', NULL, "", modifyCommandTable, 0, 0, 0 },

{ "waypoint", 'w', NULL, "", waypointCommandTable, 0, 0, 0 },

{ "debug", 'd', NULL, "", debugCommandTable, 0, 0, 0 },

- { "gm", '0', NULL, "", gmCommandTable, 0, 0, 0 },

+ { "gm", 't', NULL, "", gmCommandTable, 0, 0, 0 },

{ "gmTicket", 'c', NULL, "", GMTicketCommandTable, 0, 0, 0 },

{ "gobject", 'o', NULL, "", GameObjectCommandTable, 0, 0, 0 },

{ "battleground", 'e', NULL, "", BattlegroundCommandTable, 0, 0, 0 },

@@ -714,11 +725,12 @@

{ "account", 'a', NULL, "", accountCommandTable, 0, 0, 0 },

{ "honor", 'm', NULL, "", honorCommandTable, 0, 0, 0 },

{ "quest", 'q', NULL, "", questCommandTable, 0, 0, 0 },

+ { "vip", '5', NULL, "", VipCommandTable, 0, 0, 0 },

{ "pet", 'm', NULL, "", petCommandTable, 0, 0, 0 },

{ "recall", 'q', NULL, "", recallCommandTable, 0, 0, 0 },

{ "guild", 'm', NULL, "", GuildCommandTable, 0, 0, 0 },

- { "server", '0', NULL, "", serverCommandTable, 0, 0, 0 },

- { "character", '0', NULL, "", characterCommandTable, 0, 0, 0 },

+ { "server", 't', NULL, "", serverCommandTable, 0, 0, 0 },

+ { "character", 't', NULL, "", characterCommandTable, 0, 0, 0 },

{ "lookup", 'l', NULL, "", lookupCommandTable, 0, 0, 0 },

{ "admin", 'z', NULL, "", adminCommandTable, 0, 0, 0 },

{ "kick", 'm', NULL, "", kickCommandTable, 0, 0, 0 },

Index: trunk/src/world/Chat.h

===================================================================

--- trunk/src/world/Chat.h (revision 2468)

+++ trunk/src/world/Chat.h (working copy)

@@ -157,6 +157,7 @@

ChatCommand* _petCommandTable;

ChatCommand* _recallCommandTable;

ChatCommand* _questCommandTable;

+ ChatCommand* _vipCommandTable;

ChatCommand* _serverCommandTable;

ChatCommand* _gmCommandTable;

ChatCommand* _characterCommandTable;

@@ -226,6 +227,8 @@

bool HandleGmLogCommentCommand( const char *args , WorldSession *m_session);

bool HandleRatingsCommand( const char *args , WorldSession *m_session );

bool HandleSimpleDistanceCommand( const char *args , WorldSession *m_session );

+ bool VipTeleCommand( const char *args , WorldSession *m_session );

+ bool VipTeleList( const char *args , WorldSession *m_session );

// Level 1 commands

bool CmdSetValueField(WorldSession *m_session, uint32 field, uint32 fieldmax, const char *fieldname, const char* args);

And the SQL in the WORLD DATABASE is

CREATE TABLE `viptele` (

`id` bigint(20) unsigned NOT NULL auto_increment,

`name` varchar(100) NOT NULL,

`MapId` int(10) unsigned NOT NULL default '0',

`positionX` float NOT NULL default '0',

`positionY` float NOT NULL default '0',

`positionZ` float NOT NULL default '0',

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='VIP Teleport Locations';

Thanks for all !

Link to comment
Share on other sites

You can play around with the command level's in the database table 'command'. If you made a custom security level (e.g., bump all GM/Admin/RA levels up one and make the level 1 for VIPs), you could easily give them access to the teleport command that GMs have, which is essentially what you have here.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use