public override Thing GenerateItem(DarkNetTrader trader) { Thing newThing = ThingMaker.MakeThing(Item); newThing.stackCount = Count; return(newThing); }
public override void Fail(DarkNetTrader trader) { TraderWorker_RogerEdmonson roger = (TraderWorker_RogerEdmonson)trader; Find.LetterStack.ReceiveLetter("Order_BodyPart_RogerEdmonson_FailTitle".Translate(), "Order_BodyPart_RogerEdmonson_FailDesc".Translate($"{Group}_group".Translate()), LetterDefOf.NegativeEvent); roger.Order = null; }
public override Thing GenerateItem(DarkNetTrader trader) { TraderWorker_RogerEdmonson roger = (TraderWorker_RogerEdmonson)trader; Thing newArt = ThingMaker.MakeThing(Art, Stuff); newArt.TryGetComp <CompQuality>()?.SetQuality(QualityUtility.GenerateQualityRandomEqualChance(), ArtGenerationContext.Colony); newArt = newArt.MakeMinified(); return(newArt); }
public override Thing GenerateItem(DarkNetTrader trader) { TraderWorker_RogerEdmonson roger = (TraderWorker_RogerEdmonson)trader; if (roger.OrderBodyparts.First(x => x.BodypartGroup == Group).Items.TryRandomElementByWeight(x2 => x2.Commonality, out OrderThing result)) { Thing thing = ThingMaker.MakeThing(result.ThingDef); if (PriceModificatorUtils.TryGetPriceModificator(thing, roger.def, out PriceModificatorDef modificator)) { DarkNetPriceUtils.FinalizeItem(thing, modificator); } return(thing); } return(null); }
protected override bool TryExecuteWorker(IncidentParms parms) { if (!TileFinder.TryFindPassableTileWithTraversalDistance(Find.AnyPlayerHomeMap.Tile, 7, 15, out int newTile, (int i) => !Find.WorldObjects.AnyWorldObjectAt(i))) { return(false); } if (GssRaids.GssFaction == null) { return(false); } DarkNet darkNet = Current.Game.GetComponent <DarkNet>(); if (darkNet == null || darkNet.Traders == null) { return(false); } DarkNetTrader trader = darkNet.Traders.RandomElement(); Quest_DarkNetKillInformator quest = new Quest_DarkNetKillInformator(trader.def); quest.GenerateRewards(quest.GetQuestThingFilter(), new FloatRange(1200, 2500), new IntRange(1, 4), null, null); quest.id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); quest.TicksToPass = 10 * 60000; quest.Faction = GssRaids.GssFaction; string title = string.Format(def.letterLabel, trader.def.LabelCap, quest.Faction.Name); string desc = string.Format(def.letterText, trader.def.LabelCap, quest.Faction.Name); QuestSite site = QuestsHandler.CreateSiteFor(quest, newTile, quest.Faction); Find.WorldObjects.Add(site); QuestsManager.Communications.AddQuest(quest); Find.LetterStack.ReceiveLetter(title, desc, def.letterDef, new LookTargets(site)); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { DarkNet darkNet = Current.Game.GetComponent <DarkNet>(); if (darkNet == null || darkNet.Traders == null) { return(false); } DarkNetTrader trader = darkNet.Traders.RandomElement(); Faction attacker = Find.FactionManager.FirstFactionOfDef(MoreEvents.FactionDefOfLocal.Pirate); if (attacker == null || attacker.defeated) { return(false); } if (!TileFinder.TryFindPassableTileWithTraversalDistance(Find.AnyPlayerHomeMap.Tile, 5, 12, out int newTile, (int i) => !Find.WorldObjects.AnyWorldObjectAt(i))) { return(false); } Quest_DarkNetCaptureMaterials quest = new Quest_DarkNetCaptureMaterials(trader.def); quest.id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); quest.TicksToPass = 7 * 60000; quest.Faction = attacker; string title = string.Format(def.letterLabel, trader.def.LabelCap); string desc = string.Format(def.letterText, trader.def.LabelCap); QuestSite site = QuestsHandler.CreateSiteFor(quest, newTile, quest.Faction); Find.WorldObjects.Add(site); QuestsManager.Communications.AddQuest(quest); Find.LetterStack.ReceiveLetter(title, desc, def.letterDef, new LookTargets(site)); return(true); }
public virtual void TraderArrive(DarkNetTrader trader) { if (Finish) { return; } Delay--; if (Delay == 0) { Finish = true; if (Rand.Chance(Chance)) { OrderedItem = GenerateItem(trader); } else { Fail(trader); } } }
public override void TraderArrive(DarkNetTrader trader) { base.TraderArrive(trader); }
protected override bool TryExecuteWorker(IncidentParms parms) { DarkNet darkNet = Current.Game.GetComponent <DarkNet>(); if (darkNet == null || darkNet.Traders == null) { return(false); } DarkNetTrader trader = darkNet.Traders.RandomElement(); List <Thing> allTraderThings = new List <Thing>(); Faction attacker = Find.FactionManager.RandomEnemyFaction(); if (attacker == null) { return(false); } if (!TileFinder.TryFindPassableTileWithTraversalDistance(Find.AnyPlayerHomeMap.Tile, 5, 12, out int newTile, (int i) => !Find.WorldObjects.AnyWorldObjectAt(i))) { return(false); } if (!trader.TryGetGoods(allTraderThings)) { return(false); } Quest_DarkNetSupplyAttack quest = new Quest_DarkNetSupplyAttack(trader.def); int takeCount = Rand.Range(1, (int)Mathf.Max(1, allTraderThings.Count * 0.4f)); IEnumerable <Thing> rewards = allTraderThings.TakeRandom(takeCount); quest.Rewards = new List <Thing>(); foreach (var reward in rewards) { Thing copy = ThingMaker.MakeThing(reward.def, reward.Stuff); copy.stackCount = (int)Mathf.Max(1, reward.stackCount * 0.6f); quest.Rewards.Add(copy); } if (quest.Rewards.Count == 0) { return(false); } quest.id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); quest.TicksToPass = 6 * 60000; quest.ShowInConsole = false; //release = false quest.Faction = attacker; string title = string.Format(def.letterLabel, trader.def.LabelCap); string desc = string.Format(def.letterText, trader.def.LabelCap); CommunicationDialog dialog = QuestsManager.Communications.AddCommunication(QuestsManager.Communications.UniqueIdManager.GetNextDialogID(), title, desc, incident: def); dialog.KnownFaction = false; quest.CommunicationDialog = dialog; QuestSite site = QuestsHandler.CreateSiteFor(quest, newTile, quest.Faction); Find.WorldObjects.Add(site); QuestsManager.Communications.AddQuest(quest); Find.LetterStack.ReceiveLetter(title, desc, def.letterDef, new LookTargets(site)); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { DarkNet darkNet = Current.Game.GetComponent <DarkNet>(); if (darkNet == null || darkNet.Traders == null) { return(false); } DarkNetTrader trader = darkNet.Traders.RandomElement(); List <Thing> allTraderThings = new List <Thing>(); Faction buyer = Find.FactionManager.RandomEnemyFaction(); Faction garant = null; if (!(from x in Find.FactionManager.AllFactions where !x.IsPlayer && !x.def.hidden && !x.defeated && x.def.humanlikeFaction && x.HostileTo(Faction.OfPlayer) && x != buyer select x).TryRandomElement(out garant)) { return(false); } if (buyer == null) { return(false); } if (!TileFinder.TryFindPassableTileWithTraversalDistance(Find.AnyPlayerHomeMap.Tile, 3, 6, out int newTile, (int i) => !Find.WorldObjects.AnyWorldObjectAt(i))) { return(false); } if (!trader.TryGetGoods(allTraderThings)) { return(false); } Quest_DarkNetTraderSupply quest = new Quest_DarkNetTraderSupply(trader.def, garant); int takeCount = Rand.Range(1, (int)Mathf.Max(1, allTraderThings.Count * 0.4f)); IEnumerable <Thing> rewards = allTraderThings.Where(x => !(x is MinifiedThing)).ToList().TakeRandom(takeCount); quest.Rewards = new List <Thing>(); foreach (var reward in rewards) { Thing copy = ThingMaker.MakeThing(reward.def, reward.Stuff); copy.stackCount = (int)Mathf.Max(1, reward.stackCount * 0.6f); quest.Rewards.Add(copy); } if (quest.Rewards.Count == 0) { return(false); } quest.id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); quest.TicksToPass = 4 * 60000; quest.Faction = buyer; quest.ShowInConsole = false; string title = string.Format(def.letterLabel, trader.def.LabelCap); string desc = string.Format(def.letterText, trader.def.LabelCap, buyer.Name, garant.Name); CommunicationDialog dialog = QuestsManager.Communications.AddCommunication(QuestsManager.Communications.UniqueIdManager.GetNextDialogID(), title, desc, incident: def); dialog.KnownFaction = true; quest.CommunicationDialog = dialog; QuestSite site = QuestsHandler.CreateSiteFor(quest, newTile, quest.Faction); Find.WorldObjects.Add(site); QuestsManager.Communications.AddQuest(quest); Find.LetterStack.ReceiveLetter(title, desc, def.letterDef, new LookTargets(site)); return(true); }
public abstract Thing GenerateItem(DarkNetTrader trader);
public virtual void Fail(DarkNetTrader trader) { }