新增/修改

新增
  - getContainerType
修改
  - HandleRequestActionEvent
This commit is contained in:
子沐呀
2024-07-23 05:59:08 +08:00
Unverified
parent 7a0e3d8019
commit f427f2f5e1
5 changed files with 32 additions and 9 deletions
+8
View File
@@ -1,6 +1,7 @@
#include "Global.h"
#include "magic_enum.hpp"
#include "mc/network/packet/InventorySlotPacket.h"
#include "mc/world/Container.h"
#include <map>
#include <regex>
#include <vector>
@@ -878,4 +879,11 @@ void Export_Compatibility_API() {
InventorySlotPacket((ContainerID)containerId, slot, *item).sendTo(*player);
}
);
RemoteCall::exportAs(
"GMLIB_API",
"getContainerType",
[](Container* container) -> std::string {
return magic_enum::enum_name(container->getContainerType()).data();
}
);
}
+2 -2
View File
@@ -266,7 +266,7 @@ void Export_Event_API() {
}
case doHash("HandleRequestAction"): {
auto Call = RemoteCall::importAs<
bool(Player * player, std::string const& actionType, int ContainerNetId, int slot)>(
bool(Player * player, std::string const& actionType, std::string const& containerNetId, int slot)>(
eventName,
eventId
);
@@ -278,7 +278,7 @@ void Export_Event_API() {
result = Call(
&ev.self(),
magic_enum::enum_name(requestAction->mActionType).data(),
(int)requestAction->getSrc().mOpenContainerNetId,
magic_enum::enum_name(requestAction->getSrc().mOpenContainerNetId).data(),
requestAction->getSrc().mSlot
);
} catch (...) {}