private bool OnGiveCommand(string userName, string[] pieces) { var player = FrogtownShared.GetPlayerWithName(userName); ItemWithCount itemWithCount = null; try { itemWithCount = ParseItemWithCount(pieces); if (itemWithCount.index < 0 || itemWithCount.index >= (int)ItemIndex.Count) { SendFailedLookupMessage(); return(true); } } catch (ArgumentException e) { SendFailedLookupMessage(); return(true); } itemWithCount.count = Math.Max(itemWithCount.count, 1); player.master.inventory.GiveItem((ItemIndex)itemWithCount.index, itemWithCount.count); FrogtownShared.SendChat(string.Format("Gave {0} items to {1}.", itemWithCount.count, userName)); return(true); }
private bool OnCharCommand(string userName, string[] pieces) { if (pieces.Length >= 2) { int prefabIndex = -1; if (!Int32.TryParse(pieces[1], out prefabIndex)) { prefabIndex = BodyCatalog.FindBodyIndexCaseInsensitive(pieces[1]); } if (prefabIndex != -1) { GameObject prefab = BodyCatalog.GetBodyPrefab(prefabIndex); if (prefab != null) { if (FrogtownShared.ChangePrefab(userName, prefab)) { FrogtownShared.SendChat(userName + " morphed into " + prefab.name); } else { FrogtownShared.SendChat(userName + " couldn't morph into " + prefab.name); } } else { FrogtownShared.SendChat("Prefab not found"); } } } return(true); }
private bool OnRemoveCommand(string userName, string[] pieces) { var player = FrogtownShared.GetPlayerWithName(userName); ItemWithCount itemWithCount = null; try { itemWithCount = ParseItemWithCount(pieces); } catch (ArgumentException e) { SendFailedLookupMessage(); return(true); } int countPlayerHas = player.master.inventory.GetItemCount((ItemIndex)itemWithCount.index); itemWithCount.count = Math.Min(Math.Max(itemWithCount.count, 1), countPlayerHas); FrogtownShared.SendChat(string.Format("countPlayerHas = {0}\r\nitemWithCount.count = {1}", countPlayerHas, itemWithCount.count)); if (itemWithCount.count > 0) { player.master.inventory.GiveItem((ItemIndex)itemWithCount.index, -itemWithCount.count); FrogtownShared.SendChat(string.Format("Took {0} items from {1}.", itemWithCount.count, userName)); } return(true); }
private bool OnClearItemsCommand(string userName, string[] pieces) { var player = FrogtownShared.GetPlayerWithName(userName); foreach (ItemIndex itemIndex in ItemCatalog.allItems) { int count = player.master.inventory.GetItemCount(itemIndex); OnRemoveCommand(userName, new[] { pieces[0], itemIndex.ToString(), count.ToString() }); } FrogtownShared.SendChat("Took all items from " + userName + "."); return(true); }
private void SendFailedLookupMessage() { FrogtownShared.SendChat("Failed to lookup item."); }
private void On_ServerStageBegin(Stage stage) { FrogtownShared.SendChat(stage.sceneDef.sceneName); }
private void On_CmdPing(On.RoR2.PingerController.orig_CmdPing orig, PingerController self, PingerController.PingInfo incomingPing) { orig(self, incomingPing); FrogtownShared.SendChat(string.Format("Origin: {0}", FormatVector3String(incomingPing.origin))); FrogtownShared.SendChat(string.Format("Normal: {0}", FormatVector3String(incomingPing.normal))); }