internal static ManageWishlistViewModel ToManageWishlistViewModel(Wishlist wishlist) { var conversion = wishlist.Select(item => new ManagePhilatelicItemViewModel { Year = item.Year, Area = item.CatalogueReference.Area, Catalogue = item.CatalogueReference.Catalogue, CatalogueNumber = item.CatalogueReference.Number, Description = item.Description, Conditions = item.Conditions } ); return(new ManageWishlistViewModel { Items = conversion }); }
internal static ShowWishlistViewModel ToShowWishlistViewModel(Wishlist wishlist) { var conversion = wishlist.Select(item => new ShowWishlistItemViewModel { Id = item.Id, Year = item.Year, Area = item.CatalogueReference.Area, Description = item.Description ?? string.Empty, Conditions = item.Conditions, CatalogueNumber = $"{ new CatalogueAbbreviations()[item.CatalogueReference.Catalogue] } {item.CatalogueReference.Number}", NextAuction = item.NextAuction != null ? item.NextAuction.AuctionDate : DateTime.MinValue, NextAuctionHouse = item.NextAuction != null ? item.NextAuction.AuctionHouse : "the item is not offered by any auction house at the moment" } ); return(new ShowWishlistViewModel { Items = conversion }); }
public void Save() { if (ImitatorName != null) { return; } _characterLog.Debug("Saving character..."); Server.Instance.CharacterDatabase.RunTransaction(comm => { var saveQuery = new StringBuilder(); saveQuery.Append("UPDATE characters SET "); saveQuery.Append("skin = '" + Skin + "', "); saveQuery.Append("hair = '" + Hair + "', "); saveQuery.Append("gender = '" + Gender + "', "); saveQuery.Append("eyes = '" + Face + "', "); saveQuery.Append("map = '" + MapID + "', "); saveQuery.Append("pos = '" + MapPosition + "', "); saveQuery.Append("level = '" + PrimaryStats.Level + "', "); saveQuery.Append("job = '" + PrimaryStats.Job + "', "); saveQuery.Append("chp = '" + PrimaryStats.HP + "', "); saveQuery.Append("cmp = '" + PrimaryStats.MP + "', "); saveQuery.Append("mhp = '" + PrimaryStats.MaxHP + "', "); saveQuery.Append("mmp = '" + PrimaryStats.MaxMP + "', "); saveQuery.Append("`int` = '" + PrimaryStats.Int + "', "); saveQuery.Append("dex = '" + PrimaryStats.Dex + "', "); saveQuery.Append("str = '" + PrimaryStats.Str + "', "); saveQuery.Append("luk = '" + PrimaryStats.Luk + "', "); saveQuery.Append("ap = '" + PrimaryStats.AP + "', "); saveQuery.Append("sp = '" + PrimaryStats.SP + "', "); saveQuery.Append("fame = '" + PrimaryStats.Fame + "', "); saveQuery.Append("exp = '" + PrimaryStats.EXP + "', "); saveQuery.Append($"pet_cash_id = 0x{PetCashId:X16},"); // saveQuery.Append($"playtime = playtime + 0x{(MasterThread.CurrentTime - LastPlayTimeSave):X16}, "); saveQuery.Append("last_savepoint = '" + LastSavepoint.ToString("yyyy-MM-dd HH:mm:ss") + "' "); saveQuery.Append("WHERE ID = " + ID); comm.CommandText = saveQuery.ToString(); comm.ExecuteNonQuery(); }, Program.MainForm.LogAppend); LastPlayTimeSave = MasterThread.CurrentTime; Server.Instance.CharacterDatabase.RunTransaction(comm => { comm.CommandText = "DELETE FROM character_wishlist WHERE charid = " + ID; comm.ExecuteNonQuery(); if (Wishlist.Count > 0) { var wishlistQuery = new StringBuilder(); wishlistQuery.Append("INSERT INTO character_wishlist VALUES "); wishlistQuery.Append(string.Join(", ", Wishlist.Select(serial => "(" + ID + ", " + serial + ")"))); comm.CommandText = wishlistQuery.ToString(); comm.ExecuteNonQuery(); } }, Program.MainForm.LogAppend); Inventory.SaveInventory(); Inventory.SaveCashItems(null); Skills.SaveSkills(); Storage.Save(); Quests.SaveQuests(); Variables.Save(); GameStats.Save(); _characterLog.Debug("Saving finished!"); }