📄 gmcmds.cpp.svn-base
字号:
/*
Rose Online Server Emulator
Copyright (C) 2006,2007 OSRose Team http://www.osrose.net
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
depeloped with Main erose/hrose source server + some change from the original eich source
*/
#include "worldserver.h"
// Parse our commands to their appropriate function
bool CWorldServer::pakGMCommand( CPlayer* thisclient, CPacket* P )
{
char* tmp;
char* command = strtok( (char*)&(*P).Buffer[1] , " ");
if (command==NULL) return true;
if (strcmp(command, "here")==0)
{
if(Config.Command_Here > thisclient->Session->accesslevel)
return true;
return pakGMTele(thisclient, thisclient->Position->Map, thisclient->Position->current.x, thisclient->Position->current.y);
}
else
if (strcmp(command, "tele")==0) // **** TELEPORT TO MAX AND X Y POINTS *****
{
if(Config.Command_Tele > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned map=atoi(tmp);
if ((tmp = strtok(NULL, " "))==NULL) return true; float x=(float)atoi(tmp);
if ((tmp = strtok(NULL, " "))==NULL) return true; float y=(float)atoi(tmp);
Log( MSG_GMACTION, " %s : /tele %i,%u,%u" , thisclient->CharInfo->charname, map, round(x), round(y));
return pakGMTele(thisclient, map, x, y);
}
else if (strcmp(command, "mute")==0) //==== Mute a player ==== [by Paul_T]
{
if(Config.Command_Mute > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL)
return true;
char* id=tmp;
if ((tmp = strtok(NULL, " "))==NULL)
return true;
int min=atoi(tmp);
Log( MSG_GMACTION, " %s : /mute %s %i" , thisclient->CharInfo->charname, id, min);
return pakGMMute(thisclient, id, min);
}
else if (strcmp(command, "reborn")==0) //==== Reborn ==== (By Core)
{
if(Config.Command_Reborn > thisclient->Session->accesslevel)
return true;
Log( MSG_GMACTION, " %s : /reborn" , thisclient->CharInfo->charname);
return pakGMReborn(thisclient);
}
else if (strcmp(command, "event")==0) //==== Trigger Events (credit Welson)
{
if(Config.Command_Event > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL)
return true;
int npctype=atoi(tmp);
if ((tmp = strtok(NULL, " "))==NULL)
return true;
int dialog=atoi(tmp);
if ((tmp = strtok(NULL, " "))==NULL)
return true;
int type=atoi(tmp);
Log( MSG_GMACTION, " %s : /event %i %i %i" ,thisclient->CharInfo->charname, npctype,dialog,type);
return pakGMEventType(thisclient,npctype,dialog,type);
}
else if (strcmp(command, "save")==0) // *** SAVE USER DATA *****
{
if(Config.Command_Save > thisclient->Session->accesslevel)
return true;
thisclient->savedata();
return true;
}
else if (strcmp(command, "reload")==0) // *** RELOAD CONFIG.INI ******
{
if(Config.Command_Reload > thisclient->Session->accesslevel)
return true;
LoadConfigurations( (char*)filename.c_str() );
Log( MSG_GMACTION, " %s : /reload" , thisclient->CharInfo->charname);
return true;
}
else if (strcmp(command, "ann")==0) // *** SEND A ANNOUNCEMENT ***
{
if(Config.Command_Ann > thisclient->Session->accesslevel)
return true;
Log( MSG_GMACTION, " %s : /ann %s" , thisclient->CharInfo->charname, &P->Buffer[5] );
return pakGMAnn(thisclient, P);
}
/*else if(strcmp(command, "bodysize")==0)
{
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT size=atoi(tmp);
BEGINPACKET(pak, 0x721);
ADDWORD(pak, 36);
ADDWORD(pak, size);
ADDWORD(pak, 0);
thisclient->client->SendPacket(&pak);
RESETPACKET(pak, 0x0730);
ADDWORD(pak, 5);
ADDWORD(pak, 0xa24d);
ADDWORD(pak, 0x40b3);
thisclient->client->SendPacket(&pak);
SendSysMsg(thisclient, "Body size changed!");
}*/
/*else if(strcmp(command, "headsize")==0)
{
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT size=atoi(tmp);
BEGINPACKET(pak, 0x721);
ADDWORD(pak, 35);
ADDWORD(pak, size);
ADDWORD(pak, 0);
thisclient->client->SendPacket(&pak);
RESETPACKET(pak, 0x0730);
ADDWORD(pak, 5);
ADDWORD(pak, 0xa24d);
ADDWORD(pak, 0x40b3);
thisclient->client->SendPacket(&pak);
SendSysMsg(thisclient, "Head size changed!");
}*/
else if(strcmp(command, "face")==0)
{
if(Config.Command_Face > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT face=atoi(tmp);
if (face > 12) return true;
UINT style;
if ((tmp = strtok(NULL, " ")) == NULL) style = 0; else style = atoi(tmp);
if (style > 3) style = 3;
thisclient->CharInfo->Face = ((face*7) + style + 1);
BEGINPACKET(pak, 0x721);
ADDWORD(pak, 8);
ADDWORD(pak, thisclient->CharInfo->Face);
ADDWORD(pak, 0);
thisclient->client->SendPacket(&pak);
RESETPACKET(pak, 0x0730);
ADDWORD(pak, 5);
ADDWORD(pak, 0xa24d);
ADDWORD(pak, 0x40b3);
thisclient->client->SendPacket(&pak);
SendPM(thisclient, "Face changed!");
DB->QExecute("UPDATE characters SET face=%i WHERE id=%i", thisclient->CharInfo->Face, thisclient->CharInfo->charid);
}
else if(strcmp(command, "hair")==0)
{
if(Config.Command_Hair > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT hair=atoi(tmp);
if (hair > 6) return true;
thisclient->CharInfo->Hair = (hair*5);
BEGINPACKET(pak, 0x721);
ADDWORD(pak, 9);
ADDWORD(pak, thisclient->CharInfo->Hair);
ADDWORD(pak, 0);
thisclient->client->SendPacket(&pak);
RESETPACKET(pak, 0x0730);
ADDWORD(pak, 5);
ADDWORD(pak, 0xa24d);
ADDWORD(pak, 0x40b3);
thisclient->client->SendPacket(&pak);
DB->QExecute("UPDATE characters SET hairStyle=%i WHERE id=%i", thisclient->CharInfo->Hair, thisclient->CharInfo->charid);
SendPM(thisclient, "Hair changed!");
}
else if(strcmp(command, "pvp")==0)
{
if(Config.Command_Pvp > thisclient->Session->accesslevel)
return true;
CMap* map = MapList.Index[thisclient->Position->Map];
BEGINPACKET(pak, 0x721);
ADDWORD(pak, 34);
if(map->allowpvp!=0)
{
map->allowpvp = 0;
ADDWORD(pak, 2);
SendSysMsg(thisclient, "PVP off");
}
else
{
map->allowpvp = 1;
ADDWORD(pak, 51);
SendSysMsg(thisclient, "PVP on");
}
ADDWORD(pak, 0);
SendToMap(&pak, thisclient->Position->Map);
RESETPACKET(pak, 0x0730);
ADDWORD(pak, 5);
ADDWORD(pak, 0xa24d);
ADDWORD(pak, 0x40b3);
SendToMap(&pak, thisclient->Position->Map);
}
else if(strcmp(command, "who")==0)
{
if(Config.Command_Who > thisclient->Session->accesslevel)
return true;
int count=1;
int gmcount=0;
int playercount=0;
char line0[200];
while(count <= (ClientList.size()-1))
{
CPlayer* whoclient = (CPlayer*)ClientList.at(count)->player;
if(whoclient->isInvisibleMode != true)
{
if(whoclient->Session->accesslevel > 100)
{
gmcount++;
}
else
{
playercount++;
}
}
count++;
}
sprintf(line0, "There are currently %i players and %i game moderators currently connected.", playercount, gmcount);
Log( MSG_GMACTION, " %s : /who" , thisclient->CharInfo->charname);
SendPM(thisclient, line0 );
return true;
}
else if (strcmp(command, "go")==0) // AtCommandGo
{
if(Config.Command_go > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0; int loc=atoi(tmp);
if(Config.Command_Go > thisclient->Session->accesslevel)
return true;
int x = 0;
int y = 0;
int map = 0;
if(loc == 1)
{
map = 22;
x = 5098;
y = 5322;
}
else if(loc == 2)
{
map = 1;
x = 5240;
y = 5192;
}
else if (loc == 3)
{
map = 2;
x = 5516;
y = 5236;
}
else if (loc == 4)
{
map = 51;
x = 5357;
y = 5013;
}
else if (loc == 5)
{
map = 61;
x = 5434;
y = 4569;
}
else if (loc == 6)
{
map = 6;
x = 5243;
y = 5240;
}
else if (loc == 7)
{
map = 24;
x = 5379;
y = 5329;
}
else if (loc == 8)
{
map = 31;
x = 5516;
y = 5437;
}
else if (loc == 9)
{
map = 29;
x = 5093;
y = 5144;
}
else if (loc == 10)
{
if (thisclient->Stats->Level<160) // by Terr0risT
{
SendPM(thisclient, "You need to be a least Level 160 to visit Sikuku Prison Underground!");
return true;
}
else
{
map = 65;
x = 5485;
y = 5285;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -