public void CancelBounty(int sourceID, string bountyName) { ShPlayer requester = EntityCollections.FindByID <ShPlayer>(sourceID); if (!requester) { Debug.LogError("[SVR] Requester not found"); return; } if (!bounties.ContainsKey(bountyName)) { requester.svPlayer.SendGameMessage("No Bounty for " + bountyName); } else if (requester.MyMoneyCount < cancelCost) { requester.svPlayer.SendGameMessage("Not enough money"); } else { bounties.Remove(bountyName); ChatHandler.SendToAll("Bounty Canceled on " + bountyName); requester.TransferMoney(DeltaInv.RemoveFromMe, cancelCost); OnEmployeeAction(requester, null); if (aiTarget && bountyName == aiTarget.username) { aiTarget = null; } } }
public void PlaceBounty(int sourceID, string bountyName) { ShPlayer requester = EntityCollections.FindByID <ShPlayer>(sourceID); if (!requester) { Debug.LogError("[SVR] Requester not found"); return; } if (bounties.ContainsKey(bountyName)) { requester.svPlayer.SendGameMessage("Bounty already exists for " + bountyName); } else if (requester.MyMoneyCount < placeCost) { requester.svPlayer.SendGameMessage("Not enough money"); } else { AddBounty(bountyName); requester.TransferMoney(DeltaInv.RemoveFromMe, placeCost); OnEmployeeAction(requester, null); } }
public void OnOptionAction(ShPlayer player, int targetID, string menuID, string optionID, string actionID) { if (targetID >= 0) { player.svPlayer.job.OnOptionMenuAction(targetID, menuID, optionID, actionID); return; } ShPlayer target = EntityCollections.FindByID <ShPlayer>(-targetID); if (target) { target.svPlayer.job.OnOptionMenuAction(player.ID, menuID, optionID, actionID); } }
public void RequestAdd(int sourceID, string itemName) { if (!requestItems.Contains(itemName)) { Debug.LogError("[SVR] Item not valid: " + itemName); return; } ShItem item = SceneManager.Instance.GetEntity <ShItem>(itemName); if (!item) { Debug.LogError("[SVR] Item not found: " + itemName); return; } ShPlayer requester = EntityCollections.FindByID <ShPlayer>(sourceID); if (!requester) { Debug.LogError("[SVR] Requester not found"); return; } if (requester.HasItem(item.index)) { requester.svPlayer.SendGameMessage("Already own item"); } else if (requester.MyMoneyCount < item.value) { requester.svPlayer.SendGameMessage("Not enough money"); } else if (requests.ContainsKey(requester.username)) { requester.svPlayer.SendGameMessage("Previous request still pending"); } else { requests[requester.username] = itemName; requester.svPlayer.SendGameMessage("Request successfully sent"); ShPlayer mayor = info.members.FirstOrDefault(); if (mayor) { mayor.svPlayer.SendGameMessage(requester.username + " requesting a " + item.itemName); } } }
public HackingContainer(ShPlayer player, int apartmentID, string username) { this.player = player; targetApartment = EntityCollections.FindByID <ShApartment>(apartmentID); EntityCollections.TryGetPlayerByNameOrID(username, out targetPlayer); }
public MinigameContainer(ShPlayer player, int entityID) { this.player = player; targetEntity = EntityCollections.FindByID(entityID); }