public void InstallLine(FishingLine fishingLine) { if (ItemCanBeInstalled) { if (CurrentRod.CurrentLine != null) { RaiseMessage(string.Format("{0} returned to Backpack", CurrentRod.CurrentLine.Name)); CurrentPlayer.AddItemToBackpack(CurrentRod.CurrentLine); } FishingLine line = fishingLine.BreakLine(50); if (fishingLine.Length == 0) { CurrentPlayer.RemoveItemFromBackpack(fishingLine); } CurrentRod.InstallLine(line); RaiseMessage(string.Format("You install {0}m of {1} on {2}", line.Length, line.OriginalName, CurrentRod.Name)); } else { RaiseMessage("Select rod first"); } }
public void InstallReel(Reel reel) { if (ItemCanBeInstalled) { if (CurrentRod.CurrentReel != null) { RaiseMessage(string.Format("{0} returned to Backpack", CurrentRod.CurrentReel.Name)); CurrentPlayer.AddItemToBackpack(CurrentRod.CurrentReel); } CurrentPlayer.RemoveItemFromBackpack(reel); CurrentRod.InstallReel(reel); RaiseMessage(string.Format("{0} installed on {1}", reel.Name, CurrentRod.Name)); } else { RaiseMessage("Select rod first"); } }
public void UseItem(GearItem item) { switch (item) { case FishingRod rod: { CurrentRod = rod; RaiseMessage(string.Format("Your current rod is {0}", rod.Name)); break; } case Reel reel: { InstallReel(reel); break; } case FishingLine line: { InstallLine(line); break; } case Lure lure: { CurrentLure = lure; RaiseMessage(string.Format("Current lure is {0} ({1} portions left)", lure.OriginalName, lure.PortionsLeft)); break; } case HooksSet hooksSet: { CurrentRod.InstallHook(hooksSet.TakeOneHook()); RaiseMessage(string.Format("You install {0} on {1}", hooksSet.Hook.Name, CurrentRod.Name)); break; } } RaiseBackpackChanged(); }