Beispiel #1
0
        public static void UpgradeNpc(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Item.Rarity == -2)
            {
                player.SendChatMessageAsync("CANT_UPGRADE_DESTROYED_SP", SayColorType.Yellow);
                return;
            }

            if (e.Item.Item.EquipmentSlot != EquipmentType.Sp)
            {
                return;
            }

            if (e.Item.Upgrade >= 15)
            {
                return;
            }

            player.EmitEvent(new UpgradeSpecialistEvent()
            {
                Item       = e.Item,
                Protection = e.Type == UpgradePacketType.UpgradeSpNoProtection ? UpgradeProtection.None : UpgradeProtection.Protected,
                IsCommand  = false
            });
        }
Beispiel #2
0
        public static void UpgradeNpc(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Item.Upgrade >= Configuration.UpgradeItem.MaximumUpgrade)
            {
                return;
            }

            if (e.Item.Item.EquipmentSlot != EquipmentType.Armor && e.Item.Item.EquipmentSlot != EquipmentType.MainWeapon &&
                e.Item.Item.EquipmentSlot != EquipmentType.SecondaryWeapon)
            {
                return;
            }

            var             hasAmulet = FixedUpMode.None;
            ItemInstanceDto amulet    = player.Inventory.GetWeared(EquipmentType.Amulet);

            if (amulet?.Item.Effect == 793)
            {
                hasAmulet = FixedUpMode.HasAmulet;
            }

            player.EmitEvent(new UpgradeEquipmentEvent
            {
                Item       = e.Item,
                Mode       = e.Type == UpgradePacketType.UpgradeItemGoldScroll ? UpgradeMode.Reduced : UpgradeMode.Normal,
                Protection = e.Type == UpgradePacketType.UpgradeItem ? UpgradeProtection.None : UpgradeProtection.Protected,
                HasAmulet  = hasAmulet,
                IsCommand  = false
            });
        }
Beispiel #3
0
        public static void SumResistance(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Item == null)
            {
                return;
            }

            if (e.SecondItem == null)
            {
                return;
            }

            if (e.Item.Sum + e.SecondItem.Sum >= 6 || (e.SecondItem.Item.EquipmentSlot != EquipmentType.Gloves ||
                                                       e.Item.Item.EquipmentSlot != EquipmentType.Gloves) &&
                (e.Item.Item.EquipmentSlot != EquipmentType.Boots || e.SecondItem.Item.EquipmentSlot != EquipmentType.Boots))
            {
                return;
            }

            if (player.Character.Gold < Configuration.Summing.GoldPrice[e.Item.Sum + e.SecondItem.Sum])
            {
                return;
            }

            if (player.Inventory.GetItemQuantityById(Configuration.Summing.SandVnum) < Configuration.Summing.SandAmount[e.Item.Sum + e.SecondItem.Sum])
            {
                return;
            }

            player.EmitEvent(new SummingEvent
            {
                Item       = e.Item,
                SecondItem = e.SecondItem
            });
        }
Beispiel #4
0
        public static void RarifyNpc(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Item.Item.EquipmentSlot != EquipmentType.Armor && e.Item.Item.EquipmentSlot != EquipmentType.MainWeapon &&
                e.Item.Item.EquipmentSlot != EquipmentType.SecondaryWeapon)
            {
                return;
            }

            var mode       = RarifyMode.Normal;
            var protection = RarifyProtection.None;
            var amulet     = player.Inventory.GetItemFromSlotAndType((short)EquipmentType.Amulet, InventoryType.Wear);

            if (amulet != null)
            {
                switch (amulet.Item.Effect)
                {
                case 791:
                    protection = RarifyProtection.RedAmulet;
                    break;

                case 792:
                    protection = RarifyProtection.BlueAmulet;
                    break;

                case 794:
                    protection = RarifyProtection.HeroicAmulet;
                    break;

                case 795:
                    protection = RarifyProtection.RandomHeroicAmulet;
                    break;

                case 796:
                case 798:
                    if (e.Item.Item.IsHeroic)
                    {
                        mode       = RarifyMode.Success;
                        protection = RarifyProtection.RandomHeroicAmulet;
                    }

                    break;

                case 797:
                    mode       = RarifyMode.Reduce;
                    protection = RarifyProtection.RandomHeroicAmulet;
                    break;
                }
            }

            player.EmitEvent(new RarifyEvent
            {
                Item       = e.Item,
                Mode       = mode,
                Protection = protection,
                IsCommand  = false
            });

            player.SendPacketAsync(player.GenerateShopEndPacket(ShopEndPacketType.CloseWindow));
        }
Beispiel #5
0
        public void Handle(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Type != Type)
            {
                return;
            }

            _func.Invoke(player, e);
        }
        public void Execute(IPlayerEntity player, ItemUpgradeEvent @event)
        {
            if (!HandlersByUpgradeType.TryGetValue(@event.Type, out ItemUpgradeHandler handler))
            {
                return;
            }

            handler.Handle(player, @event);
        }
Beispiel #7
0
        public static void RarifyScroll(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Item.Item.EquipmentSlot != EquipmentType.Armor && e.Item.Item.EquipmentSlot != EquipmentType.MainWeapon &&
                e.Item.Item.EquipmentSlot != EquipmentType.SecondaryWeapon)
            {
                return;
            }

            player.EmitEvent(new RarifyEvent
            {
                Item       = e.Item,
                Mode       = RarifyMode.Normal,
                Protection = RarifyProtection.Scroll,
                IsCommand  = false
            });
        }
Beispiel #8
0
 public static void UpgradeItemProtected(IPlayerEntity player, ItemUpgradeEvent e)
 {
     UpgradeNpc(player, e);
 }
Beispiel #9
0
        public static void CellonItemNpc(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.CellonItem == null)
            {
                return;
            }
            if (e.SecondItem == null)
            {
                return;
            }

            if (e.CellonItem.Item.EffectValue > e.SecondItem.Item.MaxCellonLvl)
            {
                player.SendTopscreenMessage("CELLON_LEVEL_TOO_HIGH", MsgPacketType.White);
                player.GenerateShopEndPacket(ShopEndPacketType.CloseSubWindow);
                return;
            }

            // e.SecondItem.EquipmentOptions.Count
            int equipmentOptionsCount = 1;

            if (e.SecondItem.Item.MaxCellon <= equipmentOptionsCount)
            {
                player.SendTopscreenMessage("CELLON_FULL", MsgPacketType.White);
                player.GenerateShopEndPacket(ShopEndPacketType.CloseSubWindow);
                return;
            }

            int gold;

            switch (e.CellonItem.Item.EffectValue)
            {
            case 1:
                gold = 700;
                break;

            case 2:
                gold = 1400;
                break;

            case 3:
                gold = 3000;
                break;

            case 4:
                gold = 5000;
                break;

            case 5:
                gold = 10000;
                break;

            case 6:
                gold = 20000;
                break;

            case 7:
                gold = 32000;
                break;

            case 8:
                gold = 58000;
                break;

            case 9:
                gold = 95000;
                break;

            default:
                return;
            }

            if (player.Character.Gold < gold)
            {
                player.SendTopscreenMessage("NOT_ENOUGH_GOLD", MsgPacketType.White);
                player.GenerateShopEndPacket(ShopEndPacketType.CloseSubWindow);
                return;
            }

            player.EmitEvent(new CellonItemEvent
            {
                Jewelry    = e.SecondItem,
                Cellon     = e.CellonItem,
                GoldAmount = gold
            });
        }
Beispiel #10
0
 public static void UpgradeSpNoProtection(IPlayerEntity player, ItemUpgradeEvent e)
 {
     UpgradeNpc(player, e);
 }
Beispiel #11
0
        public static void PerfectSpCardNPC(IPlayerEntity player, ItemUpgradeEvent e)
        {
            if (e.Item.Rarity == -2)
            {
                player.SendChatMessageAsync("CANT_UPGRADE_DESTROYED_SP", SayColorType.Yellow);
                return;
            }

            if (e.Item.Item.EquipmentSlot != EquipmentType.Sp)
            {
                return;
            }

            short stonevnum;
            byte  upmode = 1;

            switch (e.Item.Item.Morph)
            {
            case 2:
                stonevnum = 2514;
                break;

            case 6:
                stonevnum = 2514;
                break;

            case 9:
                stonevnum = 2514;
                break;

            case 12:
                stonevnum = 2514;
                break;

            case 3:
                stonevnum = 2515;
                break;

            case 4:
                stonevnum = 2515;
                break;

            case 14:
                stonevnum = 2515;
                break;

            case 5:
                stonevnum = 2516;
                break;

            case 11:
                stonevnum = 2516;
                break;

            case 15:
                stonevnum = 2516;
                break;

            case 10:
                stonevnum = 2517;
                break;

            case 13:
                stonevnum = 2517;
                break;

            case 7:
                stonevnum = 2517;
                break;

            case 17:
                stonevnum = 2518;
                break;

            case 18:
                stonevnum = 2518;
                break;

            case 19:
                stonevnum = 2518;
                break;

            case 20:
                stonevnum = 2519;
                break;

            case 21:
                stonevnum = 2519;
                break;

            case 22:
                stonevnum = 2519;
                break;

            case 23:
                stonevnum = 2520;
                break;

            case 24:
                stonevnum = 2520;
                break;

            case 25:
                stonevnum = 2520;
                break;

            case 26:
                stonevnum = 2521;
                break;

            case 27:
                stonevnum = 2521;
                break;

            case 28:
                stonevnum = 2521;
                break;

            default:
                return;
            }

            if (e.Item.SpecialistUpgrade > 99)
            {
                return;
            }

            if (e.Item.SpStoneUpgrade > 80)
            {
                upmode = 5;
            }
            else if (e.Item.SpStoneUpgrade > 60)
            {
                upmode = 4;
            }
            else if (e.Item.SpStoneUpgrade > 40)
            {
                upmode = 3;
            }
            else if (e.Item.SpStoneUpgrade > 20)
            {
                upmode = 2;
            }

            if (e.Item.IsFixed)
            {
                return;
            }

            if (player.Character.Gold < Configuration.PerfectSp.GoldPrice[upmode - 1])
            {
                return;
            }

            if (player.Inventory.GetItemQuantityById(stonevnum) < Configuration.PerfectSp.GoldPrice[upmode - 1])
            {
                return;
            }

            player.EmitEvent(new PerfectSPCardEvent
            {
                SpCard    = e.Item,
                StoneVnum = stonevnum,
                UpMode    = upmode
            });
        }