// Token: 0x06001EAD RID: 7853 RVA: 0x000B64DC File Offset: 0x000B46DC private void Awake() { this.m_character = base.GetComponent <Character>(); this.m_quickslotTrans = base.transform.Find("QuickSlots"); // Add our 8 QuickSlots for (var x = 0; x < 8; ++x) { // Create a GameObject with a name that shouldn't overlap with anything else GameObject gameObject = new GameObject(string.Format("EXQS_{0}", x)); // Add a QuickSlot object and set the name based on how the client will process it QuickSlot qs = gameObject.AddComponent <QuickSlot>(); qs.name = string.Format("{0}", x + 12); // Set the parent so the code below will find the new objects and treat them like the originals gameObject.transform.SetParent(this.m_quickslotTrans); } QuickSlot[] componentsInChildren = this.m_quickslotTrans.GetComponentsInChildren <QuickSlot>(); this.m_quickSlots = new QuickSlot[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { int num = int.Parse(componentsInChildren[i].name); this.m_quickSlots[num - 1] = componentsInChildren[i]; this.m_quickSlots[num - 1].Index = num - 1; } for (int j = 0; j < this.m_quickSlots.Length; j++) { this.m_quickSlots[j].SetOwner(this.m_character); } }
private void Start() { playerIn = FindObjectOfType <PlayerInventory>(); mainInventory = FindObjectOfType <MainInventory>(); playerQ = FindObjectOfType <PlayerQuickSlot>(); quickSlot = FindObjectOfType <QuickSlot>(); }
public void EquipSpell(RuntimeSpellItems spell) { currentSpell = spell; QuickSlot uiSlot = QuickSlot.singleton; uiSlot.UpdateSlot(QSlotType.spell, spell.instance.icon); }
public override bool DoEquip(Hero hero) { DetachAll(hero.Belongings.Backpack); if (hero.Belongings.Weapon == null || hero.Belongings.Weapon.DoUnequip(hero, true)) { hero.Belongings.Weapon = this; Activate(hero); QuickSlot.Refresh(); cursedKnown = true; if (cursed) { EquipCursed(hero); GLog.Negative(TxtEquipCursed, Name); } hero.SpendAndNext(TimeToEquip); return(true); } Collect(hero.Belongings.Backpack); return(false); }
public void EquipWeapon(RuntimeWeapon w, bool isLeft = false) { if (isLeft) { if (leftHandWeapon != null) { leftHandWeapon.weaponModel.SetActive(false); } leftHandWeapon = w; } else { if (rightHandWeapon != null) { rightHandWeapon.weaponModel.SetActive(false); } rightHandWeapon = w; } string targetIdle = w.instance.oh_idle; targetIdle += (isLeft) ? StaticStrings._l : StaticStrings._r; states.anim.SetBool(StaticStrings.mirror, isLeft); states.anim.Play(StaticStrings.changeWeapon); states.anim.Play(targetIdle); QuickSlot uiSlot = QuickSlot.singleton; uiSlot.UpdateSlot( (isLeft)? QSlotType.lh : QSlotType.rh, w.instance.icon); w.weaponModel.SetActive(true); }
public virtual void Cast(Hero user, int dst) { var cell = Ballistica.Cast(user.pos, dst, false, true); user.Sprite.DoZap(cell); user.Busy(); var enemy = Actor.FindChar(cell); QuickSlot.Target(this, enemy); var delay = TimeToThrow; if (this is MissileWeapon) { // FIXME delay *= ((MissileWeapon)this).SpeedFactor(user); if (enemy != null && enemy.Buff <SnipersMark>() != null) { delay *= 0.5f; } } float finalDelay = delay; //((MissileSprite)user.sprite.parent.Recycle(typeof(MissileSprite))).Reset(user.pos, cell, this, new ICallback() { public void call() { Item.detach(user.belongings.backpack).onThrow(cell); user.spendAndNext(finalDelay); } }); }
public Item DetachAll(Bag container) { foreach (var item in container.Items) { if (item == this) { container.Items.Remove(this); item.OnDetach(); QuickSlot.Refresh(); return(this); } var bag1 = item as Bag; if (bag1 == null) { continue; } var bag = bag1; if (bag.Contains(this)) { return(DetachAll(bag)); } } return(this); }
public static bool AwakePrefix(CharacterQuickSlotManager __instance, ref QuickSlot[] ___m_quickSlots, ref Character ___m_character, ref Transform ___m_quickslotTrans) { ___m_character = __instance.GetComponent <Character>(); ___m_quickslotTrans = __instance.transform.Find("QuickSlots"); // Add our 8 QuickSlots for (var x = 0; x < ExtendedQuickslots.numSlots; ++x) { // Create a GameObject with a name that shouldn't overlap with anything else GameObject gameObject = new GameObject(string.Format("EXQS_{0}", x)); // Add a QuickSlot object and set the name based on how the client will process it QuickSlot qs = gameObject.AddComponent <QuickSlot>(); qs.name = string.Format("{0}", x + 12); // Set the parent so the code below will find the new objects and treat them like the originals gameObject.transform.SetParent(___m_quickslotTrans); } QuickSlot[] componentsInChildren = ___m_quickslotTrans.GetComponentsInChildren <QuickSlot>(); ___m_quickSlots = new QuickSlot[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { int num = int.Parse(componentsInChildren[i].name); ___m_quickSlots[num - 1] = componentsInChildren[i]; ___m_quickSlots[num - 1].Index = num - 1; } for (int j = 0; j < ___m_quickSlots.Length; j++) { ___m_quickSlots[j].SetOwner(___m_character); } return(false); }
private void InitializeVariables() { saveData = FindObjectOfType <SaveData>(); playerCamera = FindObjectOfType <PlayerCamera>(); dialogueManager = FindObjectOfType <DialogueManager>(); quickSlot = FindObjectOfType <QuickSlot>(); mainInventory = FindObjectOfType <MainInventory>(); }
public void UpdateQuickslot() { //TODO: CHECK UpdateQuickslot if (Stackable && Dungeon.Quickslot == this) { QuickSlot.Refresh(); } }
protected override bool OnLongClick() { if (_owner.listener == null && _item.DefaultAction != null) { _owner.Hide(); Dungeon.Quickslot = _item; QuickSlot.Refresh(); return(true); } return(false); }
private int FindQuickSlotIndex(int skillId, long itemUid = 0) { for (int i = 0; i < MaxSlots; i++) { QuickSlot currentSlot = Slots[i]; if (currentSlot.SkillId == skillId && currentSlot.ItemUid == itemUid) { return(i); } } return(-1); }
public bool RemoveQuickSlot(QuickSlot quickSlot) { int targetSlotIndex = FindQuickSlotIndex(quickSlot.SkillId, quickSlot.ItemUid); if (targetSlotIndex is < 0 or >= MaxSlots) { // TODO - There is either a) hotbar desync or b) something unintended occuring return(false); } Slots[targetSlotIndex] = new(); // Clear return(true); }
public void Init(bool isQuickSlot = false) { _textCount = GetComponentInChildren <TextMeshProUGUI>(); _inventoryRect = transform.parent.parent.GetComponent <RectTransform>().rect; _quickSlot = FindObjectOfType <QuickSlot>(); _quickSlotRect = _quickSlot.GetComponent <RectTransform>(); _quickSlotR = _quickSlot.GetComponent <RectTransform>().rect; IsQuickSlot = isQuickSlot; _player = FindObjectOfType <Player>(); _itemDrop = FindObjectOfType <ItemDrop>(); _inventory = FindObjectOfType <InventoryUI>(); }
public void EquipWeapon(RuntimeWeapon weapon, bool isLeft = false) { string targetIdle = weapon.instance.oh_idle; targetIdle += (isLeft) ? "_l" : "_r"; states.anim.SetBool(StaticStrings.mirror, isLeft); states.anim.Play(StaticStrings.changeWeapon); states.anim.Play(targetIdle); QuickSlot uiSlot = QuickSlot.singleton; uiSlot.UpdateSlot((isLeft) ? QSlotType.lh : QSlotType.rh, weapon.instance.icon); weapon.weaponModel.SetActive(true); }
public static void Prefix(CharacterQuickSlotManager __instance) { var self = __instance; Transform m_quickslotTrans = self.transform.Find("QuickSlots"); At.SetValue(m_quickslotTrans, typeof(CharacterQuickSlotManager), self, "m_quickslotTrans"); for (int x = 0; x < settings.NumberOfQuickSlotsToAdd; x++) { GameObject gameObject = new GameObject(string.Format("EXQS_{0}", x)); QuickSlot qs = gameObject.AddComponent <QuickSlot>(); qs.name = "" + (x + 12); gameObject.transform.SetParent(m_quickslotTrans); } }
private void Start() { tr = this.transform; pickup = this.GetComponent <PickUp>(); if (pickup == null) { pickup = this.gameObject.AddComponent <PickUp>(); } slot = this.transform.GetComponentInChildren <QuickSlot>(); equipment = tr.GetComponent <Equipment>(); if (equipment == null) { equipment = tr.gameObject.AddComponent <Equipment>(); } }
public static void Prefix(CharacterQuickSlotManager __instance, ref Transform ___m_quickslotTrans) { var self = __instance; var trans = self.transform.Find("QuickSlots"); ___m_quickslotTrans = trans; for (int i = 0; i < SlotsToAdd; i++) { GameObject gameObject = new GameObject($"EQS_{i}"); QuickSlot qs = gameObject.AddComponent <QuickSlot>(); qs.name = "" + (i + 12); gameObject.transform.SetParent(trans); } }
public override int AttackProc(Character enemy, int damage) { var wep = RangedWeapon ?? Belongings.Weapon; if (wep == null) { return(damage); } wep.Proc(this, enemy, damage); switch (subClass.SubClassType) { case HeroSubClassType.GLADIATOR: if (wep is MeleeWeapon) { damage += buffs.Buff.Affect <Combo>(this).Hit(enemy, damage); } break; case HeroSubClassType.BATTLEMAGE: var wand = wep as Wand; if (wand != null) { if (wand.CurrrentCharges < wand.MaxCharges && damage > 0) { wand.CurrrentCharges++; if (Dungeon.Quickslot == wand) { QuickSlot.Refresh(); } ScrollOfRecharging.Charge(this); } damage += wand.CurrrentCharges; } goto case HeroSubClassType.SNIPER; case HeroSubClassType.SNIPER: if (RangedWeapon != null) { buffs.Buff.Prolong <SnipersMark>(enemy, AttackDelay() * 1.1f); } break; } return(damage); }
public void Init(StateManager st) { states = st; quickSlotManager = QuickSlot.Instance; LoadLists(); ClearReferences(); LoadInventory(); ParryCollider parryCol = parryCollider.GetComponent <ParryCollider>(); parryCol.InitPlayer(st); CloseParryCollider(); CloseBreathCollider(); CloseBlockCollider(); }
private void Start() { tr = this.transform; slot = GetComponent <QuickSlot>(); slotImage = GetComponent <QuickSlotImage>(); pickup = tr.parent.GetComponent <PickUp>(); if (pickup == null) { pickup = tr.parent.gameObject.AddComponent <PickUp>(); } equipment = tr.parent.GetComponent <Equipment>(); if (equipment == null) { equipment = tr.parent.gameObject.AddComponent <Equipment>(); } }
private void MoveQuickSlot(GameSession session, PacketReader packet) { short hotbarId = packet.ReadShort(); if (!session.Player.GameOptions.TryGetHotbar(hotbarId, out Hotbar targetHotbar)) { Logger.Warning($"Invalid hotbar id {hotbarId}"); return; } // Adds or moves a quickslot around QuickSlot quickSlot = packet.Read <QuickSlot>(); int targetSlot = packet.ReadInt(); targetHotbar.MoveQuickSlot(targetSlot, quickSlot); session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions)); }
public bool AddToFirstSlot(QuickSlot quickSlot) { if (Slots.Contains(quickSlot)) { return(false); } for (int i = 0; i < MAX_SLOTS; i++) { if (Slots[i].ItemId != 0 || Slots[i].SkillId != 0) { continue; } Slots[i] = quickSlot; return(true); } return(false); }
private static void AddToQuickSlot(GameSession session, PacketReader packet) { short hotbarId = packet.ReadShort(); if (!session.Player.GameOptions.TryGetHotbar(hotbarId, out Hotbar targetHotbar)) { Logger.Warning("Invalid hotbar id {hotbarId}", hotbarId); return; } QuickSlot quickSlot = packet.Read <QuickSlot>(); int targetSlot = packet.ReadInt(); if (targetHotbar.AddToFirstSlot(quickSlot)) { session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions)); } }
public Hotbar(long gameOptionsId, Job job) { Slots = new QuickSlot[MaxSlots]; for (int i = 0; i < MaxSlots; i++) { Slots[i] = new(); } AddDefaultSkills(); Id = DatabaseManager.Hotbars.Insert(this, gameOptionsId); void AddDefaultSkills() { JobMetadata jobMetadata = JobMetadataStorage.GetJobMetadata(job); if (jobMetadata is null) { return; } List <int> skillIds = new(); jobMetadata.LearnedSkills.ForEach(x => skillIds.AddRange(x.SkillIds)); List <(int skillId, byte slotPriority)> hotbarSkills = new(); foreach (int skillId in skillIds) { JobSkillMetadata jobSkillMetadata = jobMetadata.Skills.First(x => x.SkillId == skillId); if (jobSkillMetadata.QuickSlotPriority != 99 && jobSkillMetadata.SubJobCode == 0) { hotbarSkills.Add((skillId, jobSkillMetadata.QuickSlotPriority)); } } foreach ((int skillId, byte _) in hotbarSkills.OrderBy(x => x.slotPriority)) { AddToFirstSlot(QuickSlot.From(skillId)); } } }
public virtual bool Collect(Bag container) { var items = container.Items; if (items.Contains(this)) { return(true); } foreach (var item in items.Where(item => item is Bag && ((Bag)item).Grab(this))) { return(Collect((Bag)item)); } if (Stackable) { var c = GetType(); foreach (var item in items.Where(item => item.GetType() == c)) { item.quantity += quantity; item.UpdateQuickslot(); return(true); } } if (items.Count < container.Size) { if (Dungeon.Hero != null && Dungeon.Hero.IsAlive) { Badge.ValidateItemLevelAquired(this); } items.Add(this); QuickSlot.Refresh(); items.Sort(); return(true); } GLog.Negative(TxtPackFull, Name); return(false); }
public QuickSlot[] GetQuickSlotByCharacterId(int characterId) { DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETCHARACTERQUICKSLOT_CHARACTERID_PARAMETER, characterId); characterIdParameter.DbType = DbType.Int32; _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETCHARACTERQUICKSLOT_STOREDPROC, CommandType.StoredProcedure, characterIdParameter); int ordinalQuickslot_slot1 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT1); int ordinalQuickslot_slot2 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT2); int ordinalQuickslot_slot3 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT3); int ordinalQuickslot_slot4 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT4); int ordinalQuickslot_slot5 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT5); int ordinalQuickslot_slot6 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT6); int ordinalQuickslot_slot7 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT7); int ordinalQuickslot_slot8 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT8); int ordinalQuickslot_slot9 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT9); int ordinalQuickslot_slot10 = reader.GetOrdinal(DbNames.QUICKSLOT_SLOT10); QuickSlot[] slots = new QuickSlot[10]; while (reader.Read()) { slots[0] = new QuickSlot(1, reader.GetInt32(ordinalQuickslot_slot1)); slots[1] = new QuickSlot(2, reader.GetInt32(ordinalQuickslot_slot2)); slots[2] = new QuickSlot(3, reader.GetInt32(ordinalQuickslot_slot3)); slots[3] = new QuickSlot(4, reader.GetInt32(ordinalQuickslot_slot4)); slots[4] = new QuickSlot(5, reader.GetInt32(ordinalQuickslot_slot5)); slots[5] = new QuickSlot(6, reader.GetInt32(ordinalQuickslot_slot6)); slots[6] = new QuickSlot(7, reader.GetInt32(ordinalQuickslot_slot7)); slots[7] = new QuickSlot(8, reader.GetInt32(ordinalQuickslot_slot8)); slots[8] = new QuickSlot(9, reader.GetInt32(ordinalQuickslot_slot9)); slots[9] = new QuickSlot(10, reader.GetInt32(ordinalQuickslot_slot10)); } reader.Close(); _db.Close(); return(slots); }
static void QuickSlot_Activate_Post(QuickSlot __instance) { #region quit if (!_assingByUsingFreeQuickslot || __instance.ActiveItem != null) { return; } #endregion Character character = __instance.OwnerCharacter; EquipmentSlot[] slots = character.Inventory.Equipment.EquipmentSlots; foreach (var slotID in new[] { EquipmentSlot.EquipmentSlotIDs.RightHand, EquipmentSlot.EquipmentSlotIDs.LeftHand }) { if (slots[(int)slotID].EquippedItem.TryAssign(out var item) && !HasItemAssignedToAnyQuickslot(character, item)) { __instance.SetQuickSlot(item); break; } } }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self session.EnterField(session.Player.MapId); session.Send(StatPacket.SetStats(session.FieldPlayer)); session.Send(StatPointPacket.WriteTotalStatPoints(session.Player)); foreach (MasteryExp mastery in session.Player.Levels.MasteryExp) { session.Send(MasteryPacket.SetExp(mastery.Type, mastery.CurrentExp)); } if (session.Player.IsVip()) { session.Send(PremiumClubPacket.ActivatePremium(session.FieldPlayer, session.Player.VIPExpiration)); } session.Send(EmotePacket.LoadEmotes(session.Player)); session.Send(ChatStickerPacket.LoadChatSticker(session.Player)); session.Send(ResponseCubePacket.LoadHome(session.FieldPlayer)); // Normally skill layout would be loaded from a database QuickSlot arrowStream = QuickSlot.From(10500001); QuickSlot arrowBarrage = QuickSlot.From(10500011); QuickSlot eagleGlide = QuickSlot.From(10500151); QuickSlot testSkill = QuickSlot.From(10500153); if (session.Player.GameOptions.TryGetHotbar(0, out Hotbar mainHotbar)) { /* * mainHotbar.MoveQuickSlot(4, arrowStream); * mainHotbar.MoveQuickSlot(5, arrowBarrage); * mainHotbar.MoveQuickSlot(6, eagleGlide); * mainHotbar.MoveQuickSlot(7, testSkill); */ session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions)); } session.Send(GameEventPacket.Load()); }
public override void Handle(GameSession session, PacketReader packet) { packet.ReadInt(); // ? // Liftable: 00 00 00 00 00 // SendBreakable // Self session.EnterField(session.Player.MapId); session.Send(FieldObjectPacket.SetStats(session.FieldPlayer)); session.Send(EmotePacket.LoadEmotes()); // Normally skill layout would be loaded from a database QuickSlot arrowStream = QuickSlot.From(10500001); QuickSlot arrowBarrage = QuickSlot.From(10500011); QuickSlot eagleGlide = QuickSlot.From(10500151); QuickSlot testSkill = QuickSlot.From(10500153); if (session.Player.GameOptions.TryGetHotbar(0, out Hotbar mainHotbar)) { /* * mainHotbar.MoveQuickSlot(4, arrowStream); * mainHotbar.MoveQuickSlot(5, arrowBarrage); * mainHotbar.MoveQuickSlot(6, eagleGlide); * mainHotbar.MoveQuickSlot(7, testSkill); */ session.Send(KeyTablePacket.SendHotbars(session.Player.GameOptions)); } // Add catalysts for testing /* * int[] catalysts = { 40100001, 40100002, 40100003, 40100021, 40100023, 40100024, 40100026 }; * foreach (int catalyst in catalysts) { * var item = new Item(catalyst) { Amount = 99999, Uid = catalyst }; * session.Inventory.Add(item); * session.Send(ItemInventoryPacket.Add(item)); * } */ }