public static void RecallEnvoy(Faction.TradeEnvoy envoy) { // TODO: do ths more naturally envoy.ExpiditionState = Faction.Expidition.State.Leaving; foreach (CreatureAI creature in envoy.Creatures) { creature.LeaveWorld(); } }
public void SendTradeEnvoy(Faction natives) { PlayState playState = (PlayState)GameState.Game.StateManager.GetState <PlayState>("PlayState"); if (!playState.IsActiveState) { return; } Faction.TradeEnvoy envoy = null; if (natives.Race.IsNative) { List <CreatureAI> creatures = PlayState.MonsterSpawner.Spawn(PlayState.MonsterSpawner.GenerateSpawnEvent(natives, PlayState.PlayerFaction, PlayState.Random.Next(4) + 1, false)); if (creatures.Count > 0) { envoy = new Faction.TradeEnvoy() { Creatures = creatures, OtherFaction = PlayState.PlayerFaction, ShouldRemove = false }; natives.TradeEnvoys.Add(envoy); PlayState.AnnouncementManager.Announce("Trade envoy from " + natives.Name + " has arrived!", "Click to zoom to location", creatures.First().ZoomToMe); } } else { PlayState.PlayerFaction.DispatchBalloon(); envoy = new Faction.TradeEnvoy() { Creatures = new List <CreatureAI>(), OtherFaction = PlayState.PlayerFaction, ShouldRemove = false }; PlayState.AnnouncementManager.Announce("Trade envoy from " + natives.Name + " has arrived!", "Trade with " + natives.Name); } if (GameState.Game.StateManager.States.ContainsKey("DiplomacyState_" + natives.Name)) { GameState.Game.StateManager.PushState("DiplomacyState_" + natives.Name); } else { GameState.Game.StateManager.PushState(new DiplomacyState(GameState.Game, GameState.Game.StateManager, (PlayState)GameState.Game.StateManager.GetState <PlayState>("PlayState"), natives) { Name = "DiplomacyState_" + natives.Name, Envoy = envoy }); } }
public DiplomacyState(DwarfGame game, GameStateManager stateManager, WorldManager world, Faction.TradeEnvoy envoy) : base(game, "DiplomacyState", stateManager) { EdgePadding = 128; Input = new InputManager(); World = world; EnableScreensaver = false; InputManager.KeyReleasedCallback += InputManager_KeyReleasedCallback; Faction = envoy.OwnerFaction; Resources = envoy.TradeGoods; }
public void SendTradeEnvoy(Faction natives) { PlayState playState = (PlayState)GameState.Game.StateManager.GetState <PlayState>("PlayState"); if (!playState.IsActiveState) { return; } Faction.TradeEnvoy envoy = null; if (natives.Race.IsNative) { List <CreatureAI> creatures = PlayState.MonsterSpawner.Spawn(PlayState.MonsterSpawner.GenerateSpawnEvent(natives, PlayState.PlayerFaction, PlayState.Random.Next(4) + 1, false)); if (creatures.Count > 0) { envoy = new Faction.TradeEnvoy() { Creatures = creatures, OtherFaction = PlayState.PlayerFaction, ShouldRemove = false, OwnerFaction = natives, TradeGoods = natives.Race.GenerateResources(), TradeMoney = natives.TradeMoney }; foreach (CreatureAI creature in envoy.Creatures) { ResourcePack resources = new ResourcePack(creature.Physics); } envoy.DistributeGoods(); natives.TradeEnvoys.Add(envoy); PlayState.AnnouncementManager.Announce("Trade envoy from " + natives.Name + " has arrived!", "Click to zoom to location", creatures.First().ZoomToMe); } } else { List <CreatureAI> creatures = PlayState.MonsterSpawner.Spawn(PlayState.MonsterSpawner.GenerateSpawnEvent(natives, PlayState.PlayerFaction, PlayState.Random.Next(4) + 1, false)); if (creatures.Count > 0) { Body balloon = PlayState.PlayerFaction.DispatchBalloon(); foreach (CreatureAI creature in creatures) { Matrix tf = creature.Physics.LocalTransform; tf.Translation = balloon.LocalTransform.Translation; creature.Physics.LocalTransform = tf; } envoy = new Faction.TradeEnvoy() { Creatures = creatures, OtherFaction = PlayState.PlayerFaction, ShouldRemove = false, OwnerFaction = natives, TradeGoods = natives.Race.GenerateResources(), TradeMoney = natives.TradeMoney }; foreach (CreatureAI creature in envoy.Creatures) { ResourcePack resources = new ResourcePack(creature.Physics); } envoy.DistributeGoods(); natives.TradeEnvoys.Add(envoy); PlayState.AnnouncementManager.Announce("Trade envoy from " + natives.Name + " has arrived!", "Click to zoom to location", creatures.First().ZoomToMe); } } }
public void SendTradeEnvoy(Faction natives, WorldManager world) { if (!world.gameState.IsActiveState) { return; } Faction.TradeEnvoy envoy = null; if (natives.Race.IsNative) { List <CreatureAI> creatures = world.MonsterSpawner.Spawn(world.MonsterSpawner.GenerateSpawnEvent(natives, world.PlayerFaction, MathFunctions.Random.Next(4) + 1, false)); if (creatures.Count > 0) { envoy = new Faction.TradeEnvoy(world.Time.CurrentDate) { Creatures = creatures, OtherFaction = world.PlayerFaction, ShouldRemove = false, OwnerFaction = natives, TradeGoods = natives.Race.GenerateResources(), TradeMoney = natives.TradeMoney }; foreach (CreatureAI creature in envoy.Creatures) { ResourcePack resources = new ResourcePack(creature.Physics); } envoy.DistributeGoods(); natives.TradeEnvoys.Add(envoy); world.MakeAnnouncement(String.Format("Trade envoy from {0} has arrived!", natives.Name), "Click to zoom to location.", creatures.First().ZoomToMe, ContentPaths.Audio.Oscar.gui_positive_generic); } } else { List <CreatureAI> creatures = world.MonsterSpawner.Spawn(world.MonsterSpawner.GenerateSpawnEvent(natives, world.PlayerFaction, MathFunctions.Random.Next(4) + 1, false)); if (creatures.Count > 0) { Body balloon = world.PlayerFaction.DispatchBalloon(); foreach (CreatureAI creature in creatures) { Matrix tf = creature.Physics.LocalTransform; tf.Translation = balloon.LocalTransform.Translation; creature.Physics.LocalTransform = tf; } envoy = new Faction.TradeEnvoy(world.Time.CurrentDate) { Creatures = creatures, OtherFaction = world.PlayerFaction, ShouldRemove = false, OwnerFaction = natives, TradeGoods = natives.Race.GenerateResources(), TradeMoney = natives.TradeMoney }; foreach (CreatureAI creature in envoy.Creatures) { ResourcePack resources = new ResourcePack(creature.Physics); } envoy.DistributeGoods(); natives.TradeEnvoys.Add(envoy); world.MakeAnnouncement(String.Format("Trade envoy from {0} has arrived!", natives.Name), "Click to zoom to location.", creatures.First().ZoomToMe, ContentPaths.Audio.Oscar.gui_positive_generic); } } }