예제 #1
0
        object OnItemPickup(Item item, BasePlayer player)
        {
            WorldItem wItem = item.GetWorldEntity() as WorldItem;

            if (wItem.item == null)
            {
                return(null);
            }
            if (item.info.shortname == "note")
            {
                PortableBounty pBounty = wItem.gameObject.GetComponent <PortableBounty>();
                if (pBounty != null)
                {
                    Bounty bounty = pBounty.bounty;
                    if (bounty == null)
                    {
                        Puts($"pBounty.bounty on Note[{item.uid}] is null. This shouldn't happen!");
                        return(null);
                    }
                    BountyData.AddBounty(bounty);
                }
            }

            return(null);
        }
예제 #2
0
파일: hunt.cs 프로젝트: kiloOhm/Bounty
            public void end(BasePlayer winner = null)
            {
#if DEBUG
                PluginInstance.PrintToChat($"ending hunt {hunterName} -> {bounty.targetName}, winner: {winner?.displayName ?? "null"}");
#endif
                if (huntTimer != null)
                {
                    huntTimer.Destroy();
                }
                if (ticker != null)
                {
                    ticker.Destroy();
                }

                PluginInstance.rename(hunter, hunterName);

                if (winner == hunter)
                {
                    Interface.Oxide.CallHook("OnBountyCompleted", winner, target);
                    //msg
                    PluginInstance.huntSuccessfullMsg(this);

                    //payout
                    hunter.GiveItem(bounty.reward);
                }
                else if (winner == target)
                {
                    //msg
                    PluginInstance.huntFailedMsg(this);

                    //payout
                    target.GiveItem(bounty.reward);
                }
                else
                {
                    //msg
                    PluginInstance.huntExpiredMsg(this);
                    bounty.noteUid = bounty.giveNote(hunter);
                    BountyData.AddBounty(bounty);
                }
                PluginInstance.closeIndicators(target);
                PluginInstance.closeIndicators(hunter);
                bounty.hunt = null;
                HuntData.removeHunt(this);
                CooldownData.addCooldown(target);
            }
예제 #3
0
            public Bounty(BasePlayer placer, BasePlayer target, int reward, string reason)
            {
                timestamp    = DateTime.Now;
                placerID     = placer.userID;
                placerName   = placer.displayName;
                targetID     = target.userID;
                targetName   = target.displayName;
                rewardAmount = reward;
                this.reason  = reason;

                noteUid = giveNote(placer);

                if (config.showSteamImage)
                {
                    PluginInstance.GetSteamUserData(targetID, (ps) =>
                                                    PluginInstance.guiCreator.registerImage(PluginInstance, targetID.ToString(), ps.avatarfull)
                                                    );
                }

                BountyData.AddBounty(this);
                PluginInstance.LogToFile(bountyLogFileName, $"{DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")} {placerName}[{placerID}] placed a bounty of {rewardAmount} {config.currency} on {targetName}[{targetID}]'s head. Reason: {reason}", PluginInstance);
            }