unsafe internal static void OnCommand(IntPtr entity) { MetaModEngine.SetResult(MetaResult.Handled); Player player = Player.GetPlayer(entity); Command cmd = CommandManager.CreateCommandFromGameEngine(CommandType.Player); switch (cmd.Arguments[0]) { case "menuselect": player.SelectMenu(Convert.ToInt32(cmd.Arguments[1]) - 1); break; default: CommandManager.Execute(player, cmd); break; } clientCommandEventArgs = new CommandEventArgs(player, cmd); OnCommand(clientCommandEventArgs); player.OnPlayerCommand(clientCommandEventArgs); if (clientCommandEventArgs.Override) { MetaModEngine.SetResult(MetaResult.Supercede); } else { MetaModEngine.SetResult(MetaResult.Handled); } }
internal static void OnPutInServer(IntPtr entity) { Player player = Player.GetPlayer(entity); PutInServerEventArgs args = new PutInServerEventArgs(player); OnPutInServer(args); player.OnPlayerPutInServer(args); }
internal static void OnDisconnect(IntPtr entity) { MetaModEngine.SetResult(MetaResult.Handled); Player player = Player.GetPlayer(entity); DisconnectEventArgs args = new DisconnectEventArgs(player); OnDisconnect(args); player.OnPlayerClientDisconnect(args); player.Release(); }
internal static bool OnConnect(IntPtr entity, string name, string address, string reject_reason) { Player player = Player.GetPlayer(entity); player.Name = name; string[] addressinformation = address.Split(':'); player.IPAddress = IPAddress.Parse(addressinformation[0]); player.Port = Convert.ToInt32(addressinformation[1]); if (player.PendingAuth) { pendingAuthPlayers.Add(player); } else { Player.OnAuthorize(player); } ConnectEventArgs connectEventArgs = new ConnectEventArgs(player, reject_reason); OnConnect(connectEventArgs); player.OnPlayerConnect(connectEventArgs); return(true); }