public static QuestCondition KillAny(string progressPrefix, int amount) { var c = new QuestCondition { Type = ConditionType.Kill }; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("Amount", amount); return(c); }
public static QuestCondition DestroyAnyVehicle(string progressPrefix, int amount) { var c = new QuestCondition { Type = ConditionType.DestroyVehicle }; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("Amount", amount); return(c); }
public static QuestCondition Custom(string progressPrefix, string name, Func <bool> condition) { var c = new QuestCondition { Type = ConditionType.Custom }; c.Name = name; c.ProgressPrefix = progressPrefix; c.CustomCondition = condition; return(c); }
public static QuestCondition Acquire(string progressPrefix, string itemName, int amountNeeded) { var c = new QuestCondition { Type = ConditionType.Acquire }; c.Name = progressPrefix; c.ProgressPrefix = progressPrefix; c.Parameters.Add("ItemName", itemName); c.Parameters.Add("Amount", amountNeeded); return(c); }
public static QuestCondition LootAnyPed(string progressPrefix, string itemName, string propModel, int dropRateOutOf100, int amountNeeded) { var c = new QuestCondition { Type = ConditionType.Loot }; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("ItemName", itemName); c.Parameters.Add("Amount", amountNeeded); c.Parameters.Add("DropRate", dropRateOutOf100); c.Parameters.Add("PropModel", propModel); return(c); }
public static QuestCondition DestroyVehicle(string progressPrefix, int amount, params VehicleHash[] vehicleHashes) { var c = new QuestCondition { Type = ConditionType.DestroyVehicle }; var models = vehicleHashes; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("VehHash", models); c.Parameters.Add("Amount", amount); return(c); }
public static QuestCondition Kill(string progressPrefix, int amount, params PedHash[] modelHashes) { var c = new QuestCondition { Type = ConditionType.Kill }; var models = modelHashes; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("ModelHash", models); c.Parameters.Add("Amount", amount); return(c); }
public static QuestCondition LootVehicles(string progressPrefix, string itemName, string propModel, int dropRateOutOf100, int amountNeeded, params VehicleHash[] vehicleHashes) { var c = new QuestCondition { Type = ConditionType.Loot }; var models = vehicleHashes; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("VehHash", models); c.Parameters.Add("ItemName", itemName); c.Parameters.Add("Amount", amountNeeded); c.Parameters.Add("DropRate", dropRateOutOf100); c.Parameters.Add("PropModel", propModel); c.Parameters.Add("Vehicles", true); return(c); }
public static QuestCondition DestroyVehicle(string progressPrefix, int amount,params VehicleHash[] vehicleHashes) { var c = new QuestCondition { Type = ConditionType.DestroyVehicle }; var models = vehicleHashes; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("VehHash", models); c.Parameters.Add("Amount", amount); return c; }
public static QuestCondition DestroyAnyVehicle(string progressPrefix, int amount) { var c = new QuestCondition { Type = ConditionType.DestroyVehicle }; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("Amount", amount); return c; }
public static QuestCondition Custom(string progressPrefix, string name, Func<bool> condition) { var c = new QuestCondition {Type = ConditionType.Custom}; c.Name = name; c.ProgressPrefix = progressPrefix; c.CustomCondition = condition; return c; }
public static QuestCondition Acquire(string progressPrefix, string itemName, int amountNeeded) { var c = new QuestCondition { Type = ConditionType.Acquire }; c.Name = progressPrefix; c.ProgressPrefix = progressPrefix; c.Parameters.Add("ItemName", itemName); c.Parameters.Add("Amount", amountNeeded); return c; }
public void SetupCondition(QuestCondition c, bool firstSetup) { if (c.Type == ConditionType.Kill && c.Parameters.ContainsKey("ModelHash") || c.Type == ConditionType.Loot && c.Parameters.ContainsKey("ModelHash")) { int[] hashes; var models = c.Parameters["ModelHash"] as uint[]; var modelsA = c.Parameters["ModelHash"] as JArray; if (models != null) { hashes = models.Select(m => (int)m).ToArray(); } else { hashes = modelsA.Select(jv => (uint)jv).Select(t => (int)t).ToArray(); } if (SpawnTargets) { c.Position = c.Position == Vector3.Zero ? RPGMethods.GetSpawnPoint(350) : c.Position; BlipObjects.Add(RPGBlips.QuestArea(Name, c.Position)); EventHandler.Do(q => { var pos = c.Position; var amountToSpawn = AmountToSpawn; var playerGroup = Game.Player.Character.RelationshipGroup; var enemies = World.AddRelationshipGroup("RPG_Enemies"); World.SetRelationshipBetweenGroups(Relationship.Neutral, playerGroup, enemies); for (int i = 0; i < amountToSpawn; i++) { var hash = hashes[Random.Range(0, hashes.Length)]; var m = new Model(hash); m.Request(1000); var ped = World.CreatePed(m, pos + Vector3.RandomXY() * 2, Game.Player.Character.Heading + 180); ped.RelationshipGroup = enemies; var b = ped.AddBlip(); EventHandler.Wait(100); b.IsFriendly = false; b.Scale = 0.6f; ped.Task.WanderAround(); //todo: apply some weapon damage scaling here lol ped.Weapons.Give(WeaponHash.Pistol, 1000, false, true); ped.CanSwitchWeapons = true; RPG.WorldData.AddPed(new NpcObject("Quest_" + Name, ped)); RPG.WorldData.AddBlip(new BlipObject("Quest_" + Name, b)); HasSpawnedTargets = true; } }); } } if (!c.Parameters.ContainsKey("Current")) { c.Parameters.Add("Current", 0); } if(firstSetup) { switch (c.Type) { case ConditionType.Kill: case ConditionType.Loot: case ConditionType.DestroyVehicle: case ConditionType.Acquire: c.Parameters["Current"] = 0; break; case ConditionType.Interact: case ConditionType.Escort: case ConditionType.Race: case ConditionType.EvadeCops: c.Parameters["Current"] = false; break; case ConditionType.Custom: break; default: throw new ArgumentOutOfRangeException(); } } }
public Quest AddCondiiton(QuestCondition condition) { condition.QuestName = Name; Conditions.Add(condition); return(this); }
public static QuestCondition LootAnyPed(string progressPrefix, string itemName, string propModel, int dropRateOutOf100, int amountNeeded) { var c = new QuestCondition {Type = ConditionType.Loot}; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("ItemName",itemName); c.Parameters.Add("Amount",amountNeeded); c.Parameters.Add("DropRate", dropRateOutOf100); c.Parameters.Add("PropModel", propModel); return c; }
public static QuestCondition Kill(string progressPrefix, int amount, Vector3 position, params PedHash[] modelHashes) { var c = new QuestCondition {Type = ConditionType.Kill}; var models = modelHashes; c.Position = position; c.Name = progressPrefix; c.ProgressPrefix = progressPrefix; c.Parameters.Add("ModelHash", models); c.Parameters.Add("Amount",amount); return c; }
public static QuestCondition KillAny(string progressPrefix, int amount, Vector3 position) { var c = new QuestCondition {Type = ConditionType.Kill}; c.Position = position; c.Name = progressPrefix; c.ProgressPrefix = progressPrefix; c.Parameters.Add("Amount",amount); return c; }
public Quest AddCondiiton(QuestCondition condition) { condition.QuestName = Name; Conditions.Add(condition); return this; }
public static QuestCondition LootVehicles(string progressPrefix, string itemName, string propModel, int dropRateOutOf100, int amountNeeded, params VehicleHash[] vehicleHashes) { var c = new QuestCondition {Type = ConditionType.Loot}; var models = vehicleHashes; c.ProgressPrefix = progressPrefix; c.Name = progressPrefix; c.Parameters.Add("VehHash", models); c.Parameters.Add("ItemName",itemName); c.Parameters.Add("Amount",amountNeeded); c.Parameters.Add("DropRate", dropRateOutOf100); c.Parameters.Add("PropModel", propModel); c.Parameters.Add("Vehicles", true); return c; }
public void SetupCondition(QuestCondition c, bool firstSetup) { if (c.Type == ConditionType.Kill && c.Parameters.ContainsKey("ModelHash") || c.Type == ConditionType.Loot && c.Parameters.ContainsKey("ModelHash")) { int[] hashes; var models = c.Parameters["ModelHash"] as uint[]; var modelsA = c.Parameters["ModelHash"] as JArray; if (models != null) { hashes = models.Select(m => (int)m).ToArray(); } else { hashes = modelsA.Select(jv => (uint)jv).Select(t => (int)t).ToArray(); } if (SpawnTargets) { c.Position = c.Position == Vector3.Zero ? RPGMethods.GetSpawnPoint(350) : c.Position; BlipObjects.Add(RPGBlips.QuestArea(Name, c.Position)); EventHandler.Do(q => { var pos = c.Position; var amountToSpawn = AmountToSpawn; var playerGroup = Game.Player.Character.RelationshipGroup; var enemies = World.AddRelationshipGroup("RPG_Enemies"); World.SetRelationshipBetweenGroups(Relationship.Neutral, playerGroup, enemies); for (int i = 0; i < amountToSpawn; i++) { var hash = hashes[Random.Range(0, hashes.Length)]; var m = new Model(hash); m.Request(1000); var ped = World.CreatePed(m, pos + Vector3.RandomXY() * 2, Game.Player.Character.Heading + 180); ped.RelationshipGroup = enemies; var b = ped.AddBlip(); EventHandler.Wait(100); b.IsFriendly = false; b.Scale = 0.6f; ped.Task.WanderAround(); //todo: apply some weapon damage scaling here lol ped.Weapons.Give(WeaponHash.Pistol, 1000, false, true); ped.CanSwitchWeapons = true; RPG.WorldData.AddPed(new NpcObject("Quest_" + Name, ped)); RPG.WorldData.AddBlip(new BlipObject("Quest_" + Name, b)); HasSpawnedTargets = true; } }); } } if (!c.Parameters.ContainsKey("Current")) { c.Parameters.Add("Current", 0); } if (firstSetup) { switch (c.Type) { case ConditionType.Kill: case ConditionType.Loot: case ConditionType.DestroyVehicle: case ConditionType.Acquire: c.Parameters["Current"] = 0; break; case ConditionType.Interact: case ConditionType.Escort: case ConditionType.Race: case ConditionType.EvadeCops: c.Parameters["Current"] = false; break; case ConditionType.Custom: break; default: throw new ArgumentOutOfRangeException(); } } }