public void tryPutStone(L2Player player, L2Item stone) { if (!supports.ContainsKey(stone.Template.ItemID)) { player.sendSystemMessage(2385);//This is an incorrect support enhancement spellbook. player.sendActionFailed(); return; } EnchantScroll dat = supports[stone.Template.ItemID]; bool next = false; switch (dat.Crystall) { case ItemTemplate.L2ItemGrade.d: next = player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.d; break; case ItemTemplate.L2ItemGrade.c: next = player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.c; break; case ItemTemplate.L2ItemGrade.b: next = player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.b; break; case ItemTemplate.L2ItemGrade.a: next = player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.a; break; case ItemTemplate.L2ItemGrade.s: next = player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s || player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s80 || player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s84 || player.EnchantItem.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s86; break; } if (next) { switch (dat.Target) { case EnchantTarget.weapon: next = player.EnchantItem.Template.Type == ItemTemplate.L2ItemType.weapon; break; case EnchantTarget.armor: next = player.EnchantItem.Template.Type == ItemTemplate.L2ItemType.armor || player.EnchantItem.Template.Type == ItemTemplate.L2ItemType.accessary; break; } } if (next) { byte min = 0, max = 0; switch (dat.Type) { case EnchantType.auxiliary: min = player.EnchantItem.Template.Bodypart == ItemTemplate.L2ItemBodypart.onepiece ? (byte)4 : (byte)3; max = 9; break; case EnchantType.ancient: max = 16; break; } next = player.EnchantItem.Enchant >= min && player.EnchantItem.Enchant <= max; } if (!next) { player.sendPacket(new ExPutEnchantSupportItemResult()); player.EnchantStone = null; player.sendSystemMessage(2386);//This item does not meet the requirements for the support enhancement spellbook. } else { player.EnchantStone = stone; player.sendPacket(new ExPutEnchantSupportItemResult(stone.ObjID)); } }
public void tryPutItem(L2Player player, L2Item item) { L2Item scroll = player.EnchantScroll; EnchantScroll dat = items[scroll.Template.ItemID]; bool next = false; switch (dat.Crystall) { case ItemTemplate.L2ItemGrade.d: next = item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.d; break; case ItemTemplate.L2ItemGrade.c: next = item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.c; break; case ItemTemplate.L2ItemGrade.b: next = item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.b; break; case ItemTemplate.L2ItemGrade.a: next = item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.a; break; case ItemTemplate.L2ItemGrade.s: next = item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s || item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s80 || item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s84 || item.Template.CrystallGrade == ItemTemplate.L2ItemGrade.s86; break; } if (next) { switch (dat.Target) { case EnchantTarget.weapon: next = item.Template.Type == ItemTemplate.L2ItemType.weapon; break; case EnchantTarget.armor: next = item.Template.Type == ItemTemplate.L2ItemType.armor || item.Template.Type == ItemTemplate.L2ItemType.accessary; break; case EnchantTarget.yogi_staff: next = item.Template.ItemID == 13539; //Staff of Master Yogi break; } } if (!next) { player.sendPacket(new ExPutEnchantTargetItemResult()); player.EnchantScroll = null; player.EnchantState = 0; player.sendSystemMessage(424);//Does not fit strengthening conditions of the scroll. } else { player.EnchantState = STATE_ENCHANT_START; player.EnchantItem = item; player.sendPacket(new ExPutEnchantTargetItemResult(item.ObjID)); } }