private static void RepairItem(Player player, ref MsgItem packet) { if (!player.Inventory.TryGetItem(packet.UnqiueId, out var found)) { return; } if (found.CurrentDurability >= found.MaximumDurability) { return; } if (Collections.Items.TryGetValue(found.ItemId, out var original)) { var delta = Math.Max(0, found.MaximumDurability - found.CurrentDurability); var cost = (double)original.PriceBaseline * delta / found.MaximumDurability; switch (found.ItemId % 10) { case 9: cost *= 1.125; break; case 8: cost *= 0.975; break; case 7: cost *= 0.9; break; case 6: cost *= 0.825; break; default: cost *= 0.75; break; } cost = Math.Max(0, Math.Round(cost, 0)); if (player.Money >= cost) { player.Money -= (int)cost; Message.SendTo(player, $"You paid: {cost}.", MsgTextType.Action); } else { Message.SendTo(player, $"You don't have enough money (Cost: {cost}).", MsgTextType.Action); return; } } found.CurrentDurability = found.MaximumDurability; var pack = new MsgItemInformation(found, MsgItemInfoAction.Update); player.ForceSend(pack, pack.Size); }
private static void ViewEquip(Player player, ref MsgAction packet) { if (!GameWorld.Find(packet.Param, out Player found)) { return; } foreach (var item in found.Equipment.Items) { var itemInfo = new MsgItemInformation(found, item.Value, item.Key); player.ForceSend(itemInfo, itemInfo.Size); } }