////////////////

        public bool GiveOffer(long offerAmount)
        {
            var logic = PirateLogic.Instance;

            if (this.OfferTested == -1)
            {
                this.OfferTested = offerAmount;

                HaggleAmount replyType = PirateLogic.GaugeOffer(logic.ComputedDemand, offerAmount);
                Main.npcChatText = PirateNegotiatorTownNPC.HaggleReplies[replyType];
            }
            else
            {
                HaggleAmount replyType = PirateLogic.GaugeOffer(logic.ComputedDemand, offerAmount);
                Main.npcChatText = PirateNegotiatorTownNPC.OfferReplies[replyType];

                if (this.OfferTested > offerAmount)
                {
                    Main.npcChatText += "\n " + PirateNegotiatorTownNPC.OfferReduceReply;
                }

                this.OfferAmount = offerAmount;
            }

            return(this.OfferAmount > 0);
        }
コード例 #2
0
        public void GiveFinalOffer(Player player, long offerTested, long offerAmount, bool syncFromServer)
        {
            HaggleAmount measure = PirateLogic.GaugeOffer(this.ComputedDemand, offerAmount);

            // Testing for lower amounts lowers negotiator's patience
            if (offerTested > offerAmount)
            {
                if (measure != HaggleAmount.VeryHigh && measure != HaggleAmount.High)
                {
                    switch (this.Patience)
                    {
                    case PirateMood.Normal:
                        this.Patience = PirateMood.Impatient;
                        break;

                    case PirateMood.Impatient:
                        this.Patience = PirateMood.Menacing;
                        break;

                    case PirateMood.Menacing:
                        //this.BeginRaid( syncFromServer );
                        break;
                    }
                }
            }

            switch (measure)
            {
            case HaggleAmount.VeryHigh:
            case HaggleAmount.High:
                switch (this.Patience)
                {
                case PirateMood.Impatient:
                    this.Patience = PirateMood.Normal;
                    break;

                case PirateMood.Menacing:
                    this.Patience = PirateMood.Impatient;
                    break;
                }
                this.GiveGoodOffer(player, offerAmount, syncFromServer);
                break;

            case HaggleAmount.Good:
                this.GiveGoodOffer(player, offerAmount, syncFromServer);
                break;

            case HaggleAmount.Low:
                switch (this.Patience)
                {
                case PirateMood.Normal:
                    this.Patience = PirateMood.Impatient;
                    this.GiveLowOffer(player, offerAmount, syncFromServer);
                    break;

                case PirateMood.Impatient:
                    this.Patience = PirateMood.Menacing;
                    this.GiveLowOffer(player, offerAmount, syncFromServer);
                    break;

                case PirateMood.Menacing:
                    this.Patience = PirateMood.Normal;
                    this.BeginRaid(syncFromServer);
                    break;
                }
                break;

            case HaggleAmount.TooLow:
                this.BeginRaid(syncFromServer);
                break;
            }
        }