diff --git a/Client/Controls/DXItemCell.cs b/Client/Controls/DXItemCell.cs index 421f577..8c9fafa 100644 --- a/Client/Controls/DXItemCell.cs +++ b/Client/Controls/DXItemCell.cs @@ -1535,6 +1535,9 @@ public bool UseItem() case ItemType.Shoes: GameScene.Game.CharacterBox.Grid[(int)EquipmentSlot.Shoes].ToEquipment(this); break; + case ItemType.Belt: + GameScene.Game.CharacterBox.Grid[(int)EquipmentSlot.Belt].ToEquipment(this); + break; case ItemType.Poison: GameScene.Game.CharacterBox.Grid[(int)EquipmentSlot.Poison].ToEquipment(this); break; @@ -1704,6 +1707,7 @@ private void PlayItemSound() DXSoundManager.Play(SoundIndex.ItemRing); break; case ItemType.Shoes: + case ItemType.Belt: DXSoundManager.Play(SoundIndex.ItemShoes); break; case ItemType.Consumable: diff --git a/Client/Envir/CConnection.cs b/Client/Envir/CConnection.cs index 096432f..71de586 100644 --- a/Client/Envir/CConnection.cs +++ b/Client/Envir/CConnection.cs @@ -4083,7 +4083,7 @@ public void Process(S.DataObjectMonster p) MonsterInfo = p.MonsterInfo, Health = p.Health, - MaxHealth = (long)p.Stats[Stat.Health] + p.Stats[Stat.HealthCount] * int.MaxValue, + MaxHealth = p.MaximumHealth, Stats = p.Stats, Dead = p.Dead, diff --git a/Client/Scenes/GameScene.cs b/Client/Scenes/GameScene.cs index 2d82383..b4db3ed 100644 --- a/Client/Scenes/GameScene.cs +++ b/Client/Scenes/GameScene.cs @@ -1531,6 +1531,7 @@ private void CreateItemLabel() case ItemType.Bracelet: case ItemType.Ring: case ItemType.Shoes: + case ItemType.Belt: case ItemType.Poison: case ItemType.Amulet: if (User.WearWeight - (Equipment[(int)EquipmentSlot.Armour]?.Info.Weight ?? 0) + MouseItem.Info.Weight > User.Stats[Stat.WearWeight]) @@ -2002,7 +2003,7 @@ private void CreateItemLabel() str += "-Weapon" + Environment.NewLine + "-Necklace" + Environment.NewLine + "-Bracelet" + Environment.NewLine + "-Ring"; break; case 2: - str += "-Armour" + Environment.NewLine + "-Shield" + Environment.NewLine + "-Helmet" + Environment.NewLine + "-Bracelet" + Environment.NewLine + "-Ring" + Environment.NewLine + "-Shoes"; + str += "-Armour" + Environment.NewLine + "-Shield" + Environment.NewLine + "-Helmet" + Environment.NewLine + "-Bracelet" + Environment.NewLine + "-Ring" + Environment.NewLine + "-Shoes" + Environment.NewLine + "-Belt"; break; default: str += "-All Items"; diff --git a/Client/Scenes/Views/CharacterDialog.cs b/Client/Scenes/Views/CharacterDialog.cs index c58e25a..3306441 100644 --- a/Client/Scenes/Views/CharacterDialog.cs +++ b/Client/Scenes/Views/CharacterDialog.cs @@ -281,7 +281,7 @@ public CharacterDialog() Grid[(int)EquipmentSlot.Wings] = cell = new DXItemCell { - Location = new Point(15, 300), + Location = new Point(15, 180), Parent = CharacterTab, FixedBorder = true, Border = true, @@ -291,6 +291,18 @@ public CharacterDialog() }; //cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 104); + Grid[(int)EquipmentSlot.Belt] = cell = new DXItemCell + { + Location = new Point(15, 300), + Parent = CharacterTab, + FixedBorder = true, + Border = true, + ItemGrid = GameScene.Game.Equipment, + Slot = (int)EquipmentSlot.Belt, + GridType = GridType.Equipment, + }; + //cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 36); + Grid[(int)EquipmentSlot.Shoes] = cell = new DXItemCell { diff --git a/Client/Scenes/Views/InspectDialog.cs b/Client/Scenes/Views/InspectDialog.cs index c9363b7..7beb99e 100644 --- a/Client/Scenes/Views/InspectDialog.cs +++ b/Client/Scenes/Views/InspectDialog.cs @@ -281,7 +281,7 @@ public InspectDialog() Grid[(int)EquipmentSlot.Wings] = cell = new DXItemCell { - Location = new Point(15, 300), + Location = new Point(15, 180), Parent = CharacterTab, FixedBorder = true, Border = true, @@ -292,6 +292,19 @@ public InspectDialog() }; //cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 104); + Grid[(int)EquipmentSlot.Belt] = cell = new DXItemCell + { + Location = new Point(15, 300), + Parent = CharacterTab, + FixedBorder = true, + Border = true, + Slot = (int)EquipmentSlot.Belt, + ItemGrid = Equipment, + GridType = GridType.Inspect, + ReadOnly = true, + }; + //cell.BeforeDraw += (o, e) => Draw((DXItemCell)o, 36); + Grid[(int)EquipmentSlot.Shoes] = cell = new DXItemCell { Location = new Point(95, 300), diff --git a/Client/Scenes/Views/NPCDialog.cs b/Client/Scenes/Views/NPCDialog.cs index 230bf1e..ad7d28d 100644 --- a/Client/Scenes/Views/NPCDialog.cs +++ b/Client/Scenes/Views/NPCDialog.cs @@ -868,6 +868,7 @@ public void OnGoodChanged(NPCGood oValue, NPCGood nValue) case ItemType.Ring: case ItemType.Shoes: case ItemType.Book: + case ItemType.Belt: ItemCell.Item.Flags |= UserItemFlags.NonRefinable; break; } @@ -904,6 +905,7 @@ public void OnGoodChanged(NPCGood oValue, NPCGood nValue) case ItemType.Poison: case ItemType.Amulet: case ItemType.DarkStone: + case ItemType.Belt: if (GameScene.Game.CanUseItem(ItemCell.Item)) { @@ -1036,6 +1038,7 @@ public void UpdateColours() case ItemType.Poison: case ItemType.Amulet: case ItemType.DarkStone: + case ItemType.Belt: RequirementLabel.ForeColour = GameScene.Game.CanUseItem(ItemCell.Item) ? Color.Aquamarine : Color.Red; break; } diff --git a/Library/Enum.cs b/Library/Enum.cs index 179f569..ea00557 100644 --- a/Library/Enum.cs +++ b/Library/Enum.cs @@ -109,6 +109,7 @@ public enum EquipmentSlot Emblem = 14, Shield = 15, Wings = 16, + Belt = 17, } public enum CompanionSlot @@ -340,6 +341,7 @@ public enum ItemType : byte Wings, Gem, Orb, + Belt, } public enum MirAction : byte diff --git a/Library/Functions.cs b/Library/Functions.cs index 0cc8784..541d480 100644 --- a/Library/Functions.cs +++ b/Library/Functions.cs @@ -458,6 +458,8 @@ public static bool CorrectSlot(ItemType type, EquipmentSlot slot) return type == ItemType.Shield; case EquipmentSlot.Wings: return type == ItemType.Wings; + case EquipmentSlot.Belt: + return type == ItemType.Belt; default: return false; } diff --git a/Library/Globals.cs b/Library/Globals.cs index 1779904..9bf0f78 100644 --- a/Library/Globals.cs +++ b/Library/Globals.cs @@ -404,7 +404,7 @@ public static long public const int InventorySize = 196, - EquipmentSize = 17, + EquipmentSize = 18, CompanionInventorySize = 40, CompanionEquipmentSize = 4, PartsStorageOffset = 2000, @@ -714,6 +714,7 @@ public bool CanFragment() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: break; default: return false; @@ -737,6 +738,7 @@ public int FragmentCost() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Info.RequiredAmount * 10000 / 9; /* case ItemType.Helmet: case ItemType.Necklace: @@ -759,6 +761,7 @@ public int FragmentCost() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Info.RequiredAmount * 10000 / 2; /* case ItemType.Helmet: case ItemType.Necklace: @@ -784,6 +787,7 @@ public int FragmentCost() case ItemType.Emblem: return 150000; case ItemType.Shoes: + case ItemType.Belt: return 30000; default: return 0; @@ -808,6 +812,7 @@ public int FragmentCount() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Math.Max(1, Info.RequiredAmount / 2 + 5); /* case ItemType.Helmet: return Math.Max(1, (Info.RequiredAmount - 30) / 6); @@ -834,6 +839,7 @@ public int FragmentCount() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Math.Max(1, Info.RequiredAmount / 2 + 5); /* case ItemType.Helmet: return Math.Max(1, (Info.RequiredAmount - 30) / 6); @@ -863,6 +869,7 @@ public int FragmentCount() case ItemType.Emblem: return 10; case ItemType.Shoes: + case ItemType.Belt: return 3; default: return 0; diff --git a/Library/Network/ServerPackets.cs b/Library/Network/ServerPackets.cs index b50e0f2..3cc007d 100644 --- a/Library/Network/ServerPackets.cs +++ b/Library/Network/ServerPackets.cs @@ -1202,6 +1202,7 @@ public sealed class DataObjectMonster : Packet public string PetOwner { get; set; } public long Health { get; set; } + public long MaximumHealth { get; set; } public Stats Stats { get; set; } public bool Dead { get; set; } diff --git a/Server/DBModels/UserItem.cs b/Server/DBModels/UserItem.cs index 16a0012..17dbdb9 100644 --- a/Server/DBModels/UserItem.cs +++ b/Server/DBModels/UserItem.cs @@ -594,6 +594,7 @@ public bool CanFragment() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: break; default: return false; @@ -617,6 +618,7 @@ public int FragmentCost() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Info.RequiredAmount * 10000 / 9; /* case ItemType.Helmet: case ItemType.Necklace: @@ -639,6 +641,7 @@ public int FragmentCost() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Info.RequiredAmount * 10000 / 2; /* case ItemType.Helmet: case ItemType.Necklace: @@ -664,6 +667,7 @@ public int FragmentCost() case ItemType.Emblem: return 150000; case ItemType.Shoes: + case ItemType.Belt: return 30000; default: return 0; @@ -688,6 +692,7 @@ public int FragmentCount() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Math.Max(1, Info.RequiredAmount / 2 + 5); /* case ItemType.Helmet: return Math.Max(1, (Info.RequiredAmount - 30) / 6); @@ -714,6 +719,7 @@ public int FragmentCount() case ItemType.Shoes: case ItemType.Shield: case ItemType.Emblem: + case ItemType.Belt: return Math.Max(1, Info.RequiredAmount / 2 + 5); /* case ItemType.Helmet: return Math.Max(1, (Info.RequiredAmount - 30) / 6); @@ -743,6 +749,7 @@ public int FragmentCount() case ItemType.Emblem: return 10; case ItemType.Shoes: + case ItemType.Belt: return 3; default: return 0; diff --git a/Server/Envir/SEnvir.cs b/Server/Envir/SEnvir.cs index 926bc71..7a1be99 100644 --- a/Server/Envir/SEnvir.cs +++ b/Server/Envir/SEnvir.cs @@ -1751,6 +1751,9 @@ public static UserItem CreateDropItem(ItemInfo info, int chance = 2) case ItemType.Shoes: UpgradeShoes(item); break; + case ItemType.Belt: + UpgradeBelt(item); + break; } item.StatsChanged(); } @@ -1765,6 +1768,7 @@ public static UserItem CreateDropItem(ItemInfo info, int chance = 2) case ItemType.Bracelet: case ItemType.Ring: case ItemType.Shoes: + case ItemType.Belt: item.CurrentDurability = Math.Min(Random.Next(info.Durability) + 1000, item.MaxDurability); break; case ItemType.Meat: @@ -2750,7 +2754,135 @@ public static void UpgradeShoes(UserItem item) item.AddStat(element, -1, StatSource.Added); } } - + + public static void UpgradeBelt(UserItem item) + { + if (Random.Next(10) < 9) + { + float value = 0.04F; + + if (Random.Next(7) == 0) + value += 0.04F; + + if (Random.Next(30) == 0) + value += 0.02F; + + item.AddStat(Stat.MaxAC, (int)(item.Info.Stats[Stat.MaxAC] * value), StatSource.Added); + } + + if (Random.Next(10) < 9) + { + float value = 0.04F; + + if (Random.Next(7) == 0) + value += 0.04F; + + if (Random.Next(30) == 0) + value += 0.02F; + + item.AddStat(Stat.MaxMR, (int)(item.Info.Stats[Stat.MaxMR] * value), StatSource.Added); + } + + if (Random.Next(10) < 9) + { + int value = 1; + + if (Random.Next(12) == 0) + value += 1; + + if (Random.Next(30) == 0) + value += 1; + + item.AddStat(Stat.Comfort, value, StatSource.Added); + } + + + List Elements = new List + { + Stat.FireResistance, Stat.IceResistance, Stat.LightningResistance, Stat.WindResistance, + Stat.HolyResistance, Stat.DarkResistance, + Stat.PhantomResistance, Stat.PhysicalResistance, + }; + if (Random.Next(10) == 0) + { + Stat element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, 1, StatSource.Added); + + if (Random.Next(2) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, -1, StatSource.Added); + } + + if (Random.Next(45) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, 1, StatSource.Added); + + if (Random.Next(2) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, -1, StatSource.Added); + } + + if (Random.Next(60) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, 1, StatSource.Added); + + if (Random.Next(2) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, -1, StatSource.Added); + } + + } + else if (Random.Next(60) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, -1, StatSource.Added); + } + } + else if (Random.Next(45) == 0) + { + element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, -1, StatSource.Added); + } + } + else if (Random.Next(10) == 0) + { + Stat element = Elements[Random.Next(Elements.Count)]; + + Elements.Remove(element); + + item.AddStat(element, -1, StatSource.Added); + } + } + public static void Login(C.Login p, SConnection con) { AccountInfo account = null; diff --git a/Server/Models/Map.cs b/Server/Models/Map.cs index 7fba1ed..19ab5d1 100644 --- a/Server/Models/Map.cs +++ b/Server/Models/Map.cs @@ -897,6 +897,7 @@ public Cell GetMovement(MapObject ob) player.SpecialRepair(EquipmentSlot.RingL); player.SpecialRepair(EquipmentSlot.RingR); player.SpecialRepair(EquipmentSlot.Shoes); + player.SpecialRepair(EquipmentSlot.Belt); player.RefreshStats(); break; diff --git a/Server/Models/MonsterObject.cs b/Server/Models/MonsterObject.cs index 0ce95f5..60a93fd 100644 --- a/Server/Models/MonsterObject.cs +++ b/Server/Models/MonsterObject.cs @@ -745,7 +745,7 @@ public override void RefreshStats() MoveDelay = MonsterInfo.MoveDelay; AttackDelay = MonsterInfo.AttackDelay; - MaximumHP = (long)Stats[Stat.Health] + Stats[Stat.HealthCount] * int.MaxValue; + MaximumHP = Stats[Stat.Health] + (long)Stats[Stat.HealthCount] * int.MaxValue; if (SummonLevel > 0) { @@ -3185,6 +3185,7 @@ public override Packet GetDataPacket(PlayerObject ob) CurrentLocation = CurrentLocation, Health = DisplayHP, + MaximumHealth = MaximumHP, Stats = Stats, Dead = Dead, diff --git a/Server/Models/PlayerObject.cs b/Server/Models/PlayerObject.cs index a21d6e8..afe4136 100644 --- a/Server/Models/PlayerObject.cs +++ b/Server/Models/PlayerObject.cs @@ -2872,7 +2872,7 @@ public override void RefreshStats() Stats[Stat.DropRate] += 20 * Stats[Stat.Rebirth]; Stats[Stat.GoldRate] += 20 * Stats[Stat.Rebirth]; - MaximumHP = Stats[Stat.Health] + Stats[Stat.HealthCount] * int.MaxValue; + MaximumHP = Stats[Stat.Health] + (long)Stats[Stat.HealthCount] * int.MaxValue; Enqueue(new S.StatsUpdate { Stats = Stats, HermitStats = Character.HermitStats, HermitPoints = Math.Max(0, (Level - 39) * 3 - Character.SpentPoints) }); @@ -6100,6 +6100,7 @@ public void ItemUse(CellLinkInfo link) work = SpecialRepair(EquipmentSlot.RingL) || work; work = SpecialRepair(EquipmentSlot.RingR) || work; work = SpecialRepair(EquipmentSlot.Shoes) || work; + work = SpecialRepair(EquipmentSlot.Belt) || work; if (!work) return; RefreshStats(); @@ -6119,6 +6120,7 @@ public void ItemUse(CellLinkInfo link) work = SpecialRepair(EquipmentSlot.Helmet); work = SpecialRepair(EquipmentSlot.Armour) || work; work = SpecialRepair(EquipmentSlot.Shoes) || work; + work = SpecialRepair(EquipmentSlot.Belt) || work; if (!work) return; RefreshStats(); @@ -7688,13 +7690,13 @@ public void ItemUpgrade(C.ItemUpgrade p) switch (fromItem.Info.Shape) { default: - success = totype == ItemType.Weapon || totype == ItemType.Armour || totype == ItemType.Helmet || totype == ItemType.Necklace || totype == ItemType.Bracelet || totype == ItemType.Ring || totype == ItemType.Shoes; + success = totype == ItemType.Weapon || totype == ItemType.Armour || totype == ItemType.Helmet || totype == ItemType.Necklace || totype == ItemType.Bracelet || totype == ItemType.Ring || totype == ItemType.Shoes || totype == ItemType.Belt; break; case 1: success = totype == ItemType.Weapon || totype == ItemType.Necklace || totype == ItemType.Bracelet || totype == ItemType.Ring; break; case 2: - success = totype == ItemType.Armour || totype == ItemType.Shield || totype == ItemType.Helmet || totype == ItemType.Bracelet || totype == ItemType.Ring || totype == ItemType.Shoes; + success = totype == ItemType.Armour || totype == ItemType.Shield || totype == ItemType.Helmet || totype == ItemType.Bracelet || totype == ItemType.Ring || totype == ItemType.Shoes || totype == ItemType.Belt; break; } if (!success) return; @@ -10012,6 +10014,7 @@ public void NPCBuy(C.NPCBuy p) case ItemType.Ring: case ItemType.Shoes: case ItemType.Book: + case ItemType.Belt: flags |= UserItemFlags.NonRefinable; break; } @@ -10785,6 +10788,7 @@ public void NPCRepair(C.NPCRepair p) case ItemType.Ring: case ItemType.Shoes: case ItemType.Shield: + case ItemType.Belt: break; default: Connection.ReceiveChat(string.Format(Connection.Language.RepairFail, item.Info.ItemName), MessageType.System);