コード例 #1
0
    //"Instantiate" a new craftable of the correct type using a passed in key
    Craftable CreateFromKey(int[] key)
    {
        bool      found        = false;
        int       realLocation = RealLocation(craftCatalog.template.KeyToLocation(key));
        Craftable newCraftable = new Craftable();

        if (craftCatalog.allCraftables[realLocation].aspectKey[0] == 0)
        {
            newCraftable = new Familiar(craftCatalog.allCraftables[realLocation]);
            found        = true;
        }
        if (craftCatalog.allCraftables[realLocation].aspectKey[0] == 1 && !found)
        {
            newCraftable = new Spell(craftCatalog.allCraftables[realLocation]);
            found        = true;
        }
        if (craftCatalog.allCraftables[realLocation].aspectKey[0] == 2 && !found)
        {
            newCraftable = new Talisman(craftCatalog.allCraftables[realLocation]);
            found        = true;
        }
        if (!found)
        {
            Debug.LogError("Create New Craftable failed to find with provided key.");
        }
        return(newCraftable);
    }
コード例 #2
0
ファイル: TalismanButton.cs プロジェクト: Kinderril/p3
    public void Init(TalismanItem talic, int countTalismans,Level level)
    {
        this.TalismanItem = talic;
        talicLogic = Talisman.Creat(TalismanItem, countTalismans, level);
        talicLogic.OnReady += OnReady;
        RadialImage.type = Image.Type.Filled;

        gameObject.SetActive(true);
        icon.sprite = talic.IconSprite;
        OnReady(false, 0,0);
    }
コード例 #3
0
 public void Init(TalismanItem talic, int countTalismans)
 {
     this.TalismanItem = talic;
     talicLogic = Talisman.Creat(TalismanItem, countTalismans);
     talicLogic.OnReady += OnReady;
     gameObject.SetActive(true);
     var spr = DataBaseController.Instance.TalismanIcon(talic.TalismanType);
       //  Debug.Log("Talisman inited " + talic.TalismanType + "   " + icon.gameObject.name);
     icon.sprite = spr;
     OnReady(false, 0);
 }
コード例 #4
0
        private static List <byte> SerializeTalisman(Talisman talisman)
        {
            var result = new List <byte>();

            if (talisman.Slot3 != SlotType.None)
            {
                result.Add((byte)talisman.Slot3);
                result.Add(Slot3Signal);
            }

            if (talisman.Slot2 != SlotType.None)
            {
                result.Add((byte)talisman.Slot2);
                result.Add(Slot2Signal);
            }

            if (talisman.Slot1 != SlotType.None)
            {
                result.Add((byte)talisman.Slot1);
                result.Add(Slot1Signal);
            }

            if (talisman.Slot1 == SlotType.None && talisman.Slot2 == SlotType.None && talisman.Slot3 == SlotType.None)
            {
                result.Add(NoSlotsSignal);
            }
            else
            {
                result.Add((byte)result.Count);
            }

            result.Add(SlotDataSignal);

            if (talisman.Skill2.Points != null)
            {
                result.AddRange(SerializeSkill(talisman.Skill2));
            }

            result.AddRange(SerializeSkill(talisman.Skill1));

            result.Add((byte)result.Count);
            result.Add(SeparatorSignal);

            result.Reverse();

            return(result);
        }
コード例 #5
0
        public Talisman GetTalisman(byte SlotId)
        {
            if (CharSaveInfo == null)
            {
                return(null);
            }

            Talisman tal = null;

            foreach (Talisman tali in CharSaveInfo._Talismans)
            {
                if (tali.Slot == SlotId && (tal == null || tali.Fused == 1))
                {
                    tal = tali;
                }
            }

            return(tal);
        }
コード例 #6
0
 void Start()
 {
     Talisman = FindObjectOfType <Talisman>();
     StartCoroutine(IncreaseEnergy());
 }
コード例 #7
0
        public static void Execute()
        {
            if (Player.Instance.IsInShopRange() || Player.Instance.CountAlliesInRange(Misc.RangeEnemy) < Misc.EnemyCount ||
                Activator.lastUsed >= Environment.TickCount)
            {
                return;
            }

            #region Self

            if (Zhonyas.IsReady() && Zhonyas.IsOwned() && Player.Instance.InDanger(Settings.ZhonyasMyHp) &&
                Settings.Zhonyas)
            {
                Zhonyas.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Seraph.IsReady() && Seraph.IsOwned() && Player.Instance.InDanger(Settings.MYHPSeraph) &&
                Settings.UseSeraph)
            {
                Seraph.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Talisman.IsReady() && Player.Instance.CountAlliesInRange(450) >= 2 && Talisman.IsOwned() &&
                Player.Instance.InDanger(30))
            {
                Talisman.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Randuin.IsReady() && Player.Instance.CountEnemiesInRange(Randuin.Range) >= 2 && Randuin.IsOwned() &&
                Player.Instance.InDanger(30))
            {
                Randuin.Cast();
                Activator.lastUsed = Environment.TickCount + 500;
            }
            //Allies
            if (FaceOfTheMountain.IsReady() && FaceOfTheMountain.IsOwned())
            {
                var allyFace = EntityManager.Heroes.Allies.FirstOrDefault(a => a.InDanger(Settings.AllyHPFaceOfTheMountain));
                if (allyFace != null)
                {
                    FaceOfTheMountain.Cast(allyFace);
                    Activator.lastUsed = Environment.TickCount + 500;
                }
            }

            if (Mikael.IsReady() && Player.Instance.HasCCs() && Mikael.IsOwned())
            {
                var allyMikael = EntityManager.Heroes.Allies.FirstOrDefault(a => a.InDanger(Settings.AllyHPMikaelHeal));
                if (allyMikael != null)
                {
                    Mikael.Cast(allyMikael);
                    Activator.lastUsed = Environment.TickCount + 500;
                }
            }

            if (Solari.IsReady() && Solari.IsOwned())
            {
                var allySolari = EntityManager.Heroes.Allies.FirstOrDefault(a => a.InDanger(Settings.AllyHealthSolari));
                if (allySolari != null)
                {
                    Solari.Cast();
                    Activator.lastUsed = Environment.TickCount + 1500;
                }
            }

            if (Ohm.IsReady() && Ohm.IsOwned())
            {
                var turret   = EntityManager.Turrets.Enemies.FirstOrDefault(t => t.IsAttackingPlayer);
                var allyFace = EntityManager.Heroes.Allies.FirstOrDefault(a => a.InDanger(Settings.OhmHealth));
                if (allyFace != null && turret != null)
                {
                    Ohm.Cast(turret);
                    Activator.lastUsed = Environment.TickCount + 500;
                }
            }

            //CC

            if (DerbishBlade.IsReady() && DerbishBlade.IsOwned() && Settings.DerbishBlade && Player.Instance.HasCCs())
            {
                Core.DelayAction(() => DerbishBlade.Cast(), Settings.CleanseDelay);
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Mercurial.IsReady() && Mercurial.IsOwned() && Settings.Mercurial && Player.Instance.HasCCs())
            {
                Core.DelayAction(() => Mercurial.Cast(), Settings.CleanseDelay);
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (QuickSilver.IsReady() && QuickSilver.IsOwned() && Settings.QuickSilver && Player.Instance.HasCCs())
            {
                Core.DelayAction(() => QuickSilver.Cast(), Settings.CleanseDelay);
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            var ally = EntityManager.Heroes.Allies.FirstOrDefault(a => a.IsValidTarget(Mikael.Range));
            if (ally == null)
            {
                return;
            }
            if (!ally.HasCCs())
            {
                return;
            }

            if (Mikael.IsReady() && Mikael.IsOwned() && Settings.MikaelCleanse)
            {
                Core.DelayAction(() => Mikael.Cast(ally), Settings.CleanseDelay);
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            #endregion Self
        }
コード例 #8
0
ファイル: Controller.cs プロジェクト: SairiMilla/Innergy
    void Update()
    {
        healthSlider.value = health;
        move = Input.GetAxis("Horizontal");
        anim.SetFloat("Speed", Mathf.Abs(move));
        curTalisman = habilities[selectedTalisman];
        levelTag.text = "level " + curTalisman.level;
        talismanSimbol.sprite = curTalisman.simbol;
        experienceSlider.value = curTalisman.energy;
        if (curTalisman.level != 1)
            experienceSlider.minValue = curTalisman.energytresholds[curTalisman.level - 2];
        else
            experienceSlider.minValue = 0;

        experienceSlider.maxValue = curTalisman.energytresholds[curTalisman.level - 1];
        if (!dashing)
        {
            if (Input.GetButton("Run"))
            {
                GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxSpeed * 1.7f, GetComponent<Rigidbody2D>().velocity.y);
            }
            else
            {
                GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxSpeed, GetComponent<Rigidbody2D>().velocity.y);
            }

            if (move > 0 && !facingRight)
                Flip();
            else if (move < 0 && facingRight)
                Flip();
        }
        if (Input.GetButtonDown("Jump") && (grounded))
        {
            grounded = false;
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, GetComponent<Rigidbody2D>().velocity.y + jumpforce);

        }
        if (Input.GetButton("Jump") && GetComponent<Rigidbody2D>().velocity.y > 0 && !(grounded))
        {
            grounded = false;
            extraspeed -= Time.deltaTime * 50;
            jumpforce += Time.deltaTime * extraspeed;
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, jumpforce);

        }

        if (!grounded && !Input.GetButton("Jump"))
            jumpforce = 0f;

        if (Input.GetButtonDown("SwitchUp")) {
            if (selectedTalisman != 3)
                selectedTalisman++;
            else
                selectedTalisman = 0;
        }

        if (Input.GetButtonDown("SwitchDown"))
        {
            if (selectedTalisman != 0)
                selectedTalisman--;
            else
                selectedTalisman = 3;
        }

        if (Input.GetButtonDown("Action")) {
            if (selectedTalisman != 0)
                curTalisman.activate();
        }

        if (Input.GetButton("Action")) {
            if (selectedTalisman == 2)
            {
                curTalisman.activate();
            }
        }
    }
コード例 #9
0
ファイル: Defensive.cs プロジェクト: Rafiters25/Schzneger-
        public static void Execute()
        {
            var target =
                EntityManager.Heroes.Enemies.FirstOrDefault(e => !e.IsDead && e.IsInRange(Player.Instance, 1500));

            if (Player.Instance.IsInShopRange() || target == null || DamageHandler.LastItemCast > Environment.TickCount)
            {
                return;
            }

            #region Self

            if (Zhonyas.IsReady() && Player.Instance.InDanger() && Zhonyas.IsOwned())
            {
                Zhonyas.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (ArchengelStaff.IsReady() && Player.Instance.InDanger() && ArchengelStaff.IsOwned())
            {
                ArchengelStaff.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (FaceOfTheMountain.IsReady() && Player.Instance.InDanger() && FaceOfTheMountain.IsOwned())
            {
                FaceOfTheMountain.Cast(Player.Instance);
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (Talisman.IsReady() && Player.Instance.CountAlliesInRange(450) >= 2 ||
                Player.Instance.InDanger() && FaceOfTheMountain.IsOwned())
            {
                FaceOfTheMountain.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (Mikael.IsReady() && Player.Instance.InDanger() || Player.Instance.HasCC() && Mikael.IsOwned())
            {
                Mikael.Cast(Player.Instance);
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (Solari.IsReady() && Player.Instance.InDanger() && Solari.IsOwned())
            {
                Solari.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (Ohm.IsReady() && Ohm.IsOwned())
            {
                var turret = EntityManager.Turrets.Enemies.FirstOrDefault(t => t.IsAttackingPlayer);
                if (turret != null)
                {
                    Ohm.Cast(turret);
                    DamageHandler.LastItemCast = Environment.TickCount + 450;
                }
            }

            if (Randuin.IsReady() && Player.Instance.CountEnemiesInRange(Randuin.Range) >= 2 && Randuin.IsOwned())
            {
                Randuin.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            //CC

            if (!Player.Instance.HasCC())
            {
                return;
            }

            if (DerbishBlade.IsReady() && DerbishBlade.IsOwned())
            {
                DerbishBlade.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (Mercurial.IsReady() && Mercurial.IsOwned())
            {
                Mercurial.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            if (QuickSilver.IsReady() && QuickSilver.IsOwned())
            {
                QuickSilver.Cast();
                DamageHandler.LastItemCast = Environment.TickCount + 450;
            }

            #endregion Self

            #region Ally

            if (DamageHandler.LastItemCast < Environment.TickCount)
            {
                if (FaceOfTheMountain.IsReady() && FaceOfTheMountain.IsOwned())
                {
                    foreach (
                        var ally in
                        EntityManager.Heroes.Allies.Where(
                            a => DamageHandler.Damages.ContainsKey(a.NetworkId) && a.InDanger()))
                    {
                        FaceOfTheMountain.Cast(ally);
                        DamageHandler.LastItemCast = Environment.TickCount + 450;
                    }
                }
            }

            if (Talisman.IsReady() && Player.Instance.CountAlliesInRange(450) >= 2 ||
                Player.Instance.InDanger() && FaceOfTheMountain.IsOwned())
            {
                foreach (
                    var ally in
                    EntityManager.Heroes.Allies.Where(
                        a => DamageHandler.Damages.ContainsKey(a.NetworkId) && a.InDanger()))
                {
                    FaceOfTheMountain.Cast(ally);
                    DamageHandler.LastItemCast = Environment.TickCount + 450;
                }
            }

            if (Mikael.IsReady() && Player.Instance.InDanger() || Player.Instance.HasCC() && Mikael.IsOwned())
            {
                foreach (
                    var ally in
                    EntityManager.Heroes.Allies.Where(
                        a => DamageHandler.Damages.ContainsKey(a.NetworkId) && a.InDanger()))
                {
                    Mikael.Cast(ally);
                    DamageHandler.LastItemCast = Environment.TickCount + 450;
                }
            }

            if (Solari.IsReady() && Player.Instance.InDanger() && Solari.IsOwned())
            {
                foreach (
                    var ally in
                    EntityManager.Heroes.Allies.Where(
                        a => DamageHandler.Damages.ContainsKey(a.NetworkId) && a.InDanger()))
                {
                    Solari.Cast(ally);
                    DamageHandler.LastItemCast = Environment.TickCount + 450;
                }
            }

            if (Ohm.IsReady() && Ohm.IsOwned())
            {
                foreach (var objAiTurret in EntityManager.Turrets.AllTurrets)
                {
                    if (DamageHandler.LastTargetTurrets.ContainsKey(objAiTurret.NetworkId))
                    {
                        var turrettarget = DamageHandler.LastTargetTurrets[objAiTurret.NetworkId];
                        if (!turrettarget.IsValidTarget() || !turrettarget.IsAlly)
                        {
                            continue;
                        }
                        Ohm.Cast();
                        DamageHandler.LastItemCast = Environment.TickCount + 450;
                    }
                }
            }
        }
コード例 #10
0
        // Writes approximately: (100 + info._Stats.Count * 8 + info.EffectsList.Count * 6 + info.SpellId > 0 ? 8 : 1 + info.Type == 23 ? info.Crafts.Count * 3 : 1 + info.Description.Length + info.TalismanSlots * 47)
        public static void BuildItem(ref PacketOut Out, Item itm, Item_Info info, MailItem mail, ushort SlotId, ushort Count, Player Plr = null, bool frombuildrepairitem = false)
        {
            SlotId = SlotId == 0 ? (itm?.SlotId ?? SlotId) : SlotId;
            Count  = Count == 0 ? (itm?.Count ?? Count) : Count;
            info   = info ?? itm?.Info;
            bool lootbag = false;



            if (mail != null)
            {
                info = ItemService.GetItem_Info(mail.id);
            }

            if (SlotId != 0 && !frombuildrepairitem)
            {
                Out.WriteUInt16(SlotId);
            }

            if (info != null && info.Entry >= 2500000 && info.Entry < 2600000)
            {
                BuildRepairableItem(ref Out, itm, info, mail, SlotId, Count, Plr);
                return;
            }
            if (!frombuildrepairitem)
            {
                Out.WriteByte(0); // repairable item
            }
            Out.WriteUInt32(info?.Entry ?? 0);

            if (info == null)
            {
                return;
            }

            //if (info.Bind == 1 || (info.Bind == 2 && itm != null && itm.BoundtoPlayer))
            //    Out.WriteUInt32(info.Entry << 2);
            //else
            //    Out.WriteUInt32(info.Entry);

            if (info.Entry == 9980 || info.Entry == 9940 || info.Entry == 9941 || info.Entry == 9942 || info.Entry == 9943)      // lootbags
            {
                lootbag = true;
            }


            Out.WriteUInt16((ushort)info.ModelId);      // Valid 1.4.8

            //Appearance
            if (itm != null && itm.AltAppearanceEntry > 0 && itm.Info.Type != 24)
            {
                Item_Info tmp = ItemService.GetItem_Info(itm.AltAppearanceEntry);

                if (tmp == null)
                {
                    itm.AltAppearanceEntry = 0;
                    Out.Fill(0, 7);
                }
                else
                {
                    Out.WriteUInt16((ushort)tmp.ModelId);    // DisplayId
                    Out.WriteUInt32(itm.AltAppearanceEntry); // Id
                    Out.WritePascalString(tmp.Name);         //name
                }
            }
            else
            {
                Out.Fill(0, 7);
            }

            Out.WriteUInt16(info.SlotId);      // Valid 1.4.8
            Out.WriteByte(info.Type);          // Valid 1.4.8

            Out.WriteByte(info.MinRank);       // Min Level
            Out.WriteByte(info.ObjectLevel);   // 1.3.5, Object Level
            Out.WriteByte(info.MinRenown);     // 1.3.5, Min Renown
            Out.WriteByte(info.MinRenown);     // ?
            Out.WriteByte(info.UniqueEquiped); // Unique - Equiped

            Out.WriteByte(info.Rarity);
            Out.WriteByte(info.Bind);      // This byte should be part of race byte
            Out.WriteByte(info.Race);


            // Trophys have some extra bytes
            if (info.Type == (byte)ItemTypes.ITEMTYPES_TROPHY)
            {
                Out.WriteUInt32(0);
                Out.WriteUInt16(0x00);
            }

            if (info.Type == (byte)ItemTypes.ITEMTYPES_ENHANCEMENT)
            {
                Out.WriteUInt32(0);
            }

            if (SlotId != 0 && info.Type == 24)     // Trophy
            {
                Out.WriteUInt16(0);
                Out.WriteUInt16((ushort)itm.AltAppearanceEntry);
            }
            else
            {
                Out.WriteUInt32(info.Career);
            }


            Out.WriteUInt16(info.BaseColor1);      // basecolor
            Out.WriteUInt16(info.BaseColor2);


            Out.WriteUInt32(info.SellPrice);

            Out.WriteUInt16(info.MaxStack);

            if (mail != null)
            {
                Out.WriteUInt16((ushort)(mail.count > 0 ? mail.count : 1));
            }
            else
            {
                Out.WriteUInt16((ushort)(Count > 0 ? Count : 1));
            }

            Out.WriteUInt32(info.ItemSet);

            Out.WriteUInt32(info.Skills);                          // Valid 1.4.8
            Out.WriteUInt16(info.Dps > 0 ? info.Dps : info.Armor); // Valid 1.4.8
            Out.WriteUInt16(info.Speed);                           // Valid 1.4.8

            Out.WritePascalString(info.Name);                      // Valid 1.4.8  + (info.Bind == 1 || (info.Bind == 2 && itm != null && itm.BoundtoPlayer) ? "_" : "" )

            //66 Bytes + info.Name.Length

            Out.WriteByte((byte)info._Stats.Count);      // Valid 1.4.8
            foreach (KeyValuePair <byte, ushort> Key in info._Stats)
            {
                if (Key.Key == (byte)Stats.AutoAttackSpeed)
                {
                    Out.WriteByte(Key.Key);
                    Out.WriteUInt16(Key.Value);
                    Out.Fill(1, 5);
                }
                else
                {
                    Out.WriteByte(Key.Key);
                    Out.WriteUInt16(Key.Value);
                    Out.Fill(0, 5);
                }
            }

            Out.WriteByte((byte)info.EffectsList.Count);
            foreach (ushort effect in info.EffectsList)
            {
                Out.WriteUInt16(effect);
                Out.WriteUInt32(0);
            }

            if (info.SpellId == 0)
            {
                Out.WriteByte(0);
            }
            else
            {
                Out.WriteByte(1);     // (byte)info._Spells.Count OK

                Out.WriteUInt32(info.SpellId);
                Out.WriteUInt16(AbilityMgr.GetCooldownFor(info.SpellId));       // cooldown time info

                if (Plr == null || itm?.CharSaveInfo == null)
                {
                    Out.WriteUInt16(0);       // current cooldown
                }
                else
                {
                    Out.WriteUInt16(itm.CharSaveInfo.RemainingCooldown);
                }
            }

            // (uint32)entry, uint16 X, uint16 Y

            if (info.Type == 23)       // talisman use craft to store its buff type
            {
                Out.WriteByte(0);
            }
            else
            {
                Out.WriteByte((byte)info._Crafts.Count);     // OK
                foreach (KeyValuePair <byte, ushort> Kp in info._Crafts)
                {
                    Out.WriteByte(Kp.Key);
                    Out.WriteUInt16(Kp.Value);
                }
            }
            Out.WriteByte(0);     // ??

            if (lootbag)
            {
                Out.WriteByte(0);
            }
            else
            {
                Out.WriteByte(info.TalismanSlots);
                Talisman talis = null;
                for (int i = 0; i < info.TalismanSlots; ++i)
                {
                    if (itm != null)
                    {
                        talis = itm.GetTalisman((byte)i);
                    }
                    else if (mail != null)
                    {
                        talis = mail.GetTalisman((byte)i);
                    }

                    if (talis == null)
                    {
                        Out.WriteUInt32(0);     // entry;
                    }
                    else
                    {
                        Item_Info talismanInfo = ItemService.GetItem_Info(talis.Entry);

                        // Out.Fill(0, 2);

                        Out.WriteByte(0);     // slot ???
                        Out.WriteByte(0);
                        Out.WriteUInt16((ushort)talismanInfo.ModelId);
                        Out.WriteByte(talis.Fused);     // 0 fused 1 unfused
                        Out.WriteByte(0);
                        Out.WritePascalString(talismanInfo.Name);
                        Out.WriteByte((byte)talismanInfo._Stats.Count);     // Valid 1.4.8
                        foreach (KeyValuePair <byte, ushort> Key in talismanInfo._Stats)
                        {
                            Out.WriteByte(Key.Key);
                            Out.WriteUInt16(Key.Value);
                            Out.WriteUInt32(talis.Timer);
                            Out.WriteByte(0);
                            //  Out.Fill(0, 5);
                        }
                        Out.WriteByte((byte)talismanInfo.EffectsList.Count);
                        foreach (ushort effect in talismanInfo.EffectsList)
                        {
                            Out.WriteUInt16(effect);
                            Out.WriteUInt32(0);
                        }
                        //if (talismanInfo.SpellId == 0)
                        //    Out.WriteByte(0);
                        //else
                        //{
                        //    Out.WriteByte(1); // (byte)talismanInfo._Spells.Count

                        //    Out.WriteUInt16(talismanInfo.SpellId);
                        //    Out.WriteUInt32(AbilityMgr.GetCooldownFor(talismanInfo.SpellId));
                        //}
                        Out.Fill(0, 3);
                        Out.WriteUInt16(0x041C);
                    }
                }
            }

            Out.WritePascalString(info.Description);

            // Note from wash : this algorithm updates shared

            byte[] Unks = info.Unk27;

            //if (info.Bind == 1 && (itm == null || !itm.BoundtoPlayer))
            //    Unks[5] = (byte)(4);  // bind on pickup, if set to true for one item, all items with have this flag active client side
            //else if (info.Bind == 2 && (itm == null || !itm.BoundtoPlayer)) //
            //    Unks[5] = (byte)(8);   // bind on equip, if set to true for one item, all items with have this flag active client side
            //else
            //    Unks[5] = 0;

            //Unks[5] = 8;

            if (info.DyeAble)
            {
                Unks[6] = (byte)(Unks[6] | 1);     // dyeable
            }
            if (info.Salvageable)
            {
                Unks[6] = (byte)(Unks[6] | 2);     // scavangable
            }
            // Prevents sale
            //   Unks[6] = (byte) (Unks[6] | 32);
            // Allow Conversion text (Ctrl+Right Click)
            //   Unks[6] = (byte) (Unks[6] | 128);


            //if (itm != null && itm.BoundtoPlayer) // info.Bind == 1
            //    Unks[8] = (byte)(1); // bound to player, if set to true for one item, all items with have this flag active client side
            //else
            //    Unks[8] = (byte)(0);


            Out.WriteByte(Unks[0]);     // londo : wut ?
            Out.WriteByte(Unks[1]);     // londo : getUnk7
            Out.WriteByte(Unks[2]);     // londo : getUnk8
            Out.WriteByte(Unks[3]);     // londo : getNoChargeLeftDontDelete
            Out.WriteByte(Unks[4]);     // londo : flag count

            if (info.Bind == 1 && (itm == null || !itm.BoundtoPlayer))
            {
                Out.WriteByte(4);                                           // bind on pickup, if set to true for one item, all items with have this flag active client side
            }
            else if (info.Bind == 2 && (itm == null || !itm.BoundtoPlayer)) //
            {
                Out.WriteByte(8);                                           // bind on equip, if set to true for one item, all items with have this flag active client side
            }
            else
            {
                Out.WriteByte(0);
            }

            Out.WriteByte(Unks[6]);     // dyeable from londo (+ scavangable from RoR ?)
            Out.WriteByte(Unks[7]);     // 0 from londo

            if (info.Bind == 2 && itm != null && itm.BoundtoPlayer)
            {
                Out.WriteByte(1);
            }
            else
            {
                Out.WriteByte(0);
            }

            //Unks[19] = (byte)(Unks[19] | 5); // potion cd

            // 4 can crash the client if changed
            // 5: if 1, hides the crafting level requirement. if 2, shows it.
            // 7 with value of 8 can suppress the Item Level text
            //for (int i = 0; i < 9; i++) //9
            //{
            //    Out.WriteByte(Unks[i]);
            //}

            if (lootbag)
            {
                Out.WriteUInt16(0);
                Out.WriteUInt16(0);
            }
            else
            {
                if (mail != null)
                {
                    Out.WriteUInt16(mail.primary_dye);
                    Out.WriteUInt16(mail.secondary_dye);
                }
                else
                {
                    Out.WriteUInt16(itm?.GetPrimaryDye() ?? 0);
                    Out.WriteUInt16(itm?.GetSecondaryDye() ?? 0);
                }
            }

            // Overwrite Unks27 with the TwoHanded flag
            if (info.TwoHanded)
            {
                Unks[26] = (byte)(Unks[26] | 1);     // bitwise? oh well better to be safe.
            }
            if ((info.SlotId == 14 || info.SlotId == 27) && Plr?.GldInterface.Guild != null)
            {
                Out.Fill(0, 7);
                Out.WriteByte(1);     // 1, Out, 1, 2
                Plr.GldInterface.Guild.BuildHeraldry(Out);
                Out.WriteByte(1);
                Out.WriteByte(1);
                Out.Fill(0, 6);
            }
            else
            {
                // 14: Skill level
                // 15: Flags for Cultivating
                // 20: Crashes the client if nonzero... is set on the Fleet Stag Mantle
                // 21-24: Seconds until decayed
                // 26: two-handed flag
                for (int i = 13; i < /*21*/ 27; i++)
                {
                    Out.WriteByte(Unks[i]);
                }

                /*
                 * 21-26:
                 * Out.WriteUInt32(0); // Seconds until decayed. Set on the Stag Mantle but doesn't show, possible double meaning based on value 20
                 *
                 * Out.WriteByte(Unks[25]);
                 * Out.WriteByte(Unks[26]);
                 */
            }


            //Out.Write(Unks);

            /*Out.WriteByte(0);
             * Out.WriteByte(0);
             * Out.WriteByte(0);
             * Out.WriteByte(0);
             *
             * Out.WriteUInt16(0x0302);
             *
             * Out.Fill(0, 8);
             * Out.WriteByte(0); // Type , Culture, etc etc
             * Out.WriteByte(0); // Type, Recipian , Soil , etc etc
             * Out.Fill(0, 11);*/
        }
コード例 #11
0
        public static void Execute()
        {
            if (Player.Instance.IsInShopRange() || Player.Instance.CountAlliesInRange(Misc.RangeEnemy) < Misc.EnemyCount ||
                Activator.lastUsed >= Environment.TickCount)
            {
                return;
            }
            #region Self

            if (Zhonyas.IsReady() && Zhonyas.IsOwned() && Player.Instance.InDanger(Settings.ZhonyasMyHp) && Settings.Zhonyas)
            {
                Zhonyas.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (ArchengelStaff.IsReady() && ArchengelStaff.IsOwned() && Player.Instance.InDanger(Settings.MYHPArchengelStaff) && Settings.UseArchengelStaff)
            {
                ArchengelStaff.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (FaceOfTheMountain.IsReady() && FaceOfTheMountain.IsOwned() && Player.Instance.InDanger(30))
            {
                FaceOfTheMountain.Cast(Player.Instance);
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Talisman.IsReady() && Player.Instance.CountAlliesInRange(450) >= 2 && Talisman.IsOwned() &&
                Player.Instance.InDanger(30))
            {
                Talisman.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Mikael.IsReady() && Player.Instance.HasCC() && Mikael.IsOwned() && Player.Instance.InDanger(30))
            {
                Mikael.Cast(Player.Instance);
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Solari.IsReady() && Solari.IsOwned() && Player.Instance.InDanger(30))
            {
                Solari.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Ohm.IsReady() && Ohm.IsOwned() && Player.Instance.InDanger(30))
            {
                var turret = EntityManager.Turrets.Enemies.FirstOrDefault(t => t.IsAttackingPlayer);
                if (turret != null)
                {
                    Ohm.Cast(turret);
                    Activator.lastUsed = Environment.TickCount + 1500;
                }
            }

            if (Randuin.IsReady() && Player.Instance.CountEnemiesInRange(Randuin.Range) >= 2 && Randuin.IsOwned() &&
                Player.Instance.InDanger(30))
            {
                Randuin.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            //CC

            if (!Player.Instance.HasCC())
            {
                return;
            }

            if (DerbishBlade.IsReady() && DerbishBlade.IsOwned())
            {
                DerbishBlade.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (Mercurial.IsReady() && Mercurial.IsOwned())
            {
                Mercurial.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            if (QuickSilver.IsReady() && QuickSilver.IsOwned())
            {
                QuickSilver.Cast();
                Activator.lastUsed = Environment.TickCount + 1500;
            }

            #endregion Self
        }
コード例 #12
0
ファイル: Player.cs プロジェクト: Chupaflor/Cronkpit_Samples
        public void acquire_item(Item thing)
        {
            if (thing is Armor)
            {
                Armor acquired_armor = new Armor((Armor)thing);
                acquired_armor.set_ID_number(new_random_ID_number());
                inventory.Add(acquired_armor);
            }
            else if (thing is Weapon)
            {
                Weapon acquired_weapon = new Weapon((Weapon)thing);
                acquired_weapon.set_ID_number(new_random_ID_number());
                inventory.Add(acquired_weapon);
            }
            else if (thing is Scroll)
            {
                Scroll acquired_scroll = new Scroll((Scroll)thing);
                acquired_scroll.set_ID_number(new_random_ID_number());
                inventory.Add(acquired_scroll);
            }
            else if (thing is Talisman)
            {
                Talisman acquired_talisman = new Talisman((Talisman)thing);
                acquired_talisman.set_ID_number(new_random_ID_number());
                inventory.Add(acquired_talisman);
            }

            //inventory.Add(thing);
        }