📄 gmcmds.cpp.svn-base
字号:
RESETPACKET( pak, 0x0730 );
ADDWORD( pak, 5 );
ADDWORD( pak, 0xa24d );
ADDWORD( pak, 0x40b3 );
otherclient->client->SendPacket( &pak );
Log(MSG_GMACTION, " %s : /skillp %i %s", thisclient->CharInfo->charname, skillp, name);
return true;
}
else if (strcmp(command, "killinrange")==0)
{
if(Config.Command_KillInRange > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned range=atoi(tmp);
Log( MSG_GMACTION, " %s : /killinrange %i" , thisclient->CharInfo->charname, range);
return pakGMKillInRange( thisclient, range );
}
else if (strcmp(command, "gotomap")==0) // *** TELEPORT WITH MAP ID *****
{ // credits to Blackie
if(Config.Command_GoToMap > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned map=atoi(tmp);
Log( MSG_GMACTION, " %s : /gotomap %i" , thisclient->CharInfo->charname, map);
return pakGMGotomap(thisclient, map);
}
else if(strcmp(command, "heal")==0)
{
if(Config.Command_Heal > thisclient->Session->accesslevel)
return true;
Log( MSG_GMACTION, " %s : /heal", thisclient->CharInfo->charname );
return pakGMHeal( thisclient );
}
else if(strcmp(command, "serverinfo")==0)
{
if(Config.Command_ServerInfo > thisclient->Session->accesslevel)
return true;
Log( MSG_GMACTION, " %s : /serverinfo" , thisclient->CharInfo->charname);
return pakGMServerInfo( thisclient );
}
else if(strcmp(command, "targetinfo")==0)
{
if(Config.Command_TargetInfo > thisclient->Session->accesslevel)
return true;
return GMShowTargetInfo( thisclient );
}
else if (strcmp(command, "hide")==0)
{
if(Config.Command_Hide > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL)
return true;
int mode= atoi( tmp );
return pakGMHide( thisclient, mode );
}
else if (strcmp(command, "class")==0)
{
if(Config.Command_Class > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL)
return true;
char* classid=(char*)tmp;
Log( MSG_GMACTION, " %s : /class %s" , thisclient->CharInfo->charname, classid);
return pakGMClass( thisclient, classid );
}
else if(strcmp(command, "convert")==0)
{
if(Config.Command_Convert > thisclient->Session->accesslevel)
return true;
if(thisclient->Battle->target==0) return true;
if ((tmp = strtok(NULL, " " ))==NULL)
return true;
UINT newmon = atoi(tmp);
if(newmon==0) return true;
CMonster* thismon = GetMonsterByID( thisclient->Battle->target, thisclient->Position->Map );
if(thismon==NULL)
{
CNPC* thisnpc = GetNPCByID( thisclient->Battle->target, thisclient->Position->Map );
if(thisnpc==NULL) return true;
MapList.Index[thisclient->Position->Map]->ConverToMonster( thisnpc, newmon );
}
else
{
MapList.Index[thisclient->Position->Map]->ConverToMonster( thismon, newmon );
}
return true;
}
else if (strcmp(command, "b")==0)
{
if(Config.Command_Broadcast > thisclient->Session->accesslevel)
return true;
time_t seconds;
seconds = time (NULL);
if((thisclient->CharInfo->LastGlobal+Config.Command_GlobalTime) <= seconds)
{
thisclient->CharInfo->LastGlobal = time (NULL);
char outputmsg[200];
sprintf( outputmsg, "%s %s", Config.Command_GlobalPrefix, &P->Buffer[3] );
Log( MSG_INFO, "%s> %s %s", thisclient->CharInfo->charname, Config.Command_GlobalPrefix, &P->Buffer[3]);
SendGlobalMSG(thisclient, outputmsg);
}
else
{
long int remaining = (Config.Command_GlobalTime-(seconds-thisclient->CharInfo->LastGlobal));
char buffer2[200];
sprintf ( buffer2, "Please wait %i seconds before sending another global message.", remaining );
SendPM(thisclient, buffer2);
}
return true;
}
else if(strcmp(command, "who2")==0)
{
if(Config.Command_Who2 > thisclient->Session->accesslevel)
return true;
SendPM(thisclient, "The following players are currently connected;");
int count=1;
int hiddenam=0;
char line0[200];
while(count <= (ClientList.size()-1))
{
CPlayer* whoclient = (CPlayer*)ClientList.at(count)->player;
if(whoclient->Session->accesslevel > 100)
{
sprintf(line0, "%s - GM[%i]", whoclient->CharInfo->charname, whoclient->Session->accesslevel);
}
else
{
sprintf(line0, "%s", whoclient->CharInfo->charname);
}
if(whoclient->isInvisibleMode != true)
{
SendPM(thisclient, line0 );
}
else
{
hiddenam++;
}
count++;
}
sprintf(line0, "There are currently %i players connected!", ((ClientList.size()-1)-hiddenam));
Log( MSG_GMACTION, " %s : /who2" , thisclient->CharInfo->charname);
SendPM(thisclient, line0 );
return true;
}
else if(strcmp(command, "rate")==0) //incomplete
{
if(Config.Command_Rate > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL) return true;
char* type = tmp;
if(strcmp(type,"drop")==0)
{
if ((tmp = strtok(NULL, " "))==NULL) return true;
Config.DROP_RATE = atoi(tmp);
}
else
if(strcmp(type,"exp")==0)
{
if ((tmp = strtok(NULL, " "))==NULL) return true;
Config.EXP_RATE = atoi(tmp);
}
}
else if(strcmp(command, "moveto")==0)
{
if(Config.Command_Moveto > thisclient->Session->accesslevel)
return true;
fPoint position;
if ((tmp = strtok(NULL, " "))==NULL) return true;
position.x = atof(tmp);
if ((tmp = strtok(NULL, " "))==NULL) return true;
position.y = atof(tmp);
if ((tmp = strtok(NULL, " "))==NULL) return true;
position.z = atof(tmp);
pakGMMoveTo( thisclient, position );
}
else if(strcmp(command, "settime")==0)
{
if(Config.Command_Settime > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL) return true;
unsigned int time = atoi(tmp);
if(MapList.Index[thisclient->Position->Map]!=NULL)
{
switch(time)
{
case MORNING:
MapList.Index[thisclient->Position->Map]->MapTime = MapList.Index[thisclient->Position->Map]->morningtime;
SendSysMsg( thisclient, "Time changed!, rejoin to see change [MORNING]" );
break;
case DAY:
MapList.Index[thisclient->Position->Map]->MapTime = MapList.Index[thisclient->Position->Map]->daytime;
SendSysMsg( thisclient, "Time changed!, rejoin to see change [DAY]" );
break;
case EVENING:
MapList.Index[thisclient->Position->Map]->MapTime = MapList.Index[thisclient->Position->Map]->eveningtime;
SendSysMsg( thisclient, "Time changed!, rejoin to see change [EVENING]" );
break;
case NIGHT:
MapList.Index[thisclient->Position->Map]->MapTime = MapList.Index[thisclient->Position->Map]->nighttime;
SendSysMsg( thisclient, "Time changed!, rejoin to see change [NIGHT]" );
break;
default:
SendSysMsg( thisclient, "Time: 0=MORNING | 1=DAY | 2=EVENING | 3=NIGHT" );
}
}
}
else if(strcmp(command, "transx")==0)
{
if(Config.Command_Transx > thisclient->Session->accesslevel)
return true;
thisclient->CharInfo->Sex = thisclient->CharInfo->Sex==0?1:0;
BEGINPACKET( pak, 0x720 );
ADDWORD( pak, 2 );
ADDWORD( pak, thisclient->CharInfo->Sex );
ADDWORD( pak, 0 );
thisclient->client->SendPacket( &pak );
RESETPACKET( pak, 0x0730 );
ADDWORD( pak, 5 );
ADDWORD( pak, 0xa24d );
ADDWORD( pak, 0x40b3 );
thisclient->client->SendPacket( &pak );
}
else if (strcmp(command, "partylvl")==0)
{
if(Config.Command_Partylvl > thisclient->Session->accesslevel)
return true;
if ((tmp = strtok(NULL, " "))==NULL) return true; int level= atoi( tmp );
return pakGMPartylvl( thisclient, level );
}
else if(strcmp(command, "pdmg")==0)
{
if(Config.Command_Pdmg > thisclient->Session->accesslevel)
return true;
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned rate=atoi(tmp);
Log( MSG_GMACTION, " Rate for Player Dmg is now set at %i by %s" , rate, thisclient->CharInfo->charname);
return pakGMChangePlayerDmg(thisclient, rate);
}
else if(strcmp(command, "mdmg")==0)
{
if(Config.Command_Mdmg > thisclient->Session->accesslevel)
return true;
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned rate=atoi(tmp);
Log( MSG_GMACTION, " Rate for Monster Dmg is now set at %i by %s" , rate, thisclient->CharInfo->charname);
return pakGMChangeMonsterDmg(thisclient, rate);
}
else if(strcmp(command, "rules")==0) // Rules Command by Matt
{
if(Config.Command_Rules > thisclient->Session->accesslevel)
return true;
SendPM(thisclient, "Please follow the following rules to ensure you have a fun time on this server!");
SendPM(thisclient, "Rule 1: No hacking");
SendPM(thisclient, "Rule 2: Do not abuse any bugs in the game");
SendPM(thisclient, "Rule 3: Be respectful to all players and GMs");
SendPM(thisclient, "Rule 4: Do not beg for items");
SendPM(thisclient, "Rule 5: Do not harass any players or GM's");
SendPM(thisclient, "Rule 6: Do not abuse any bugs in the game");
}
else if(strcmp(command, "cfmode")==0)
{
if(Config.Command_Cfmode > thisclient->Session->accesslevel)
return true;
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned mode=atoi(tmp);
Log( MSG_GMACTION, " Clan field mode changed to %i by %s" , mode, thisclient->CharInfo->charname);
return pakGMChangeCfmode(thisclient, mode);
}
else if(strcmp(command, "whoattacksme")==0)
{
return pakGMWhoAttacksMe(thisclient);
}
else if(strcmp(command, "atkModif")==0)
{
if(300 > thisclient->Session->accesslevel)
return true;
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned attkSpeedModif=atoi(tmp);
Log( MSG_GMACTION, " AttkSpeedModif changed to %i by %s" , attkSpeedModif, thisclient->CharInfo->charname);
return pakGMChangeAtkSpeedModif(thisclient, attkSpeedModif);
}
else if(strcmp(command, "hitModif")==0)
{
if(300 > thisclient->Session->accesslevel)
return true;
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned hitDelayModif=atoi(tmp);
Log( MSG_GMACTION, " HitDelayModif changed to %i by %s" , hitDelayModif, thisclient->CharInfo->charname);
return pakGMChangeHitDelayModif(thisclient, hitDelayModif);
}
else if(strcmp(command, "speedModif")==0)
{
if(300 > thisclient->Session->accesslevel)
return true;
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned mSpeedModif=atoi(tmp);
Log( MSG_GMACTION, " mSpeedModif changed to %i by %s" , mSpeedModif, thisclient->CharInfo->charname);
return pakGMChangeMSpeedModif(thisclient, mSpeedModif);
}
else
{
Log( MSG_WARNING, "Invalid GM Command '%s' by '%s'", command, thisclient->CharInfo->charname);
}
return true;
}
// GM: Announcment
bool CWorldServer::pakGMAnn( CPlayer* thisclient, CPacket *P )
{
BEGINPACKET( pak, 0x702 );
ADDSTRING( pak, thisclient->CharInfo->charname );
ADDSTRING( pak, "> " );
ADDSTRING( pak, (&P->Buffer[5]));
ADDBYTE( pak, 0x00);
SendToAll( &pak );
return true;
}
// GM: Spawn x mobs
bool CWorldServer::pakGMMon( CPlayer* thi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -