public void DrawDetails(NTree dataTree) { if(Type == NodeType.Skill) { var skill = RPG.PlayerData.Skills.First(s => s.Name == Ref); new UIText(Ref, new Point(UI.WIDTH / 2, UI.HEIGHT - 95), 0.3f, Color.White, 0, true).Draw(); new UIText(skill.Description, new Point(UI.WIDTH / 2, UI.HEIGHT - 75), 0.22f, Color.White, 0, true).Draw(); var topPoint = new Point(UI.WIDTH/2, UI.HEIGHT - 62); var i = 0; var sparams = SkillRepository.GetVisibleParams(Ref); foreach (var kvp in sparams) { new UIText(kvp.Key +": " + kvp.Value.Invoke(skill) ,topPoint + new Size(0,10 * i) , 0.20f, Color.DodgerBlue, 0, true).Draw(); i++; } new UIText(skill.Unlocked ? "unlocked" : "unlock for " + skill.PointsToUnlock + " SP", new Point(UI.WIDTH / 2, UI.HEIGHT - 22), 0.20f, Color.Gray, 0, true).Draw(); Sprite.Draw(new Point(UI.WIDTH / 2 - 140, UI.HEIGHT - 50), 40, 40, Color.FromArgb(120, 255, 255, 255)); } else if (Type == NodeType.SkillMod) { new UIText(Ref, new Point(UI.WIDTH / 2, UI.HEIGHT - 95), 0.3f, Color.White, 0, true).Draw(); new UIText(Description, new Point(UI.WIDTH / 2, UI.HEIGHT - 75), 0.22f, Color.White, 0, true).Draw(); var skillForMod = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == dataTree.TreeRef); var mod = skillForMod.UsedMods.FirstOrDefault(s => s == Ref); var unlockedText = mod != null ? "unlocked" : "unlock for " + skillForMod.Mods[Ref] + " SP"; new UIText(unlockedText, new Point(UI.WIDTH / 2, UI.HEIGHT - 22), 0.20f, Color.Gray, 0, true).Draw(); Sprite.Draw(new Point(UI.WIDTH / 2 - 140, UI.HEIGHT - 50), 40, 40, Color.FromArgb(120, 255, 255, 255)); } }
public NTree AddChild(Node dataa) { var check = dataa.Direction != TreeDirection.Auto ? (int)dataa.Direction : children.Count; dataa.Parent = this; var tree = new NTree(dataa); children.Add(tree); if (check == 0) { dataa.Position = Node.Position + new Size(NodeSize + 20 + LinkLength, 0); dataa.Direction = TreeDirection.Right; dataa.Parent = this; } else if (check == 1) { dataa.Position = Node.Position + new Size(0, NodeSize + 20 + LinkLength); dataa.Direction = TreeDirection.Down; dataa.Parent = this; } else if (check == 2) { dataa.Position = Node.Position + new Size(-(NodeSize + 20 + LinkLength), 0); dataa.Direction = TreeDirection.Left; dataa.Parent = this; } else if (check == 3) { dataa.Position = Node.Position + new Size(0, -(NodeSize + 20 + LinkLength)); dataa.Direction = TreeDirection.Up; dataa.Parent = this; } return(tree); }
public void Draw(NTree node, Node parent, TreeDraw visitor) { visitor(node.Node, node.Node.Parent != null ? node.Node.Parent.Node : null, node.Node.Direction); foreach (NTree kid in node.children) { Draw(kid, this.Node, visitor); } }
public void DrawDetails(NTree dataTree) { if (Type == NodeType.Skill) { var skill = RPG.PlayerData.Skills.First(s => s.Name == Ref); new UIText(Ref, new Point(UI.WIDTH / 2, UI.HEIGHT - 95), 0.3f, Color.White, 0, true).Draw(); new UIText(skill.Description, new Point(UI.WIDTH / 2, UI.HEIGHT - 75), 0.22f, Color.White, 0, true).Draw(); var topPoint = new Point(UI.WIDTH / 2, UI.HEIGHT - 62); var i = 0; var sparams = SkillRepository.GetVisibleParams(Ref); foreach (var kvp in sparams) { new UIText(kvp.Key + ": " + kvp.Value.Invoke(skill), topPoint + new Size(0, 10 * i), 0.20f, Color.DodgerBlue, 0, true).Draw(); i++; } new UIText(skill.Unlocked ? "unlocked" : "unlock for " + skill.PointsToUnlock + " SP", new Point(UI.WIDTH / 2, UI.HEIGHT - 22), 0.20f, Color.Gray, 0, true).Draw(); Sprite.Draw(new Point(UI.WIDTH / 2 - 140, UI.HEIGHT - 50), 40, 40, Color.FromArgb(120, 255, 255, 255)); } else if (Type == NodeType.Weapon) { var wep = RPG.PlayerData.Weapons.FirstOrDefault(s => s.WeaponHash == WepHash); new UIText(Ref, new Point(UI.WIDTH / 2, UI.HEIGHT - 95), 0.3f, Color.White, 0, true).Draw(); new UIText(wep.Description, new Point(UI.WIDTH / 2, UI.HEIGHT - 75), 0.22f, Color.White, 0, true).Draw(); var topPoint = new Point(UI.WIDTH / 2, UI.HEIGHT - 62); //var i = 0; //var sparams = SkillRepository.GetVisibleParams(Ref); //foreach (var kvp in sparams) //{ // new UIText(kvp.Key +": " + kvp.Value.Invoke(skill) ,topPoint + new Size(0,10 * i) , 0.20f, Color.DodgerBlue, 0, true).Draw(); // i++; //} new UIText(wep.Unlocked ? "unlocked" : "unlock for " + wep.PointsToUnlock + " SP [Requires Lv." + wep.LevelToUnlock + "]", new Point(UI.WIDTH / 2, UI.HEIGHT - 22), 0.20f, Color.Gray, 0, true).Draw(); Sprite.Draw(new Point(UI.WIDTH / 2 - 140, UI.HEIGHT - 50), 40, 40, Color.FromArgb(120, 255, 255, 255)); } else if (Type == NodeType.SkillMod) { new UIText(Ref, new Point(UI.WIDTH / 2, UI.HEIGHT - 95), 0.3f, Color.White, 0, true).Draw(); new UIText(Description, new Point(UI.WIDTH / 2, UI.HEIGHT - 75), 0.22f, Color.White, 0, true).Draw(); var skillForMod = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == dataTree.TreeRef); var mod = skillForMod.UsedMods.FirstOrDefault(s => s == Ref); var unlockedText = mod != null ? "unlocked" : "unlock for " + skillForMod.Mods[Ref] + " SP"; new UIText(unlockedText, new Point(UI.WIDTH / 2, UI.HEIGHT - 22), 0.20f, Color.Gray, 0, true).Draw(); Sprite.Draw(new Point(UI.WIDTH / 2 - 140, UI.HEIGHT - 50), 40, 40, Color.FromArgb(120, 255, 255, 255)); } }
public string GetFooter(NTree dataTree) { switch (Type) { case NodeType.Skill: var skill = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == Ref); return(skill.Unlocked ? "unlocked" : skill.PointsToUnlock + " SP"); case NodeType.Weapon: var wep = RPG.PlayerData.Weapons.FirstOrDefault(s => s.WeaponHash == WepHash); return(wep.Unlocked ? "unlocked" : wep.PointsToUnlock + " SP at Level " + wep.LevelToUnlock); case NodeType.SkillMod: var skillForMod = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == dataTree.TreeRef); var mod = skillForMod.UsedMods.FirstOrDefault(s => s == Ref); return(mod != null ? "unlocked" : skillForMod.Mods[Ref] + " SP"); default: throw new ArgumentOutOfRangeException(); } }
public bool Unlocked(NTree dataTree) { if (Type == NodeType.Skill) { var skill = RPG.PlayerData.Skills.First(s => s.Name == Ref); return(skill.Unlocked); } if (Type == NodeType.Weapon) { var wep = RPG.PlayerData.Weapons.First(s => s.WeaponHash == WepHash); return(wep.Unlocked); } if (Type == NodeType.SkillMod) { var skillForMod = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == dataTree.TreeRef); var mod = skillForMod.UsedMods.FirstOrDefault(s => s == Ref); return(mod != null); } return(false); }
public Skill WithModTree(NTree modTree) { ModTree = modTree; return this; }
private static NTree RampageTree() { var pos = new Point(UI.WIDTH / 2 - NTree.NodeCenter.Width, UI.HEIGHT / 2 - NTree.NodeCenter.Height * 3); var startingNode = new Node("Rampage", new GTASprite("mpinventory", "drug_trafficking"), NodeType.Skill).WithUnusable(); var tree = new NTree("Rampage", startingNode, TreeType.SkillMod, pos); tree.AddChild(new Node("Rampage I", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Rampage Time", 8000); }) .WithDescription("Increases rampage time to 8 seconds")); tree.AddChild(new Node("Rampage II", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Rampage Time", 10000); }) .WithDescription("Increases rampage time to 10 seconds")); return tree; }
public void Draw(NTree node, Node parent, TreeDraw visitor) { visitor(node.Node, node.Node.Parent != null ? node.Node.Parent.Node : null, node.Node.Direction); foreach (NTree kid in node.children) Draw(kid, this.Node, visitor); }
public NTree AddChild(Node dataa) { var check = dataa.Direction != TreeDirection.Auto ? (int)dataa.Direction : children.Count; dataa.Parent = this; var tree = new NTree(dataa); children.Add(tree); if (check == 0) { dataa.Position = Node.Position + new Size(NodeSize + 20 + LinkLength, 0); dataa.Direction = TreeDirection.Right; dataa.Parent = this; } else if (check == 1) { dataa.Position = Node.Position + new Size(0, NodeSize + 20 + LinkLength); dataa.Direction = TreeDirection.Down; dataa.Parent = this; } else if (check == 2) { dataa.Position = Node.Position + new Size(-(NodeSize + 20 + LinkLength), 0); dataa.Direction = TreeDirection.Left; dataa.Parent = this; } else if (check == 3) { dataa.Position = Node.Position + new Size(0, -(NodeSize + 20 + LinkLength)); dataa.Direction = TreeDirection.Up; dataa.Parent = this; } return tree; }
private static NTree GetHighTree() { var pos = new Point(UI.WIDTH / 2 - NTree.NodeCenter.Width, UI.HEIGHT / 2 - NTree.NodeCenter.Height * 3); var startingNode = new Node("Get High", new GTASprite("mpinventory", "mp_specitem_weed"), NodeType.Skill).WithUnusable(); var tree = new NTree("Get High", startingNode, TreeType.SkillMod, pos); tree.AddChild(new Node("Slow I", new GTASprite("mpinventory","team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Slow Time", 7000); }) .WithDescription("Increases slow time to 7 seconds")); tree.AddChild(new Node("Slow II", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Slow Time", 8000);}) .WithDescription("Increases slow time to 8 seconds")); return tree; }
private void GetTitle(NTree tree, out string title, out string subText, out string activateText) { var type = tree.Type; switch(type) { case TreeType.Skill: title = "SKILLS"; subText = "SP: " + RPG.PlayerData.SkillExp.ToString("N0"); activateText = "unlock skill / customise skill"; break; case TreeType.SkillMod: var s = RPG.PlayerData.GetSkill(tree.TreeRef); title = s.Name; subText = "SP: " + RPG.PlayerData.SkillExp.ToString("N0"); activateText = "unlock skill mod"; break; default: throw new ArgumentOutOfRangeException(type.ToString()); } }
public override void OnChangeItem(bool right) { var dir = right ? TreeDirection.Right : TreeDirection.Left; var nextTree = Branch.children.FirstOrDefault(c => c.Node.Direction == dir); if (nextTree != null) { Branch = nextTree; } else { var parentDirToThis = dir == TreeDirection.Right ? TreeDirection.Left : TreeDirection.Right; var parentInDir = SelectedObj.Direction == parentDirToThis; if (parentInDir) { Branch = SelectedObj.Parent; } } }
public TreeMenu GetSkillMenu() { var skillTree = new NTree(new Node("Get High", new GTASprite("mpinventory", "mp_specitem_weed"), NodeType.Skill),TreeType.Skill, new Point(50, 120)); skillTree.AddChild(new Node("Blazed Off Glory", new GTASprite("mpcarhud", "ocelot"), NodeType.Skill)) .AddChild(new Node("Reject Nonsense", new GTASprite("mpinventory", "mp_specitem_heroin"), NodeType.Skill)) .AddChild(new Node("Get Hammered", new GTASprite("mpinventory", "survival"), NodeType.Skill)); var toughen = skillTree.AddChild(new Node("Toughen Up", new GTASprite("mpinventory", "drug_trafficking"), NodeType.Skill)) .AddChild(new Node("Reinforcements", new GTASprite("mpinventory", "team_deathmatch"), NodeType.Skill)); toughen.AddChild(new Node("Rampage", new GTASprite("heisthud", "hc_trevor"), NodeType.Skill,TreeDirection.Down)); return new TreeMenu(skillTree); }
private static NTree ReinforcementTree() { var pos = new Point(UI.WIDTH / 2 - NTree.NodeCenter.Width, UI.HEIGHT / 2 - NTree.NodeCenter.Height * 3); var startingNode = new Node("Reinforcements", new GTASprite("mpinventory", "mp_specitem_weed"), NodeType.Skill).WithUnusable(); var tree = new NTree("Reinforcements", startingNode, TreeType.SkillMod, pos); tree.AddChild(new Node("Additional Flyers", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Crew Size", 3); }) .WithDescription("Distribute more flyers to increase crew size to 3")); tree.AddChild(new Node("Fund Kevlar", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Member HP", 60);}) .WithDescription("Crew members survive longer")); tree.AddChild(new Node("Fund Weapons", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Weapon", WeaponHash.AssaultRifle);}) .WithDescription("Fund your reinforcements to carry rifles instead of pistols")); return tree; }
private static NTree ToughenUpTree() { var pos = new Point(UI.WIDTH / 2 - NTree.NodeCenter.Width, UI.HEIGHT / 2 - NTree.NodeCenter.Height * 3); var startingNode = new Node("Toughen Up", new GTASprite("mpinventory", "drug_trafficking"), NodeType.Skill).WithUnusable(); var tree = new NTree("Toughen Up", startingNode, TreeType.SkillMod, pos); tree.AddChild(new Node("Increased Armor", new GTASprite("mpinventory","team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Armor Amount", 20); }) .WithDescription("Increases armor gain to 20")); tree.AddChild(new Node("Swift Change", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.CoolDownMs = 15000;}) .WithDescription("Decreases cooldown time to 15 seconds")); return tree; }
private static NTree RejectNonsenseTree() { var pos = new Point(UI.WIDTH / 2 - NTree.NodeCenter.Width, UI.HEIGHT / 2 - NTree.NodeCenter.Height * 3); var startingNode = new Node("Reject Nonsense", new GTASprite("mpinventory", "drug_trafficking"), NodeType.Skill).WithUnusable(); var tree = new NTree("Reject Nonsense", startingNode, TreeType.SkillMod, pos); tree.AddChild(new Node("Reach For The Stars", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Knockup Height", 50); }) .WithDescription("Increases knockup height")); tree.AddChild(new Node("Knocked Up", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Radius", 10); }) .WithDescription("Target more nearby characters")); return tree; }
public TreeMenu GetWeaponMenu() { var weaponTree = new NTree(new Node("Pistol", WeaponHash.Pistol, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon), TreeType.Weapon, new Point(110, 350)); weaponTree.AddChild(new Node("AP Pistol", WeaponHash.APPistol, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); weaponTree.AddChild(new Node("Stun Gun", WeaponHash.StunGun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); var rifles = weaponTree.AddChild(new Node("Assault Rifle", WeaponHash.AssaultRifle, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var throwables = rifles.AddChild(new Node("Sticky Bomb", WeaponHash.StickyBomb, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var smg = throwables.AddChild(new Node("Micro SMG", WeaponHash.MicroSMG, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var shotgun = smg.AddChild(new Node("Shotgun", WeaponHash.PumpShotgun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var snipers = shotgun.AddChild(new Node("Sniper", WeaponHash.SniperRifle, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var heavy = snipers.AddChild(new Node("RPG", WeaponHash.RPG, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var melee = heavy.AddChild(new Node("Knife", WeaponHash.Knife, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); var railgun = melee.AddChild(new Node("Railgun MK 3000", WeaponHash.Railgun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Right)); rifles.AddChild(new Node("Bullpup Rifle", WeaponHash.BullpupRifle, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)) .AddChild(new Node("Advanced Rifle", WeaponHash.AdvancedRifle, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); rifles.AddChild(new Node("Carbine Rifle", WeaponHash.CarbineRifle, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)) .AddChild(new Node("Special Carbine", WeaponHash.SpecialCarbine, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); throwables.AddChild(new Node("Grenade", WeaponHash.Grenade, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)) .AddChild(new Node("Smoke Grenade", WeaponHash.SmokeGrenade, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); throwables.AddChild(new Node("Molotov", WeaponHash.Molotov, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); smg.AddChild(new Node("SMG", WeaponHash.SMG, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); smg.AddChild(new Node("MG", WeaponHash.MG, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)) .AddChild(new Node("Combat MG", WeaponHash.CombatMG, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); shotgun.AddChild(new Node("Assault Shotgun", WeaponHash.AssaultShotgun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); shotgun.AddChild(new Node("Bullpup Shotgun", WeaponHash.BullpupShotgun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)) .AddChild(new Node("Sawn-Off Shotgun", WeaponHash.SawnOffShotgun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); snipers.AddChild(new Node("Heavy Sniper", WeaponHash.HeavySniper, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); snipers.AddChild(new Node("Marksman Rifle", WeaponHash.MarksmanRifle, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); heavy.AddChild(new Node("Firework Launcher", WeaponHash.Firework, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)) .AddChild(new Node("Homing Launcher", WeaponHash.HomingLauncher, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); heavy.AddChild(new Node("Grenade Launcher", WeaponHash.GrenadeLauncher, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)) .AddChild(new Node("Minigun", WeaponHash.Minigun, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); melee.AddChild(new Node("Nightstick", WeaponHash.Nightstick, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)) .AddChild(new Node("Hammer", WeaponHash.Hammer, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Down)); melee.AddChild(new Node("Golf Club", WeaponHash.GolfClub, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)) .AddChild(new Node("Hatchet", WeaponHash.Hatchet, new GTASprite("mpweaponscommon_small", "w_sb_assaultsmg"), NodeType.Weapon, TreeDirection.Up)); //var weaponTree = new NTree(new Node("Pistol", WeaponHash.Pistol, new GTASprite("srange_weap", "weap_hg_1"), NodeType.Weapon), TreeType.Weapon, new Point(110, 350)); //weaponTree.AddChild(new Node("AP Pistol", WeaponHash.APPistol, new GTASprite("srange_weap", "weap_hg_2"), NodeType.Weapon, TreeDirection.Up)); //weaponTree.AddChild(new Node("Stun Gun", WeaponHash.StunGun, new GTASprite("mpweaponsgang0_small", "w_pi_stungun"), NodeType.Weapon, TreeDirection.Down)); // //var rifles = weaponTree.AddChild(new Node("Assault Rifle", WeaponHash.AssaultRifle, new GTASprite("srange_weap", "weap_ar_1"), NodeType.Weapon, TreeDirection.Right)); //var throwables = rifles.AddChild(new Node("Sticky Bomb", WeaponHash.StickyBomb, new GTASprite("mpweaponscommon_small", "w_ex_pe"), NodeType.Weapon, TreeDirection.Right)); //var smg = throwables.AddChild(new Node("Micro SMG", WeaponHash.MicroSMG, new GTASprite("srange_weap2", "weap_smg_1"), NodeType.Weapon, TreeDirection.Right)); //var shotgun = smg.AddChild(new Node("Shotgun", WeaponHash.PumpShotgun, new GTASprite("srange_weap2", "weap_sg_1"), NodeType.Weapon, TreeDirection.Right)); //var snipers = shotgun.AddChild(new Node("Sniper", WeaponHash.SniperRifle, new GTASprite("mpweaponsgang0_small", "w_sr_sniperrifle"), NodeType.Weapon, TreeDirection.Right)); //var heavy = snipers.AddChild(new Node("RPG", WeaponHash.RPG, new GTASprite("mpweaponscommon_small", "w_lr_rpg"), NodeType.Weapon, TreeDirection.Right)); //var melee = heavy.AddChild(new Node("Knife", WeaponHash.Knife, new GTASprite("mpweaponsunusedfornow", "w_me_knife_01"), NodeType.Weapon, TreeDirection.Right)); //var railgun = melee.AddChild(new Node("Railgun MK 3000", WeaponHash.Railgun, new GTASprite("mpweaponscommon_small", "weap_rg_1"), NodeType.Weapon, TreeDirection.Right)); // // //rifles.AddChild(new Node("Bullpup Rifle", WeaponHash.BullpupRifle, new GTASprite("srange_weap", "weap_ar_5"), NodeType.Weapon, TreeDirection.Down)) // .AddChild(new Node("Advanced Rifle", WeaponHash.AdvancedRifle, new GTASprite("srange_weap", "weap_ar_3"), NodeType.Weapon, TreeDirection.Down)); //rifles.AddChild(new Node("Carbine Rifle", WeaponHash.CarbineRifle, new GTASprite("srange_weap", "weap_ar_2"), NodeType.Weapon, TreeDirection.Up)) // .AddChild(new Node("Special Carbine", WeaponHash.SpecialCarbine, new GTASprite("srange_weap", "weap_ar_6"), NodeType.Weapon, TreeDirection.Up)); // //throwables.AddChild(new Node("Grenade", WeaponHash.Grenade, new GTASprite("mpweaponsgang0_small", "w_ex_grenadefrag"), NodeType.Weapon, TreeDirection.Down)) // .AddChild(new Node("Smoke Grenade", WeaponHash.SmokeGrenade, new GTASprite("mpweaponscommon_small", "w_ex_grenadesmoke"), NodeType.Weapon, TreeDirection.Down)); //throwables.AddChild(new Node("Molotov", WeaponHash.Molotov, new GTASprite("mpweaponsunusedfornow", "w_ex_molotov"), NodeType.Weapon, TreeDirection.Up)); // // //smg.AddChild(new Node("SMG", WeaponHash.SMG, new GTASprite("srange_weap2", "weap_smg_2"), NodeType.Weapon, TreeDirection.Down)); //smg.AddChild(new Node("MG", WeaponHash.MG, new GTASprite("srange_weap2", "weap_lmg_1"), NodeType.Weapon, TreeDirection.Up)) // .AddChild(new Node("Combat MG", WeaponHash.CombatMG, new GTASprite("srange_weap2", "weap_lmg_2"), NodeType.Weapon, TreeDirection.Up)); // // //shotgun.AddChild(new Node("Assault Shotgun", WeaponHash.AssaultShotgun, new GTASprite("srange_weap2", "weap_sg_3"), NodeType.Weapon, TreeDirection.Down)); //shotgun.AddChild(new Node("Bullpup Shotgun", WeaponHash.BullpupShotgun, new GTASprite("srange_weap2", "weap_sg_4"), NodeType.Weapon, TreeDirection.Up)) // .AddChild(new Node("Sawn-Off Shotgun", WeaponHash.SawnOffShotgun, new GTASprite("srange_weap2", "weap_sg_2"), NodeType.Weapon, TreeDirection.Up)); // // //snipers.AddChild(new Node("Heavy Sniper", WeaponHash.HeavySniper, new GTASprite("mpweaponsgang0_small", "w_sr_heavysniper"), NodeType.Weapon, TreeDirection.Down)); //snipers.AddChild(new Node("Marksman Rifle", WeaponHash.MarksmanRifle, new GTASprite("mpweaponsgang0_small", "ocelot"), NodeType.Weapon, TreeDirection.Up)); // // //heavy.AddChild(new Node("Firework Launcher", WeaponHash.Firework, new GTASprite("mpawards1", "parachut1min"), NodeType.Weapon, TreeDirection.Down)) // .AddChild(new Node("Homing Launcher", WeaponHash.HomingLauncher, new GTASprite("mpweaponscommon_small", "rocket"), NodeType.Weapon, TreeDirection.Down)); //heavy.AddChild(new Node("Grenade Launcher", WeaponHash.GrenadeLauncher, new GTASprite("mpweaponscommon_small", "w_r_grenadelauncher"), NodeType.Weapon, TreeDirection.Up)) // .AddChild(new Node("Minigun", WeaponHash.Minigun, new GTASprite("mpweaponscommon_small", "weap_hvy_1"), NodeType.Weapon, TreeDirection.Up)); // //melee.AddChild(new Node("Nightstick", WeaponHash.Nightstick, new GTASprite("mpweaponsunusedfornow", "w_me_nightstick"), NodeType.Weapon, TreeDirection.Down)) // .AddChild(new Node("Hammer", WeaponHash.Hammer, new GTASprite("mpweaponsunusedfornow", "w_me_hammer"), NodeType.Weapon, TreeDirection.Down)); //melee.AddChild(new Node("Golf Club", WeaponHash.GolfClub, new GTASprite("mpweaponsunusedfornow", "w_me_gclub"), NodeType.Weapon, TreeDirection.Up)) // .AddChild(new Node("Hatchet", WeaponHash.Hatchet, new GTASprite("mpweaponsunusedfornow", "w_me_fireaxe"), NodeType.Weapon, TreeDirection.Up)); return new TreeMenu(weaponTree); }
public string GetFooter(NTree dataTree) { switch(Type) { case NodeType.Skill: var skill = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == Ref); return skill.Unlocked ? "unlocked" : skill.PointsToUnlock + " SP"; case NodeType.Weapon: var wep = RPG.PlayerData.Weapons.FirstOrDefault(s => s.WeaponHash == WepHash); return wep.Unlocked ? "unlocked" : wep.PointsToUnlock + " SP at Level " + wep.LevelToUnlock; case NodeType.SkillMod: var skillForMod = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == dataTree.TreeRef); var mod = skillForMod.UsedMods.FirstOrDefault(s => s == Ref); return mod != null ? "unlocked" : skillForMod.Mods[Ref] + " SP"; default: throw new ArgumentOutOfRangeException(); } }
public override void OnChangeSelection(bool down) { var dir = down ? TreeDirection.Down : TreeDirection.Up; var nextTree = Branch.children.FirstOrDefault(c => c.Node.Direction == dir); if(nextTree != null) { Branch = nextTree; } else { var parentDirToThis = dir == TreeDirection.Down ? TreeDirection.Up : TreeDirection.Down; var parentInDir = SelectedObj.Direction == parentDirToThis; if(parentInDir) { Branch = SelectedObj.Parent; } } }
public bool Unlocked(NTree dataTree) { if (Type == NodeType.Skill) { var skill = RPG.PlayerData.Skills.First(s => s.Name == Ref); return skill.Unlocked; } if (Type == NodeType.Weapon) { var wep = RPG.PlayerData.Weapons.First(s => s.WeaponHash == WepHash); return wep.Unlocked; } if (Type == NodeType.SkillMod) { var skillForMod = RPG.PlayerData.Skills.FirstOrDefault(s => s.Name == dataTree.TreeRef); var mod = skillForMod.UsedMods.FirstOrDefault(s => s == Ref); return mod != null; } return false; }
public TreeMenu(NTree tree) { DataTree = tree; Branch = tree; }
private static NTree BlazedOffGloryTree() { var pos = new Point(UI.WIDTH / 2 - NTree.NodeCenter.Width, UI.HEIGHT / 2 - NTree.NodeCenter.Height * 3); var startingNode = new Node("Blazed Off Glory", new GTASprite("mpinventory", "mp_specitem_weed"), NodeType.Skill).WithUnusable(); var tree = new NTree("Blazed Off Glory", startingNode, TreeType.SkillMod, pos); tree.AddChild(new Node("Two Puffs", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Blaze Time", 20000); }) .WithDescription("Increases blaze time to 20 seconds")); tree.AddChild(new Node("Lethal Dose", new GTASprite("mpinventory", "team_deathmatch"), NodeType.SkillMod) .WithUnlockAction(o => { var skill = (Skill)o; skill.SetParam("Damage Buff", 2.0f);}) .WithDescription("Increases damage buff to 200%")); return tree; }