//////////////// private void UpdateHaggleState(NPC npc) { if (Main.netMode != NetmodeID.Server) { if (this.HagglingDone && Main.npcChatText == "") { PirateNegotiatorTownNPC.AllDealingsFinished_FromLocal(this.OfferTested, this.OfferAmount); } } }
public static void Exit(NPC npc, bool syncFromServer) { npc.active = false; if (syncFromServer) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } PirateNegotiatorTownNPC.EmitSmoke(npc.Center, false); }
public static void AllDealingsFinished_FromLocal(long offerTested, long offerAmount) { if (Main.netMode == NetmodeID.MultiplayerClient) { DemandReplyProtocol.BroadcastFromClient(offerTested, offerAmount); } else if (Main.netMode == NetmodeID.SinglePlayer) { PirateNegotiatorTownNPC.AllDealingsFinished_ToClient(Main.LocalPlayer, offerTested, offerAmount); } }
//////////////// 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 EmitSmoke(Vector2 pos, bool fake) { ParticleFxHelpers.MakeDustCloud( position: fake ? pos : pos - new Vector2(16f), quantity: 1, sprayAmount: 0.3f, scale: fake ? 0.5f : 2f ); if (!fake) { PirateNegotiatorTownNPC.EmitSmoke(pos, true); } }
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); } }