/// <summary> /// Make an update to the weapon /// </summary> /// <param name="type">Level, EXP, Durability</param> /// <param name="value">value to add</param> public void UpdateWeaponInfo(Packets.Server.WeaponAdjust.Function type, uint value) { Packets.Server.WeaponAdjust p = new SagaMap.Packets.Server.WeaponAdjust(); p.SetFunction(type); p.SetValue(value); this.netIO.SendPacket(p, this.SessionID); }
public void OnWeaponUpgrade(Packets.Client.WeaponUpgrade p) { Weapon weapon = WeaponFactory.GetActiveWeapon(this.Char); int price = 0; if (weapon.exp >= ExperienceManager.Instance.GetExpForLevel(weapon.level, ExperienceManager.LevelType.WLEVEL)) { for (int i = 1; i <= weapon.level; i++) { int value = (i / 5) + 1; int multpler = value * 25; int rest = i % 5; if (rest != 0) { price += multpler; } else { if ((i % 10) != 0) { int amount = 150 + ((value - 2) / 2) * 300; price += amount; } else { int amount = 400; value = (i / 10); for (int j = 1; j < value; j++) { amount = amount + 300 + 600 * j; } price += amount; } } } weapon.level += 1; this.Char.zeny -= (uint)price; Packets.Server.WeaponAdjust p1 = new SagaMap.Packets.Server.WeaponAdjust(); p1.SetFunction(SagaMap.Packets.Server.WeaponAdjust.Function.Level); p1.SetValue(weapon.level); this.netIO.SendPacket(p1, this.SessionID); this.SendZeny(); this.SendBattleStatus(); Packet p2 = new Packet(); p2.data = new byte[5]; p2.ID = 0x0517;//don't know its function,maybe to close the window? this.netIO.SendPacket(p2, this.SessionID); } }
public void OnWeaponUpgrade(Packets.Client.WeaponUpgrade p) { Weapon weapon = WeaponFactory.GetActiveWeapon(this.Char); int price = 0; if (weapon.exp >= ExperienceManager.Instance.GetExpForLevel(weapon.level, ExperienceManager.LevelType.WLEVEL)) { for (int i = 1; i <= weapon.level; i++) { int value = (i / 5) + 1; int multpler = value * 25; int rest = i % 5; if (rest != 0) price += multpler; else { if ((i % 10) != 0) { int amount = 150 + ((value - 2) / 2) * 300; price += amount; } else { int amount = 400; value = (i / 10); for (int j = 1; j < value; j++) { amount = amount + 300 + 600 * j; } price += amount; } } } weapon.level += 1; this.Char.zeny -= (uint)price; Packets.Server.WeaponAdjust p1 = new SagaMap.Packets.Server.WeaponAdjust(); p1.SetFunction(SagaMap.Packets.Server.WeaponAdjust.Function.Level); p1.SetValue(weapon.level); this.netIO.SendPacket(p1, this.SessionID); this.SendZeny(); this.SendBattleStatus(); Packet p2 = new Packet(); p2.data = new byte[5]; p2.ID = 0x0517;//don't know its function,maybe to close the window? this.netIO.SendPacket(p2, this.SessionID); } }