private static int OnHandlePartyMessage(void *pMessage, void *pPlayer, byte nMinor) { PartyEventType eventType = (PartyEventType)nMinor; if (!Enum.IsDefined(eventType)) { return(Hook.CallOriginal(pMessage, pPlayer, nMinor)); } CNWSMessage message = CNWSMessage.FromPointer(pMessage); uint oidTarget = message.PeekMessage <uint>(0) & 0x7FFFFFFF; OnPartyEvent eventData = new OnPartyEvent { EventType = eventType, Player = CNWSPlayer.FromPointer(pPlayer).ToNwPlayer() !, Target = oidTarget.ToNwObject <NwCreature>() !, }; eventData.Result = new Lazy <bool>(() => !eventData.PreventEvent && Hook.CallOriginal(pMessage, pPlayer, nMinor).ToBool()); ProcessEvent(eventData); return(eventData.Result.Value.ToInt()); } }
protected Event(PartyEventType type) { EventType = type; CreatedOn = DateTimeOffset.Now; }