when you walk up to a banker and click him he opens the bank windows ( as it should)
on live he will also talk to you (as if you pressed hail)(on live not sure in emu)
what it doesnt do when bank is selected is trigger casted on like other spawn types
am i missing soemthing or would we just have to add something to the client bank code to taht casted_on or something else in the spawn script whould get triggerred
what i envision walk up to a bank and
click bank, bank opens but then also have him talk to us via spawn script "Hello Ememjr, welcome to my bank"
of click Guild Bank, guild bank opens and he says "Hello Ememjr, welcome to the Persevernce Guild Bank"
but we could script what ever we wanted quest updates, etc
i thought i saw a thread about this type of thing before but cannot find it now
Entity commands, casted_on
Moderator: Team Members
- Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
- Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Re: Entity commands, casted_on
the way the client works as we know when you click on an NPC the primary command is executed,
via the OP_EntityVerbsVerbMsg opcode/packet
what our code does here is first it looks to see if its one of our "commands" (such as bank)
if it is bank or one of our other commands then it ( on an npc) it does
but
it will then not do
which actually handle the custom entity commands
since the custom entitiy commands are handle by casted_on i the script it does not seem to hurt to remove the else from this
so now if i click on a banker and use casted_on in the script it will execute even if the primary command is a command like bank
where as before it would only do one or the other
I will commit this as long as i dont run into any issues with it
via the OP_EntityVerbsVerbMsg opcode/packet
what our code does here is first it looks to see if its one of our "commands" (such as bank)
if it is bank or one of our other commands then it ( on an npc) it does
Code: Select all
commands.Process(handler, &command, this);it will then not do
Code: Select all
(NPC*)spawn)->HandleUse(this, command.data)since the custom entitiy commands are handle by casted_on i the script it does not seem to hurt to remove the else from this
Code: Select all
if(spawn && spawn->IsNPC()){
command = packet->getType_EQ2_16BitString_ByName("command");
//if (EntityCommandPrecheck(spawn, command.data.c_str())){
if (!((NPC*)spawn)->HandleUse(this, command.data)){
LogWrite(WORLD__ERROR, 0, "World", "Unhandled command in OP_EntityVerbsVerbMsg: %s", command.data.c_str());
}where as before it would only do one or the other
Code: Select all
case OP_EntityVerbsVerbMsg:{
LogWrite(OPCODE__DEBUG, 1, "Opcode", "Opcode 0x%X (%i): OP_EntityVerbsVerbMsg", opcode, opcode);
PacketStruct* packet = configReader.getStruct("WS_EntityVerbsVerb", GetVersion());
if(packet){
packet->LoadPacketData(app->pBuffer, app->size);
int32 spawn_id = packet->getType_int32_ByName("spawn_id");
player->SetTarget(player->GetSpawnWithPlayerID(spawn_id));
Spawn* spawn = player->GetTarget();
if (spawn && !spawn->IsNPC() && !spawn->IsPlayer()){
string command = packet->getType_EQ2_16BitString_ByName("command").data;
if (EntityCommandPrecheck(spawn, command.c_str())){
if (spawn->IsGroundSpawn())
((GroundSpawn*)spawn)->HandleUse(this, command);
else if (spawn->IsObject())
((Object*)spawn)->HandleUse(this, command);
else if (spawn->IsWidget())
((Widget*)spawn)->HandleUse(this, command);
else if (spawn->IsSign())
((Sign*)spawn)->HandleUse(this, command);
}
}
else{
EQ2_16BitString command = packet->getType_EQ2_16BitString_ByName("command");
if(command.size > 0){
string command_name = command.data;
if(command_name.find(" ") < 0xFFFFFFFF)
command_name = command_name.substr(0, command_name.find(" "));
int32 handler = commands.GetCommandHandler(command_name.c_str());
if(handler != 0xFFFFFFFF){
if(command.data == command_name){
command.data = "";
command.size = 0;
}
else{
command.data = command.data.substr(command.data.find(" ")+1);
command.size = command.data.length();
}
commands.Process(handler, &command, this);
}
//else{
if(spawn && spawn->IsNPC()){
command = packet->getType_EQ2_16BitString_ByName("command");
//if (EntityCommandPrecheck(spawn, command.data.c_str())){
if (!((NPC*)spawn)->HandleUse(this, command.data)){
LogWrite(WORLD__ERROR, 0, "World", "Unhandled command in OP_EntityVerbsVerbMsg: %s", command.data.c_str());
}
//}
}
else
LogWrite(WORLD__ERROR, 0, "World", "Unknown command in OP_EntityVerbsVerbMsg: %s", command.data.c_str());
//}
}
}
safe_delete(packet);
}
break;- Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Re: Entity commands, casted_on
ok one issue with this so far, if the command in bank or a completely custom entity that there is no /command for then it works ok
if there is a /command and entity command for it such as hail , then hail executes twice not sure if we have a way around that other than doing an if that will skip the second version on certain entities ie hail
if there is a /command and entity command for it such as hail , then hail executes twice not sure if we have a way around that other than doing an if that will skip the second version on certain entities ie hail
Who is online
Users browsing this forum: No registered users and 0 guests