public void SetRarityPoint() { if (this.Item.EquipmentSlot == (byte)EquipmentType.MainWeapon || this.Item.EquipmentSlot == (byte)EquipmentType.SecondaryWeapon) { int point = CharacterHelper.RarityPoint(this.Rare, (this.Item.IsHeroic ? (short)(95 + this.Item.LevelMinimum) : this.Item.LevelMinimum)); this.Concentrate = 0; this.HitRate = 0; this.DamageMinimum = 0; this.DamageMaximum = 0; for (int i = 0; i < point; i++) { int rndn = _random.Next(0, 3); if (rndn == 0) { this.Concentrate++; this.HitRate++; } else { this.DamageMinimum++; this.DamageMaximum++; } } } else if (this.Item.EquipmentSlot == (byte)EquipmentType.Armor) { int point = CharacterHelper.RarityPoint(this.Rare, this.Item.LevelMinimum); this.DefenceDodge = 0; this.DistanceDefenceDodge = 0; this.DistanceDefence = 0; this.MagicDefence = 0; this.CloseDefence = 0; for (int i = 0; i < point; i++) { int rndn = _random.Next(0, 3); if (rndn == 0) { this.DefenceDodge++; this.DistanceDefenceDodge++; } else { this.DistanceDefence++; this.MagicDefence++; this.CloseDefence++; } } } }
public string GenerateSlInfo() { int freepoint = CharacterHelper.SPPoint(SpLevel, Upgrade) - SlDamage - SlHP - SlElement - SlDefence; int slElement = CharacterHelper.SlPoint(SlElement, 2); int slHp = CharacterHelper.SlPoint(SlHP, 3); int slDefence = CharacterHelper.SlPoint(SlDefence, 1); int slHit = CharacterHelper.SlPoint(SlDamage, 0); string skill = string.Empty; List <CharacterSkill> skillsSp = new List <CharacterSkill>(); foreach (Skill ski in ServerManager.Instance.GetAllSkill().Where(ski => ski.Class == Item.Morph + 31 && ski.LevelMinimum <= SpLevel)) { skillsSp.Add(new CharacterSkill { SkillVNum = ski.SkillVNum, CharacterId = CharacterId }); } byte spdestroyed = 0; if (Rare == -2) { spdestroyed = 1; } if (!skillsSp.Any()) { skill = "-1"; } short firstskillvnum = skillsSp[0].SkillVNum; for (int i = 1; i < 11; i++) { if (skillsSp.Count >= i + 1) { if (skillsSp[i].SkillVNum <= firstskillvnum + 10) { skill += $"{skillsSp[i].SkillVNum}."; } } } // 10 9 8 '0 0 0 0'<- bonusdamage bonusarmor bonuselement bonushpmp its after upgrade and // 3 first values are not important skill = skill.TrimEnd('.'); return($"slinfo {(Type == InventoryType.Wear || Type == InventoryType.Specialist || Type == InventoryType.Equipment ? "0" : "2")} {ItemVNum} {Item.Morph} {SpLevel} {Item.LevelJobMinimum} {Item.ReputationMinimum} 0 0 0 0 0 0 0 {Item.SpType} {Item.FireResistance} {Item.WaterResistance} {Item.LightResistance} {Item.DarkResistance} {XP} {CharacterHelper.SPXPData[SpLevel - 1]} {skill} {TransportId} {freepoint} {slHit} {slDefence} {slElement} {slHp} {Upgrade} 0 0 {spdestroyed} 0 0 0 0 {SpStoneUpgrade} {SpDamage} {SpDefence} {SpElement} {SpHP} {SpFire} {SpWater} {SpLight} {SpDark}"); }
public override void Use(ClientSession session, ref ItemInstance inv, byte option = 0, string[] packetsplit = null) { switch (Effect) { default: bool delay = false; if (option == 255) { delay = true; option = 0; } Mate mate = null; if (option != 0) { mate = session.Character.Mates.FirstOrDefault(s => s.MateType == MateType.Partner && s.PetId == (option - 1)); } short slot = inv.Slot; InventoryType equipment = InventoryType.Wear; switch (option) { case 1: equipment = InventoryType.FirstPartnerInventory; break; case 2: equipment = InventoryType.SecondPartnerInventory; break; case 3: equipment = InventoryType.ThirdPartnerInventory; break; } InventoryType itemToWearType = inv.Type; if (inv == null) { return; } if (ItemValidTime > 0 && inv.IsBound) { inv.ItemDeleteTime = DateTime.Now.AddSeconds(ItemValidTime); } if (!inv.IsBound) { if (!delay && (EquipmentSlot == EquipmentType.Fairy && (MaxElementRate == 70 || MaxElementRate == 80) || EquipmentSlot == EquipmentType.CostumeHat || EquipmentSlot == EquipmentType.CostumeSuit || EquipmentSlot == EquipmentType.WeaponSkin)) { session.SendPacket($"qna #u_i^1^{session.Character.CharacterId}^{(byte)itemToWearType}^{slot}^1 {Language.Instance.GetMessageFromKey("ASK_BIND")}"); return; } if (delay) { inv.BoundCharacterId = session.Character.CharacterId; } } double timeSpanSinceLastSpUsage = (DateTime.Now - Process.GetCurrentProcess().StartTime.AddSeconds(-50)).TotalSeconds - session.Character.LastSp; if (EquipmentSlot == EquipmentType.Sp && inv.Rare == -2) { session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("CANT_EQUIP_DESTROYED_SP"), 0)); return; } if (option == 0) { if (EquipmentSlot == EquipmentType.Sp && timeSpanSinceLastSpUsage <= session.Character.SpCooldown && session.Character.Inventory.LoadBySlotAndType <SpecialistInstance>((byte)EquipmentType.Sp, InventoryType.Specialist) != null) { session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SP_INLOADING"), session.Character.SpCooldown - (int)Math.Round(timeSpanSinceLastSpUsage)), 0)); return; } if (ItemType != ItemType.Weapon && ItemType != ItemType.Armor && ItemType != ItemType.Fashion && ItemType != ItemType.Jewelery && ItemType != ItemType.Specialist || LevelMinimum > (IsHeroic ? session.Character.HeroLevel : session.Character.Level) || Sex != 0 && Sex != (byte)session.Character.Gender + 1 || ItemType != ItemType.Jewelery && EquipmentSlot != EquipmentType.Boots && EquipmentSlot != EquipmentType.Gloves && ((Class >> (byte)session.Character.Class) & 1) != 1) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } if (session.Character.UseSp) { SpecialistInstance sp = session.Character.Inventory.LoadBySlotAndType <SpecialistInstance>((byte)EquipmentType.Sp, equipment); if (sp != null && sp.Item.Element != 0 && EquipmentSlot == EquipmentType.Fairy && Element != sp.Item.Element && Element != sp.Item.SecondaryElement) { session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("BAD_FAIRY"), 0)); return; } } if (session.Character.UseSp && EquipmentSlot == EquipmentType.Sp) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SP_BLOCKED"), 10)); return; } if (session.Character.JobLevel < LevelJobMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("LOW_JOB_LVL"), 10)); return; } } else if (mate != null) { if (mate.Level < LevelMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } switch (EquipmentSlot) { case EquipmentType.Armor: if (ItemSubType == 4) { mate.ArmorInstance = inv; break; } else { goto default; } case EquipmentType.MainWeapon: if (ItemSubType == 12) { mate.WeaponInstance = inv; break; } else { goto default; } case EquipmentType.Gloves: mate.GlovesInstance = inv; break; case EquipmentType.Boots: mate.BootsInstance = inv; break; case EquipmentType.Sp: if (ItemSubType == 4) { mate.SpInstance = inv; break; } else { goto default; } default: session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } } ItemInstance currentlyEquippedItem = session.Character.Inventory.LoadBySlotAndType((short)EquipmentSlot, equipment); if (currentlyEquippedItem == null) { // move from equipment to wear session.Character.Inventory.MoveInInventory(inv.Slot, itemToWearType, equipment); session.SendPacket(UserInterfaceHelper.Instance.GenerateInventoryRemove(itemToWearType, slot)); } else { // move from wear to equipment and back session.Character.Inventory.MoveInInventory(currentlyEquippedItem.Slot, equipment, itemToWearType, inv.Slot); session.SendPacket(currentlyEquippedItem.GenerateInventoryAdd()); session.Character.EquipmentBCards = session.Character.EquipmentBCards.Replace(o => o.ItemVNum != currentlyEquippedItem.ItemVNum); switch (currentlyEquippedItem.Slot) { case (byte)EquipmentType.Armor: session.Character.Inventory.Armor = null; break; case (byte)EquipmentType.MainWeapon: session.Character.Inventory.PrimaryWeapon = null; break; case (byte)EquipmentType.SecondaryWeapon: session.Character.Inventory.SecondaryWeapon = null; break; } } inv.Item.BCards.ForEach(s => session.Character.EquipmentBCards.Add(s)); if (inv is WearableInstance wearableInstance) { if (wearableInstance.EquipmentOptions != null) { switch (wearableInstance.Item.ItemType) { case ItemType.Armor: case ItemType.Weapon: switch (wearableInstance.Slot) { case (byte)EquipmentType.Armor: session.Character.Inventory.Armor = wearableInstance; break; case (byte)EquipmentType.MainWeapon: session.Character.Inventory.PrimaryWeapon = wearableInstance; break; case (byte)EquipmentType.SecondaryWeapon: session.Character.Inventory.SecondaryWeapon = wearableInstance; break; } EquipmentOptionHelper.Instance.ShellToBCards(wearableInstance.EquipmentOptions, wearableInstance.ItemVNum).ForEach(s => session.Character.EquipmentBCards.Add(s)); break; case ItemType.Jewelery: EquipmentOptionHelper.Instance.CellonToBCards(wearableInstance.EquipmentOptions, wearableInstance.ItemVNum).ForEach(s => session.Character.EquipmentBCards.Add(s)); break; } } } if (option == 0) { session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMapInstance?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMapInstance?.Broadcast(session.Character.GeneratePairy()); switch (EquipmentSlot) { case EquipmentType.Fairy: WearableInstance fairy = session.Character.Inventory.LoadBySlotAndType <WearableInstance>((byte)EquipmentType.Fairy, equipment); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("FAIRYSTATS"), fairy.XP, CharacterHelper.LoadFairyXpData(fairy.ElementRate + fairy.Item.ElementRate)), 10)); break; case EquipmentType.Amulet: session.SendPacket(session.Character.GenerateEff(39)); inv.BoundCharacterId = session.Character.CharacterId; break; } } else if (mate != null) { session.SendPacket(mate.GenerateScPacket()); } break; } }
public override void Use(ClientSession session, ref ItemInstance inv, byte Option = 0, string[] packetsplit = null) { switch (Effect) { default: bool delay = false; if (Option == 255) { delay = true; Option = 0; } Mate mate = null; if (Option != 0) { mate = session.Character.Mates.Find(s => s.MateType == MateType.Partner && s.PetId == Option - 1); } short slot = inv.Slot; InventoryType equipment = InventoryType.Wear; switch (Option) { case 1: equipment = InventoryType.FirstPartnerInventory; break; case 2: equipment = InventoryType.SecondPartnerInventory; break; case 3: equipment = InventoryType.ThirdPartnerInventory; break; } InventoryType itemToWearType = inv.Type; if (inv == null) { return; } if (ItemValidTime > 0 && inv.IsBound) { inv.ItemDeleteTime = DateTime.Now.AddSeconds(ItemValidTime); } if (!inv.IsBound) { if (!delay && ((EquipmentSlot == EquipmentType.Fairy && (MaxElementRate == 70 || MaxElementRate == 80)) || EquipmentSlot == EquipmentType.CostumeHat || EquipmentSlot == EquipmentType.CostumeSuit || EquipmentSlot == EquipmentType.WeaponSkin)) { session.SendPacket($"qna #u_i^1^{session.Character.CharacterId}^{(byte)itemToWearType}^{slot}^1 {Language.Instance.GetMessageFromKey("ASK_BIND")}"); return; } if (delay) { inv.BoundCharacterId = session.Character.CharacterId; } } double timeSpanSinceLastSpUsage = (DateTime.Now - Process.GetCurrentProcess().StartTime.AddSeconds(-50)).TotalSeconds - session.Character.LastSp; if (EquipmentSlot == EquipmentType.Sp && inv.Rare == -2) { session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CANT_EQUIP_DESTROYED_SP"), 0)); return; } if (Option == 0) { if (EquipmentSlot == EquipmentType.Sp && timeSpanSinceLastSpUsage <= session.Character.SpCooldown && session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, InventoryType.Specialist) != null) { session.SendPacket(UserInterfaceHelper.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SP_INLOADING"), session.Character.SpCooldown - (int)Math.Round(timeSpanSinceLastSpUsage)), 0)); return; } if ((ItemType != ItemType.Weapon && ItemType != ItemType.Armor && ItemType != ItemType.Fashion && ItemType != ItemType.Jewelery && ItemType != ItemType.Specialist) || LevelMinimum > (IsHeroic ? session.Character.HeroLevel : session.Character.Level) || (Sex != 0 && Sex != (byte)session.Character.Gender + 1) || (ItemType != ItemType.Jewelery && EquipmentSlot != EquipmentType.Boots && EquipmentSlot != EquipmentType.Gloves && ((Class >> (byte)session.Character.Class) & 1) != 1)) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } if (session.Character.UseSp) { ItemInstance sp = session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, equipment); if (sp.Item.Element != 0 && EquipmentSlot == EquipmentType.Fairy && Element != sp.Item.Element && Element != sp.Item.SecondaryElement) { session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("BAD_FAIRY"), 0)); return; } } if (session.Character.UseSp && EquipmentSlot == EquipmentType.Sp) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SP_BLOCKED"), 10)); return; } if (session.Character.JobLevel < LevelJobMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("LOW_JOB_LVL"), 10)); return; } } else if (mate != null) { if ((EquipmentSlot != EquipmentType.Gloves && EquipmentSlot != EquipmentType.Boots) || LevelMinimum > mate.Level) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } } ItemInstance currentlyEquippedItem = session.Character.Inventory.LoadBySlotAndType((short)EquipmentSlot, equipment); if (currentlyEquippedItem == null) { // move from equipment to wear session.Character.Inventory.MoveInInventory(inv.Slot, itemToWearType, equipment); session.SendPacket(UserInterfaceHelper.Instance.GenerateInventoryRemove(itemToWearType, slot)); } else { Logger.LogUserEvent("EQUIPMENT_TAKEOFF", session.GenerateIdentity(), $"IIId: {currentlyEquippedItem.Id} ItemVnum: {currentlyEquippedItem.ItemVNum} Upgrade: {currentlyEquippedItem.Upgrade} Rare: {currentlyEquippedItem.Rare}"); // move from wear to equipment and back session.Character.Inventory.MoveInInventory(currentlyEquippedItem.Slot, equipment, itemToWearType, inv.Slot); session.SendPacket(currentlyEquippedItem.GenerateInventoryAdd()); session.Character.EquipmentBCards.RemoveAll(o => o.ItemVNum == currentlyEquippedItem.ItemVNum); } Logger.LogUserEvent("EQUIPMENT_WEAR", session.GenerateIdentity(), $"IIId: {inv.Id} ItemVnum: {inv.ItemVNum} Upgrade: {inv.Upgrade} Rare: {inv.Rare}"); session.Character.EquipmentBCards.AddRange(inv.Item.BCards); if (Option == 0) { session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMapInstance?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMapInstance?.Broadcast(session.Character.GeneratePairy()); if (EquipmentSlot == EquipmentType.Fairy) { ItemInstance fairy = session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Fairy, equipment); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("FAIRYSTATS"), fairy.XP, CharacterHelper.LoadFairyXPData(fairy.ElementRate + fairy.Item.ElementRate)), 10)); } if (EquipmentSlot == EquipmentType.Amulet) { session.SendPacket(StaticPacketHelper.GenerateEff(UserType.Player, session.Character.CharacterId, 42)); inv.BoundCharacterId = session.Character.CharacterId; } } else if (mate != null) { session.SendPacket(mate.GenerateScPacket()); } break; } }
public override void Use(ClientSession session, ref ItemInstance inv, bool delay = false, string[] packetsplit = null) { switch (Effect) { default: short slot = inv.Slot; InventoryType itemToWearType = inv.Type; if (inv == null) { return; } if (ItemValidTime > 0 && inv.IsBound) { inv.ItemDeleteTime = DateTime.Now.AddSeconds(ItemValidTime); } if (!inv.IsBound) { if (!delay && ((EquipmentSlot == EquipmentType.Fairy && (MaxElementRate == 70 || MaxElementRate == 80)) || EquipmentSlot == EquipmentType.CostumeHat || EquipmentSlot == EquipmentType.CostumeSuit || EquipmentSlot == EquipmentType.WeaponSkin)) { session.SendPacket($"qna #u_i^1^{session.Character.CharacterId}^{(byte)itemToWearType}^{slot}^1 {Language.Instance.GetMessageFromKey("ASK_BIND")}"); return; } if (delay) { inv.BoundCharacterId = session.Character.CharacterId; } } double timeSpanSinceLastSpUsage = (DateTime.Now - Process.GetCurrentProcess().StartTime.AddSeconds(-50)).TotalSeconds - session.Character.LastSp; if (EquipmentSlot == EquipmentType.Sp && inv.Rare == -2) { session.SendPacket(session.Character.GenerateMsg(Language.Instance.GetMessageFromKey("CANT_EQUIP_DESTROYED_SP"), 0)); return; } if (EquipmentSlot == EquipmentType.Sp && timeSpanSinceLastSpUsage <= session.Character.SpCooldown && session.Character.Inventory.LoadBySlotAndType <SpecialistInstance>((byte)EquipmentType.Sp, InventoryType.Specialist) != null) { session.SendPacket(session.Character.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SP_INLOADING"), session.Character.SpCooldown - (int)Math.Round(timeSpanSinceLastSpUsage)), 0)); return; } if ((ItemType != ItemType.Weapon && ItemType != ItemType.Armor && ItemType != ItemType.Fashion && ItemType != ItemType.Jewelery && ItemType != ItemType.Specialist) || LevelMinimum > (IsHeroic ? session.Character.HeroLevel : session.Character.Level) || (Sex != 0 && Sex != (byte)session.Character.Gender + 1) || (ItemType != ItemType.Jewelery && EquipmentSlot != EquipmentType.Boots && EquipmentSlot != EquipmentType.Gloves && ((Class >> (byte)session.Character.Class) & 1) != 1)) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } if (session.Character.UseSp) { SpecialistInstance sp = session.Character.Inventory.LoadBySlotAndType <SpecialistInstance>((byte)EquipmentType.Sp, InventoryType.Wear); if (sp.Item.Element != 0 && EquipmentSlot == EquipmentType.Fairy && Element != sp.Item.Element && Element != sp.Item.SecondaryElement) { session.SendPacket(session.Character.GenerateMsg(Language.Instance.GetMessageFromKey("BAD_FAIRY"), 0)); return; } } if (session.Character.UseSp && EquipmentSlot == EquipmentType.Sp) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SP_BLOCKED"), 10)); return; } if (session.Character.JobLevel < LevelJobMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("LOW_JOB_LVL"), 10)); return; } ItemInstance currentlyEquippedItem = session.Character.Inventory.LoadBySlotAndType((short)EquipmentSlot, InventoryType.Wear); if (EquipmentSlot == EquipmentType.Amulet) { session.SendPacket(session.Character.GenerateEff(39)); inv.BoundCharacterId = session.Character.CharacterId; } if (currentlyEquippedItem == null) { // move from equipment to wear session.Character.Inventory.MoveInInventory(inv.Slot, itemToWearType, InventoryType.Wear); session.SendPacket(session.Character.GenerateInventoryAdd(-1, 0, itemToWearType, slot, 0, 0, 0, 0)); session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMap?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMap?.Broadcast(session.Character.GeneratePairy()); } else { // move from wear to equipment and back session.Character.Inventory.MoveInInventory(currentlyEquippedItem.Slot, InventoryType.Wear, itemToWearType, inv.Slot); session.SendPacket(session.Character.GenerateInventoryAdd(-1, 0, itemToWearType, slot, 0, 0, 0, 0)); session.SendPacket(session.Character.GenerateInventoryAdd(currentlyEquippedItem.ItemVNum, currentlyEquippedItem.Amount, currentlyEquippedItem.Type, currentlyEquippedItem.Slot, currentlyEquippedItem.Rare, currentlyEquippedItem.Design, currentlyEquippedItem.Upgrade, (currentlyEquippedItem as SpecialistInstance)?.SpStoneUpgrade ?? (byte)0)); session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMap?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMap?.Broadcast(session.Character.GeneratePairy()); } if (EquipmentSlot == EquipmentType.Fairy) { WearableInstance fairy = session.Character.Inventory.LoadBySlotAndType <WearableInstance>((byte)EquipmentType.Fairy, InventoryType.Wear); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("FAIRYSTATS"), fairy.XP, CharacterHelper.LoadFairyXPData(fairy.ElementRate + fairy.Item.ElementRate)), 10)); } break; } }
public override void Use(ClientSession session, ref ItemInstance inv, byte option = 0, string[] packetsplit = null) { switch (Effect) { default: bool delay = false; if (option == 255) { delay = true; option = 0; } Mate mate = null; if (option != 0) { if (session.Character.Mates.Count(s => s.MateType == MateType.Partner) == 1 && option == 2) { option = 1; } mate = session.Character.Mates.Find(s => s.MateType == MateType.Partner && s.PartnerSlot == (option - 1)); } short slot = inv.Slot; InventoryType equipment = InventoryType.Wear; if (option >= 1 && option <= 12) { equipment = (InventoryType)(option + 12); // partner inventories } InventoryType itemToWearType = inv.Type; if (inv == null) { return; } if (ItemValidTime > 0 && !inv.IsBound) { inv.ItemDeleteTime = DateTime.UtcNow.AddSeconds(ItemValidTime); } if (!inv.IsBound) { if (!delay && ((EquipmentSlot == EquipmentType.Fairy && (MaxElementRate == 70 || MaxElementRate == 80)) || EquipmentSlot == EquipmentType.CostumeHat || EquipmentSlot == EquipmentType.CostumeSuit || EquipmentSlot == EquipmentType.WeaponSkin)) { session.SendPacket($"qna #u_i^1^{session.Character.CharacterId}^{(byte)itemToWearType}^{slot}^1 {Language.Instance.GetMessageFromKey("ASK_BIND")}"); return; } if (delay) { inv.BoundCharacterId = session.Character.CharacterId; } } double timeSpanSinceLastSpUsage = (DateTime.UtcNow - Process.GetCurrentProcess().StartTime.AddHours(-2).AddSeconds(-50)).TotalSeconds - session.Character.LastSp; if (EquipmentSlot == EquipmentType.Sp && inv.Rare == -2) { session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CANT_EQUIP_DESTROYED_SP"), 0)); return; } if (option == 0) { if (EquipmentSlot == EquipmentType.Sp && timeSpanSinceLastSpUsage <= session.Character.SpCooldown && session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, InventoryType.Specialist) != null) { session.SendPacket(UserInterfaceHelper.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SP_INLOADING"), session.Character.SpCooldown - (int)Math.Round(timeSpanSinceLastSpUsage)), 0)); return; } if ((ItemType != ItemType.Weapon && ItemType != ItemType.Armor && ItemType != ItemType.Fashion && ItemType != ItemType.Jewelery && ItemType != ItemType.Specialist) || LevelMinimum > (IsHeroic ? session.Character.HeroLevel : session.Character.Level) || (Sex != 0 && Sex != (byte)session.Character.Gender + 1) || (ItemType != ItemType.Jewelery && EquipmentSlot != EquipmentType.Boots && EquipmentSlot != EquipmentType.Gloves && ((Class >> (byte)session.Character.Class) & 1) != 1) || (inv.BoundCharacterId != null && inv.BoundCharacterId != session.Character.CharacterId)) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } if (session.Character.UseSp && session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, equipment) is ItemInstance sp && sp.Item.Element != 0 && EquipmentSlot == EquipmentType.Fairy && Element != sp.Item.Element && Element != sp.Item.SecondaryElement) { session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("BAD_FAIRY"), 0)); return; } if (session.Character.UseSp && EquipmentSlot == EquipmentType.Sp) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SP_BLOCKED"), 10)); return; } if (session.Character.JobLevel < LevelJobMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("LOW_JOB_LVL"), 10)); return; } } else if (mate != null) { if (mate.Level < LevelMinimum || mate.Level < inv.MinimumLevel) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } var isRagnar = mate.NpcMonsterVNum == 2603 || mate.NpcMonsterVNum == 2618; var mateSpType = ServerManager.GetNpcMonster(mate.NpcMonsterVNum).SpecialistType; var itemSpType = ServerManager.GetItem(VNum).SpecialistType; switch (EquipmentSlot) { case EquipmentType.Armor: if (ItemSubType == 4 && !inv.Item.IsHeroic && mateSpType == itemSpType) { mate.ArmorInstance = inv; break; } else if (ItemSubType == 4 && isRagnar && !inv.Item.IsHeroic && itemSpType == PartnerSpecialistType.Close) { mate.ArmorInstance = inv; break; } else { goto default; } case EquipmentType.MainWeapon: if (ItemSubType == 12 && !inv.Item.IsHeroic && mateSpType == itemSpType) { mate.WeaponInstance = inv; break; } else if (ItemSubType == 4 && isRagnar && !inv.Item.IsHeroic && itemSpType == PartnerSpecialistType.Close) { mate.WeaponInstance = inv; break; } else { goto default; } case EquipmentType.Gloves: if (!inv.Item.IsHeroic) { mate.GlovesInstance = inv; } else { goto default; } break; case EquipmentType.Boots: if (!inv.Item.IsHeroic) { mate.BootsInstance = inv; } else { goto default; } break; case EquipmentType.Sp: if (ItemSubType == 4 && mateSpType == itemSpType) { mate.SpInstance = inv; break; } else if (ItemSubType == 4 && isRagnar && itemSpType == PartnerSpecialistType.RagnarOnly) { mate.SpInstance = inv; break; } else { goto default; } default: session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } } ItemInstance currentlyEquippedItem = session.Character.Inventory.LoadBySlotAndType((short)EquipmentSlot, equipment); if (currentlyEquippedItem == null) { // move from equipment to wear session.Character.Inventory.MoveInInventory(inv.Slot, itemToWearType, equipment); session.SendPacket(UserInterfaceHelper.Instance.GenerateInventoryRemove(itemToWearType, slot)); } else { GameLogger.Instance.LogEquipmentUnwear(ServerManager.Instance.ChannelId, session.Character.Name, session.Character.CharacterId, currentlyEquippedItem); // move from wear to equipment and back session.Character.Inventory.MoveInInventory(currentlyEquippedItem.Slot, equipment, itemToWearType, inv.Slot); session.SendPacket(currentlyEquippedItem.GenerateInventoryAdd()); session.Character.EquipmentBCards.RemoveAll(o => o.ItemVNum == currentlyEquippedItem.ItemVNum); } GameLogger.Instance.LogEquipmentWear(ServerManager.Instance.ChannelId, session.Character.Name, session.Character.CharacterId, inv); session.Character.EquipmentBCards.AddRange(inv.Item.BCards); switch (inv.Item.ItemType) { case ItemType.Armor: session.Character.ShellEffectArmor.Clear(); foreach (ShellEffectDTO dto in inv.ShellEffects) { session.Character.ShellEffectArmor.Add(dto); } break; case ItemType.Weapon: switch (inv.Item.EquipmentSlot) { case EquipmentType.MainWeapon: session.Character.ShellEffectMain.Clear(); foreach (ShellEffectDTO dto in inv.ShellEffects) { session.Character.ShellEffectMain.Add(dto); } break; case EquipmentType.SecondaryWeapon: session.Character.ShellEffectSecondary.Clear(); foreach (ShellEffectDTO dto in inv.ShellEffects) { session.Character.ShellEffectSecondary.Add(dto); } break; } break; } if (option == 0) { session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMapInstance?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMapInstance?.Broadcast(session.Character.GeneratePairy()); if (EquipmentSlot == EquipmentType.Fairy) { ItemInstance fairy = session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Fairy, equipment); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("FAIRYSTATS"), fairy.XP, CharacterHelper.LoadFairyXPData(fairy.ElementRate + fairy.Item.ElementRate)), 10)); } if (EquipmentSlot == EquipmentType.Amulet) { session.SendPacket(StaticPacketHelper.GenerateEff(UserType.Player, session.Character.CharacterId, 39)); inv.BoundCharacterId = session.Character.CharacterId; } } else if (mate != null) { session.SendPacket(mate.GenerateScPacket()); } break; } }
public override void Use(ClientSession session, ref ItemInstance inv, byte Option = 0, string[] packetsplit = null) { switch (Effect) { default: bool delay = false; if (Option == 255) { delay = true; Option = 0; } Mate mate = null; if (Option != 0) { mate = session.Character.Mates.Find(s => s.MateType == MateType.Partner && s.PetId == Option - 1); if (mate == null || mate.IsTemporalMate) { return; } } short slot = inv.Slot; InventoryType equipment = InventoryType.Wear; if (Option > 0) { equipment = (InventoryType)(12 + Option); } InventoryType itemToWearType = inv.Type; if (inv == null) { return; } if (ItemValidTime > 0 && !inv.IsBound) { inv.ItemDeleteTime = DateTime.Now.AddSeconds(ItemValidTime); } else if (!inv.IsBound && ItemType == ItemType.Jewelery && new int[] { 3951, 3952, 3953, 3954, 3955, 7427 }.Contains(EffectValue)) { inv.ItemDeleteTime = DateTime.Now.AddSeconds(3600); } if (!inv.IsBound) { switch (inv.Item.Effect) { case 790: // Tarot case 932: // Attack amulet case 933: // defense amulet inv.BoundCharacterId = session.Character.CharacterId; break; } if (!delay && ((EquipmentSlot == EquipmentType.Fairy && (MaxElementRate == 70 || MaxElementRate == 80)) || EquipmentSlot == EquipmentType.CostumeHat || EquipmentSlot == EquipmentType.CostumeSuit || EquipmentSlot == EquipmentType.WeaponSkin)) { session.SendPacket($"qna #u_i^1^{session.Character.CharacterId}^{(byte)itemToWearType}^{slot}^1 {Language.Instance.GetMessageFromKey("ASK_BIND")}"); return; } if (delay) { inv.BoundCharacterId = session.Character.CharacterId; } } double timeSpanSinceLastSpUsage = (DateTime.Now - Process.GetCurrentProcess().StartTime.AddSeconds(-50)).TotalSeconds - session.Character.LastSp; if (EquipmentSlot == EquipmentType.Sp && inv.Rare == -2) { session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CANT_EQUIP_DESTROYED_SP"), 0)); return; } if (Option == 0) { if (EquipmentSlot == EquipmentType.Sp && timeSpanSinceLastSpUsage <= session.Character.SpCooldown && session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, InventoryType.Specialist) != null) { session.SendPacket(UserInterfaceHelper.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SP_INLOADING"), session.Character.SpCooldown - (int)Math.Round(timeSpanSinceLastSpUsage)), 0)); return; } if ((ItemType != ItemType.Weapon && ItemType != ItemType.Armor && ItemType != ItemType.Fashion && ItemType != ItemType.Jewelery && ItemType != ItemType.Specialist) || LevelMinimum > (IsHeroic ? session.Character.HeroLevel : session.Character.Level) || (Sex != 0 && Sex != (byte)session.Character.Gender + 1) || (ItemType != ItemType.Jewelery && EquipmentSlot != EquipmentType.Boots && EquipmentSlot != EquipmentType.Gloves && ((Class >> (byte)session.Character.Class) & 1) != 1)) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } if (session.Character.UseSp) { if (session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, equipment) is ItemInstance sp && sp.Item.Element != 0 && EquipmentSlot == EquipmentType.Fairy && Element != sp.Item.Element && Element != sp.Item.SecondaryElement) { session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("BAD_FAIRY"), 0)); return; } } if (ItemType == ItemType.Weapon || ItemType == ItemType.Armor) { if (inv.BoundCharacterId.HasValue && inv.BoundCharacterId.Value != session.Character.CharacterId) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } } if (session.Character.UseSp && EquipmentSlot == EquipmentType.Sp) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SP_BLOCKED"), 10)); return; } if (session.Character.JobLevel < LevelJobMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("LOW_JOB_LVL"), 10)); return; } } else if (mate != null) { if (inv.Item.EquipmentSlot == EquipmentType.MainWeapon || inv.Item.EquipmentSlot == EquipmentType.SecondaryWeapon || inv.Item.EquipmentSlot == EquipmentType.Armor) { switch (mate.Monster.AttackClass) { case 0: if (inv.ItemVNum != 990 && inv.ItemVNum != 997) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } break; case 1: if (inv.ItemVNum != 991 && inv.ItemVNum != 996) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } break; case 2: if (inv.ItemVNum != 992 && inv.ItemVNum != 995) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } break; } } if (mate.Level < LevelMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } Item partnerEquipment = ServerManager.GetItem(inv.ItemVNum); bool isBadEquipment = false; switch (partnerEquipment.EquipmentSlot) { case EquipmentType.MainWeapon: { if (partnerEquipment.ItemSubType != 12) { isBadEquipment = true; } else { mate.WeaponInstance = inv; } } break; case EquipmentType.Armor: { if (partnerEquipment.ItemSubType != 4) { isBadEquipment = true; } else { mate.ArmorInstance = inv; } } break; case EquipmentType.Gloves: { mate.GlovesInstance = inv; } break; case EquipmentType.Boots: { mate.BootsInstance = inv; } break; case EquipmentType.Sp: { if (mate.IsUsingSp) { return; } if (partnerEquipment.ItemSubType != 4 || !PartnerHelper.CanWearSp(mate.NpcMonsterVNum, inv.ItemVNum)) { isBadEquipment = true; } else { if (!mate.CanUseSp()) { int spRemainingCooldown = mate.GetSpRemainingCooldown(); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("STAY_TIME"), spRemainingCooldown), 11)); session.SendPacket($"psd {spRemainingCooldown}"); return; } mate.Sp = new PartnerSp(inv); } } break; } if (isBadEquipment) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } } ItemInstance currentlyEquippedItem = session.Character.Inventory.LoadBySlotAndType((short)EquipmentSlot, equipment); if (currentlyEquippedItem == null) { // move from equipment to wear session.Character.Inventory.MoveInInventory(inv.Slot, itemToWearType, equipment); session.SendPacket(UserInterfaceHelper.Instance.GenerateInventoryRemove(itemToWearType, slot)); } else { Logger.LogUserEvent("EQUIPMENT_TAKEOFF", session.GenerateIdentity(), $"IIId: {currentlyEquippedItem.Id} ItemVnum: {currentlyEquippedItem.ItemVNum} Upgrade: {currentlyEquippedItem.Upgrade} Rare: {currentlyEquippedItem.Rare}"); // move from wear to equipment and back session.Character.Inventory.MoveInInventory(currentlyEquippedItem.Slot, equipment, itemToWearType, inv.Slot); session.SendPacket(currentlyEquippedItem.GenerateInventoryAdd()); session.Character.EquipmentBCards.RemoveAll(o => o.ItemVNum == currentlyEquippedItem.ItemVNum); } Logger.LogUserEvent("EQUIPMENT_WEAR", session.GenerateIdentity(), $"IIId: {inv.Id} ItemVnum: {inv.ItemVNum} Upgrade: {inv.Upgrade} Rare: {inv.Rare}"); ScriptedInstance raid = ServerManager.Instance.Raids.FirstOrDefault(s => s.RequiredItems?.Any(obj => obj?.VNum == VNum) == true)?.Copy(); if (raid?.DailyEntries > 0) { var entries = raid.DailyEntries - session.Character.GeneralLogs.CountLinq(s => s.LogType == "InstanceEntry" && short.Parse(s.LogData) == raid.Id && s.Timestamp.Date == DateTime.Today); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("INSTANCE_ENTRIES"), entries), 10)); } if (mate == null) { session.Character.EquipmentBCards.AddRange(inv.Item.BCards); switch (inv.Item.ItemType) { case ItemType.Armor: session.Character.ShellEffectArmor.Clear(); foreach (ShellEffectDTO dto in inv.ShellEffects) { session.Character.ShellEffectArmor.Add(dto); } break; case ItemType.Weapon: switch (inv.Item.EquipmentSlot) { case EquipmentType.MainWeapon: session.Character.ShellEffectMain.Clear(); foreach (ShellEffectDTO dto in inv.ShellEffects) { session.Character.ShellEffectMain.Add(dto); } break; case EquipmentType.SecondaryWeapon: session.Character.ShellEffectSecondary.Clear(); foreach (ShellEffectDTO dto in inv.ShellEffects) { session.Character.ShellEffectSecondary.Add(dto); } break; } break; } } else { mate.BattleEntity.BCards.AddRange(inv.Item.BCards); } if (Option == 0) { session.SendPackets(session.Character.GenerateStatChar()); session.CurrentMapInstance?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMapInstance?.Broadcast(session.Character.GeneratePairy()); if (EquipmentSlot == EquipmentType.Fairy) { ItemInstance fairy = session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Fairy, equipment); session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("FAIRYSTATS"), fairy.XP, CharacterHelper.LoadFairyXPData(fairy.ElementRate + fairy.Item.ElementRate)), 10)); } if (EquipmentSlot == EquipmentType.Amulet) { session.SendPacket(StaticPacketHelper.GenerateEff(UserType.Player, session.Character.CharacterId, 39)); inv.BoundCharacterId = session.Character.CharacterId; if (inv.ItemDeleteTime > DateTime.Now || inv.DurabilityPoint > 0) { session.Character.AddBuff(new Buff(62, session.Character.Level), session.Character.BattleEntity); } } } else if (mate != null) { session.SendPacket(mate.GenerateScPacket()); } break; } }
public void SetRarityPoint() { switch (Item.EquipmentSlot) { case EquipmentType.MainWeapon: case EquipmentType.SecondaryWeapon: { int point = CharacterHelper.RarityPoint(Rare, Item.IsHeroic ? (short)(95 + Item.LevelMinimum) : Item.LevelMinimum); Concentrate = 0; HitRate = 0; DamageMinimum = 0; DamageMaximum = 0; if (Rare >= 0) { for (int i = 0; i < point; i++) { int rndn = ServerManager.Instance.RandomNumber(0, 3); if (rndn == 0) { Concentrate++; HitRate++; } else { DamageMinimum++; DamageMaximum++; } } } else { for (int i = 0; i > Rare * 10; i--) { DamageMinimum--; DamageMaximum--; } } } break; case EquipmentType.Armor: { int point = CharacterHelper.RarityPoint(Rare, Item.IsHeroic ? (short)(95 + Item.LevelMinimum) : Item.LevelMinimum); DefenceDodge = 0; DistanceDefenceDodge = 0; DistanceDefence = 0; MagicDefence = 0; CloseDefence = 0; if (Rare >= 0) { for (int i = 0; i < point; i++) { int rndn = ServerManager.Instance.RandomNumber(0, 3); if (rndn == 0) { DefenceDodge++; DistanceDefenceDodge++; } else { DistanceDefence++; MagicDefence++; CloseDefence++; } } } else { for (int i = 0; i > Rare * 10; i--) { DistanceDefence--; MagicDefence--; CloseDefence--; } } } break; } }
public string GenerateEInfo() { EquipmentType equipmentslot = Item.EquipmentSlot; ItemType itemType = Item.ItemType; byte classe = Item.Class; byte subtype = Item.ItemSubType; DateTime test = ItemDeleteTime ?? DateTime.Now; long time = ItemDeleteTime != null ? (long)test.Subtract(DateTime.Now).TotalSeconds : 0; long seconds = IsBound ? time : Item.ItemValidTime; if (seconds < 0) { seconds = 0; } switch (itemType) { case ItemType.Weapon: switch (equipmentslot) { case EquipmentType.MainWeapon: switch (classe) { case 4: return($"e_info 1 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.DamageMinimum + DamageMinimum} {Item.DamageMaximum + DamageMaximum} {Item.HitRate + HitRate} {Item.CriticalLuckRate + CriticalLuckRate} {Item.CriticalRate + CriticalRate} {Ammo} {Item.MaximumAmmo} {Item.Price} -1 0 0 0"); // -1 = {ShellEffectValue} {FirstShell}... case 8: return($"e_info 5 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.DamageMinimum + DamageMinimum} {Item.DamageMaximum + DamageMaximum} {Item.HitRate + HitRate} {Item.CriticalLuckRate + CriticalLuckRate} {Item.CriticalRate + CriticalRate} {Ammo} {Item.MaximumAmmo} {Item.Price} -1 0 0 0"); default: return($"e_info 0 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.DamageMinimum + DamageMinimum} {Item.DamageMaximum + DamageMaximum} {Item.HitRate + HitRate} {Item.CriticalLuckRate + CriticalLuckRate} {Item.CriticalRate + CriticalRate} {Ammo} {Item.MaximumAmmo} {Item.Price} -1 0 0 0"); } case EquipmentType.SecondaryWeapon: switch (classe) { case 1: return($"e_info 1 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.DamageMinimum + DamageMinimum} {Item.DamageMaximum + DamageMaximum} {Item.HitRate + HitRate} {Item.CriticalLuckRate + CriticalLuckRate} {Item.CriticalRate + CriticalRate} {Ammo} {Item.MaximumAmmo} {Item.Price} -1 0 0 0"); case 2: return($"e_info 1 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.DamageMinimum + DamageMinimum} {Item.DamageMaximum + DamageMaximum} {Item.HitRate + HitRate} {Item.CriticalLuckRate + CriticalLuckRate} {Item.CriticalRate + CriticalRate} {Ammo} {Item.MaximumAmmo} {Item.Price} -1 0 0 0"); default: return($"e_info 0 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.DamageMinimum + DamageMinimum} {Item.DamageMaximum + DamageMaximum} {Item.HitRate + HitRate} {Item.CriticalLuckRate + CriticalLuckRate} {Item.CriticalRate + CriticalRate} {Ammo} {Item.MaximumAmmo} {Item.Price} -1 0 0 0"); } } break; case ItemType.Armor: return($"e_info 2 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.CloseDefence + CloseDefence} {Item.DistanceDefence + DistanceDefence} {Item.MagicDefence + MagicDefence} {Item.DefenceDodge + DefenceDodge} {Item.Price} -1 0 0 0"); case ItemType.Fashion: switch (equipmentslot) { case EquipmentType.CostumeHat: return($"e_info 3 {ItemVNum} {Item.LevelMinimum} {Item.CloseDefence + CloseDefence} {Item.DistanceDefence + DistanceDefence} {Item.MagicDefence + MagicDefence} {Item.DefenceDodge + DefenceDodge} {Item.FireResistance + FireResistance} {Item.WaterResistance + WaterResistance} {Item.LightResistance + LightResistance} {Item.DarkResistance + DarkResistance} {Item.Price} {(Item.ItemValidTime == 0 ? -1 : 0)} 2 {(Item.ItemValidTime == 0 ? -1 : seconds / 3600)}"); case EquipmentType.CostumeSuit: return($"e_info 2 {ItemVNum} {Rare} {Upgrade} {(IsFixed ? 1 : 0)} {Item.LevelMinimum} {Item.CloseDefence + CloseDefence} {Item.DistanceDefence + DistanceDefence} {Item.MagicDefence + MagicDefence} {Item.DefenceDodge + DefenceDodge} {Item.Price} {(Item.ItemValidTime == 0 ? -1 : 0)} 1 {(Item.ItemValidTime == 0 ? -1 : seconds / 3600)}"); // 1 = IsCosmetic -1 = no shells default: return($"e_info 3 {ItemVNum} {Item.LevelMinimum} {Item.CloseDefence + CloseDefence} {Item.DistanceDefence + DistanceDefence} {Item.MagicDefence + MagicDefence} {Item.DefenceDodge + DefenceDodge} {Item.FireResistance + FireResistance} {Item.WaterResistance + WaterResistance} {Item.LightResistance + LightResistance} {Item.DarkResistance + DarkResistance} {Item.Price} {Upgrade} 0 -1"); // after Item.Price theres TimesConnected {(Item.ItemValidTime == 0 ? -1 : Item.ItemValidTime / (3600))} } case ItemType.Jewelery: switch (equipmentslot) { case EquipmentType.Amulet: return($"e_info 4 {ItemVNum} {Item.LevelMinimum} {seconds * 10} 0 0 {Item.Price}"); case EquipmentType.Fairy: return($"e_info 4 {ItemVNum} {Item.Element} {ElementRate + Item.ElementRate} 0 0 0 0 0"); // last IsNosmall default: return($"e_info 4 {ItemVNum} {Item.LevelMinimum} {Item.MaxCellonLvl} {Item.MaxCellon} {Cellon} {Item.Price}"); } case ItemType.Specialist: return($"e_info 8 {ItemVNum}"); case ItemType.Box: if (GetType() == typeof(BoxInstance)) { BoxInstance specialist = (BoxInstance)this; // 0 = NOSMATE pearl 1= npc pearl 2 = sp box 3 = raid box 4= VEHICLE pearl // 5=fairy pearl switch (subtype) { case 0: return(specialist.HoldingVNum == 0 ? $"e_info 7 {ItemVNum} 0" : $"e_info 7 {ItemVNum} 1 {specialist.HoldingVNum} {specialist.SpLevel} {specialist.XP} 100 {specialist.SpDamage} {specialist.SpDefence}"); case 2: Item spitem = ServerManager.Instance.GetItem(specialist.HoldingVNum); return(specialist.HoldingVNum == 0 ? $"e_info 7 {ItemVNum} 0" : $"e_info 7 {ItemVNum} 1 {specialist.HoldingVNum} {specialist.SpLevel} {specialist.XP} {CharacterHelper.SPXPData[specialist.SpLevel - 1]} {Upgrade} {CharacterHelper.SlPoint(specialist.SlDamage, 0)} {CharacterHelper.SlPoint(specialist.SlDefence, 1)} {CharacterHelper.SlPoint(specialist.SlElement, 2)} {CharacterHelper.SlPoint(specialist.SlHP, 3)} {CharacterHelper.SPPoint(specialist.SpLevel, Upgrade) - specialist.SlDamage - specialist.SlHP - specialist.SlElement - specialist.SlDefence} {specialist.SpStoneUpgrade} {spitem.FireResistance} {spitem.WaterResistance} {spitem.LightResistance} {spitem.DarkResistance} {specialist.SpDamage} {specialist.SpDefence} {specialist.SpElement} {specialist.SpHP} {specialist.SpFire} {specialist.SpWater} {specialist.SpLight} {specialist.SpDark}"); case 4: return(specialist.HoldingVNum == 0 ? $"e_info 11 {ItemVNum} 0" : $"e_info 11 {ItemVNum} 1 {specialist.HoldingVNum}"); case 5: Item fairyitem = ServerManager.Instance.GetItem(specialist.HoldingVNum); return(specialist.HoldingVNum == 0 ? $"e_info 12 {ItemVNum} 0" : $"e_info 12 {ItemVNum} 1 {specialist.HoldingVNum} {specialist.ElementRate + fairyitem.ElementRate}"); default: return($"e_info 8 {ItemVNum} {Design} {Rare}"); } } return($"e_info 7 {ItemVNum} 0"); case ItemType.Shell: return($"e_info 4 {ItemVNum} {Item.LevelMinimum} {Rare} {Item.Price} 0"); // 0 = Number of effects } return(string.Empty); }
public override void Use(ClientSession session, ref Inventory inventory, bool DelayUsed = false) { switch (Effect) { default: short slot = inventory.Slot; InventoryType type = inventory.Type; if (inventory == null) { return; } if (ItemValidTime > 0 && ((ItemInstance)inventory.ItemInstance).IsBound) { inventory.ItemInstance.ItemDeleteTime = DateTime.Now.AddSeconds(ItemValidTime); } if (!((ItemInstance)inventory.ItemInstance).IsBound) { if (!DelayUsed && ((EquipmentSlot == (byte)EquipmentType.Fairy && (MaxElementRate == 70 || MaxElementRate == 80)) || (EquipmentSlot == (byte)EquipmentType.CostumeHat || EquipmentSlot == (byte)EquipmentType.CostumeSuit || EquipmentSlot == (byte)EquipmentType.WeaponSkin))) { session.SendPacket($"qna #u_i^1^{session.Character.CharacterId}^{(byte)type}^{slot}^1 {Language.Instance.GetMessageFromKey("ASK_BIND")}"); return; } else if (DelayUsed) { inventory.ItemInstance.BoundCharacterId = session.Character.CharacterId; } } double timeSpanSinceLastSpUsage = (DateTime.Now - Process.GetCurrentProcess().StartTime.AddSeconds(-50)).TotalSeconds - session.Character.LastSp; if (EquipmentSlot == (byte)EquipmentType.Sp && inventory.ItemInstance.Rare == -2) { session.SendPacket(session.Character.GenerateMsg(Language.Instance.GetMessageFromKey("CANT_EQUIP_DESTROYED_SP"), 0)); return; } if (EquipmentSlot == (byte)EquipmentType.Sp && timeSpanSinceLastSpUsage <= session.Character.SpCooldown && session.Character.EquipmentList.LoadInventoryBySlotAndType((byte)EquipmentType.Sp, InventoryType.Sp) != null) { session.SendPacket(session.Character.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("SP_INLOADING"), session.Character.SpCooldown - (int)Math.Round(timeSpanSinceLastSpUsage)), 0)); return; } if ((ItemType != (byte)Domain.ItemType.Weapon && ItemType != (byte)Domain.ItemType.Armor && ItemType != (byte)Domain.ItemType.Fashion && ItemType != (byte)Domain.ItemType.Jewelery && ItemType != (byte)Domain.ItemType.Specialist) || LevelMinimum > (IsHeroic ? session.Character.HeroLevel : session.Character.Level) || (Sex != 0 && Sex != session.Character.Gender + 1) || ((ItemType != (byte)Domain.ItemType.Jewelery && EquipmentSlot != (byte)EquipmentType.Boots && EquipmentSlot != (byte)EquipmentType.Gloves) && ((Class >> session.Character.Class) & 1) != 1)) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("BAD_EQUIPMENT"), 10)); return; } if (session.Character.UseSp) { SpecialistInstance sp = session.Character.EquipmentList.LoadBySlotAndType <SpecialistInstance>( (byte)EquipmentType.Sp, InventoryType.Equipment); if (sp.Item.Element != 0 && EquipmentSlot == (byte)EquipmentType.Fairy && Element != sp.Item.Element && Element != sp.Item.SecondaryElement) { session.SendPacket(session.Character.GenerateMsg(Language.Instance.GetMessageFromKey("BAD_FAIRY"), 0)); return; } } if (session.Character.UseSp && EquipmentSlot == (byte)EquipmentType.Sp) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("SP_BLOCKED"), 10)); return; } if (session.Character.JobLevel < LevelJobMinimum) { session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("LOW_JOB_LVL"), 10)); return; } Inventory equip = session.Character.EquipmentList.LoadInventoryBySlotAndType(EquipmentSlot, InventoryType.Equipment); if (EquipmentSlot == (byte)EquipmentType.Amulet) { session.SendPacket(session.Character.GenerateEff(39)); inventory.ItemInstance.BoundCharacterId = session.Character.CharacterId; } if (equip == null) { session.Character.EquipmentList.AddToInventoryWithSlotAndType(inventory.ItemInstance as ItemInstance, InventoryType.Equipment, EquipmentSlot); session.SendPacket(session.Character.GenerateInventoryAdd(-1, 0, type, slot, 0, 0, 0, 0)); session.Character.InventoryList.DeleteFromSlotAndType(inventory.Slot, inventory.Type); session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMap?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMap?.Broadcast(session.Character.GeneratePairy()); } else { session.Character.InventoryList.DeleteFromSlotAndType(inventory.Slot, inventory.Type); session.Character.EquipmentList.DeleteFromSlotAndType(equip.Slot, equip.Type); session.SendPacket(session.Character.GenerateInventoryAdd(-1, 0, type, slot, 0, 0, 0, 0)); session.Character.EquipmentList.AddToInventoryWithSlotAndType(inventory.ItemInstance as ItemInstance, InventoryType.Equipment, EquipmentSlot); session.Character.InventoryList.AddToInventoryWithSlotAndType(equip.ItemInstance as ItemInstance, type, slot); session.SendPacket(session.Character.GenerateInventoryAdd(equip.ItemInstance.ItemVNum, equip.ItemInstance.Amount, type, slot, equip.ItemInstance.Rare, equip.ItemInstance.Design, equip.ItemInstance.Upgrade, 0)); session.SendPacket(session.Character.GenerateStatChar()); session.CurrentMap?.Broadcast(session.Character.GenerateEq()); session.SendPacket(session.Character.GenerateEquipment()); session.CurrentMap?.Broadcast(session.Character.GeneratePairy()); } if (EquipmentSlot == (byte)EquipmentType.Fairy) { WearableInstance fairy = session.Character.EquipmentList.LoadBySlotAndType <WearableInstance>((byte)EquipmentType.Fairy, InventoryType.Equipment); session.SendPacket(session.Character.GenerateSay(String.Format(Language.Instance.GetMessageFromKey("FAIRYSTATS"), fairy.XP, CharacterHelper.LoadFairyXpData((fairy.ElementRate + fairy.Item.ElementRate))), 10)); } break; } }