// SPDX-License-Identifier: MIT pragma solidity >=0.8.24; /* Autogenerated file. Do not edit manually. */ import { KillMailSystem } from "../../systems/kill-mail/KillMailSystem.sol"; import { KillMailData } from "../index.sol"; import { revertWithBytes } from "@latticexyz/world/src/revertWithBytes.sol"; import { IWorldCall } from "@latticexyz/world/src/IWorldKernel.sol"; import { SystemCall } from "@latticexyz/world/src/SystemCall.sol"; import { Systems } from "@latticexyz/world/src/codegen/tables/Systems.sol"; import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; type KillMailSystemType is bytes32; // equivalent to WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: "evefrontier", name: "KillMailSystem" })) KillMailSystemType constant killMailSystem = KillMailSystemType.wrap( 0x737965766566726f6e746965720000004b696c6c4d61696c53797374656d0000 ); struct CallWrapper { ResourceId systemId; address from; } struct RootCallWrapper { ResourceId systemId; address from; } /** * @title KillMailSystemLib * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) * @dev This library is automatically generated from the corresponding system contract. Do not edit manually. */ library KillMailSystemLib { error KillMailSystemLib_CallingFromRootSystem(); error KillMail_AlreadyExists(uint256 killMailId); error KillMail_InvalidCharacterId(uint256 killMailId, uint256 characterId); function reportKill(KillMailSystemType self, uint256 killMailId, KillMailData memory killMailData) internal { return CallWrapper(self.toResourceId(), address(0)).reportKill(killMailId, killMailData); } function reportKill(CallWrapper memory self, uint256 killMailId, KillMailData memory killMailData) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert KillMailSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_reportKill_uint256_KillMailData.reportKill, (killMailId, killMailData)); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function reportKill(RootCallWrapper memory self, uint256 killMailId, KillMailData memory killMailData) internal { bytes memory systemCall = abi.encodeCall(_reportKill_uint256_KillMailData.reportKill, (killMailId, killMailData)); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function callFrom(KillMailSystemType self, address from) internal pure returns (CallWrapper memory) { return CallWrapper(self.toResourceId(), from); } function callAsRoot(KillMailSystemType self) internal view returns (RootCallWrapper memory) { return RootCallWrapper(self.toResourceId(), msg.sender); } function callAsRootFrom(KillMailSystemType self, address from) internal pure returns (RootCallWrapper memory) { return RootCallWrapper(self.toResourceId(), from); } function toResourceId(KillMailSystemType self) internal pure returns (ResourceId) { return ResourceId.wrap(KillMailSystemType.unwrap(self)); } function fromResourceId(ResourceId resourceId) internal pure returns (KillMailSystemType) { return KillMailSystemType.wrap(resourceId.unwrap()); } function getAddress(KillMailSystemType self) internal view returns (address) { return Systems.getSystem(self.toResourceId()); } function _world() private view returns (IWorldCall) { return IWorldCall(StoreSwitch.getStoreAddress()); } } /** * System Function Interfaces * * We generate an interface for each system function, which is then used for encoding system calls. * This is necessary to handle function overloading correctly (which abi.encodeCall cannot). * * Each interface is uniquely named based on the function name and parameters to prevent collisions. */ interface _reportKill_uint256_KillMailData { function reportKill(uint256 killMailId, KillMailData memory killMailData) external; } using KillMailSystemLib for KillMailSystemType global; using KillMailSystemLib for CallWrapper global; using KillMailSystemLib for RootCallWrapper global;