[Server] Add OnContainer script callback

pull/163/head
David Cernat 8 years ago
parent 5300bcd711
commit 1198caddf6

@ -537,9 +537,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
break; break;
} }
case ID_CONTAINER: case ID_OBJECT_HEALTH:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_HEALTH from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(baseEvent); myPacket->Read(baseEvent);
@ -548,26 +548,30 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
break; break;
} }
case ID_OBJECT_HEALTH: case ID_DOOR_STATE:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_HEALTH from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(baseEvent); myPacket->Read(baseEvent);
myPacket->Send(baseEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnDoorState")>(
player->getId(),
baseEvent->cell.getDescription().c_str());
break; break;
} }
case ID_DOOR_STATE: case ID_CONTAINER:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(baseEvent); myPacket->Read(baseEvent);
myPacket->Send(baseEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnDoorState")>( Script::Call<Script::CallbackIdentity("OnContainer")>(
player->getId(), player->getId(),
baseEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());

@ -123,6 +123,7 @@ public:
{"OnObjectLock", Function<void, unsigned short, const char*>()}, {"OnObjectLock", Function<void, unsigned short, const char*>()},
{"OnObjectUnlock", Function<void, unsigned short, const char*>()}, {"OnObjectUnlock", Function<void, unsigned short, const char*>()},
{"OnDoorState", Function<void, unsigned short, const char*>()}, {"OnDoorState", Function<void, unsigned short, const char*>()},
{"OnContainer", Function<void, unsigned short, const char*>()},
{"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()}, {"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()},
{"OnPlayerEndCharGen", Function<void, unsigned short>()}, {"OnPlayerEndCharGen", Function<void, unsigned short>()},
{"OnGUIAction", Function<void, unsigned short, int, const char*>()} {"OnGUIAction", Function<void, unsigned short, int, const char*>()}

Loading…
Cancel
Save