/// <summary> /// Character frame getter for target. /// </summary> /// <returns></returns> public CharacterFrame GetEnemyCharacterFrame() { if (this.enemyCharacterFrame == null) { this.enemyCharacterFrame = GetComponentInChildren <CharacterFrame>(); } return(this.enemyCharacterFrame); }
public static void GetEquippedItems() { GItemHelper GIH = new GItemHelper(); if (CharacterSlots == null) { CharacterSlots = GetCharacterSlots(); } CharacterFrame.ShowFrame(); foreach (string slot in CharacterSlots) { string tooltipName = "none"; PPather.Debug("\n\n == SLOT LOOKUP FOR {0} START ==", slot); List <string> tooltip = CharacterFrame.GetTooltip(slot); if (tooltip != null && tooltip.Count > 0) { //foreach (string tip in tooltip) // PPather.WriteLine("Character: Tooltip[{0}]\t=>\t{1}", slot, tip); tooltipName = tooltip[tooltip.Count - 1]; } PPather.Debug("Character: Name for {0} = {1}", slot, tooltipName); if (tooltip == null || IsEmptySlotName(tooltipName)) { AddNullSlot(slot); } else { Item i = ItemManager.get(tooltipName); if (i == null) { AddNullSlot(slot); } else { GItem Item = (GItem)GObjectList.FindObject(GIH.GetEquippedGUID(slot)); if (Item == null) { continue; } EasyItem E = new EasyItem(Item, i, Item.GUID, tooltipName); try { CurrentlyEquipped.Add(slot, E); PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Character: Item [{0}] equipped in '{1}'", tooltipName, slot); PPather.Debug(String.Format("ToolTip[{0}]: {1}", i.Name, CleanToolTip(tooltip))); } catch (ArgumentException) { PPather.Debug("Character: " + tooltipName + " is already added to CurrentlyEquipped (skipping)"); } } } PPather.Debug("\n=== SLOT LOOKUP FOR {0} END ===\n", slot); } CharacterFrame.HideFrame(); }
private void ApplyStateFrame(CharacterFrame currentFrame) { if ((currentFrame.Flags & FrameFlags.AUTO_JUMP) > 0) { //we want to jump, get the jump type int jumpId = data.CanJump(); //may swap the next series of if statements to switch //check if we can jump (0 means we can't) if (jumpId > 0) { //player wants to air jump if (jumpId == 2) { //increment the number of current air jumps data.moveCondition.curAirJumps += 1; //Debug.Log("jumping"); } //gets the jump velocity and sets it to the y value. calcVelocity.y = data.moveStats.jumpForce; } } //if the state applies its own custom velocity if ((currentFrame.Flags & FrameFlags.APPLY_VEL) > 0) { int facing = 1; if (!data.moveCondition.facingRight) { facing = -1; } if ((currentFrame.Flags & FrameFlags.SET_VEL) == FrameFlags.SET_VEL) { calcVelocity = new FPVector2(facing * currentFrame.velocity.x, currentFrame.velocity.y); } else { calcVelocity += new FPVector2(facing * currentFrame.velocity.x, currentFrame.velocity.y); } } //if the state applies its own custom velocity if ((currentFrame.Flags & FrameFlags.CHANGE_DIRECTION) > 0) { //Debug.Log("trying to turn around"); //statement to change facing if (data.moveCondition.facingRight) { //face left sprite.transform.eulerAngles = new Vector3(0f, 0f, 0f); //sprite.flipX=true; data.moveCondition.facingRight = false; } else { //face right sprite.transform.eulerAngles = new Vector3(0f, 180f, 0f); //sprite.flipX=false; data.moveCondition.facingRight = true; } } //check if there are hitboxes if (currentFrame.HasHitboxes()) { //sets the data of the bitboxes //get the array for easier access HitBoxData[] hitBoxData = currentFrame.hitboxes; //get the length of for the for loop int len = hitBoxData.Length; for (int i = 0; i < len; i++) { this.hitboxObj[i].SetBoxData(hitBoxData[i], data.moveCondition.facingRight); } } }
public static bool Equip(EasyItem E, bool EquipBOE, string slot) { PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Equip: Attempting to equip {0} [{1}]", E.RealName, slot); bool placed = false; BagManager bm = new BagManager(); CharacterFrame.ShowFrame(); GInterfaceObject BagItemObject = null; GInterfaceObject TargetSlotObject; TargetSlotObject = GContext.Main.Interface.GetByName("Character" + slot); //PPather.WriteLine(LOG_CATEGORY.DEBUG, "Equip: TargetSlotObject = {0}", TargetSlotObject.LabelText); GItem[] Items = bm.GetAllItems(); foreach (GItem Item in Items) { if (Item.GUID == E.GUID) { Thread.Sleep(500); BagItemObject = bm.GetItem(Item); //PPather.WriteLine(LOG_CATEGORY.DEBUG, "Equip: BagItemObject = {0}", BagItemObject.LabelText); //PPather.WriteLine("item: " + BagItemObject.ToString()); Functions.Drag(BagItemObject, TargetSlotObject); placed = true; Thread.Sleep(500); string BOEButton = "StaticPopup1Button2"; if (EquipBOE) { BOEButton = "StaticPopup1Button1"; } GInterfaceObject ButtonObject = GContext.Main.Interface.GetByName(BOEButton); if (ButtonObject != null && ButtonObject.IsVisible) { if (!EquipBOE) { placed = false; } GContext.Main.EnableCursorHook(); ButtonObject.Hover(); ButtonObject.ClickMouse(false); GContext.Main.DisableCursorHook(); GContext.Main.ClearTarget(); } } } CharacterFrame.HideFrame(); /* put the old item in bags */ if (GContext.Main.Interface.CursorItemType != GCursorItemTypes.None) { Functions.Click(BagItemObject); } bm.UpdateItems(); bm.CloseAllBags(); if (placed) { Character.ReplaceCurrentlyEquipped(E, slot); return(true); } return(false); }