POSIX clock() sums CPU time across every thread in the process, unlike Windows' clock() which tracks wall-clock milliseconds. With several worker threads running, respawn/spawn/AI timers based on clock() raced far ahead of real elapsed time. Switch spawn-timer bookkeeping to time(NULL)/time_t (seconds) throughout the world server, and add a portable clock() shim in sockets.h (backed by CLOCK_MONOTONIC, millisecond resolution) for remaining call sites so CLOCKS_PER_SEC==1000 still holds like it did on Windows. Also: fix MapDelay/VisualDelay/WorldDelay being passed to usleep() (us) without converting from their configured milliseconds; fix the shutdown timer likewise; stop leaking the temporary actor used to run an NPC's AIP script; fix CleanDrops() skipping the element that shifts into position after an erase. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3878 lines
139 KiB
C++
3878 lines
139 KiB
C++
/*
|
|
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;
|
|
//non GM functions
|
|
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->Session->accesslevel > 100)
|
|
{
|
|
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;
|
|
}
|
|
|
|
// all commands beyond here require IsGM or IsDev to be active in the character record
|
|
if (thisclient->CharInfo->IsGM == 0)
|
|
{
|
|
SendPM(thisclient, "Sorry. you do not have GM priveleges with this character");
|
|
return true;
|
|
}
|
|
//SendPM(thisclient, "Well it looks like you do have GM or DEV priveleges with this character");
|
|
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,%i,%i" , thisclient->CharInfo->charname, map, x, y);
|
|
return pakGMTele(thisclient, map, x, y);
|
|
}
|
|
else if (strcmp(command, "usebuff")==0) // apply a status effect. icon plus visual
|
|
{
|
|
//SendPM(thisclient, "effect used");
|
|
//if(thisclient->Session->accesslevel < 300)
|
|
//return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
return true;
|
|
unsigned effect = atoi(tmp);
|
|
SendPM(thisclient, "Effect called for skill effect %i",effect);
|
|
return pakGMEffect(thisclient, effect);
|
|
}
|
|
else if (strcmp(command, "mute")==0) //==== Mute a player ==== [by Paul_T]
|
|
{
|
|
//SendPM(thisclient, "trying to use mute");
|
|
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, "configreset")==0) // *** REALOAD DATA FILES ******
|
|
{
|
|
//SendPM(thisclient, "trying to use configreset");
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
char* action;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)return true; action = tmp;
|
|
if(strcmp(action, "maxlevel")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.MaxLevel = newval;
|
|
const char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET maxlevel=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "xprate")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.EXP_RATE = newval;
|
|
const char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET exp_rate=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
else if(strcmp(action, "cmd")==0)
|
|
{
|
|
LoadConfigurations( "commands.ini" );
|
|
}
|
|
else
|
|
{
|
|
Log( MSG_INFO, "Unrecognized configreset command by GM %s" , thisclient->CharInfo->charname);
|
|
SendPM(thisclient, "/reload %s is not a valid command", tmp);
|
|
return true;
|
|
}
|
|
Log( MSG_GMACTION, " %s : /configreset %s" , thisclient->CharInfo->charname, action);
|
|
SendPM(thisclient, "%s data has been reloaded", action);
|
|
return true;
|
|
}
|
|
else if (strcmp(command,"readobjvar")==0)
|
|
{
|
|
//SendPM(thisclient, "trying to use readobjvar");
|
|
if(thisclient->Session->accesslevel < 300 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
return true;
|
|
int objVar = atoi(tmp);
|
|
if (objVar > 1999)return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
return true;
|
|
int thisIndex = atoi(tmp);
|
|
if (thisIndex > 19)return true;
|
|
int thisValue = GServer->ObjVar[objVar][thisIndex];
|
|
SendPM(thisclient, "Global Object Variable [%i][%i] current value is %i" , objVar,thisIndex,thisValue);
|
|
}
|
|
else if (strcmp(command,"setobjvar")==0)
|
|
{
|
|
//SendPM(thisclient, "trying to use setobjvar");
|
|
if(thisclient->Session->accesslevel < 300 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
return true;
|
|
int objVar = atoi(tmp);
|
|
if (objVar > 1999)return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
return true;
|
|
int thisIndex = atoi(tmp);
|
|
if (thisIndex > 19)return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
return true;
|
|
int thisValue = atoi(tmp);
|
|
SendPM(thisclient, "Global Object Variable [%i][%i] set to value %i" , objVar,thisIndex,thisValue);
|
|
GServer->ObjVar[objVar][thisIndex] = thisValue;
|
|
}
|
|
/*else if (strcmp(command, "configreset")==0) // *** REALOAD DATA FILES ******
|
|
{
|
|
if(thisclient->Session->accesslevel < 900)
|
|
return true;
|
|
char* action;
|
|
char* buffer;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)return true; action = tmp;
|
|
if(strcmp(action, "maxlevel")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.MaxLevel = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET maxlevel=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "xprate")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.EXP_RATE = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET exp_rate=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "droprate")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.DROP_RATE = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET drop_rate=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "droptype")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.DROP_TYPE = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET drop_type=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "zulyrate")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.ZULY_RATE = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET zuly_rate=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "savetime")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.SAVETIME = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET savetime=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "partygap")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.PARTYGAP = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET partygap=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "maxstat")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.MAXSTAT = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET maxstat=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "playerdmg")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.PLAYERDMG = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET player_damage=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "monsterdmg")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.MONSTERDMG = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET monster_damage=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
if(strcmp(action, "cfmode")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; UINT newval = atoi(tmp);
|
|
{
|
|
Config.CFMODE = newval;
|
|
char* confname = "default";
|
|
GServer->DB->QExecute("UPDATE list_config SET cfmode=%i WHERE conf='%s'",newval,confname);
|
|
}
|
|
}
|
|
else if(strcmp(action, "cmd")==0)
|
|
{
|
|
LoadConfigurations( "commands.ini" );
|
|
}
|
|
else
|
|
{
|
|
Log( MSG_INFO, "Unrecognized configreset command by GM %s" , thisclient->CharInfo->charname);
|
|
sprintf ( buffer, "/reload %s is not a valid command", tmp );
|
|
SendPM(thisclient, buffer);
|
|
return true;
|
|
}
|
|
Log( MSG_GMACTION, " %s : /configreset %s" , thisclient->CharInfo->charname, action);
|
|
sprintf ( buffer, "%s data has been reloaded", action );
|
|
SendPM(thisclient, buffer);
|
|
return true;
|
|
}*/
|
|
else if (strcmp(command, "save")==0) // *** SAVE USER DATA *****
|
|
{
|
|
if(Config.Command_Save > thisclient->Session->accesslevel)
|
|
return true;
|
|
thisclient->savedata();
|
|
SendPM(thisclient, "Character data saved");
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "savequest")==0) // *** SAVE USER DATA *****
|
|
{
|
|
if(Config.Command_Save > thisclient->Session->accesslevel)
|
|
return true;
|
|
thisclient->savequests(thisclient);
|
|
SendPM(thisclient, "Character Quest data saved");
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "aiwatch")==0) // set a skill for mobs to use. testing
|
|
{
|
|
//SendPM(thisclient, "trying to use aiwatch");
|
|
if(thisclient->Session->accesslevel < 300 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
UINT newval = atoi(tmp);
|
|
Config.AIWatch = newval;
|
|
SendPM(thisclient, "AI script watching set to %i",newval);
|
|
}
|
|
else if (strcmp(command, "reload")==0) // *** REALOAD DATA FILES ******
|
|
{
|
|
//SendPM(thisclient, "trying to use reload");
|
|
if(Config.Command_Reload > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0 )
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
if(strcmp(tmp, "config")==0)
|
|
{
|
|
LoadConfigurations( (const char*)filename.c_str() );
|
|
GServer->LoadConfig( );
|
|
}
|
|
else if(strcmp(tmp, "mobs")==0)
|
|
GServer->LoadNPCData( );
|
|
else if(strcmp(tmp, "drops")==0)
|
|
//GServer->LoadPYDropsData( );
|
|
GServer->LoadNewDrops( );
|
|
else if(strcmp(tmp, "cmd")==0)
|
|
LoadConfigurations( "commands.ini" );
|
|
else if(strcmp(tmp, "spawns")==0)
|
|
{
|
|
GServer->LoadMonsterSpawn();
|
|
}
|
|
else if(strcmp(tmp, "tdef")==0)
|
|
LoadWayPoints( );
|
|
//else if(strcmp(tmp, "equip")==0)
|
|
//{
|
|
// GServer->LoadEquip();
|
|
//}
|
|
else
|
|
{
|
|
Log( MSG_INFO, "Unrecognized reload command by GM %s" , thisclient->CharInfo->charname);
|
|
SendPM(thisclient, "/reload %s is not a valid command", tmp);
|
|
return true;
|
|
}
|
|
Log( MSG_GMACTION, " %s : /reload %s" , thisclient->CharInfo->charname, tmp);
|
|
SendPM(thisclient, "%s data has been reloaded", tmp);
|
|
return true;
|
|
}
|
|
else if(strcmp(command, "setspeedmod")==0)
|
|
{
|
|
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 if(strcmp(command, "mystat")==0)
|
|
{
|
|
//SendPM(thisclient, "trying to use mystat");
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
if(strcmp(tmp, "ap")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My Attack Power is %i", thisclient->Stats->Attack_Power );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "acc")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My Accuracy is %i", thisclient->Stats->Accury );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "hp")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My current HP is %i", thisclient->Stats->HP );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "mp")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My current MP is %i", thisclient->Stats->MP );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "maxhp")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My Maximum HP is %i", thisclient->GetMaxHP());
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "maxmp")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My maximum MP is %i", thisclient->GetMaxMP());
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "dodge")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My dodge is %i", thisclient->Stats->Dodge);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "def")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My defense is %i", thisclient->Stats->Defense);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "mdef")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My Magic defense is %i", thisclient->Stats->Magic_Defense);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "crit")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My critical is %i", thisclient->Stats->Critical);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "mspd")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My move speed is %i", thisclient->Stats->Move_Speed);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "aspd")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My attack speed is %i", thisclient->Stats->Attack_Speed);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "xprate")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My xp rate is %i", thisclient->Stats->xprate);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "stamina")==0)
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My Stamina is %i", thisclient->CharInfo->stamina);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "weight")==0)
|
|
{
|
|
int weight = thisclient->GetCurrentWeight();
|
|
int maxweight = thisclient->GetMaxWeight();
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "My current weight is %i. max weight = %i", weight,maxweight);
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else if(strcmp(tmp, "zulydrop")==0)
|
|
{
|
|
SendPM(thisclient, "My zuly drop rate is %i", thisclient->Stats->zulydroprate);
|
|
}
|
|
else if(strcmp(tmp, "itemdrop")==0)
|
|
{
|
|
SendPM(thisclient, "My item drop rate is %i", thisclient->Stats->itemdroprate);
|
|
}
|
|
else if(strcmp(tmp, "serverdrop")==0)
|
|
{
|
|
SendPM(thisclient, "Server item drop rate is %i", GServer->Config.DROP_RATE);
|
|
}
|
|
else if(strcmp(tmp, "clan")==0)
|
|
{
|
|
SendPM(thisclient, "My clan id is: %i My clan rank is: %i", thisclient->Clan->clanid, thisclient->Clan->clanrank);
|
|
}
|
|
else if(strcmp(tmp, "map")==0)
|
|
{
|
|
SendPM(thisclient, "My current is: %i ", thisclient->Position->Map);
|
|
}
|
|
else if(strcmp(tmp, "job")==0)
|
|
{
|
|
SendPM(thisclient, "My class id is: %i ", thisclient->CharInfo->Job);
|
|
}
|
|
}
|
|
else if (strcmp(command, "ann")==0) // *** SEND A ANNUNCEMENT ***
|
|
{
|
|
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 > 15) 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 || thisclient->CharInfo->IsDev == 0)
|
|
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 != NULL)
|
|
{
|
|
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
|
|
{
|
|
SendPM(thisclient,"Got to the go command");
|
|
if(Config.Command_Go > thisclient->Session->accesslevel)
|
|
return true;
|
|
SendPM(thisclient,"Got past the accesslevel check");
|
|
if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0; int loc=atoi(tmp);
|
|
int x = 0;
|
|
int y = 0;
|
|
int map = 0;
|
|
if(loc == 1)
|
|
{
|
|
map = 22;
|
|
x = 5749;
|
|
y = 5101;
|
|
}
|
|
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 = 6;
|
|
x = 5243;
|
|
y = 5240;
|
|
}
|
|
else if (loc == 6)
|
|
{
|
|
map = 24;
|
|
x = 5525;
|
|
y = 5376;
|
|
}
|
|
else if (loc == 7)
|
|
{
|
|
map = 31;
|
|
x = 5516;
|
|
y = 5437;
|
|
}
|
|
else if (loc == 8)
|
|
{
|
|
map = 28;
|
|
x = 5639;
|
|
y = 4761;
|
|
}
|
|
else
|
|
{
|
|
SendPM(thisclient, "Please input a number after the go command, below is a list of places and their appropriate number");
|
|
SendPM(thisclient, "1 = Adventurers plains");
|
|
SendPM(thisclient, "2 = The city of Zant");
|
|
SendPM(thisclient, "3 = Junon Polis");
|
|
SendPM(thisclient, "4 = The city of Eucar");
|
|
SendPM(thisclient, "5 = Training grounds");
|
|
SendPM(thisclient, "6 = El Verloon Desert");
|
|
SendPM(thisclient, "7 = Goblin Cave (B1)");
|
|
SendPM(thisclient, "8 = Gorge of Silence");
|
|
SendPM(thisclient, "Example; /go 3");
|
|
}
|
|
|
|
if( (x != 0) && (y != 0) && (map != 0) )
|
|
{
|
|
fPoint coord;
|
|
coord.x = x;
|
|
coord.y = y;
|
|
SendPM(thisclient, "teleport to map: %i",map);
|
|
MapList.Index[map]->TeleportPlayer( thisclient, coord, false );
|
|
Log( MSG_GMACTION, " %s : /go %i" , thisclient->CharInfo->charname, loc);
|
|
}
|
|
return true;
|
|
}
|
|
else if(strcmp(command, "p")==0) //*** READ THE PACKET.TXT AND SEND IT
|
|
{
|
|
if(Config.Command_Pak > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
|
|
char buffer;
|
|
std::string fname = "packet/packet";
|
|
fname += tmp;
|
|
fname += ".txt";
|
|
FILE *packet1 = fopen(fname.c_str(),"r");
|
|
if(packet1==NULL)
|
|
{
|
|
printf("Error opening packet.txt!\n");
|
|
return true;
|
|
}
|
|
unsigned int comm = 0;
|
|
fread( &comm, 1, 2, packet1 );
|
|
BEGINPACKET(pak,comm);
|
|
while((fscanf(packet1,"%c",&buffer))!=EOF)
|
|
ADDBYTE(pak,buffer);
|
|
thisclient->client->SendPacket( &pak );
|
|
fclose(packet1);
|
|
}
|
|
else if (strcmp(command, "mybuffs")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 300)
|
|
return true;
|
|
for(int i=0;i<15;i++)
|
|
{
|
|
if(thisclient->MagicStatus[i].Buff != 0)
|
|
{
|
|
// don't do anything for now. Still working on this concept.
|
|
Log(MSG_GMACTION, "MyBuffs command called. Not yet functional");
|
|
}
|
|
}
|
|
}
|
|
else if (strcmp(command, "level")==0)
|
|
{
|
|
if(Config.Command_Level > thisclient->Session->accesslevel)
|
|
return true;
|
|
char* name;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned level=atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) name = thisclient->CharInfo->charname; else name = tmp;
|
|
Log( MSG_GMACTION, " %s : /level %i %s" , thisclient->CharInfo->charname, level, name);
|
|
return pakGMLevel( thisclient, level, name );
|
|
}
|
|
else if (strcmp(command, "info")==0)
|
|
{
|
|
if(Config.Command_Info > thisclient->Session->accesslevel)
|
|
return true;
|
|
Log( MSG_GMACTION, " %s : /info" , thisclient->CharInfo->charname);
|
|
thisclient->GetPlayerInfo( );
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "exp")==0)
|
|
{
|
|
if(Config.Command_Exp > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned exp=atoi(tmp);
|
|
char* name;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
name = thisclient->CharInfo->charname;
|
|
else
|
|
name = tmp;
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if (otherclient == NULL)
|
|
return true;
|
|
otherclient->CharInfo->Exp += exp;
|
|
BEGINPACKET( pak, 0x79b );
|
|
ADDDWORD ( pak, otherclient->CharInfo->Exp );
|
|
ADDWORD ( pak, otherclient->CharInfo->stamina );
|
|
ADDWORD ( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
Log( MSG_GMACTION, " %s : /exp %i %s" , thisclient->CharInfo->charname, exp, name);
|
|
}
|
|
else if (strcmp(command, "tdmon") == 0)
|
|
{
|
|
if(Config.Command_Mon > thisclient->Session->accesslevel)
|
|
return true;
|
|
unsigned montype = 0;
|
|
unsigned moncount = 1;
|
|
unsigned monAI = 331; //TD Mob AI
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; montype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))!=NULL)moncount = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : spawned %i TD Mobs of type %i" , thisclient->CharInfo->charname, moncount, montype);
|
|
return pakGMMon( thisclient, montype, moncount, monAI );
|
|
}
|
|
else if (strcmp(command, "mon") == 0)
|
|
{
|
|
if(Config.Command_Mon > thisclient->Session->accesslevel)
|
|
return true;
|
|
unsigned montype = 0;
|
|
unsigned moncount = 1;
|
|
unsigned monAI = 0; //default AI. Monster gets whatever AI is normal for its type
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; montype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))!=NULL)moncount = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))!=NULL)monAI = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : spawned %i monsters of type %i with AI %i" , thisclient->CharInfo->charname, moncount, montype, monAI);
|
|
return pakGMMon( thisclient, montype, moncount, monAI );
|
|
}
|
|
else if (strcmp(command, "kick")==0)
|
|
{
|
|
if(Config.Command_Kick > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
CPlayer* otherclient = GServer->GetClientByCharName(name);
|
|
if (otherclient == NULL)
|
|
return true;
|
|
if(thisclient->Session->accesslevel <= otherclient->Session->accesslevel)
|
|
{
|
|
SendPM(thisclient,"You cannot kick that player. His access level is as high as yours");
|
|
SendPM(otherclient,"LOL %s just tried to kick you but his access level isn't higher than yours");
|
|
Log( MSG_GMACTION, " %s : /kick %s" , thisclient->CharInfo->charname, name);
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
Log( MSG_GMACTION, " %s : /kick %s" , thisclient->CharInfo->charname, name);
|
|
return pakGMKick( thisclient, name );
|
|
}
|
|
}
|
|
else if (strcmp(command, "job")==0) // *** Change Job *****
|
|
{
|
|
if(Config.Command_Job > thisclient->Session->accesslevel)
|
|
return true;
|
|
//char* tmp;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* job=tmp;
|
|
Log( MSG_GMACTION, " %s : /job %s" , thisclient->CharInfo->charname, job);
|
|
if(thisclient->CharInfo->Job != 0 || thisclient->Stats->Level<10)
|
|
return true;
|
|
if(strcmp(job,"soldier")==0)
|
|
{
|
|
BEGINPACKET(pak, 0x721);
|
|
ADDWORD (pak, 0x0004);
|
|
ADDWORD (pak, 0x006f);
|
|
ADDWORD (pak, 0x0000);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET( pak, 0x730);
|
|
ADDBYTE(pak, 0x05);
|
|
ADDBYTE(pak, 0x00);
|
|
ADDWORD(pak, 0xf52f);
|
|
ADDWORD(pak, 0x2964);
|
|
thisclient->client->SendPacket( &pak );
|
|
thisclient->CharInfo->Job=111;
|
|
}
|
|
else
|
|
if(strcmp(job,"muse")==0)
|
|
{
|
|
BEGINPACKET(pak, 0x721);
|
|
ADDWORD (pak, 0x0004);
|
|
ADDWORD (pak, 0x00D3);
|
|
ADDWORD (pak, 0x0000);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET( pak, 0x730);
|
|
ADDBYTE(pak, 0x05);
|
|
ADDBYTE(pak, 0x00);
|
|
ADDWORD(pak, 0xdc3b);
|
|
ADDWORD(pak, 0x20cd);
|
|
thisclient->client->SendPacket( &pak );
|
|
thisclient->CharInfo->Job=211;
|
|
}
|
|
else
|
|
if(strcmp(job,"hawker")==0)
|
|
{
|
|
BEGINPACKET(pak, 0x721);
|
|
ADDWORD (pak, 0x0004);
|
|
ADDWORD (pak, 0x0137);
|
|
ADDWORD (pak, 0x0000);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET( pak, 0x730);
|
|
ADDBYTE(pak, 0x05);
|
|
ADDBYTE(pak, 0x00);
|
|
ADDWORD(pak, 0x1104);
|
|
ADDWORD(pak, 0x5150);
|
|
thisclient->client->SendPacket( &pak );
|
|
thisclient->CharInfo->Job=311;
|
|
}
|
|
else
|
|
if(strcmp(job,"dealer")==0)
|
|
{
|
|
BEGINPACKET(pak, 0x721);
|
|
ADDWORD (pak, 0x0004);
|
|
ADDWORD (pak, 0x019b);
|
|
ADDWORD (pak, 0x0000);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET( pak, 0x730);
|
|
ADDBYTE(pak, 0x05);
|
|
ADDBYTE(pak, 0x00);
|
|
ADDWORD(pak, 0x4c1c);
|
|
ADDWORD(pak, 0xef69);
|
|
thisclient->client->SendPacket( &pak );
|
|
thisclient->CharInfo->Job=411;
|
|
}
|
|
}
|
|
else if (strcmp(command, "set")==0)
|
|
{
|
|
if(Config.Command_Set > thisclient->Session->accesslevel)
|
|
return true;
|
|
int refine;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
int id=atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
refine = 0;
|
|
else
|
|
refine=atoi(tmp);
|
|
refine *= 16;
|
|
BEGINPACKET( pak, 0);
|
|
if(EquipList[2].Index[id+100]!=NULL)
|
|
{
|
|
if(id > 200)
|
|
{
|
|
thisclient->items[2].itemnum = id+100; //hats are always 100 positions higher so this should make set line up
|
|
}
|
|
else
|
|
{
|
|
thisclient->items[2].itemnum = id;
|
|
}
|
|
thisclient->items[2].itemtype = 2;
|
|
thisclient->items[2].refine =refine;
|
|
thisclient->items[2].durability = 50;
|
|
thisclient->items[2].lifespan = 100;
|
|
thisclient->items[2].count = 1;
|
|
thisclient->items[2].stats = 0;
|
|
thisclient->items[2].socketed = false;
|
|
thisclient->items[2].appraised = true;
|
|
thisclient->items[2].gem = 0;
|
|
thisclient->UpdateInventory( 2 );
|
|
|
|
RESETPACKET( pak, 0x7a5);
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, 0x0002);
|
|
ADDWORD( pak, id+100); // ITEM NUM
|
|
ADDWORD( pak, BuildItemRefine( thisclient->items[2] ) ); // REFINE
|
|
ADDWORD( pak, thisclient->Stats->Move_Speed ); // REFINE
|
|
SendToVisible( &pak,thisclient );
|
|
}
|
|
if(EquipList[3].Index[id]!=NULL)
|
|
{
|
|
thisclient->items[3].itemnum = id;
|
|
thisclient->items[3].itemtype = 3;
|
|
thisclient->items[3].refine =refine;
|
|
thisclient->items[3].durability = 50;
|
|
thisclient->items[3].lifespan = 100;
|
|
thisclient->items[3].count = 1;
|
|
thisclient->items[3].stats = 0;
|
|
thisclient->items[3].socketed = false;
|
|
thisclient->items[3].appraised = true;
|
|
thisclient->items[3].gem = 0;
|
|
thisclient->UpdateInventory( 3 );
|
|
|
|
RESETPACKET( pak, 0x7a5);
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, 0x0003);
|
|
ADDWORD( pak, id); // ITEM NUM
|
|
ADDWORD( pak, BuildItemRefine( thisclient->items[3] )); // REFINE
|
|
ADDWORD( pak, thisclient->Stats->Move_Speed ); // REFINE
|
|
SendToVisible( &pak,thisclient );
|
|
}
|
|
if(EquipList[4].Index[id]!=NULL)
|
|
{
|
|
thisclient->items[5].itemnum = id;
|
|
thisclient->items[5].itemtype = 4;
|
|
thisclient->items[5].refine =refine;
|
|
thisclient->items[5].durability = 50;
|
|
thisclient->items[5].lifespan = 100;
|
|
thisclient->items[5].count = 1;
|
|
thisclient->items[5].stats = 0;
|
|
thisclient->items[5].socketed = false;
|
|
thisclient->items[5].appraised = true;
|
|
thisclient->items[5].gem = 0;
|
|
|
|
thisclient->UpdateInventory( 4 );
|
|
|
|
RESETPACKET( pak, 0x7a5);
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, 5);
|
|
ADDWORD( pak, id); // ITEM NUM
|
|
ADDWORD( pak, BuildItemRefine( thisclient->items[5] )); // REFINE
|
|
ADDWORD( pak, thisclient->Stats->Move_Speed ); // REFINE 2602
|
|
SendToVisible( &pak,thisclient );
|
|
}
|
|
if(EquipList[5].Index[id]!=NULL)
|
|
{
|
|
thisclient->items[6].itemnum = id;
|
|
thisclient->items[6].itemtype = 5;
|
|
thisclient->items[6].refine =refine;
|
|
thisclient->items[6].durability = 50;
|
|
thisclient->items[6].lifespan = 100;
|
|
thisclient->items[6].count = 1;
|
|
thisclient->items[6].stats = 0;
|
|
thisclient->items[6].socketed = false;
|
|
thisclient->items[6].appraised = true;
|
|
thisclient->items[6].gem = 0;
|
|
|
|
thisclient->UpdateInventory( 6 );
|
|
|
|
RESETPACKET( pak, 0x7a5);
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, 6);
|
|
ADDWORD( pak, id); // ITEM NUM
|
|
ADDWORD( pak, BuildItemRefine( thisclient->items[6] )); // REFINE
|
|
ADDWORD( pak, thisclient->Stats->Move_Speed); // REFINE
|
|
SendToVisible( &pak,thisclient );
|
|
}
|
|
thisclient->SetStats( );
|
|
}
|
|
else if (strcmp(command, "cha")==0)
|
|
{
|
|
if(Config.Command_Cha > thisclient->Session->accesslevel)
|
|
return true;
|
|
int slot;
|
|
int tipo;
|
|
int id;
|
|
int stats;
|
|
int socket;
|
|
int refine;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
if(strcmp(tmp, "mask")==0)
|
|
{
|
|
slot=1;
|
|
tipo=1;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "cap")==0)
|
|
{
|
|
slot=2;
|
|
tipo=2;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "suit")==0)
|
|
{
|
|
slot=3;
|
|
tipo=3;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "back")==0)
|
|
{
|
|
slot=4;
|
|
tipo=6;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "glov")==0)
|
|
{
|
|
slot=5;
|
|
tipo=4;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "shoe")==0)
|
|
{
|
|
slot=6;
|
|
tipo=5;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "weap")==0)
|
|
{
|
|
slot=7;
|
|
tipo=8;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "shield")==0)
|
|
{
|
|
slot=8;
|
|
tipo=9;
|
|
}
|
|
else
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
id=atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
stats=0;
|
|
else
|
|
stats=atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
socket=0;
|
|
else
|
|
socket=1;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
refine=0;
|
|
else
|
|
refine=atoi(tmp);
|
|
thisclient->items[slot].itemnum = id;
|
|
thisclient->items[slot].itemtype = tipo;
|
|
thisclient->items[slot].refine = refine;
|
|
thisclient->items[slot].durability = 50;
|
|
thisclient->items[slot].lifespan = 100;
|
|
thisclient->items[slot].count = 1;
|
|
thisclient->items[slot].stats = stats;
|
|
thisclient->items[slot].socketed = socket;
|
|
thisclient->items[slot].appraised = true;
|
|
if(stats > 300)
|
|
{
|
|
thisclient->items[slot].gem = stats;
|
|
thisclient->items[slot].socketed = 1;
|
|
}
|
|
else
|
|
{
|
|
thisclient->items[slot].gem = 0;
|
|
}
|
|
|
|
BEGINPACKET( pak, 0x7a5);
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, slot);
|
|
ADDWORD( pak, id); // ITEM NUM
|
|
ADDWORD( pak, BuildItemRefine( thisclient->items[slot] )); // REFINE
|
|
ADDWORD( pak, thisclient->Stats->Move_Speed ); // REFINE 2602
|
|
SendToVisible( &pak,thisclient );
|
|
|
|
thisclient->UpdateInventory( slot );
|
|
thisclient->SetStats( );
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "learnskill")==0)
|
|
{
|
|
if (thisclient->Session->accesslevel < 300)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT skillId = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /learnskill %i", thisclient->CharInfo->charname, skillId);
|
|
if (skillId < 0) return false;
|
|
if (skillId > SkillList.size()) return false;
|
|
LearnSkill(thisclient, skillId);
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "spawn")==0)
|
|
{
|
|
if(Config.Command_ESpawn > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
int mobid;
|
|
int max;
|
|
int radius;
|
|
int stime;
|
|
int spawntype;
|
|
int triggermontype;
|
|
int triggeramount;
|
|
int lim;
|
|
int spawnk;
|
|
int aggro;
|
|
int refvar; //Objvar NPC reference
|
|
int refval; //Objvar array reference
|
|
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
else
|
|
mobid = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
else
|
|
max = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
else
|
|
radius = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
else
|
|
stime = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
else
|
|
spawntype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
triggermontype = 0;
|
|
else
|
|
triggermontype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
triggeramount = 0;
|
|
else
|
|
triggeramount = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
lim = 0;
|
|
else
|
|
lim = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
spawnk = 1;
|
|
else
|
|
spawnk = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
aggro = 1;
|
|
else
|
|
aggro = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
refvar = 0;
|
|
else
|
|
refvar = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
refval = 0;
|
|
else
|
|
refval = atoi(tmp);
|
|
|
|
GServer->DB->QExecute("INSERT INTO list_special_spawns (map,montype,min,max,respawntime,x,y,radius,agressive,triggerammount,triggermontype,spawntype,areatrigger,lim,spawnk,refvar,refval) VALUES(%i,%i,%i,%i,%i,%f,%f,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i)",
|
|
thisclient->Position->Map,mobid,0,max,stime,thisclient->Position->current.x,thisclient->Position->current.y,radius,aggro,triggeramount,triggermontype,spawntype,1,lim,spawnk,refvar,refval );
|
|
CSpawnArea* thisspawn = new (nothrow) CSpawnArea;
|
|
if(thisspawn == NULL)
|
|
{
|
|
Log(MSG_ERROR, "Error allocing memory" );
|
|
DB->QFree( );
|
|
return false;
|
|
}
|
|
GServer->maxSpawnId++;
|
|
thisspawn->id = GServer->maxSpawnId;
|
|
thisspawn->map = thisclient->Position->Map;
|
|
thisspawn->montype = mobid;
|
|
thisspawn->min = 0;//atoi(row[3]);
|
|
thisspawn->max = max;
|
|
thisspawn->respawntime = stime;
|
|
thisspawn->point.x = thisclient->Position->current.x;
|
|
thisspawn->point.y = thisclient->Position->current.y;
|
|
thisspawn->radius = radius;
|
|
thisspawn->amon = 0;
|
|
thisspawn->lastRespawnTime = 0;
|
|
thisspawn->type = spawntype;
|
|
thisspawn->triggertype = triggermontype;
|
|
thisspawn->triggeramount = triggeramount;
|
|
thisspawn->aggressive = aggro;
|
|
thisspawn->typeoftrigger = 1;
|
|
thisspawn->limit = lim;
|
|
thisspawn->spawnkey = spawnk;
|
|
thisspawn->triggercount = 0;
|
|
thisspawn->thisnpc = GetNPCDataByID( thisspawn->montype );
|
|
thisspawn->RefVar = refvar;
|
|
thisspawn->RefVal = refval;
|
|
if(thisspawn->thisnpc == NULL)
|
|
{
|
|
SendPM(thisclient, "Invalid montype - Spawn %i will not be added", thisspawn->id );
|
|
delete thisspawn;
|
|
return true;
|
|
}
|
|
MapList.Index[thisspawn->map]->MonsterSpawnList.push_back( thisspawn );
|
|
SendPM(thisclient,"Spawn successfully saved with spawn id %i.",thisspawn->id);
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "refine")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 300)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
int slot = 7; //defaults to weapon
|
|
int tipo;
|
|
int itemrefine;
|
|
if(strcmp(tmp, "mask")==0)
|
|
{
|
|
slot=1;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "cap")==0)
|
|
{
|
|
slot=2;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "suit")==0)
|
|
{
|
|
slot=3;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "back")==0)
|
|
{
|
|
slot=4;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "glov")==0)
|
|
{
|
|
slot=5;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "shoe")==0)
|
|
{
|
|
slot=6;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "weap")==0)
|
|
{
|
|
slot=7;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "shield")==0)
|
|
{
|
|
slot=8;
|
|
}
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemrefine =0;
|
|
else
|
|
itemrefine = atoi(tmp)<10?atoi(tmp)*16:9*16;
|
|
thisclient->items[slot].refine = itemrefine;
|
|
|
|
BEGINPACKET( pak, 0x7a5);
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, slot);
|
|
ADDWORD( pak, thisclient->items[slot].itemnum); // ITEM NUM
|
|
ADDWORD( pak, BuildItemRefine( thisclient->items[slot] )); // REFINE
|
|
ADDWORD( pak, thisclient->Stats->Move_Speed ); // REFINE 2602
|
|
SendToVisible( &pak,thisclient );
|
|
|
|
thisclient->UpdateInventory( slot );
|
|
thisclient->SetStats( );
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "itemstat")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 300)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
int slot = 7; //defaults to weapon
|
|
int tipo;
|
|
int itemstat;
|
|
if(strcmp(tmp, "mask")==0)
|
|
{
|
|
slot=1;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "cap")==0)
|
|
{
|
|
slot=2;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "suit")==0)
|
|
{
|
|
slot=3;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "back")==0)
|
|
{
|
|
slot=4;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "glov")==0)
|
|
{
|
|
slot=5;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "shoe")==0)
|
|
{
|
|
slot=6;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "weap")==0)
|
|
{
|
|
slot=7;
|
|
}
|
|
else
|
|
if(strcmp(tmp, "shield")==0)
|
|
{
|
|
slot=8;
|
|
}
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemstat = 0;
|
|
else
|
|
itemstat = atoi(tmp);
|
|
thisclient->items[slot].stats= itemstat;
|
|
if(itemstat > 300)
|
|
{
|
|
thisclient->items[slot].socketed = 1;
|
|
thisclient->items[slot].gem = itemstat;
|
|
}
|
|
else
|
|
thisclient->items[slot].gem = 0;
|
|
thisclient->items[slot].appraised = true;
|
|
|
|
//BEGINPACKET( pak, 0x7a5);
|
|
//ADDWORD( pak, thisclient->clientid );
|
|
//ADDWORD( pak, slot);
|
|
//ADDWORD( pak, thisclient->items[slot].itemnum); // ITEM NUM
|
|
//ADDWORD( pak, BuildItemRefine( thisclient->items[slot] )); // REFINE
|
|
//ADDWORD( pak, thisclient->Stats->Move_Speed ); // REFINE 2602
|
|
//SendToVisible( &pak,thisclient );
|
|
|
|
BEGINPACKET( pak,0x7a5 );
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, slot );
|
|
ADDDWORD( pak, BuildItemShow(thisclient->items[slot])); // ITEM
|
|
ADDWORD ( pak, thisclient->Stats->Move_Speed);
|
|
SendToVisible( &pak, thisclient );
|
|
|
|
thisclient->UpdateInventory( slot );
|
|
thisclient->SetStats( );
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "item")==0)//Modified by Hiei (added refine/socket/stats)
|
|
{
|
|
if(Config.Command_Item > thisclient->Session->accesslevel)
|
|
return true;
|
|
UINT itemrefine, itemstats, itemls, itemsocket;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT itemid =atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT itemtype =atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT itemamount =atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemrefine =0;
|
|
else
|
|
itemrefine = atoi(tmp) < 10?atoi(tmp)*16:9*16;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
itemls = 100;
|
|
else
|
|
itemls = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
itemsocket = 0;
|
|
else
|
|
itemsocket = atoi(tmp)==0?false:true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemstats =0;
|
|
else
|
|
itemstats =atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /item %i,%i,%i,%i,%i,%i" , thisclient->CharInfo->charname, itemid, itemtype, itemamount , itemrefine , itemsocket ,itemstats);
|
|
return pakGMItem( thisclient , itemid , itemtype , itemamount , itemrefine , itemls, itemstats , itemsocket );
|
|
}
|
|
else if (strcmp(command, "levelup")==0 || strcmp(command,"l")==0)
|
|
{
|
|
if(Config.Command_LevelUp > thisclient->Session->accesslevel)
|
|
return true;
|
|
Log( MSG_GMACTION, " %s : /levelup" , thisclient->CharInfo->charname);
|
|
thisclient->CharInfo->Exp += thisclient->GetLevelEXP();
|
|
}
|
|
else if (strcmp(command, "drop")==0)
|
|
{
|
|
if(Config.Command_Drop > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned itemtype=atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned itemid=atoi(tmp);
|
|
unsigned int itemcount = 0;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemcount = 1;
|
|
else
|
|
itemcount = atoi(tmp);
|
|
if(itemtype < 10 || itemtype > 12 )
|
|
itemcount = 1;
|
|
Log( MSG_GMACTION, " %s : /drop %i,%i" , thisclient->CharInfo->charname, itemtype, itemid);
|
|
|
|
CDrop* thisdrop = new CDrop;
|
|
assert(thisdrop);
|
|
thisdrop->clientid = GetNewClientID();
|
|
thisdrop->type = 2;
|
|
thisdrop->pos.x = thisclient->Position->current.x;
|
|
thisdrop->pos.y = thisclient->Position->current.y;
|
|
thisdrop->posMap = thisclient->Position->Map;
|
|
thisdrop->droptime = time(NULL);
|
|
|
|
ClearItem(thisdrop->item);
|
|
thisdrop->item.itemnum = itemid;
|
|
thisdrop->item.itemtype = itemtype;
|
|
thisdrop->item.count = itemcount;
|
|
thisdrop->item.refine = 0;
|
|
thisdrop->item.durability = 35;
|
|
thisdrop->item.lifespan = 100;
|
|
thisdrop->item.appraised = true;
|
|
thisdrop->item.socketed = false;
|
|
thisdrop->item.stats = 0;
|
|
thisdrop->item.gem = 0;
|
|
|
|
thisdrop->amount = 1;
|
|
thisdrop->owner = 0;
|
|
CMap* map = MapList.Index[thisdrop->posMap];
|
|
map->AddDrop( thisdrop );
|
|
}
|
|
else if(strcmp(command, "givezuly")==0)
|
|
{
|
|
if(Config.Command_GiveZuly > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; char* name = tmp;
|
|
if((tmp = strtok(NULL, " ")) == NULL) return true; int zuly = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /givezuly %s, %i" , thisclient->CharInfo->charname, name, zuly);
|
|
return pakGMZulygive(thisclient, name, zuly);
|
|
}
|
|
else if(strcmp(command, "unionpoints") == 0)
|
|
{
|
|
if(Config.Command_GiveZuly > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " ")) == NULL) return true; char* name = tmp;
|
|
if((tmp = strtok(NULL, " ")) == NULL) return true; int Upoints = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /unionpoints %s, %i" , thisclient->CharInfo->charname, name, Upoints);
|
|
|
|
return pakGMUnionPoints(thisclient, name, Upoints);
|
|
}
|
|
else if(strcmp(command, "npc")==0)
|
|
{
|
|
if(Config.Command_Npc > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned npcid=atoi(tmp);
|
|
unsigned npcdialog = 0;
|
|
if((tmp = strtok(NULL, " "))!=NULL)
|
|
npcdialog=atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /npc %i, %i" , thisclient->CharInfo->charname, npcid, npcdialog);
|
|
return pakGMNpc(thisclient, npcid, npcdialog);
|
|
}
|
|
else if(strcmp(command, "givefairy") == 0)
|
|
{
|
|
if(Config.Command_GiveFairy > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true; char* name = tmp;
|
|
if((tmp = strtok(NULL, " ")) == NULL) return true; unsigned mode = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /givefairy %s, %i" , thisclient->CharInfo->charname, name, mode);
|
|
return pakGMFairyto(thisclient, name, mode);
|
|
}
|
|
else if(strcmp(command, "fairymode") == 0)
|
|
{
|
|
if(Config.Command_ManageFairy > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned mode=atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /fairymode mode: %i" , thisclient->CharInfo->charname, mode);
|
|
return pakGMManageFairy(thisclient, mode);
|
|
}
|
|
else if(strcmp(command, "fairywait")==0)
|
|
{
|
|
if(Config.Command_ChangeFairyWait > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned value=atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /fairywait value: %i" , thisclient->CharInfo->charname, value);
|
|
return pakGMChangeFairyWait(thisclient, value);
|
|
}
|
|
else if(strcmp(command, "fairystay")==0)
|
|
{
|
|
if(Config.Command_ChangeFairyStay > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned value=atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /fairystay value: %i" , thisclient->CharInfo->charname, value);
|
|
return pakGMChangeFairyStay(thisclient, value);
|
|
}
|
|
else if(strcmp(command, "fairytestmode")==0)
|
|
{
|
|
if(Config.Command_ChangeFairyTestMode > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " "))==NULL) return true; unsigned mode=atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /fairytestmode mode: %i" , thisclient->CharInfo->charname, mode);
|
|
return pakGMChangeFairyTestMode(thisclient, mode);
|
|
}
|
|
else if (strcmp(command, "move")==0)
|
|
{
|
|
if(Config.Command_Move > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
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 : /move %s,%i,%i,%i" , thisclient->CharInfo->charname, name, map, x, y);
|
|
return pakGMTeleOtherPlayer(thisclient, name, map, x, y);
|
|
}
|
|
else if (strcmp(command, "goto")==0)
|
|
{
|
|
if(Config.Command_Goto > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
Log( MSG_GMACTION, " %s : /goto %s" , thisclient->CharInfo->charname, name);
|
|
return pakGMTeleToPlayer(thisclient, name);
|
|
}
|
|
else if (strcmp(command, "teletome")==0)
|
|
{
|
|
if(Config.Command_TeleToMe > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
Log( MSG_GMACTION, " %s : /teletome %s" , thisclient->CharInfo->charname, name);
|
|
if(strcmp(name,"all")==0)
|
|
{
|
|
return pakGMTeleAllHere(thisclient);
|
|
}
|
|
return pakGMTelePlayerHere(thisclient, name);
|
|
}
|
|
else if(strcmp(command, "CharInfo")==0)
|
|
{
|
|
if(Config.Command_PlayerInfo > thisclient->Session->accesslevel)
|
|
return true;
|
|
if((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
Log( MSG_GMACTION, " %s : /CharInfo %s" , thisclient->CharInfo->charname, name);
|
|
return pakGMInfo(thisclient, name);
|
|
}
|
|
/*else if (strcmp(command, "give2")==0)
|
|
{
|
|
if(Config.Command_Give2 > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned itemid = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned itemtype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; unsigned itemamount = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /give2 %s,%i,%i,%i" , thisclient->CharInfo->charname, name, itemid, itemtype, itemamount);
|
|
return pakGMItemtoplayer( thisclient , name , itemid , itemtype , itemamount );
|
|
|
|
}*/
|
|
else if (strcmp(command, "give2")==0)
|
|
{
|
|
if(Config.Command_Item > thisclient->Session->accesslevel)
|
|
return true;
|
|
UINT itemrefine, itemstats, itemls, itemsocket;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name = tmp;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT itemid = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT itemtype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; UINT itemamount = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemrefine =0;
|
|
else
|
|
itemrefine = atoi(tmp)<10?atoi(tmp)*16:9*16;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemls = 100;
|
|
else
|
|
itemls = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemsocket = 0;
|
|
else
|
|
itemsocket =atoi(tmp)==0?false:true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
itemstats = 0;
|
|
else
|
|
itemstats =atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /give2 %s,%i,%i,%i,%i,%i,%i,%i" , thisclient->CharInfo->charname, name, itemid , itemtype , itemamount , itemrefine , itemls, itemstats , itemsocket);
|
|
return pakGMItemtoplayer( thisclient , name , itemid , itemtype , itemamount , itemrefine , itemls, itemstats , itemsocket );
|
|
}
|
|
else if (strcmp(command, "ban")==0)
|
|
{
|
|
if(Config.Command_Ban > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* name=tmp;
|
|
Log( MSG_GMACTION, " %s : /ban %s" , thisclient->CharInfo->charname, name);
|
|
return pakGMBan( thisclient, name );
|
|
}
|
|
else if (strcmp(command, "ani")==0)
|
|
{
|
|
if(Config.Command_Ani > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
unsigned anid =atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /ani %i" , thisclient->CharInfo->charname, anid);
|
|
pakGMDoEmote( thisclient, anid );
|
|
}
|
|
else if(strcmp(command,"summon")==0)
|
|
{
|
|
if(Config.Command_Summon > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
unsigned int summon = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /summon %i" , thisclient->CharInfo->charname, summon);
|
|
fPoint position = RandInCircle( thisclient->Position->current, 5 );
|
|
CMap* map = MapList.Index[thisclient->Position->Map];
|
|
map->AddMonster( summon, position, thisclient->clientid, 0,0,168 );
|
|
//Start Animation
|
|
BEGINPACKET( pak, 0x7b2 );
|
|
ADDWORD ( pak, thisclient->clientid );
|
|
ADDWORD ( pak, 2802 );
|
|
SendToVisible( &pak, thisclient );
|
|
//Finish Animation
|
|
RESETPACKET( pak, 0x7bb );
|
|
ADDWORD ( pak, thisclient->clientid );
|
|
SendToVisible( &pak, thisclient );
|
|
//????
|
|
RESETPACKET( pak, 0x7b9);
|
|
ADDWORD ( pak, thisclient->clientid);
|
|
ADDWORD ( pak, 1286 );
|
|
SendToVisible( &pak, thisclient );
|
|
// Add our Mob to the mobs list
|
|
}
|
|
else if (strcmp(command,"setxprate")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
unsigned int newxprate = atoi(tmp);
|
|
GServer->Config.EXP_RATE = newxprate;
|
|
Log( MSG_GMACTION, "EXP Rate set to %i" , newxprate);
|
|
}
|
|
else if (strcmp(command,"setdroprate")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
unsigned int newdroprate = atoi(tmp);
|
|
GServer->Config.DROP_RATE= newdroprate;
|
|
Log( MSG_GMACTION, "Drop Rate set to %i" , newdroprate);
|
|
}
|
|
else if (strcmp(command,"setzulyrate")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
unsigned int newzulyrate = atoi(tmp);
|
|
GServer->Config.ZULY_RATE = newzulyrate;
|
|
Log( MSG_GMACTION, "Zuly Rate set to %i" , newzulyrate);
|
|
}
|
|
else if (strcmp(command,"delwp")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
int counter = 0;
|
|
for(int i=0;i<100;i++)
|
|
{
|
|
|
|
if(GServer->WPList[thisclient->Position->Map][i].WPType != 0)
|
|
{
|
|
GServer->WPList[thisclient->Position->Map][i].WPType = 0;
|
|
GServer->WPList[thisclient->Position->Map][i].X = 0;
|
|
GServer->WPList[thisclient->Position->Map][i].Y = 0;
|
|
counter++;
|
|
}
|
|
}
|
|
if(counter > 0)
|
|
{
|
|
SendPM(thisclient, "All WayPoints in this map have been deleted. Use /savewp to make the change in the DB too");
|
|
return true;
|
|
}
|
|
SendPM(thisclient, "No Waypoints were found for this map");
|
|
return true;
|
|
}
|
|
else if (strcmp(command,"setwp")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
{
|
|
SendPM(thisclient, "Sorry! You do not have access to this command");
|
|
return true;
|
|
}
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
return true;
|
|
unsigned int wptype = atoi(tmp);
|
|
if(wptype > 3 )
|
|
{
|
|
SendPM(thisclient, "Data not saved. WP Type cannot be greater than 3");
|
|
return true;
|
|
}
|
|
if(wptype == 0)
|
|
{
|
|
SendPM(thisclient, "Data not saved. WP Type cannot be zero");
|
|
return true;
|
|
}
|
|
SendPM(thisclient, "REMINDER. Changes made here are not permanent. please use /savewp to make the change in the DB too");
|
|
UINT nextentry = 1;
|
|
bool firstentry = false;
|
|
bool finalentry = false;
|
|
UINT mapid = thisclient->Position->Map;
|
|
for(int i=1;i<100;i++) //let's see what is already set for this map
|
|
{
|
|
int j = GServer->WPList[mapid][i].WPType;
|
|
if(j > 0)
|
|
{
|
|
nextentry++;
|
|
if(j == 1)
|
|
firstentry = true;
|
|
if(j == 3)
|
|
finalentry = true;
|
|
}
|
|
}
|
|
if(wptype == 1) //first Way Point
|
|
{
|
|
if(firstentry == true)
|
|
{
|
|
SendPM(thisclient, "The path for this map already contains a start point. You will need to delete the list before adding a new one");
|
|
return true;
|
|
}
|
|
GServer->WPList[mapid][nextentry].WPType = 1;
|
|
GServer->WPList[mapid][nextentry].X = thisclient->Position->current.x;
|
|
GServer->WPList[mapid][nextentry].Y = thisclient->Position->current.y;
|
|
SendPM(thisclient, "A new TDef Start point has been added for this map");
|
|
return true;
|
|
}
|
|
if(wptype == 2) //regular Way Point
|
|
{
|
|
if(firstentry == false)
|
|
{
|
|
SendPM(thisclient, "The path for this map does not contain a start point. You will need to add one before you can add regular waypoints");
|
|
return true;
|
|
}
|
|
if(finalentry == true)
|
|
{
|
|
SendPM(thisclient, "The path for this map already contains a Final destination point. You cannot add more regular way points until you delete it");
|
|
return true;
|
|
}
|
|
GServer->WPList[mapid][nextentry].WPType = 2;
|
|
GServer->WPList[mapid][nextentry].X = thisclient->Position->current.x;
|
|
GServer->WPList[mapid][nextentry].Y = thisclient->Position->current.y;
|
|
SendPM(thisclient, "A new TDef Way Point has been added for this map");
|
|
return true;
|
|
}
|
|
if(wptype == 3) //Final Way Point
|
|
{
|
|
if(finalentry == true)
|
|
{
|
|
SendPM(thisclient, "The path for this map already contains a Final destination point. You will need to delete the list before adding a new one");
|
|
return true;
|
|
}
|
|
GServer->WPList[mapid][nextentry].WPType = 3;
|
|
GServer->WPList[mapid][nextentry].X = thisclient->Position->current.x;
|
|
GServer->WPList[mapid][nextentry].Y = thisclient->Position->current.y;
|
|
SendPM(thisclient, "A new TDef Final Point has been added for this map");
|
|
return true;
|
|
}
|
|
SendPM(thisclient, "Unrecognised SetWP command");
|
|
return true; //just to catch any non handled stuff
|
|
}
|
|
else if (strcmp(command,"savewp")==0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
bool firstentry = false;
|
|
bool finalentry = false;
|
|
UINT mapid = thisclient->Position->Map;
|
|
for(int i=1;i<100;i++) //let's see what is already set for this map
|
|
{
|
|
int j = GServer->WPList[mapid][i].WPType;
|
|
if(j > 0)
|
|
{
|
|
if(j == 1)
|
|
firstentry = true;
|
|
if(j == 3)
|
|
finalentry = true;
|
|
}
|
|
}
|
|
if(firstentry == false)
|
|
{
|
|
SendPM(thisclient, "Cannot save to the database. The WayPoint list for this map contains no start point.");
|
|
return true;
|
|
}
|
|
if(finalentry == false)
|
|
{
|
|
SendPM(thisclient, "Cannot save to the database. The WayPoint list for this map contains no final destination point.");
|
|
return true;
|
|
}
|
|
//save the data
|
|
GServer->DB->QExecute("DELETE FROM list_waypoints WHERE mapid=%i", mapid);
|
|
for(int j=1;j<100;j++)
|
|
{
|
|
if(GServer->WPList[mapid][j].WPType != 0)
|
|
GServer->DB->QExecute("INSERT INTO list_waypoints (mapid,wpnum,mapx,mapy,wptype) VALUES(%i,%i,%f,%f,%i)",
|
|
mapid, j, GServer->WPList[mapid][j].X, GServer->WPList[mapid][j].Y,GServer->WPList[mapid][j].WPType);
|
|
}
|
|
SendPM(thisclient, "The Waypoint list for this map has been saved to the database.");
|
|
return true;
|
|
}
|
|
else if (strcmp(command,"checkwp") == 0)
|
|
{
|
|
if(thisclient->Session->accesslevel < 900 || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
UINT mapid = thisclient->Position->Map;
|
|
for(unsigned int i=0;i<20;i++)
|
|
{
|
|
SendPM(thisclient, "Waypoint %i type is %i",i,GServer->WPList[mapid][i].WPType);
|
|
}
|
|
}
|
|
else if (strcmp(command, "shutdown")==0)
|
|
{
|
|
if(Config.Command_Shutdown > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
unsigned int minutes =atoi(tmp);
|
|
char text[200];
|
|
sprintf( text, "Server will shutdown in %i minutes, Please logout NOW to be sure your information is saved correctly.",
|
|
minutes );
|
|
BEGINPACKET( pak, 0x702 );
|
|
ADDSTRING ( pak, thisclient->CharInfo->charname );
|
|
ADDSTRING ( pak, "> " );
|
|
ADDSTRING ( pak, text );
|
|
ADDBYTE ( pak, 0x00 );
|
|
SendToAll ( &pak );
|
|
pthread_create( &WorldThread[SHUTDOWN_THREAD], NULL, (void *(__cdecl *)(void *))ShutdownServer, (PVOID)minutes);
|
|
Log( MSG_GMACTION, " %s : /shutdown %u" , thisclient->CharInfo->charname, shutdown);
|
|
}
|
|
else if(strcmp(command, "dquest")==0) // toggle quest debug mode
|
|
{
|
|
if(Config.Command_DQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
char buffer2[200];
|
|
if( thisclient->questdebug )
|
|
{
|
|
thisclient->questdebug = false;
|
|
sprintf ( buffer2, "Quest Debug Mode disabled" );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else
|
|
{
|
|
thisclient->questdebug = true;
|
|
sprintf ( buffer2, "Quest Debug Mode enabled" );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
return true;
|
|
}
|
|
else if(strcmp(command, "debugmode")==0) //sets the GM into debugmode. PMs will be sent at various parts of the code
|
|
{
|
|
if(thisclient->Session->accesslevel <= 100)
|
|
return true;
|
|
char buffer2[200];
|
|
if( thisclient->Session->codedebug || thisclient->CharInfo->IsDev == 0)
|
|
{
|
|
thisclient->Session->codedebug = false;
|
|
|
|
sprintf ( buffer2, "Debug Mode disabled" );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else
|
|
{
|
|
thisclient->Session->codedebug = true;
|
|
sprintf ( buffer2, "Debug Mode enabled" );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
return true;
|
|
}
|
|
else if(strcmp(command, "iquest")==0)
|
|
{
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
int n=1;
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true;
|
|
unsigned int itemquest = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " ")) != NULL)
|
|
n = atoi(tmp);
|
|
if( thisclient->questdebug )
|
|
{
|
|
for(int i=0;i<n;i++)
|
|
{
|
|
BEGINPACKET( pak, 0x731 )
|
|
ADDWORD ( pak, itemquest );
|
|
thisclient->client->SendPacket( &pak );
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
else if(strcmp(command, "addquest")==0)
|
|
{
|
|
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
unsigned int questnum =atoi(tmp);
|
|
Log( MSG_GMACTION, "add quest %i" , questnum);
|
|
for(int i=0;i<10;i++)
|
|
{
|
|
if (thisclient->quest.quests[i].QuestID != 0) continue;
|
|
thisclient->quest.quests[i].QuestID = questnum;
|
|
thisclient->quest.quests[i].StartTime = clock_t();
|
|
Log( MSG_GMACTION, "quest added %i" , thisclient->quest.quests[i].QuestID);
|
|
|
|
}
|
|
}
|
|
else if(strcmp(command, "listquest")==0)
|
|
{
|
|
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
SendPM( thisclient, "Current Quests:" );
|
|
for(int i=0;i<10;i++)
|
|
{
|
|
if (thisclient->quest.quests[i].QuestID == 0) continue;
|
|
SendPM( thisclient, "Quest[%i]: %i[%i] %i[%i] %i[%i] %i[%i] %i[%i]" , thisclient->quest.quests[i].QuestID, thisclient->quest.quests[i].Items[0].itemnum, thisclient->quest.quests[i].Items[0].count, thisclient->quest.quests[i].Items[1].itemnum, thisclient->quest.quests[i].Items[1].count, thisclient->quest.quests[i].Items[2].itemnum,thisclient->quest.quests[i].Items[2].count,thisclient->quest.quests[i].Items[3].itemnum,thisclient->quest.quests[i].Items[3].count,thisclient->quest.quests[i].Items[4].itemnum,thisclient->quest.quests[i].Items[4].count);
|
|
}
|
|
}
|
|
else if(strcmp(command, "listqflag") == 0)
|
|
{
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
SendPM( thisclient, "The following quest flags are set: ");
|
|
//for (dword i = 0; i < 0x40; i++)
|
|
//{
|
|
// char buf2[5];
|
|
// sprintf(buf2, "%i ", thisclient->quest.flags[i]);
|
|
// buffer.append(buf2);
|
|
// if (i > 0 && i%10 == 0)
|
|
// {
|
|
// SendPM(thisclient, (char*)buffer.c_str());
|
|
// buffer = "";
|
|
// }
|
|
//}
|
|
for (int i=0;i<64;i++)
|
|
{
|
|
for(int j=0;j<8;j++)
|
|
{
|
|
if(thisclient->quest.Qflags[i][j] == 1)
|
|
{
|
|
int flagval = i*8 + j;
|
|
SendPM( thisclient, "flag %i",flagval);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if(strcmp(command, "listqswitch") == 0)
|
|
{
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
SendPM( thisclient, "The following quest switches are set: ");
|
|
char buffer[200];
|
|
for(unsigned int j=0;j<=5;j++)
|
|
{
|
|
sprintf(buffer, "Switch [%i] = %02x ", j, thisclient->quest.quests[0].Switches[j]);
|
|
SendPM( thisclient, buffer);
|
|
}
|
|
}
|
|
else if(strcmp(command, "listqvar") == 0)
|
|
{
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
SendPM( thisclient, "Quest Variables");
|
|
|
|
string buffer = "Episode: ";
|
|
for(dword i = 0; i < 5; i++)
|
|
{
|
|
char buf2[5];
|
|
sprintf(buf2, "%02x ", thisclient->quest.EpisodeVar[i]);
|
|
buffer.append(buf2);
|
|
}
|
|
SendPM( thisclient, (char*)buffer.c_str() );
|
|
|
|
buffer = "Job: ";
|
|
for(dword i = 0; i < 3; i++)
|
|
{
|
|
char buf2[5];
|
|
sprintf(buf2, "%02x ", thisclient->quest.JobVar[i]);
|
|
buffer.append(buf2);
|
|
}
|
|
SendPM( thisclient, (char*)buffer.c_str());
|
|
|
|
buffer = "Planet: ";
|
|
for(dword i = 0; i < 7; i++)
|
|
{
|
|
char buf2[5];
|
|
sprintf(buf2, "%02x ", thisclient->quest.PlanetVar[i]);
|
|
buffer.append(buf2);
|
|
}
|
|
SendPM( thisclient, (char*)buffer.c_str());
|
|
|
|
buffer = "Union: ";
|
|
for(dword i = 0; i < 10; i++)
|
|
{
|
|
char buf2[5];
|
|
sprintf(buf2, "%02x ", thisclient->quest.UnionVar[i]);
|
|
buffer.append(buf2);
|
|
}
|
|
SendPM( thisclient, (char*)buffer.c_str());
|
|
|
|
for (dword j = 0; j < 10; j++)
|
|
{
|
|
if (thisclient->quest.quests[j].QuestID == 0) continue;
|
|
buffer = "Quest: ";
|
|
char buf3[5];
|
|
sprintf(buf3, "%i ",thisclient->quest.quests[j].QuestID);
|
|
buffer.append(buf3);
|
|
for(dword i = 0; i < 10; i++)
|
|
{
|
|
char buf2[5];
|
|
sprintf(buf2, "%02x ", thisclient->quest.quests[j].Variables[i]);
|
|
buffer.append(buf2);
|
|
}
|
|
SendPM( thisclient, (char*)buffer.c_str());
|
|
}
|
|
}
|
|
else if(strcmp(command, "setqvar") == 0)
|
|
{
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true;
|
|
unsigned int vartype = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true;
|
|
unsigned int var = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true;
|
|
unsigned int val = atoi(tmp);
|
|
if (vartype > 3) return true;
|
|
switch (vartype)
|
|
{
|
|
case 0:
|
|
if (var >= 5) return true;
|
|
thisclient->quest.EpisodeVar[var] = val;
|
|
break;
|
|
case 1:
|
|
if (var >= 3) return true;
|
|
thisclient->quest.JobVar[var] = val;
|
|
break;
|
|
case 2:
|
|
if (var >= 7) return true;
|
|
thisclient->quest.PlanetVar[var] = val;
|
|
break;
|
|
case 3:
|
|
if (var >= 10) return true;
|
|
thisclient->quest.UnionVar[var] = val;
|
|
break;
|
|
default:
|
|
return true;
|
|
break;
|
|
}
|
|
SendPM( thisclient, "Set Var[%i][%i] = %i", vartype, var, val);
|
|
}
|
|
else if (strcmp(command, "qtrigger")==0)
|
|
{
|
|
if(Config.Command_IQuest > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
char* tempName;
|
|
int mode;
|
|
int success;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)return true; tempName = tmp;
|
|
dword hash = MakeStrHash(tempName);
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
mode = 0;
|
|
else
|
|
mode = 1;
|
|
SendPM(thisclient, "Execute Quest Trigger %s hash: [%08x]", tempName, hash);
|
|
success = thisclient->ExecuteQuestTrigger(hash);
|
|
SendPM(thisclient, "Quest returned %i", success);
|
|
if(mode = 1)
|
|
success = atoi(tmp);
|
|
SendPM(thisclient, "Quest value sent %i", success);
|
|
CPacket pakout(0x730);
|
|
pakout.AddByte(success);
|
|
pakout.AddByte(0);
|
|
pakout.AddDWord(hash);
|
|
thisclient->client->SendPacket(&pakout);
|
|
}
|
|
else if (strcmp(command, "shoptype")==0)
|
|
{
|
|
if(Config.Command_ShopType > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL) return true;
|
|
unsigned int shoptype = atoi(tmp);
|
|
thisclient->Shop->ShopType = shoptype;
|
|
Log( MSG_GMACTION, " %s : /shoptype %i" , thisclient->CharInfo->charname, shoptype);
|
|
}
|
|
else if (strcmp(command, "stat")==0) /// Code By Minoc
|
|
{
|
|
if(Config.Command_Stat > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; char* statname =(char*)tmp;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; int statvalue = atoi(tmp);
|
|
Log( MSG_GMACTION, " %s : /stat %s,%i" , thisclient->CharInfo->charname, statname, statvalue);
|
|
return pakGMStat( thisclient , statname , statvalue);
|
|
}
|
|
else if (strcmp(command, "statp")==0)
|
|
{
|
|
if (Config.Command_Stat > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; int statvalue = atoi(tmp);
|
|
char* name;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
name = thisclient->CharInfo->charname;
|
|
else
|
|
name = tmp;
|
|
CPlayer* otherclient = GetClientByCharName(name);
|
|
if (otherclient == NULL)
|
|
return true;
|
|
if ((int)otherclient->CharInfo->StatPoints + statvalue < 0)
|
|
otherclient->CharInfo->StatPoints = 0;
|
|
else
|
|
otherclient->CharInfo->StatPoints += statvalue;
|
|
BEGINPACKET( pak, 0x720 );
|
|
ADDWORD( pak, 32 );
|
|
ADDWORD( pak, statvalue );
|
|
ADDWORD( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
RESETPACKET( pak, 0x0730 );
|
|
ADDWORD( pak, 5 );
|
|
ADDWORD( pak, 0xa24d );
|
|
ADDWORD( pak, 0x40b3 );
|
|
otherclient->client->SendPacket( &pak );
|
|
Log(MSG_GMACTION, " %s : /stats %i %s", thisclient->CharInfo->charname, statvalue, name);
|
|
return true;
|
|
}
|
|
else if (strcmp(command, "skillp")==0)
|
|
{
|
|
if (Config.Command_Stat > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true; int skillp = atoi(tmp);
|
|
char* name;
|
|
if ((tmp = strtok(NULL, " "))==NULL)
|
|
name = thisclient->CharInfo->charname;
|
|
else
|
|
name = tmp;
|
|
CPlayer* otherclient = GetClientByCharName(name);
|
|
if (otherclient == NULL)
|
|
return true;
|
|
if ((int)otherclient->CharInfo->SkillPoints + skillp < 0)
|
|
otherclient->CharInfo->SkillPoints = 0;
|
|
else
|
|
otherclient->CharInfo->SkillPoints += skillp;
|
|
BEGINPACKET( pak, 0x720 );
|
|
ADDWORD( pak, 37 );
|
|
ADDWORD( pak, skillp );
|
|
ADDWORD( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
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)
|
|
{
|
|
int hpamount = 0;
|
|
int mpamount = 0;
|
|
if(Config.Command_Heal > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
{
|
|
hpamount = thisclient->Stats->MaxHP;
|
|
}
|
|
else
|
|
{
|
|
hpamount = atoi(tmp);
|
|
}
|
|
if ((tmp = strtok(NULL, " ")) == NULL)
|
|
{
|
|
mpamount = thisclient->Stats->MaxMP;
|
|
}
|
|
else
|
|
{
|
|
mpamount = atoi(tmp);
|
|
}
|
|
Log( MSG_GMACTION, " %s : /heal", thisclient->CharInfo->charname );
|
|
return pakGMHeal( thisclient, hpamount, mpamount );
|
|
}
|
|
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 || thisclient->CharInfo->IsDev == 0)
|
|
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, "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 != NULL)
|
|
{
|
|
if(whoclient->Session->accesslevel > 100)
|
|
{
|
|
//sprintf(line0, "%s - GM[%i]", whoclient->CharInfo->charname, whoclient->Session->accesslevel);
|
|
sprintf(line0, "%s - (GM %i, lvl %u), map %u[%.2f,%.2f]", whoclient->CharInfo->charname, whoclient->Session->accesslevel,
|
|
whoclient->Stats->Level,
|
|
whoclient->Position->Map,
|
|
whoclient->Position->current.x,
|
|
whoclient->Position->current.y);
|
|
|
|
}
|
|
else
|
|
{
|
|
//sprintf(line0, "%s", whoclient->CharInfo->charname);
|
|
|
|
sprintf(line0, "%s (job %u, lvl %u), map %u[%.2f,%.2f]", whoclient->CharInfo->charname,
|
|
whoclient->CharInfo->Job,
|
|
whoclient->Stats->Level,
|
|
whoclient->Position->Map,
|
|
whoclient->Position->current.x,
|
|
whoclient->Position->current.y);
|
|
|
|
}
|
|
if(!whoclient->isInvisibleMode || thisclient->Session->accesslevel >= whoclient->Session->accesslevel)
|
|
{
|
|
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) //Highly expandable function to change most config values related to rates
|
|
{
|
|
if(Config.Command_Rate > thisclient->Session->accesslevel || thisclient->CharInfo->IsDev == 0)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
char* type = tmp;
|
|
if(strcmp(type,"death")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.DeathDelay = atoi(tmp);
|
|
SendPM(thisclient, "Monster Death Delay has been reset to %i",Config.DeathDelay );
|
|
}
|
|
else
|
|
if(strcmp(type,"drop")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.DROP_RATE = atoi(tmp);
|
|
SendPM(thisclient, "Drop rate has been reset to %i",Config.DROP_RATE );
|
|
}
|
|
else
|
|
if(strcmp(type,"exp")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.EXP_RATE = atoi(tmp);
|
|
SendPM(thisclient, "EXP rate has been reset to %i",Config.EXP_RATE );
|
|
}
|
|
else
|
|
if(strcmp(type,"blue")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.BlueChance = atoi(tmp);
|
|
SendPM(thisclient, "Blue item conversion rate has been reset to %i",Config.BlueChance );
|
|
}
|
|
if(strcmp(type,"attkmult")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.AttkMult = atoi(tmp);
|
|
SendPM(thisclient, "Attack delay multiplier has been reset to %i",Config.AttkMult );
|
|
}
|
|
if(strcmp(type,"skillmult")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.SkillMult = atoi(tmp);
|
|
SendPM(thisclient, "Skill delay multiplier has been reset to %i",Config.SkillMult );
|
|
}
|
|
if(strcmp(type,"dropdelay")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.DropDelay = atoi(tmp);
|
|
SendPM(thisclient, "Drop delay multiplier has been reset to %i",Config.DropDelay );
|
|
}
|
|
if(strcmp(type,"floordrop")==0)
|
|
{
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
Config.BASE_DROP_CHANCE = atoi(tmp);
|
|
SendPM(thisclient, "Minimum drop rate has been reset to %i",Config.BASE_DROP_CHANCE );
|
|
}
|
|
return true;
|
|
}
|
|
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 || thisclient->CharInfo->IsDev == 0)
|
|
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 || thisclient->CharInfo->IsDev == 0)
|
|
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 || thisclient->CharInfo->IsDev == 0)
|
|
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 || thisclient->CharInfo->IsDev == 0)
|
|
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, "skill")==0)
|
|
{
|
|
if (Config.Command_KillInRange > thisclient->Session->accesslevel)
|
|
return true;
|
|
if ((tmp = strtok(NULL, " "))==NULL) return true;
|
|
unsigned skillid = atoi(tmp);
|
|
Log(MSG_GMACTION, "%s cast skill %i", thisclient->CharInfo->charname, skillid);
|
|
SendPM(thisclient, "Casting skill %i", skillid);
|
|
CCharacter* Target = thisclient->GetCharTarget( );
|
|
CSkills* thisskill = GetSkillByID(skillid);
|
|
if(thisskill == NULL)return true;
|
|
thisclient->UseSkill(thisskill, Target);
|
|
}
|
|
else if(strcmp(command, "sendhp")==0)
|
|
{
|
|
SendPM(thisclient, "Testing HP send");
|
|
// SET PLAYER HEALTH
|
|
thisclient->Stats->HP = thisclient->Stats->MaxHP;
|
|
BEGINPACKET( pak, 0x79f );
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDWORD( pak, thisclient->Stats->HP );
|
|
ADDWORD( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
}
|
|
else if (strcmp(command, "dialog")==0 && thisclient->Session->accesslevel >= 300 || thisclient->CharInfo->IsDev == 0)
|
|
{
|
|
//can be a very dangerous tool to use
|
|
UINT npc;
|
|
UINT dialog;
|
|
UINT eventid;
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
npc = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
dialog = atoi(tmp);
|
|
if ((tmp = strtok(NULL, " "))==NULL)return true;
|
|
eventid = atoi(tmp);
|
|
if(thisclient->ChangeDialog(npc, dialog, eventid))
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "dialog for npc %i set to %i event set to %i", npc, dialog, eventid );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
else
|
|
{
|
|
char buffer2[200];
|
|
sprintf ( buffer2, "dialog and event for npc %i not changed", npc );
|
|
SendPM(thisclient, buffer2);
|
|
}
|
|
//thisclient->refresh = true; //doesn't exist in osprose. trying a different approach first
|
|
//thisclient->VisiblityList( );
|
|
}
|
|
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* thisclient, int montype, int moncount, int monAI )
|
|
{
|
|
CMap* map = MapList.Index[thisclient->Position->Map]; //find current map
|
|
if(monAI == 331) //it's a TD mob
|
|
{
|
|
SendPM(thisclient,"%i monsters of type %i summoned in Map: %i ",moncount,montype,map->id);
|
|
for (int i=0; i<moncount; i++) //add the TD spawns to the Map TDSpawnlist
|
|
{
|
|
if(map->TDMobList[map->TDNextMon] == 0)
|
|
{
|
|
map->TDMobList[map->TDNextMon] = montype;
|
|
map->TDNextMon ++;
|
|
if(map->TDNextMon > 100)map->TDNextMon = 0;
|
|
}
|
|
else
|
|
{
|
|
SendPM(thisclient,"Sorry! Cannot add monster %i. the TD Spawn list is full",i);
|
|
}
|
|
}
|
|
}
|
|
else // normal spawn
|
|
{
|
|
for (int i=0; i<moncount; i++)
|
|
{
|
|
fPoint position = RandInCircle( thisclient->Position->current, 10 );
|
|
map->AddMonster( montype, position, 0, 0, 1, 0, 0, monAI );
|
|
}
|
|
SendPM(thisclient,"%i monsters of type %i summoned in Map: %i using AI %i",moncount,montype,map->id,monAI);
|
|
}
|
|
|
|
SendPM(thisclient,"Spawning successful");
|
|
return true;
|
|
}
|
|
|
|
// GM: Teleport somewhere
|
|
bool CWorldServer::pakGMTele( CPlayer* thisclient, int map, float x, float y )
|
|
{
|
|
fPoint coord;
|
|
coord.x = x;
|
|
coord.y = y;
|
|
CMap* mapid = GServer->MapList.Index[map];
|
|
if(mapid == NULL)
|
|
{
|
|
SendPM(thisclient,"%i is not a valid map id",map);
|
|
return true;
|
|
}
|
|
if(thisclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
MapList.Index[map]->TeleportPlayer( thisclient, coord, false );
|
|
return true;
|
|
}
|
|
|
|
// GM: apply Status effects for a skill id defined in 'effect'
|
|
bool CWorldServer::pakGMEffect(CPlayer* thisclient, int effect)
|
|
{
|
|
if(thisclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
// build buffs first
|
|
BYTE buff1 = 0;
|
|
BYTE buff2 = 0;
|
|
BYTE buff3 = 0;
|
|
BYTE buff4 = 0;
|
|
//Build Debuffs and Buffs
|
|
//Up
|
|
if(effect == 18)//A_ATTACK:
|
|
buff2 += ATTACK_UP;
|
|
if(effect == 20)//A_DEFENSE:
|
|
buff2 += DEFENSE_UP;
|
|
if(effect == 22)//A_MDEFENSE_UP
|
|
buff2 += MDEFENSE_UP;
|
|
if(effect == 24)//A_ACCUR:
|
|
buff3 += HITRATE_UP;
|
|
if(effect == 14)//A_DASH:
|
|
buff1 += DASH_UP;
|
|
if(effect == 16)//A_HASTE:
|
|
buff2 += HASTE_UP;
|
|
if(effect == 12)//A_HP:
|
|
buff1 += HP_UP;
|
|
if(effect == 13)//A_MP:
|
|
buff1 += MP_UP;
|
|
if(effect == 26)//A_CRITICAL:
|
|
buff3 += CRITICAL_UP;
|
|
if(effect == 28)//A_DODGE:
|
|
buff1 += DODGE_UP;
|
|
if(effect == 36)//A_Extra_Damage:
|
|
buff4 += DAMAGE_UP;
|
|
//Down
|
|
if(effect == 19) // A_ATTACK:
|
|
buff2 += ATTACK_DOWN;
|
|
if(effect == 21)//A_DEFENSE:
|
|
buff2 += DEFENSE_DOWN;
|
|
if(effect == 23)
|
|
buff2 += MDEFENSE_DOWN;
|
|
if(effect == 25)//A_ACCUR:
|
|
buff3 += HITRATE_DOWN;
|
|
if(effect == 15)//A_DASH:
|
|
buff1 += DASH_DOWN;
|
|
if(effect == 17)//A_HASTE:
|
|
buff2 += HASTE_DOWN;
|
|
if(effect == 27)//A_CRITICAL:
|
|
buff3 += CRITICAL_DOWN;
|
|
if(effect == 32)//A_STUN
|
|
buff4+= STUN;
|
|
if(effect >= 7 && effect <= 11)//A_POISON
|
|
buff1+= POISONED;
|
|
if(effect == 30)//A_MUTE
|
|
buff3+= MUTED;
|
|
int thisbuff = (buff1 * 0x01) + (buff2 * 0x100 ) + (buff3 * 0x10000) + (buff4 * 0x1000000);
|
|
|
|
BEGINPACKET( pak,0x7b7 );
|
|
ADDWORD ( pak, thisclient->clientid );
|
|
ADDDWORD ( pak, thisbuff );
|
|
GServer->SendToVisible( &pak, thisclient );
|
|
SendPM(thisclient,"Buff effect applied %i",thisbuff);
|
|
}
|
|
|
|
// [by Paul_T] [Thanks to AridTag for the packet :D]
|
|
bool CWorldServer::pakGMMute( CPlayer* thisclient, char* name, int time)
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName ( name );
|
|
if(otherclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
BEGINPACKET( pak, 0x70d );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDWORD ( pak, time );
|
|
ADDSTRING ( pak, thisclient->CharInfo->charname );
|
|
ADDBYTE ( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
return true;
|
|
}
|
|
|
|
// GM: Item - Modified by Hiei (added refine/socket/stats)
|
|
bool CWorldServer::pakGMItem( CPlayer* thisclient, UINT itemid, UINT itemtype, UINT itemamount, UINT itemrefine, UINT itemls, UINT itemstats, UINT itemsocket )
|
|
{
|
|
CItem item;
|
|
item.count = itemamount;
|
|
item.durability = 40;
|
|
item.itemnum = itemid;
|
|
item.itemtype = itemtype;
|
|
item.lifespan = itemls;
|
|
item.refine = itemrefine;
|
|
item.stats = itemstats;
|
|
item.socketed = itemsocket;
|
|
item.appraised = 1;
|
|
item.gem = 0;
|
|
unsigned newslot = thisclient->GetNewItemSlot( item );
|
|
if (newslot != 0xffff)
|
|
{
|
|
thisclient->items[newslot] = item;
|
|
thisclient->UpdateInventory( newslot );
|
|
char buffer[200];
|
|
sprintf( buffer, "Item added! (ID: %i) (Type: %i) (Refine: %i) (Socket: %i)", item.itemnum, item.itemtype, item.refine, item.socketed );
|
|
BEGINPACKET ( pak, 0x702 );
|
|
ADDSTRING( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
|
|
}else{
|
|
BEGINPACKET( pak, 0x7a7 );
|
|
ADDWORD( pak, thisclient->clientid );
|
|
ADDBYTE( pak, 5 );
|
|
thisclient->client->SendPacket( &pak );
|
|
|
|
RESETPACKET ( pak, 0x702 );
|
|
ADDSTRING( pak, "No free slot !" );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// GM: Kick
|
|
bool CWorldServer::pakGMKick( CPlayer* thisclient, char* name )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if(otherclient == NULL)
|
|
return true;
|
|
BEGINPACKET( pak, 0x702 );
|
|
ADDSTRING( pak, "You were disconnected from the server !" );
|
|
ADDBYTE( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
|
|
RESETPACKET( pak, 0x707 );
|
|
ADDWORD( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
|
|
otherclient->client->isActive = false;
|
|
|
|
return true;
|
|
}
|
|
|
|
// GM: Ban
|
|
bool CWorldServer::pakGMBan( CPlayer* thisclient, char* name )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if(otherclient == NULL)
|
|
return true;
|
|
otherclient->Session->accesslevel = -1;
|
|
DB->QExecute( "UPDATE accounts SET accesslevel='0' WHERE id=%i", otherclient->Session->userid);
|
|
BEGINPACKET( pak, 0x702 );
|
|
ADDSTRING( pak, "You were banned from the server !" );
|
|
ADDBYTE( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
|
|
RESETPACKET( pak, 0x707 );
|
|
ADDWORD( pak, 0 );
|
|
otherclient->client->SendPacket( &pak );
|
|
|
|
otherclient->client->isActive = false;
|
|
|
|
return true;
|
|
}
|
|
|
|
// GM: Add/Remove/Drop/Set zuly
|
|
bool CWorldServer::pakGMZuly( CPlayer* thisclient, int mode, int amount, char* charname )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName(charname);
|
|
if(otherclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
if (mode == 1)
|
|
{
|
|
//ADD
|
|
otherclient->CharInfo->Zulies += amount;
|
|
BEGINPACKET( pak, 0x71d );
|
|
ADDQWORD( pak, otherclient->CharInfo->Zulies );
|
|
otherclient->client->SendPacket( &pak );
|
|
}
|
|
if (mode == 2)
|
|
{
|
|
//REMOVE
|
|
otherclient->CharInfo->Zulies -= amount;
|
|
BEGINPACKET( pak, 0x71d );
|
|
ADDQWORD( pak, otherclient->CharInfo->Zulies );
|
|
otherclient->client->SendPacket( &pak );
|
|
}
|
|
if (mode == 3)
|
|
{
|
|
//DROP
|
|
CDrop* thisdrop = new CDrop;
|
|
assert(thisdrop);
|
|
thisdrop->clientid = GetNewClientID();
|
|
thisdrop->type = 1; // ZULY
|
|
thisdrop->pos.x = otherclient->Position->current.x;
|
|
thisdrop->pos.y = otherclient->Position->current.y;
|
|
thisdrop->posMap = otherclient->Position->Map;
|
|
thisdrop->droptime = time(NULL);
|
|
thisdrop->amount = amount;
|
|
thisdrop->owner = 0;
|
|
CMap* map = MapList.Index[thisdrop->posMap];
|
|
map->AddDrop( thisdrop );
|
|
}
|
|
if (mode == 4)
|
|
{
|
|
//SET
|
|
otherclient->CharInfo->Zulies = amount;
|
|
BEGINPACKET( pak, 0x71d );
|
|
ADDQWORD( pak, otherclient->CharInfo->Zulies );
|
|
otherclient->client->SendPacket( &pak );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Change player Level
|
|
bool CWorldServer::pakGMLevel( CPlayer* thisclient, int level, char* name )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if(otherclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
if (((int)otherclient->Stats->Level + level) > 0)
|
|
otherclient->Stats->Level += level;
|
|
else
|
|
otherclient->Stats->Level = 1;
|
|
if (otherclient->Stats->Level > 250)
|
|
otherclient->Stats->Level = 250;
|
|
otherclient->CharInfo->Exp = 0;
|
|
if (level < 0) {
|
|
otherclient->CharInfo->StatPoints = 0;
|
|
otherclient->CharInfo->SkillPoints = 0;
|
|
if(otherclient->Stats->Level > 1)
|
|
{
|
|
for(int s = 2; s <= otherclient->Stats->Level; s++)
|
|
{
|
|
otherclient->CharInfo->StatPoints += 10;
|
|
otherclient->CharInfo->StatPoints += s / 2;
|
|
if (s >= 10)
|
|
{
|
|
switch (s) {
|
|
case 10:
|
|
case 14:
|
|
otherclient->CharInfo->SkillPoints += 2;
|
|
break;
|
|
case 18:
|
|
otherclient->CharInfo->SkillPoints += 3;
|
|
break;
|
|
case 22:
|
|
otherclient->CharInfo->SkillPoints += 4;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
// 5 skill points every 4 levels from 22
|
|
if (s > 22 && s < 99 && ((s - 22) % 4) == 0)
|
|
otherclient->CharInfo->SkillPoints += 5;
|
|
// 5 skill points every 2 levels from 98
|
|
if (s > 98 && (s % 2) == 0)
|
|
otherclient->CharInfo->SkillPoints += 5;
|
|
}
|
|
}
|
|
}
|
|
pakGMStat(otherclient, "str", 15);
|
|
pakGMStat(otherclient, "dex", 15);
|
|
pakGMStat(otherclient, "con", 15);
|
|
pakGMStat(otherclient, "int", 15);
|
|
pakGMStat(otherclient, "cha", 10);
|
|
pakGMStat(otherclient, "sen", 10);
|
|
} else {
|
|
for(int s = (otherclient->Stats->Level - level + 1); s <= otherclient->Stats->Level; s++)
|
|
{
|
|
otherclient->CharInfo->StatPoints += 10;
|
|
otherclient->CharInfo->StatPoints += s / 2;
|
|
if (s >= 10)
|
|
{
|
|
switch (s)
|
|
{
|
|
case 10:
|
|
case 14:
|
|
otherclient->CharInfo->SkillPoints += 2;
|
|
break;
|
|
case 18:
|
|
otherclient->CharInfo->SkillPoints += 3;
|
|
break;
|
|
case 22:
|
|
otherclient->CharInfo->SkillPoints += 4;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
// 5 skill points every 4 levels from 22
|
|
if (s > 22 && s < 99 && ((s - 22) % 4) == 0)
|
|
otherclient->CharInfo->SkillPoints += 5;
|
|
// 5 skill points every 2 levels from 98
|
|
if (s > 98 && (s % 2) == 0)
|
|
otherclient->CharInfo->SkillPoints += 5;
|
|
}
|
|
}
|
|
}
|
|
BEGINPACKET( pak, 0x79e );
|
|
ADDWORD( pak, otherclient->clientid );
|
|
ADDWORD( pak, otherclient->Stats->Level );
|
|
ADDDWORD( pak, otherclient->CharInfo->Exp );
|
|
ADDWORD( pak, otherclient->CharInfo->StatPoints );
|
|
ADDWORD( pak, otherclient->CharInfo->SkillPoints );
|
|
otherclient->client->SendPacket( &pak );
|
|
|
|
RESETPACKET( pak, 0x79e );
|
|
ADDWORD( pak, otherclient->clientid );
|
|
SendToVisible( &pak, otherclient, false );
|
|
|
|
otherclient->SetStats( );
|
|
otherclient->Stats->HP = otherclient->Stats->MaxHP;
|
|
otherclient->Stats->MP = otherclient->Stats->MaxMP;
|
|
return true;
|
|
}
|
|
|
|
|
|
// Reload Mob Spawn
|
|
bool CWorldServer::ReloadMobSpawn( CPlayer* thisclient, int id )
|
|
{
|
|
CSpawnArea* thisspawn = new (nothrow) CSpawnArea;
|
|
if(thisspawn == NULL)
|
|
{
|
|
Log(MSG_WARNING, "Error allocing memory" );
|
|
return true;
|
|
}
|
|
thisspawn->thisnpc = GetNPCDataByID( thisclient->GMRespawnPoints.mobID );
|
|
if(thisspawn->thisnpc == NULL)
|
|
{
|
|
SendSysMsg( thisclient, "Invalid Respawn" );
|
|
return true;
|
|
}
|
|
thisspawn->id = id;
|
|
thisspawn->map = thisclient->GMRespawnPoints.map;
|
|
thisspawn->montype = thisclient->GMRespawnPoints.mobID;
|
|
thisspawn->min = thisclient->GMRespawnPoints.min;
|
|
thisspawn->max = thisclient->GMRespawnPoints.max;
|
|
thisspawn->respawntime = thisclient->GMRespawnPoints.respawntime;
|
|
thisspawn->pcount = thisclient->GMRespawnPoints.n;
|
|
thisspawn->points = thisclient->GMRespawnPoints.points;
|
|
CMap* map = MapList.Index[thisspawn->map];
|
|
for(int j=0; j<thisspawn->max; j++)
|
|
{
|
|
fPoint position = RandInPoly( thisspawn->points, thisspawn->pcount );
|
|
map->AddMonster( thisspawn->montype, position, 0, thisspawn->id, 1 );
|
|
}
|
|
thisspawn->lastRespawnTime=time(NULL);
|
|
return true;
|
|
}
|
|
|
|
// Teleport To player to other place
|
|
bool CWorldServer::pakGMTeleOtherPlayer( CPlayer *thisclient, char* name, int map, float x, float y )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if (otherclient != NULL)
|
|
{
|
|
fPoint coord;
|
|
coord.x = x;
|
|
coord.y = y;
|
|
MapList.Index[map]->TeleportPlayer( otherclient, coord, false );
|
|
}
|
|
else
|
|
{
|
|
SendSysMsg( thisclient, "User does not exist or is not online!" );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Teleport Me to player
|
|
bool CWorldServer::pakGMTeleToPlayer( CPlayer* thisclient, char* name )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if (otherclient != NULL)
|
|
{
|
|
MapList.Index[otherclient->Position->Map]->TeleportPlayer( thisclient, otherclient->Position->current, false );
|
|
}
|
|
else
|
|
{
|
|
SendSysMsg( thisclient, "User does not exist or is not online!" );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Teleport Player Here
|
|
bool CWorldServer::pakGMTelePlayerHere( CPlayer* thisclient, char* name )
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName( name );
|
|
if (otherclient != NULL)
|
|
{
|
|
CMap* map = MapList.Index[thisclient->Position->Map];
|
|
map->TeleportPlayer( otherclient, thisclient->Position->current, false );
|
|
}
|
|
else
|
|
{
|
|
SendSysMsg( thisclient, "User does not exist or is not online!");
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Show Player info
|
|
bool CWorldServer::pakGMInfo(CPlayer* thisclient, char* name)
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName(name);
|
|
if(otherclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
char buffer[200];
|
|
const char* jobname;
|
|
|
|
if(otherclient != 0) {
|
|
if((otherclient->CharInfo->Job - 0) == 0) { jobname = "Visitor"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 111) { jobname = "Soldier"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 121) { jobname = "Knight"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 122) { jobname = "Champion"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 211) { jobname = "Muse"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 221) { jobname = "Mage"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 222) { jobname = "Cleric"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 311) { jobname = "Hawker"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 321) { jobname = "Raider"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 322) { jobname = "Scout"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 411) { jobname = "Dealer"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 421) { jobname = "Bourgeois"; }
|
|
else if((otherclient->CharInfo->Job - 0) == 422) { jobname = "Artisan"; }
|
|
else { jobname = "Unknown"; }
|
|
|
|
BEGINPACKET(pak, 0x702);
|
|
|
|
sprintf(buffer, "Info about <%s>" , otherclient->CharInfo->charname);
|
|
ADDSTRING(pak, buffer);
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET(pak, 0x702);
|
|
sprintf(buffer, "Account: %s | ID: %i" , otherclient->Session->username, otherclient->Session->userid);
|
|
ADDSTRING(pak, buffer);
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET(pak, 0x702);
|
|
sprintf(buffer, "Level: %i | Job: %s" , (otherclient->Stats->Level-0) , jobname);
|
|
ADDSTRING(pak, buffer);
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET(pak, 0x702);
|
|
sprintf(buffer,"Map: %i , X: %i , Y: %i", (otherclient->Position->Map-0), (int)otherclient->Position->current.x, (int)otherclient->Position->current.y);
|
|
ADDSTRING(pak, buffer);
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
}
|
|
else {
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "User does not exist or is not online!");
|
|
ADDBYTE(pak, 0)
|
|
thisclient->client->SendPacket(&pak);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Add Fairy
|
|
bool CWorldServer::pakGMFairyto(CPlayer* thisclient, char* name, int mode)
|
|
{
|
|
if (GServer->Config.FairyMode== 0){
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "Fairy feature is de-activated.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
CPlayer* otherclient = GetClientByCharName (name);
|
|
if(otherclient == NULL){
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "User does not exist or is not online.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
if(mode == 0 && otherclient->Fairy == false){
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "User already not fairied.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
if(mode == 1 && otherclient->Fairy == true)
|
|
{
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "User already fairied.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
if(!otherclient->Fairy && mode == 1)
|
|
{
|
|
int FairyIndex=100;
|
|
for (int i=0; i<GServer->Config.FairyMax; i++)
|
|
{
|
|
if (GServer->FairyList.at(i)->assigned == false)
|
|
{
|
|
FairyIndex=i;
|
|
i=GServer->Config.FairyMax;
|
|
}
|
|
}
|
|
if (FairyIndex == 100)
|
|
{
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "No free Fairy.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "User fairied.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
int ListIndex;
|
|
for (int i=0; i<ClientList.size(); i++)
|
|
{
|
|
if (GServer->ClientList.at(i)->player == otherclient)
|
|
{
|
|
ListIndex = i;
|
|
i = GServer->ClientList.size();
|
|
}
|
|
}
|
|
otherclient->Fairy = true;
|
|
otherclient->FairyListIndex = FairyIndex;
|
|
GServer->FairyList.at(FairyIndex)->ListIndex = ListIndex;
|
|
GServer->FairyList.at(FairyIndex)->assigned = true;
|
|
GServer->FairyList.at(FairyIndex)->LastTime = clock();
|
|
GServer->FairyList.at(FairyIndex)->WaitTime = GServer->Config.FairyWait;
|
|
GServer->DoFairyStuff( otherclient, mode );
|
|
otherclient->SetStats();
|
|
Log( MSG_INFO, "HP: %i MP: %i ATK: %i DEF: %i CRI: %i MSPD: %i", otherclient->Stats->MaxHP, otherclient->Stats->MaxMP, otherclient->Stats->Attack_Power, otherclient->Stats->Defense, otherclient->Stats->Critical, otherclient->Stats->Move_Speed);
|
|
}
|
|
if(otherclient->Fairy && mode == 0){
|
|
GServer->DoFairyFree(otherclient->FairyListIndex);
|
|
GServer->FairyList.at(otherclient->FairyListIndex)->WaitTime = GServer->Config.FairyWait;
|
|
otherclient->Fairy = false;
|
|
otherclient->FairyListIndex = 0;
|
|
GServer->DoFairyStuff( otherclient, mode );
|
|
BEGINPACKET(pak, 0x702);
|
|
ADDSTRING(pak, "User unfairied.");
|
|
ADDBYTE(pak, 0);
|
|
otherclient->client->SendPacket(&pak);
|
|
otherclient->SetStats();
|
|
Log( MSG_INFO, "HP: %i MP: %i ATK: %i DEF: %i CRI: %i MSPD: %i", otherclient->Stats->MaxHP, otherclient->Stats->MaxMP, otherclient->Stats->Attack_Power, otherclient->Stats->Defense, otherclient->Stats->Critical, otherclient->Stats->Move_Speed);
|
|
}
|
|
otherclient->SetStats();
|
|
return true;
|
|
}
|
|
|
|
// Activate de-activate Fairy mode in game
|
|
bool CWorldServer::pakGMManageFairy(CPlayer* thisclient, int mode)
|
|
{
|
|
BEGINPACKET (pak, 0x702);
|
|
if(mode == 0)
|
|
{
|
|
if (GServer->Config.FairyMode != mode)
|
|
{
|
|
GServer->Config.FairyMode = 0;
|
|
ADDSTRING(pak, "You have de-activated the Fairy mode ingame.");
|
|
}
|
|
else
|
|
{
|
|
ADDSTRING(pak, "The Fairy mode is already de-activated.");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (GServer->Config.FairyMode != mode)
|
|
{
|
|
GServer->Config.FairyMode = 1;
|
|
for (int i=0; i<GServer->Config.FairyMax; i++)
|
|
{
|
|
GServer->DoFairyFree(i);
|
|
GServer->FairyList.at(i)->WaitTime = GServer->Config.FairyWait;
|
|
}
|
|
ADDSTRING(pak, "You have activated the Fairy mode ingame.");
|
|
}
|
|
else
|
|
{
|
|
ADDSTRING(pak, "The Fairy mode is already activated.");
|
|
}
|
|
}
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
|
|
return true;
|
|
}
|
|
|
|
// Change FairyWait
|
|
bool CWorldServer::pakGMChangeFairyWait(CPlayer* thisclient, int newvalue)
|
|
{
|
|
GServer->Config.FairyWait = newvalue;
|
|
for (int i=0; i<GServer->FairyList.size(); i++)
|
|
{
|
|
GServer->FairyList.at(i)->WaitTime = newvalue;
|
|
}
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have changed the time between each Fairies");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
|
|
// Change FairyStay
|
|
bool CWorldServer::pakGMChangeFairyStay(CPlayer* thisclient, int newvalue)
|
|
{
|
|
GServer->Config.FairyStay = newvalue;
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have changed the time of Fairies for Buffing ");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
|
|
// Change Fairy Test mode.
|
|
// 0 -> normal random x * Fairywait
|
|
// 1 -> Test mode activated: 1 * Fairywait only
|
|
bool CWorldServer::pakGMChangeFairyTestMode(CPlayer* thisclient, int mode)
|
|
{
|
|
GServer->Config.FairyTestMode = mode;
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have changed the Fairy test mode.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
|
|
// Give Zuly
|
|
bool CWorldServer::pakGMZulygive(CPlayer* thisclient, char* name, int zuly)
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName (name);
|
|
if(otherclient == NULL)
|
|
{
|
|
SendPM(thisclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
otherclient->CharInfo->Zulies += zuly;
|
|
BEGINPACKET(pak, 0x7a7);
|
|
ADDWORD(pak, otherclient->clientid);
|
|
ADDWORD(pak, 0);
|
|
ADDBYTE(pak, 0);
|
|
ADDWORD(pak, 0xccdf );//0xccccccdf);
|
|
ADDDWORD(pak, zuly);
|
|
otherclient->client->SendPacket(&pak);
|
|
|
|
return true;
|
|
}
|
|
|
|
// Spawn a NPC
|
|
bool CWorldServer::pakGMNpc(CPlayer* thisclient, int npcid,int dialogid)
|
|
{
|
|
CNPC* thisnpc = new CNPC;
|
|
assert(thisnpc);
|
|
thisnpc->clientid = GetNewClientID();
|
|
thisnpc->dir = 0;
|
|
thisnpc->npctype = npcid;
|
|
thisnpc->pos = thisclient->Position->current;
|
|
thisnpc->posMap = thisclient->Position->Map;
|
|
thisnpc->thisnpc = GetNPCDataByID( npcid );
|
|
if( thisnpc->thisnpc == NULL )
|
|
{
|
|
SendPM(thisclient,"Cannot create NPC");
|
|
delete thisnpc;
|
|
return true;
|
|
}
|
|
thisnpc->thisnpc->dialogid = dialogid;
|
|
CMap* map = MapList.Index[thisclient->Position->Map];
|
|
map->AddNPC( thisnpc );
|
|
SendPM(thisclient,"NPC type %i added to map %i",npcid,thisnpc->posMap);
|
|
return true;
|
|
}
|
|
|
|
// Give Item to Player
|
|
bool CWorldServer::pakGMItemtoplayer(CPlayer* thisclient, char* name , UINT itemid, UINT itemtype, UINT itemamount, UINT itemrefine, UINT itemls, UINT itemstats, UINT itemsocket)
|
|
{
|
|
CItem item;
|
|
item.count = itemamount;
|
|
item.durability = 40;
|
|
item.itemnum = itemid;
|
|
item.itemtype = itemtype;
|
|
item.lifespan = 100; //itemls Set lifespan to 100
|
|
item.refine = itemrefine;
|
|
item.stats = itemstats;
|
|
item.socketed = itemsocket;
|
|
item.appraised = 1;
|
|
if(itemstats > 300)
|
|
{
|
|
item.gem = itemstats;
|
|
}
|
|
else
|
|
{
|
|
item.gem = 0;
|
|
}
|
|
|
|
CPlayer* otherclient = GetClientByCharName ( name );
|
|
|
|
if(otherclient != NULL)
|
|
{
|
|
unsigned newslot = otherclient->GetNewItemSlot( item );
|
|
if(newslot != 0xffff)
|
|
{
|
|
otherclient->items[newslot] = item;
|
|
otherclient->UpdateInventory( newslot );
|
|
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have recieved an item from a GM !");
|
|
ADDBYTE(pak, 0);
|
|
otherclient->client->SendPacket(&pak);
|
|
|
|
RESETPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "Item has been given!");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
}
|
|
else
|
|
{
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "No free slot !");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// Do Emotion
|
|
bool CWorldServer::pakGMDoEmote( CPlayer* thisclient, int emotionid )
|
|
{
|
|
ClearBattle( thisclient->Battle );
|
|
BEGINPACKET( pak, 0x781 );
|
|
ADDDWORD( pak, emotionid );
|
|
ADDWORD( pak, thisclient->clientid );
|
|
SendToVisible( &pak, thisclient );
|
|
return true;
|
|
}
|
|
|
|
// Change GM Stats (Coded by Minoc)
|
|
bool CWorldServer::pakGMStat( CPlayer* thisclient, const char* statname, int statvalue )
|
|
{
|
|
int statid;
|
|
if (strcmp( statname, "Str" )==0 || strcmp( statname, "str" )==0)
|
|
{
|
|
thisclient->Attr->Str = statvalue;
|
|
statid = 0;
|
|
}
|
|
else if (strcmp( statname, "Dex" )==0 || strcmp( statname, "dex" )==0)
|
|
{
|
|
thisclient->Attr->Dex = statvalue;
|
|
statid = 1;
|
|
}
|
|
else if (strcmp( statname, "Int" )==0 || strcmp( statname, "int" )==0)
|
|
{
|
|
thisclient->Attr->Int = statvalue;
|
|
statid = 2;
|
|
}
|
|
else if (strcmp( statname, "Con" )==0 || strcmp( statname, "con" )==0)
|
|
{
|
|
thisclient->Attr->Con = statvalue;
|
|
statid = 3;
|
|
}
|
|
else if (strcmp( statname, "Cha" )==0 || strcmp( statname, "cha" )==0)
|
|
{
|
|
thisclient->Attr->Cha = statvalue;
|
|
statid = 4;
|
|
}
|
|
else if (strcmp( statname, "Sen" )==0 || strcmp( statname, "sen" )==0)
|
|
{
|
|
thisclient->Attr->Sen = statvalue;
|
|
statid = 5;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
BEGINPACKET( pak, 0x7a9 );
|
|
ADDBYTE( pak, statid );
|
|
ADDWORD( pak, (unsigned short)statvalue );
|
|
thisclient->client->SendPacket( &pak );
|
|
thisclient->SetStats( );
|
|
return true;
|
|
}
|
|
|
|
// GM: Teleport using map id credits to Blackie
|
|
bool CWorldServer::pakGMGotomap( CPlayer* thisclient, int map )
|
|
{
|
|
CMap* thismap = GServer->MapList.Index[map];
|
|
if(thismap == NULL)
|
|
{
|
|
SendSysMsg( thisclient, "Invalid map id" );
|
|
return true;
|
|
}
|
|
CRespawnPoint* thisrespawn = MapList.Index[map]->GetFirstRespawn( );
|
|
if(thisrespawn==NULL)
|
|
{
|
|
SendSysMsg( thisclient, "This map have no respawn" );
|
|
return true;
|
|
}
|
|
MapList.Index[map]->TeleportPlayer( thisclient, thisrespawn->dest, false );
|
|
return true;
|
|
}
|
|
|
|
// Heal a player ( by rl2171 )
|
|
bool CWorldServer::pakGMHeal( CPlayer* thisclient, int hpamount, int mpamount )
|
|
{
|
|
//this one works with the modified trose. pak 0x7ec does not work with base 112 client
|
|
thisclient->Stats->HP = hpamount;
|
|
thisclient->Stats->MP = mpamount;
|
|
BEGINPACKET( pak, 0x7ec );
|
|
ADDWORD( pak, hpamount );
|
|
ADDWORD( pak, mpamount );
|
|
thisclient->client->SendPacket( &pak );
|
|
|
|
//experimental heal command. Might not work but if it does then we are sorted.
|
|
//BEGINPACKET( pak, 0x7d5 );
|
|
//ADDDWORD ( pak, thisclient->CharInfo->charid );
|
|
//ADDWORD ( pak, thisclient->clientid );
|
|
//ADDWORD ( pak, thisclient->Stats->MaxHP );
|
|
//ADDWORD ( pak, thisclient->Stats->HP );
|
|
//ADDDWORD ( pak, 0x01000000 );
|
|
//ADDDWORD ( pak, 0x0000000f );
|
|
//ADDWORD ( pak, 0x1388 );
|
|
// didn't work either
|
|
|
|
//let's try this
|
|
//BEGINPACKET( pak, 0x753 );
|
|
//ADDWORD ( pak, thisclient->clientid ); // USER ID
|
|
//ADDWORD ( pak, thisclient->Stats->HP ); // CURRENT HP
|
|
//ADDWORD ( pak, thisclient->Stats->MP ); // CURRENT MP
|
|
//well it kind of works. You get healed OK but with a pillar of light.
|
|
//works Ok here but we need a heal without effects for other places
|
|
//also resets the zone time lol. Apparently this is not a good plan
|
|
|
|
//thisclient->client->SendPacket( &pak );
|
|
Log(MSG_INFO,"GM Heal used for HP %i MP %i",hpamount,mpamount);
|
|
SendPM(thisclient, "Set HP to %i and MP to %i",hpamount,mpamount);
|
|
return true;
|
|
}
|
|
|
|
// GM: Server Information ( by rl2171 ) modified by me
|
|
bool CWorldServer::pakGMServerInfo( CPlayer* thisclient )
|
|
{
|
|
char buffer[200];
|
|
// Players Online
|
|
BEGINPACKET( pak, 0x0784 );
|
|
ADDSTRING( pak, "[SYS]ServerInfo" );
|
|
ADDBYTE( pak, 0 );
|
|
ADDSTRING( pak, "SERVER INFORMATION" );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Online Players: %i", (int)ClientList.size()-1 );// -1 (we don't count charserver)
|
|
RESETPACKET( pak, 0x0784 );
|
|
ADDSTRING( pak, "[SYS]ServerInfo" );
|
|
ADDBYTE( pak, 0 );
|
|
ADDSTRING( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
// Exp / Zulies / Drop rates
|
|
sprintf( buffer, "Exp %i | Zulies %i | Drops %i", Config.EXP_RATE, Config.ZULY_RATE, Config.DROP_RATE );
|
|
RESETPACKET( pak, 0x0784 );
|
|
ADDSTRING( pak, "[SYS]ServerInfo" );
|
|
ADDBYTE( pak, 0 );
|
|
ADDSTRING( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
// Send map time
|
|
if(MapList.Index[thisclient->Position->Map]!=NULL)
|
|
{
|
|
RESETPACKET( pak, 0x0784 );
|
|
ADDSTRING( pak, "[SYS]ServerInfo" );
|
|
ADDBYTE( pak, 0 );
|
|
switch(MapList.Index[thisclient->Position->Map]->CurrentTime)
|
|
{
|
|
case MORNING:
|
|
sprintf( buffer, "The Time is: Morning[%i]", MapList.Index[thisclient->Position->Map]->MapTime%MapList.Index[thisclient->Position->Map]->dayperiod );
|
|
ADDSTRING( pak, buffer );
|
|
break;
|
|
case DAY:
|
|
sprintf( buffer, "The Time is: Day[%i]", MapList.Index[thisclient->Position->Map]->MapTime%MapList.Index[thisclient->Position->Map]->dayperiod );
|
|
ADDSTRING( pak, buffer );
|
|
break;
|
|
case EVENING:
|
|
sprintf( buffer, "The Time is: Evening[%i]", MapList.Index[thisclient->Position->Map]->MapTime%MapList.Index[thisclient->Position->Map]->dayperiod );
|
|
ADDSTRING( pak, buffer );
|
|
break;
|
|
case NIGHT:
|
|
sprintf( buffer, "The Time is: Night[%i]", MapList.Index[thisclient->Position->Map]->MapTime%MapList.Index[thisclient->Position->Map]->dayperiod );
|
|
ADDSTRING( pak, buffer );
|
|
break;
|
|
default:
|
|
sprintf( buffer, "Invalid Time is the End of world [%i]", MapList.Index[thisclient->Position->Map]->MapTime );
|
|
ADDSTRING( pak, buffer );
|
|
}
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Show Target Info
|
|
bool CWorldServer::GMShowTargetInfo( CPlayer* thisclient )
|
|
{
|
|
if(thisclient->Battle->target==0) return true;
|
|
char buffer[200];
|
|
CMonster* monster = GetMonsterByID( thisclient->Battle->target, thisclient->Position->Map );
|
|
if(monster == NULL) return true;
|
|
float dist = distance( thisclient->Position->current, monster->Position->current );
|
|
sprintf( buffer, "Target Position: %.4f, %.4f", monster->Position->current.x, monster->Position->current.y );
|
|
BEGINPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Distance: %.0f", dist );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Target Defense: %i", monster->Stats->Defense );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Target Level: %i", monster->thisnpc->level );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Target Attack Power: %i", monster->Stats->Attack_Power );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Target Attack Speed: %.0f", monster->Stats->Attack_Speed );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Target Move Speed: %i", monster->Stats->Move_Speed );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
sprintf( buffer, "Target HP/MAXHP: %i/%i", monster->Stats->HP, monster->Stats->MaxHP );
|
|
RESETPACKET( pak, 0x784 );
|
|
ADDSTRING ( pak, "[SYS]TargetInfo" );
|
|
ADDBYTE ( pak, 0 );
|
|
ADDSTRING ( pak, buffer );
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket( &pak );
|
|
return true;
|
|
}
|
|
|
|
// GM: Make yourself invisible from tomiz
|
|
bool CWorldServer::pakGMHide( CPlayer* thisclient, int mode )
|
|
{
|
|
BEGINPACKET( pak, 0x702 );
|
|
if ( mode == 1 )
|
|
{
|
|
thisclient -> isInvisibleMode = true;
|
|
ADDSTRING( pak, "You are now invisible !" );
|
|
Log( MSG_GMACTION, " %s : /hide invisible" , thisclient->CharInfo->charname);
|
|
}
|
|
else
|
|
{
|
|
thisclient -> isInvisibleMode = false;
|
|
ADDSTRING( pak, "You are now visible !" );
|
|
Log( MSG_GMACTION, " %s : /hide visible" , thisclient->CharInfo->charname);
|
|
}
|
|
ADDBYTE( pak, 0 );
|
|
thisclient->client->SendPacket ( &pak );
|
|
return true;
|
|
}
|
|
// GM : Change the party lvl
|
|
bool CWorldServer::pakGMPartylvl( CPlayer* partyclient, int level )
|
|
{
|
|
if (partyclient->Party->party == NULL) return true;
|
|
if (level < 0 || level >50) return true;
|
|
partyclient->Party->party->PartyLevel = level;
|
|
if( partyclient->Party->party->PartyLevel == 50)
|
|
partyclient->Party->party->Exp = 0;
|
|
//Send Party Level and Party Exp
|
|
BEGINPACKET( pak, 0x7d4 ); //
|
|
ADDBYTE ( pak, partyclient->Party->party->PartyLevel);
|
|
ADDDWORD ( pak, partyclient->Party->party->Exp );
|
|
partyclient->Party->party->SendToMembers( &pak );
|
|
return true;
|
|
}
|
|
|
|
// GM: Kill all mobs in a range of x-Fields
|
|
bool CWorldServer::pakGMKillInRange( CPlayer* thisclient, int range )
|
|
{
|
|
for(UINT j = 0; j < MapList.Index[thisclient->Position->Map]->MonsterList.size(); j++)
|
|
{
|
|
CMonster* thismon = MapList.Index[thisclient->Position->Map]->MonsterList.at(j);
|
|
if(thismon == NULL)
|
|
{
|
|
//SendPM(thisclient,"Target Monster does not exist");
|
|
continue;
|
|
}
|
|
if( IsMonInCircle( thisclient, thismon, (float)range ))
|
|
{
|
|
//Kill the mob
|
|
thismon->Stats->HP = -1;
|
|
BEGINPACKET( pak, 0x799 );
|
|
ADDWORD ( pak, thismon->clientid );
|
|
ADDWORD ( pak, thismon->clientid );
|
|
ADDWORD ( pak, 0x8005);
|
|
//ADDDWORD ( pak, thismon->thisnpc->hp*thismon->thisnpc->level );
|
|
//ADDDWORD ( pak, 16 );
|
|
SendToVisible( &pak, thismon );
|
|
CMap* map = MapList.Index[thisclient->Position->Map];
|
|
map->DeleteMonster( thismon );
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// GM: Change Class (from Crash)
|
|
bool CWorldServer::pakGMClass( CPlayer* thisclient, char* classid )
|
|
{
|
|
int classid_new;
|
|
|
|
if ( strcmp ( classid , "Visitor" ) == 0 || strcmp ( classid , "visitor" ) == 0)
|
|
{
|
|
classid_new = 0;
|
|
}
|
|
else if ( strcmp ( classid , "Soldier" ) == 0 || strcmp ( classid , "soldier" ) == 0)
|
|
{
|
|
classid_new = 111;
|
|
}
|
|
else if ( strcmp ( classid , "Knight" ) == 0 || strcmp ( classid , "knight" ) == 0)
|
|
{
|
|
classid_new = 121;
|
|
}
|
|
else if ( strcmp ( classid , "Champion" ) == 0 || strcmp ( classid , "champion" ) == 0)
|
|
{
|
|
classid_new = 122;
|
|
}
|
|
else if ( strcmp ( classid , "Muse" ) == 0 || strcmp ( classid , "muse" ) == 0)
|
|
{
|
|
classid_new = 211;
|
|
}
|
|
else if ( strcmp ( classid , "Mage" ) == 0 || strcmp ( classid , "mage" ) == 0)
|
|
{
|
|
classid_new = 221;
|
|
}
|
|
else if ( strcmp ( classid , "Cleric" ) == 0 || strcmp ( classid , "cleric" ) == 0)
|
|
{
|
|
classid_new = 222;
|
|
}
|
|
else if ( strcmp ( classid , "Hawker" ) == 0 || strcmp ( classid , "hawker" ) == 0)
|
|
{
|
|
classid_new = 311;
|
|
}
|
|
else if ( strcmp ( classid , "Raider" ) == 0 || strcmp ( classid , "raider" ) == 0)
|
|
{
|
|
classid_new = 321;
|
|
}
|
|
else if ( strcmp ( classid , "Scout" ) == 0 || strcmp ( classid , "scout" ) == 0)
|
|
{
|
|
classid_new = 322;
|
|
}
|
|
else if ( strcmp ( classid , "Dealer" ) == 0 || strcmp ( classid , "dealer" ) == 0)
|
|
{
|
|
classid_new = 411;
|
|
}
|
|
else if ( strcmp ( classid , "Bourgeois" ) == 0 || strcmp ( classid , "bourgeois" ) == 0)
|
|
{
|
|
classid_new = 421;
|
|
}
|
|
else if ( strcmp ( classid , "Artisan" ) == 0 || strcmp ( classid , "artisan" ) == 0)
|
|
{
|
|
classid_new = 422;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
// Set the quest vars for the new class
|
|
dword jVarSw = classid_new % 10;
|
|
thisclient->quest.JobVar[0] = 0;
|
|
thisclient->quest.JobVar[1] = 0;
|
|
if (jVarSw == 1)
|
|
{
|
|
thisclient->quest.JobVar[0] = 1;
|
|
}
|
|
else if (jVarSw == 2)
|
|
{
|
|
thisclient->quest.JobVar[0] = 1;
|
|
thisclient->quest.JobVar[1] = 2;
|
|
}
|
|
thisclient->CharInfo->Job = classid_new;
|
|
BEGINPACKET(pak, 0x0721);
|
|
ADDWORD(pak,4);
|
|
ADDWORD(pak, thisclient->CharInfo->Job);
|
|
ADDWORD(pak,0);
|
|
thisclient->client->SendPacket(&pak);
|
|
RESETPACKET(pak, 0x0730);//05 00 2f f5 64 29
|
|
ADDWORD(pak, 5);
|
|
ADDWORD(pak, 0xf52f);//ADDWORD(pak, 0xa24d);
|
|
ADDWORD(pak, 0x2964);//ADDWORD(pak, 0x40b3);
|
|
thisclient->client->SendPacket(&pak);
|
|
SendPM(thisclient, "Class changed!" );
|
|
|
|
return true;
|
|
}
|
|
|
|
bool CWorldServer::pakGMTeleAllHere( CPlayer* thisclient )
|
|
{
|
|
int count=1;
|
|
while(count <= (ClientList.size()-1))
|
|
{
|
|
CPlayer* otherclient = (CPlayer*)ClientList.at(count)->player;
|
|
if ((otherclient != NULL) && (otherclient != thisclient))
|
|
{
|
|
CMap* map = MapList.Index[thisclient->Position->Map];
|
|
map->TeleportPlayer( otherclient, thisclient->Position->current, false );
|
|
}
|
|
count++;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool CWorldServer::pakGMMoveTo( CPlayer* thisclient, fPoint position )
|
|
{
|
|
if( thisclient->Shop->open || (!thisclient->Ride->Drive && thisclient->Ride->Ride) || !thisclient->Status->CanMove )
|
|
return true;
|
|
if( thisclient->Status->Stance==1 )
|
|
thisclient->Status->Stance=3;
|
|
thisclient->Position->destiny = position;
|
|
ClearBattle( thisclient->Battle );
|
|
BEGINPACKET( pak, 0x79a );
|
|
ADDWORD ( pak, thisclient->clientid );
|
|
ADDWORD ( pak, thisclient->Battle->target );
|
|
ADDWORD ( pak, thisclient->Stats->Move_Speed );
|
|
ADDFLOAT ( pak, thisclient->Position->destiny.x*100 );
|
|
ADDFLOAT ( pak, thisclient->Position->destiny.y*100 );
|
|
ADDFLOAT ( pak, thisclient->Position->destiny.z*100 );
|
|
SendToVisible( &pak, thisclient );
|
|
return true;
|
|
}
|
|
//change the player dmg rate
|
|
bool CWorldServer::pakGMChangePlayerDmg(CPlayer* thisclient, int rate)
|
|
{
|
|
GServer->Config.PlayerDmg = rate;
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have changed the player dmg rate.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
//change the monster dmg rate
|
|
bool CWorldServer::pakGMChangeMonsterDmg(CPlayer* thisclient, int rate)
|
|
{
|
|
GServer->Config.MonsterDmg = rate;
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have changed the Monster dmg rate.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
|
|
//change the mSpeedModif || For test only
|
|
bool CWorldServer::pakGMChangeMSpeedModif(CPlayer* thisclient, int modif)
|
|
{
|
|
GServer->MOVE_SPEED_MOD = modif;
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "mSpeedModif Changed.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
|
|
//change the Cfmode
|
|
bool CWorldServer::pakGMChangeCfmode(CPlayer* thisclient, int mode)
|
|
{
|
|
if(mode<0) mode = 0;
|
|
if(mode>1) mode = 1;
|
|
GServer->Config.Cfmode = mode;
|
|
BEGINPACKET (pak, 0x702);
|
|
ADDSTRING(pak, "You have changed the Clan Field Mode.");
|
|
ADDBYTE(pak, 0);
|
|
thisclient->client->SendPacket(&pak);
|
|
return true;
|
|
}
|
|
|
|
//LMA: Giving union points to a player.
|
|
bool CWorldServer::pakGMUnionPoints(CPlayer* thisclient, char* name, int nb_points)
|
|
{
|
|
CPlayer* otherclient = GetClientByCharName (name);
|
|
if(otherclient == NULL)
|
|
{
|
|
SendPM(otherclient,"Target Player does not exist or is offline");
|
|
return true;
|
|
}
|
|
if(otherclient->Union_s->unionvar[0] == 0)
|
|
{
|
|
// Otherclient not in a union
|
|
Log(MSG_INFO,"Could not give union Points as this player is not in a Union");
|
|
return true;
|
|
}
|
|
|
|
otherclient->Union_s->unionvar[otherclient->Union_s->unionvar[0]] += nb_points;
|
|
int new_amount = otherclient->Union_s->unionvar[otherclient->Union_s->unionvar[0]];
|
|
|
|
//Need to run a quest trigger to make this happen client side too. Have to write the QSD first though.
|
|
|
|
BEGINPACKET( pak, 0x720 ); // i think this should be 720 and not 721 as Lmame had it. 721 will change your union ID
|
|
ADDWORD( pak, otherclient->Union_s->unionvar[0] );
|
|
ADDWORD( pak, new_amount );
|
|
ADDWORD( pak, 0x0000 );
|
|
otherclient->client->SendPacket( &pak );
|
|
RESETPACKET( pak, 0x730 );
|
|
ADDWORD ( pak, 0x0005 );
|
|
ADDDWORD ( pak, 0x40b3a24d );
|
|
otherclient->client->SendPacket( &pak );
|
|
|
|
SendPM(otherclient, "You have been given %i Faction Points by %s",nb_points,thisclient->CharInfo->charname);
|
|
Log( MSG_GMACTION, "%i Faction points given to %s by %s" , nb_points,name,thisclient->CharInfo->charname);
|
|
|
|
|
|
return true;
|
|
}
|