public int GetSlHp(ClientSession session, SpecialistInstance specialistInstance) { int slHp = CharacterHelper.Instance.SlPoint(specialistInstance.SlHP, 3); if (session == null) { return(slHp); } slHp += session.Character.GetMostValueEquipmentBuff(BCardType.CardType.SPSL, (byte)AdditionalTypes.SPSL.HPMP) + session.Character.GetMostValueEquipmentBuff(BCardType.CardType.SPSL, (byte)AdditionalTypes.SPSL.All); slHp = slHp > 100 ? 100 : slHp; return(slHp); }
public string GenerateStashPacket() { string packet = $"{Slot}.{ItemVNum}.{(byte)Item.Type}"; switch (Item.Type) { case InventoryType.Equipment: return(packet + $".{Amount}.{Rare}.{Upgrade}"); case InventoryType.Specialist: SpecialistInstance sp = this as SpecialistInstance; return(packet + $".{Upgrade}.{sp?.SpStoneUpgrade ?? 0}.0"); default: return(packet + $".{Amount}.0.0"); } }
public int GetSlElement(ClientSession session, SpecialistInstance specialistInstance) { int slElement = CharacterHelper.Instance.SlPoint(specialistInstance.SlElement, 2); if (session == null) { return(slElement); } slElement += session.Character.GetMostValueEquipmentBuff(BCardType.CardType.SPSL, (byte)AdditionalTypes.SPSL.Element) + session.Character.GetMostValueEquipmentBuff(BCardType.CardType.SPSL, (byte)AdditionalTypes.SPSL.All); slElement = slElement > 100 ? 100 : slElement; return(slElement); }
public int GetSlDefense(ClientSession session, SpecialistInstance specialistInstance) { int slDefence = CharacterHelper.Instance.SlPoint(specialistInstance.SlDefence, 1); if (session == null) { return(slDefence); } slDefence += session.Character.GetMostValueEquipmentBuff(BCardType.CardType.SPSL, (byte)AdditionalTypes.SPSL.Defense) + session.Character.GetMostValueEquipmentBuff(BCardType.CardType.SPSL, (byte)AdditionalTypes.SPSL.All); slDefence = slDefence > 100 ? 100 : slDefence; return(slDefence); }
public void PerfectSp() { short[] upsuccess = { 50, 40, 30, 20, 10 }; int[] goldprice = { 5000, 10000, 20000, 50000, 100000 }; short[] stoneprice = { 1, 2, 3, 4, 5 }; short stonevnum; byte upmode = 1; switch (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 (SpStoneUpgrade > 99) { return; } if (SpStoneUpgrade > 80) { upmode = 5; } else if (SpStoneUpgrade > 60) { upmode = 4; } else if (SpStoneUpgrade > 40) { upmode = 3; } else if (SpStoneUpgrade > 20) { upmode = 2; } if (IsFixed) { return; } if (CharacterSession.Character.Gold < goldprice[upmode - 1]) { return; } if (CharacterSession.Character.Inventory.CountItem(stonevnum) < stoneprice[upmode - 1]) { return; } SpecialistInstance specialist = CharacterSession.Character.Inventory.LoadByItemInstance <SpecialistInstance>(Id); if (specialist == null) { return; } int rnd = ServerManager.Instance.RandomNumber(); if (rnd < upsuccess[upmode - 1]) { byte type = (byte)ServerManager.Instance.RandomNumber(0, 16), count = 1; if (upmode == 4) { count = 2; } if (upmode == 5) { count = (byte)ServerManager.Instance.RandomNumber(3, 6); } CharacterSession.CurrentMapInstance.Broadcast(CharacterSession.Character.GenerateEff(3005), CharacterSession.Character.MapX, CharacterSession.Character.MapY); if (type < 3) { specialist.SpDamage += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_ATTACK"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_ATTACK"), count), 0)); } else if (type < 6) { specialist.SpDefence += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_DEFENSE"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_DEFENSE"), count), 0)); } else if (type < 9) { specialist.SpElement += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_ELEMENT"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_ELEMENT"), count), 0)); } else if (type < 12) { specialist.SpHP += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_HPMP"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_HPMP"), count), 0)); } else if (type == 12) { specialist.SpFire += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_FIRE"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_FIRE"), count), 0)); } else if (type == 13) { specialist.SpWater += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_WATER"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_WATER"), count), 0)); } else if (type == 14) { specialist.SpLight += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_LIGHT"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_LIGHT"), count), 0)); } else if (type == 15) { specialist.SpDark += count; CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_SHADOW"), count), 12)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("PERFECTSP_SUCCESS"), Language.Instance.GetMessageFromKey("PERFECTSP_SHADOW"), count), 0)); } specialist.SpStoneUpgrade++; } else { CharacterSession.SendPacket(CharacterSession.Character.GenerateSay(Language.Instance.GetMessageFromKey("PERFECTSP_FAILURE"), 11)); CharacterSession.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("PERFECTSP_FAILURE"), 0)); } CharacterSession.SendPacket(specialist.GenerateInventoryAdd()); CharacterSession.Character.Gold -= goldprice[upmode - 1]; CharacterSession.SendPacket(CharacterSession.Character.GenerateGold()); CharacterSession.Character.Inventory.RemoveItemAmount(stonevnum, stoneprice[upmode - 1]); CharacterSession.SendPacket("shop_end 1"); }
public void RestorePoints(ClientSession session, SpecialistInstance specialistInstance) { int slHit = specialistInstance.GetSlHit(session, specialistInstance); int slDefence = specialistInstance.GetSlDefense(session, specialistInstance); int slElement = specialistInstance.GetSlElement(session, specialistInstance); int slHp = specialistInstance.GetSlHp(session, specialistInstance); #region slHit specialistInstance.DamageMinimum = 0; specialistInstance.DamageMaximum = 0; specialistInstance.HitRate = 0; specialistInstance.CriticalLuckRate = 0; specialistInstance.CriticalRate = 0; specialistInstance.DefenceDodge = 0; specialistInstance.DistanceDefenceDodge = 0; specialistInstance.ElementRate = 0; specialistInstance.DarkResistance = 0; specialistInstance.LightResistance = 0; specialistInstance.FireResistance = 0; specialistInstance.WaterResistance = 0; specialistInstance.CriticalDodge = 0; specialistInstance.CloseDefence = 0; specialistInstance.DistanceDefence = 0; specialistInstance.MagicDefence = 0; specialistInstance.HP = 0; specialistInstance.MP = 0; if (slHit >= 1) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHit >= 10) { specialistInstance.HitRate += 10; } if (slHit >= 20) { specialistInstance.CriticalLuckRate += 2; } if (slHit >= 30) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; specialistInstance.HitRate += 10; } if (slHit >= 40) { specialistInstance.CriticalRate += 10; } if (slHit >= 50) { specialistInstance.HP += 200; specialistInstance.MP += 200; } if (slHit >= 60) { specialistInstance.HitRate += 15; } if (slHit >= 70) { specialistInstance.HitRate += 15; specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHit >= 80) { specialistInstance.CriticalLuckRate += 3; } if (slHit >= 90) { specialistInstance.CriticalRate += 20; } if (slHit >= 100) { specialistInstance.CriticalLuckRate += 3; specialistInstance.CriticalRate += 20; specialistInstance.HP += 200; specialistInstance.MP += 200; specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; specialistInstance.HitRate += 20; } #endregion #region slDefence if (slDefence >= 10) { specialistInstance.DefenceDodge += 5; specialistInstance.DistanceDefenceDodge += 5; } if (slDefence >= 20) { specialistInstance.CriticalDodge += 2; } if (slDefence >= 30) { specialistInstance.HP += 100; } if (slDefence >= 40) { specialistInstance.CriticalDodge += 2; } if (slDefence >= 50) { specialistInstance.DefenceDodge += 5; specialistInstance.DistanceDefenceDodge += 5; } if (slDefence >= 60) { specialistInstance.HP += 200; } if (slDefence >= 70) { specialistInstance.CriticalDodge += 3; } if (slDefence >= 75) { specialistInstance.FireResistance += 2; specialistInstance.WaterResistance += 2; specialistInstance.LightResistance += 2; specialistInstance.DarkResistance += 2; } if (slDefence >= 80) { specialistInstance.DefenceDodge += 10; specialistInstance.DistanceDefenceDodge += 10; specialistInstance.CriticalDodge += 3; } if (slDefence >= 90) { specialistInstance.FireResistance += 3; specialistInstance.WaterResistance += 3; specialistInstance.LightResistance += 3; specialistInstance.DarkResistance += 3; } if (slDefence >= 95) { specialistInstance.HP += 300; } if (slDefence >= 100) { specialistInstance.DefenceDodge += 20; specialistInstance.DistanceDefenceDodge += 20; specialistInstance.FireResistance += 5; specialistInstance.WaterResistance += 5; specialistInstance.LightResistance += 5; specialistInstance.DarkResistance += 5; } #endregion #region slHp if (slHp >= 5) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHp >= 10) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHp >= 15) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHp >= 20) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; specialistInstance.CloseDefence += 10; specialistInstance.DistanceDefence += 10; specialistInstance.MagicDefence += 10; } if (slHp >= 25) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHp >= 30) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHp >= 35) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; } if (slHp >= 40) { specialistInstance.DamageMinimum += 5; specialistInstance.DamageMaximum += 5; specialistInstance.CloseDefence += 15; specialistInstance.DistanceDefence += 15; specialistInstance.MagicDefence += 15; } if (slHp >= 45) { specialistInstance.DamageMinimum += 10; specialistInstance.DamageMaximum += 10; } if (slHp >= 50) { specialistInstance.DamageMinimum += 10; specialistInstance.DamageMaximum += 10; specialistInstance.FireResistance += 2; specialistInstance.WaterResistance += 2; specialistInstance.LightResistance += 2; specialistInstance.DarkResistance += 2; } if (slHp >= 55) { specialistInstance.DamageMinimum += 10; specialistInstance.DamageMaximum += 10; } if (slHp >= 60) { specialistInstance.DamageMinimum += 10; specialistInstance.DamageMaximum += 10; } if (slHp >= 65) { specialistInstance.DamageMinimum += 10; specialistInstance.DamageMaximum += 10; } if (slHp >= 70) { specialistInstance.DamageMinimum += 10; specialistInstance.DamageMaximum += 10; specialistInstance.CloseDefence += 20; specialistInstance.DistanceDefence += 20; specialistInstance.MagicDefence += 20; } if (slHp >= 75) { specialistInstance.DamageMinimum += 15; specialistInstance.DamageMaximum += 15; } if (slHp >= 80) { specialistInstance.DamageMinimum += 15; specialistInstance.DamageMaximum += 15; } if (slHp >= 85) { specialistInstance.DamageMinimum += 15; specialistInstance.DamageMaximum += 15; specialistInstance.CriticalDodge += 1; } if (slHp >= 86) { specialistInstance.CriticalDodge += 1; } if (slHp >= 87) { specialistInstance.CriticalDodge += 1; } if (slHp >= 88) { specialistInstance.CriticalDodge += 1; } if (slHp >= 90) { specialistInstance.DamageMinimum += 15; specialistInstance.DamageMaximum += 15; specialistInstance.CloseDefence += 25; specialistInstance.DistanceDefence += 25; specialistInstance.MagicDefence += 25; } if (slHp >= 91) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 92) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 93) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 94) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 95) { specialistInstance.DamageMinimum += 20; specialistInstance.DamageMaximum += 20; specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 96) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 97) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 98) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 99) { specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; } if (slHp >= 100) { specialistInstance.FireResistance += 3; specialistInstance.WaterResistance += 3; specialistInstance.LightResistance += 3; specialistInstance.DarkResistance += 3; specialistInstance.CloseDefence += 30; specialistInstance.DistanceDefence += 30; specialistInstance.MagicDefence += 30; specialistInstance.DamageMinimum += 20; specialistInstance.DamageMaximum += 20; specialistInstance.DefenceDodge += 2; specialistInstance.DistanceDefenceDodge += 2; specialistInstance.CriticalDodge += 1; } #endregion #region slElement if (slElement >= 1) { specialistInstance.ElementRate += 2; } if (slElement >= 10) { specialistInstance.MP += 100; } if (slElement >= 20) { specialistInstance.MagicDefence += 5; } if (slElement >= 30) { specialistInstance.FireResistance += 2; specialistInstance.WaterResistance += 2; specialistInstance.LightResistance += 2; specialistInstance.DarkResistance += 2; specialistInstance.ElementRate += 2; } if (slElement >= 40) { specialistInstance.MP += 100; } if (slElement >= 50) { specialistInstance.MagicDefence += 5; } if (slElement >= 60) { specialistInstance.FireResistance += 3; specialistInstance.WaterResistance += 3; specialistInstance.LightResistance += 3; specialistInstance.DarkResistance += 3; specialistInstance.ElementRate += 2; } if (slElement >= 70) { specialistInstance.MP += 100; } if (slElement >= 80) { specialistInstance.MagicDefence += 5; } if (slElement >= 90) { specialistInstance.FireResistance += 4; specialistInstance.WaterResistance += 4; specialistInstance.LightResistance += 4; specialistInstance.DarkResistance += 4; specialistInstance.ElementRate += 2; } if (slElement >= 100) { specialistInstance.FireResistance += 6; specialistInstance.WaterResistance += 6; specialistInstance.LightResistance += 6; specialistInstance.DarkResistance += 6; specialistInstance.MagicDefence += 5; specialistInstance.MP += 200; specialistInstance.ElementRate += 2; } #endregion }