Example #1
0
        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;
                }
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
            }
        }
Example #4
0
        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);
                }
            }
        }
Example #5
0
 public HackingContainer(ShPlayer player, int apartmentID, string username)
 {
     this.player     = player;
     targetApartment = EntityCollections.FindByID <ShApartment>(apartmentID);
     EntityCollections.TryGetPlayerByNameOrID(username, out targetPlayer);
 }
Example #6
0
 public MinigameContainer(ShPlayer player, int entityID)
 {
     this.player  = player;
     targetEntity = EntityCollections.FindByID(entityID);
 }