Esempio n. 1
0
        ////////////////

        public override bool PreAI()
        {
            if (PirateLogic.Instance.CheckAndValidateNegotiatorPresence(npc))
            {
                this.UpdateHaggleState(this.npc);
            }
            else
            {
                PirateNegotiatorTownNPC.Exit(npc, false);
                return(false);
            }

            return(base.PreAI());
        }
        public static void AllDealingsFinished_FromServer(Player player, long offerTested, long offerAmount)
        {
            var logic = PirateLogic.Instance;

            if (player != null && offerAmount > 0)
            {
                logic.GiveFinalOffer(player, offerTested, offerAmount, true);
            }
            else
            {
                logic.GiveNoOffer(true);
            }

            logic.SetNextNegotiatorArrivalTime(logic.IsRaiding);

            int negotType = NPCType <PirateNegotiatorTownNPC>();
            IEnumerable <NPC> negotiator = Main.npc.SafeWhere(n => n?.active == true && n.type == negotType);

            // Remove negotiator(s)
            foreach (NPC npc in negotiator)
            {
                PirateNegotiatorTownNPC.Exit(npc, false);
            }
        }