Пример #1
0
            public void deliver()
            {
                StringBuilder sb1 = new StringBuilder();
                StringBuilder sb2 = new StringBuilder();

                foreach (ulong id in Conversation.Participants)
                {
                    Profile    profile = ProfileData.getProfile(id);
                    BasePlayer player  = profile.Player;
                    if (player == Sender)
                    {
                        continue;
                    }
                    player.ChatMessage(string.Format(PluginInstance.lang.GetMessage(msg.message.ToString(), PluginInstance), SenderName, Content));
                    profile.lastConversation = Conversation.ID;
                    sb1.Append($" {player.displayName}[{player.userID}]");
                    sb2.Append($"\n{player.displayName}({profile.Status})");
                }
                string logEntry = $"{DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")} {SenderName}[{SenderID}] -> [{sb1.ToString().Trim()}]: \"{Content}\"";

                PluginInstance.Puts(logEntry);
                PluginInstance.LogToFile("Messages", logEntry, PluginInstance);
                PluginInstance.PrintToChat(Sender, PluginInstance.lang.GetMessage(msg.messageSent.ToString(), PluginInstance, Sender.UserIDString), Content, sb2);
                //Sender.ChatMessage($"Message: {Content} \ndelivered to {sb2}");
            }
Пример #2
0
            public static void removeBounty(uint itemID)
            {
                if (!initialized)
                {
                    init();
                }
                instance.bounties.Remove(itemID);
                save();
#if DEBUG
                PluginInstance.PrintToChat($"removed Bounty {itemID} from data");
#endif
            }
Пример #3
0
            public static void AddBounty(Bounty bounty)
            {
                if (!initialized)
                {
                    init();
                }
                instance.bounties.Add(bounty.noteUid, bounty);
                save();
#if DEBUG
                PluginInstance.PrintToChat($"added Bounty {bounty.placerName} -> {bounty.targetName} {bounty.rewardAmount} to data");
#endif
            }
Пример #4
0
            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);
            }