public EasyItem(GItem gi, Item ii, long g, string rn) { RealName = rn; GItem = gi; Item = ii; GUID = g; }
public EasyItem(Item i) { GItem gi = Inventory.GetItem(i.Name); if (gi == null) gi = Inventory.GetItem(GetBaseName(i.Name)); GItem = gi; Item = i; if(gi != null) { GUID = gi.GUID; } }
public static List<string> GetTooltip(GItem item) { BagManager bm = new BagManager(); List<string> text = new List<string>(); GInterfaceObject ItemObj = bm.GetItem(item); if (ItemObj != null) { GContext.Main.EnableCursorHook(); ItemObj.Hover(); Thread.Sleep(50); GInterfaceObject ToolTip = GContext.Main.Interface.GetByName("GameTooltip"); if (ToolTip != null) { foreach (GInterfaceObject child in ToolTip.Children) { if (child.ToString().Contains("GameTooltipText")) text.Add(child.LabelText); } } GContext.Main.DisableCursorHook(); } bm.CloseAllBags(); return text; }
public override void OnEnter() { DefaultFont = Game.Content.Load <SpriteFont>("Default"); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load <SpriteFont>("Title"), Game.Content.Load <SpriteFont>("Small"), Input); IsInitialized = true; Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice); MainWindow = new Panel(GUI, GUI.RootComponent); MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2); Layout = new GridLayout(GUI, MainWindow, 10, 4); Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont); Layout.SetComponentPosition(label, 0, 0, 1, 1); Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true); Layout.SetComponentPosition(check, 0, 1, 1, 1); Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true); Layout.SetComponentPosition(check2, 0, 2, 1, 1); Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(apply, 2, 9, 1, 1); Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(back, 3, 9, 1, 1); Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont); Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1); sliderLabel.Alignment = Drawer2D.Alignment.Right; Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer); Layout.SetComponentPosition(slider, 1, 3, 1, 1); Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont); comboLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1); ComboBox combo = new ComboBox(GUI, Layout); combo.AddValue("Foo"); combo.AddValue("Bar"); combo.AddValue("Baz"); combo.AddValue("Quz"); combo.CurrentValue = "Foo"; Layout.SetComponentPosition(combo, 1, 4, 1, 1); back.OnClicked += back_OnClicked; GroupBox groupBox = new GroupBox(GUI, Layout, ""); Layout.SetComponentPosition(groupBox, 2, 1, 2, 6); Layout.UpdateSizes(); /* * Texture2D Image = Game.Content.Load<Texture2D>("pine"); * string[] tags = {""}; * DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags)); * image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height); * * Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont); * imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height); * imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left; */ GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2); DragManager dragManager = new DragManager(); DragGrid dragGrid = new DragGrid(GUI, groupLayout, dragManager, 32, 32); DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32); groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1); groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1); Layout.UpdateSizes(); groupLayout.UpdateSizes(); dragGrid.SetupLayout(); dragGrid2.SetupLayout(); foreach (Resource r in ResourceLibrary.Resources.Values) { GItem gitem = new GItem(r, r.Image, r.Tint, 0, 32, 2, 1); gitem.CurrentAmount = 2; dragGrid.AddItem(gitem); } ProgressBar progress = new ProgressBar(GUI, Layout, 0.7f); Label progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont); progressLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1); Layout.SetComponentPosition(progress, 1, 5, 1, 1); LineEdit line = new LineEdit(GUI, Layout, ""); Label lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont); lineLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1); Layout.SetComponentPosition(line, 1, 6, 1, 1); base.OnEnter(); }
public void CastSpellItem(GItem item) { ClickItem(item, true); Thread.Sleep(500); while (GContext.Main.Me.IsCasting) { Thread.Sleep(100); } }
public LRxItem(GItem source, CHashSet <int> la) { produce = source.produce; express = source.express; lookahead = la; }
public EasyItem(GItem gi, Item ii, long g) { GItem = gi; Item = ii; GUID = g; }
public BagItem(int b, int s, GItem i) { bag = b; slot = s; item = i; }
public override void AI() { Player player = Main.player[projectile.owner]; player.ChangeDir(Main.MouseWorld.X > player.position.X ? 1 : -1); player.itemTime = 5; // Set item time to 2 frames while we are used player.itemAnimation = 5; // Set item animation time to 2 frames while we are used direction = Main.MouseWorld - (player.Center); direction.Normalize(); direction *= 70f; projectile.position = player.Center + direction; projectile.velocity = Vector2.Zero; player.itemRotation = direction.ToRotation(); player.heldProj = projectile.whoAmI; if (player.direction != 1) { player.itemRotation -= 3.14f; } if (player.channel) { if (projectile.soundDelay <= 0 && targets.Count > 0) //Create sound & use ammo { projectile.soundDelay = 20; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 15); GItem.UseAmmo(player, AmmoID.Gel); } projectile.timeLeft = 2; counter++; projectile.frame = (counter / 5) % 4; for (int i = 0; i < Main.npc.Length; i++) { NPC npc = Main.npc[i]; Vector2 toNPC = npc.Center - player.Center; if (toNPC.Length() < RANGE && npc.active && AnglesWithinCone(toNPC.ToRotation(), direction.ToRotation()) && (!npc.townNPC || !npc.friendly)) { bool targetted = false; foreach (var npc2 in targets) { if (npc2.active) { if (npc2 == npc) { targetted = true; } } } if (!targetted) { SpiritMod.primitives.CreateTrail(new RailgunPrimTrail(projectile, npc)); targets.Add(npc); npc.GetGlobalNPC <TeslaCannonGNPC>().charging = true; } } else { if (npc.active) { npc.GetGlobalNPC <TeslaCannonGNPC>().charging = false; } targets.Remove(npc); } } foreach (var npc2 in targets.ToArray()) { if (!npc2.active) { targets.Remove(npc2); } } } else { projectile.active = false; } }
public GInterfaceObject GetItem(GItem item) { UpdateItems(); //PPather.WriteLine("you want {0}",item.Name); // search for it for (int i = 0; i < BagItems.Length; i++) { BagItem it = BagItems[i]; if (it.item == item) { //PPather.WriteLine("Getting more info"); //PPather.WriteLine("Bag: {0}, Slot: {1}",it.bag,it.slot); GInterfaceObject obj = GetItem(it.bag, it.slot); return obj; } } return null; }
public static bool EquipNewBag(GItem Item) { BagManager bm = new BagManager(); GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID); if (bag != null) { bm.ClickItem(Item, true); for (int p = 1; p <= 4; p++) { if (Popup.IsVisible(p)) { String text = Popup.GetText(p); PPather.WriteLine("Inventory: Got a popup ('" + text + "')"); if (text.Contains("will bind it to you")) { Popup.ClickButton(p, 1); } else { Popup.ClickButton(p, 2); } } } bm.CloseAllBags(); return true; } bm.CloseAllBags(); return false; }
public EasyItem(GItem gi, Item ii, long g) { GItem = gi; Item = ii; GUID = g; }
public static void EquipBag(GItem bag, bool NewBag, string BagSlotName) { if (NewBag) { if (Inventory.EquipNewBag(bag)) { PPather.WriteLine(String.Format("AutoEquip: Equipped New Bag ({0})", bag.Name)); GContext.Main.Debug(String.Format("AutoEquip: Equipped New Bag ({0})", bag.Name)); } } else if (Inventory.EquipBetterBag(bag, BagSlotName)) { PPather.WriteLine(String.Format("AutoEquip: Equipped Better Bag ({0})", bag.Name)); GContext.Main.Debug(String.Format("AutoEquip: Equipped Better Bag ({0})", bag.Name)); } }
public void DeleteListItem(ISPCItem item) { GItem fileItem = (GItem)item; GMailManager.GetInstance().DeleteFile(fileItem.SiteSetting, fileItem.UniqueIdentifier); }
public int slots = 0; // SlotCount #endregion Fields #region Constructors public RankedBag(int l, int s, GContainer b, GItem i, string sname) { location = l; slots = s; bag = b; item = i; slotname = sname; }
public static string GetBagSlotName(GItem Item) { long[] AllBags = GPlayerSelf.Me.Bags; for (int i = 0; i < AllBags.Length; i++) { if (Item.GUID == AllBags[i]) return "CharacterBag" + i + "Slot"; } return null; }
//BagNr is 0-4, ItemNr is 1-BagSlots public bool ClickItem(int BagNr, int ItemNr, GItem item, bool RightMouse) { ClickItem: if(tries >= 4) { tries = 1; PPather.WriteLine(LOG_CATEGORY.INFORMATION, "BagManager: Tried to click {0} 3 times now and it didn't work. Aborting :-(",item.Name); return false; } OpenBag(BagNr); Thread.Sleep(100); //PPather.WriteLine("BagManager: Click item " + BagNr + " " + ItemNr); String itemStr = "ContainerFrame1Item" + ItemNr; GInterfaceObject ItemObj = GContext.Main.Interface.GetByName(itemStr); if (ItemObj != null) { GContext.Main.EnableCursorHook(); ItemObj.Hover(); Thread.Sleep(100); GInterfaceObject ToolTip = GContext.Main.Interface.GetByName("GameTooltip"); if(ToolTip != null) { GInterfaceObject child = ToolTip.Children[0]; // PPather.WriteLine(child.ToString() + " with labeltext " + child.LabelText); if (child.ToString().Contains("GameTooltipTextLeft1")) { if (child.LabelText != item.Name) { PPather.WriteLine(LOG_CATEGORY.INFORMATION, "BagManger: Tried to click item {0} but found {1}. Will try again...",item.Name, child.LabelText); Thread.Sleep(100); GContext.Main.DisableCursorHook(); CloseAllBags(); CurrentOpenBag = -1; // PPather.WriteLine("BagManager: Retry number " + tries); tries++; Thread.Sleep(150); goto ClickItem; } } } GContext.Main.DisableCursorHook(); Functions.Click(ItemObj, RightMouse); return true; } return false; }
public Bag(int b, GItem[] i) { bag = b; I = i; }
public bool ClickItem(GItem item, bool RightMouse) { UpdateItems(); // search for it for (int i = 0; i < BagItems.Length; i++) { BagItem it = BagItems[i]; if (it.item == item) { return ClickItem(it.bag, it.slot, item, RightMouse); } } return false; }
public static bool EquipBetterBag(GItem Item) { GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID); if (bag != null) { long[] AllBags = GPlayerSelf.Me.Bags; for (int i = 0; i < AllBags.Length; i++) { GContainer cbag = (GContainer)GObjectList.FindObject(AllBags[i]); if (cbag != null) { if (cbag.SlotCount < bag.SlotCount && !cbag.Name.ToString().ToLower().Contains("ammo") && !cbag.Name.ToString().ToLower().Contains("quiver")) { GInterfaceObject OldBag = GContext.Main.Interface.GetByName("CharacterBag" + i + "Slot"); BagManager bm = new BagManager(); bm.ClickItem(Item, false); Functions.Click(OldBag, false); for (int p = 1; p <= 4; p++) { if (Popup.IsVisible(p)) { String text = Popup.GetText(p); PPather.WriteLine("Inventory: Got a popup ('" + text + "')"); if (text.Contains("will bind it to you")) { Popup.ClickButton(p, 1); } else { Popup.ClickButton(p, 2); } } } bm.CloseAllBags(); return true; } } } } return false; }
/*public BagManager() { // make sure all bags are closed CloseAllBags(); UpdateItems(); // check all contents }*/ public void UpdateItemsSorted() { //PPather.WriteLine("UpdateItemsSorted()"); int[] count = new int[5] {0,0,0,0,0}; UpdateItems(); for (int i = 0; i < BagItems.Length; i++) { BagItem it = BagItems[i]; //PPather.WriteLine("UpdateItemsSorted: Adding {0} to Bag {1} (count = {2})", it.item.Name, it.bag, count[it.bag] + 1); count[it.bag]++; } int bags = GPlayerSelf.Me.Bags.Length+1; long[] AllBags = GPlayerSelf.Me.Bags; for (int bagNr = 0; bagNr < 5; bagNr++) { int SlotCount; if (bagNr == 0) SlotCount = GContext.Main.Me.SlotCount; else { GContainer bag = (GContainer)GObjectList.FindObject(AllBags[bagNr - 1]); if (bag != null) SlotCount = bag.SlotCount; else SlotCount = 0; } count[bagNr] = SlotCount; } //PPather.WriteLine("UpdateItemsSorted: Creating new Bag array of size {0}", bags); Bags = new Bag[bags]; for(int i=0; i<bags; i++) { //PPather.WriteLine("UpdateItemsSorted: Creating new GItem array of size {0} to Bag {1}", count[i], i); GItem[] gits = new GItem[count[i]]; //PPather.WriteLine("UpdateItemsSorted: Adding gits to Bag {0}", i); Bags[i] = new Bag(i,gits); } for (int i = 0; i < BagItems.Length; i++) { BagItem it = BagItems[i]; //PPather.WriteLine("UpdateItemsSorted: Bag[{0}].Add({1}, {2})", it.bag, it.item.Name, it.slot-1); Bags[it.bag].Add(it.item, it.slot-1); } }
public void Add(GItem i, int index) { I[index] = i; count++; }
public void Add(GItem i, int index) { I[index] = i; count++; }
public void addObject(GItem obj) { obj.reflist_index.all = all.count(); all.addObject(obj); }
public BagItem(int b, int s, GItem i) { bag = b; slot = s; item = i; }
public override void OnEnter() { DefaultFont = Game.Content.Load<SpriteFont>("Default"); GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>("Title"), Game.Content.Load<SpriteFont>("Small"), Input); IsInitialized = true; Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice); MainWindow = new Panel(GUI, GUI.RootComponent); MainWindow.LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2); Layout = new GridLayout(GUI, MainWindow, 10, 4); Label label = new Label(GUI, Layout, "GUI Elements", GUI.TitleFont); Layout.SetComponentPosition(label, 0, 0, 1, 1); Checkbox check = new Checkbox(GUI, Layout, "Check 1", GUI.DefaultFont, true); Layout.SetComponentPosition(check, 0, 1, 1, 1); Checkbox check2 = new Checkbox(GUI, Layout, "Check 2", GUI.DefaultFont, true); Layout.SetComponentPosition(check2, 0, 2, 1, 1); Button apply = new Button(GUI, Layout, "Apply", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(apply, 2, 9, 1, 1); Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.PushButton, null); Layout.SetComponentPosition(back, 3, 9, 1, 1); Label sliderLabel = new Label(GUI, Layout, "Slider", GUI.DefaultFont); Layout.SetComponentPosition(sliderLabel, 0, 3, 1, 1); sliderLabel.Alignment = Drawer2D.Alignment.Right; Slider slider = new Slider(GUI, Layout, "Slider", 0, -1000, 1000, Slider.SliderMode.Integer); Layout.SetComponentPosition(slider, 1, 3, 1, 1); Label comboLabel = new Label(GUI, Layout, "Combobox", GUI.DefaultFont); comboLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(comboLabel, 0, 4, 1, 1); ComboBox combo = new ComboBox(GUI, Layout); combo.AddValue("Foo"); combo.AddValue("Bar"); combo.AddValue("Baz"); combo.AddValue("Quz"); combo.CurrentValue = "Foo"; Layout.SetComponentPosition(combo, 1, 4, 1, 1); back.OnClicked += back_OnClicked; GroupBox groupBox = new GroupBox(GUI, Layout, ""); Layout.SetComponentPosition(groupBox, 2, 1, 2, 6); Layout.UpdateSizes(); /* Texture2D Image = Game.Content.Load<Texture2D>("pine"); string[] tags = {""}; DraggableItem image = new DraggableItem(GUI, groupBox,new GItem("Item", new ImageFrame(Image, Image.Bounds), 0, 1, 1, tags)); image.LocalBounds = new Rectangle(50, 50, Image.Width, Image.Height); Label imageLabel = new Label(GUI, image, "Image Panel", GUI.DefaultFont); imageLabel.LocalBounds = new Rectangle(0, 0, Image.Width, Image.Height); imageLabel.Alignment = Drawer2D.Alignment.Top | Drawer2D.Alignment.Left; */ GridLayout groupLayout = new GridLayout(GUI, groupBox, 1, 2); DragManager dragManager = new DragManager(); DragGrid dragGrid = new DragGrid(GUI, groupLayout, dragManager, 32, 32); DragGrid dragGrid2 = new DragGrid(GUI, groupLayout, dragManager, 32, 32); groupLayout.SetComponentPosition(dragGrid, 0, 0, 1, 1); groupLayout.SetComponentPosition(dragGrid2, 1, 0, 1, 1); Layout.UpdateSizes(); groupLayout.UpdateSizes(); dragGrid.SetupLayout(); dragGrid2.SetupLayout(); foreach(Resource r in ResourceLibrary.Resources.Values) { if(r.ResourceName != "Container") { GItem gitem = new GItem(r.ResourceName, r.Image, 0, 32, 2, 1); gitem.CurrentAmount = 2; dragGrid.AddItem(gitem); } } ProgressBar progress = new ProgressBar(GUI, Layout, 0.7f); Label progressLabel = new Label(GUI, Layout, "Progress Bar", GUI.DefaultFont); progressLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(progressLabel, 0, 5, 1, 1); Layout.SetComponentPosition(progress, 1, 5, 1, 1); LineEdit line = new LineEdit(GUI, Layout, ""); Label lineLabel = new Label(GUI, Layout, "Line Edit", GUI.DefaultFont); lineLabel.Alignment = Drawer2D.Alignment.Right; Layout.SetComponentPosition(lineLabel, 0, 6, 1, 1); Layout.SetComponentPosition(line, 1, 6, 1, 1); base.OnEnter(); }