Support for /movecharacter
Fix #199 /movecharacter name zonename updates the characters table, moves to safe x,y,z,heading of zone character should be logged out, otherwise there is no point to using this command (just gets overwritten on char save). - /castspell command updated for third argument, when set to '0' will cast as 'self' as it were the target. eg /castspell 1234 1 0 (will cast spell id 1234 tier 1 and self cast it on your target)
This commit is contained in:
parent
940ff104be
commit
f85294d6a0
3 changed files with 35 additions and 2 deletions
1
DB/updates/movecharacter_command_dec27_2020.sql
Normal file
1
DB/updates/movecharacter_command_dec27_2020.sql
Normal file
|
@ -0,0 +1 @@
|
|||
insert into commands set type=1,command='movecharacter',subcommand='',handler=525,required_status=200;
|
|
@ -2787,6 +2787,17 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
|
|||
if (sep->arg[1] && sep->IsNumber(1))
|
||||
tier = atoul(sep->arg[1]);
|
||||
|
||||
int8 self = 1;
|
||||
if (sep->arg[1] && sep->IsNumber(2))
|
||||
{
|
||||
self = atoul(sep->arg[2]);
|
||||
if(self != 1 && !cmdTarget->IsEntity())
|
||||
{
|
||||
client->Message(CHANNEL_COLOR_RED, "Target is not an entity required to cast non-self spell.");
|
||||
self = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int32 spellid = atoul(sep->arg[0]);
|
||||
Spell* spell = master_spell_list.GetSpell(spellid, tier);
|
||||
|
||||
|
@ -2797,7 +2808,7 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
|
|||
// Get the current zones spell process
|
||||
spellProcess = client->GetCurrentZone()->GetSpellProcess();
|
||||
|
||||
spellProcess->CastInstant(spell, (Entity*)client->GetPlayer(), (cmdTarget && cmdTarget->IsEntity()) ? (Entity*)cmdTarget : (Entity*)client->GetPlayer());
|
||||
spellProcess->CastInstant(spell, (!cmdTarget || self == 1) ? (Entity*)client->GetPlayer() : (Entity*)cmdTarget, (cmdTarget && cmdTarget->IsEntity()) ? (Entity*)cmdTarget : (Entity*)client->GetPlayer());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4514,8 +4525,8 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
|
|||
case CANCEL_AA_PROFILE : { Cancel_AA_Profile(client, sep); break; }
|
||||
case SAVE_AA_PROFILE : { Save_AA_Profile(client, sep); break; }
|
||||
case COMMAND_TARGETITEM : { Command_TargetItem(client, sep); break; }
|
||||
|
||||
case COMMAND_FINDSPAWN: { Command_FindSpawn(client, sep); break; }
|
||||
case COMMAND_MOVECHARACTER: { Command_MoveCharacter(client, sep); break; }
|
||||
|
||||
|
||||
default:
|
||||
|
@ -10429,3 +10440,20 @@ void Commands::Command_FindSpawn(Client* client, Seperator* sep) {
|
|||
if(sep)
|
||||
client->GetCurrentZone()->FindSpawn(client, (char*)sep->argplus[0]);
|
||||
}
|
||||
|
||||
void Commands::Command_MoveCharacter(Client* client, Seperator* sep) {
|
||||
if(sep && sep->arg[0][0] && sep->arg[1][0])
|
||||
{
|
||||
char* name = sep->arg[0];
|
||||
char* zoneName = sep->arg[1];
|
||||
|
||||
char query[256];
|
||||
snprintf(query, 256, "UPDATE characters c, zones z set c.x = z.safe_x, c.y = z.safe_y, c.z = z.safe_z, c.heading = z.safe_heading, c.current_zone_id = z.id where c.name = '%s' and z.name='%s'", name, zoneName);
|
||||
if (database.RunQuery(query, strnlen(query, 256)))
|
||||
{
|
||||
client->Message(CHANNEL_COLOR_YELLOW, "Ran query:%s", query);
|
||||
}
|
||||
else
|
||||
client->Message(CHANNEL_COLOR_RED, "Query FAILED to run: %s", query);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,6 +429,8 @@ public:
|
|||
|
||||
void Command_FindSpawn(Client* client, Seperator* set);
|
||||
|
||||
void Command_MoveCharacter(Client* client, Seperator* set);
|
||||
|
||||
// Bot Commands
|
||||
void Command_Bot(Client* client, Seperator* sep);
|
||||
void Command_Bot_Create(Client* client, Seperator* sep);
|
||||
|
@ -868,6 +870,8 @@ private:
|
|||
|
||||
#define COMMAND_RELOADREGIONSCRIPTS 524
|
||||
|
||||
#define COMMAND_MOVECHARACTER 525
|
||||
|
||||
#define GET_AA_XML 750
|
||||
#define ADD_AA 751
|
||||
#define COMMIT_AA_PROFILE 752
|
||||
|
|
Loading…
Reference in a new issue