public static MuleItem MapToMuleItem(this Item item, MuleManagerAccount account, Character character) { return(new MuleItem { Id = $"{account.Name}-{character.Name}-{item.Id}", AccountName = account.Name, CharacterName = character.Name, ItemName = item.Name.ToString(), QualityType = item.Quality.ToString(), ClassificationType = item.Classification.ToString(), Stats = item.Properties.ToDictionary(k => k.MapToStatKey(), v => v.Value.Value) }); }
public async Task UpdateCharacter(MuleManagerAccount account, Character character, List <MuleItem> muleItems) { var itemsOfAccount = await GetAllItemsOfCharacter(account, character); foreach (var item in itemsOfAccount) { _session.Delete(item); } _session.Store <MuleItem>(muleItems); await _session.SaveChangesAsync(); }
private bool ReconnectClient(Client client, MuleManagerAccount account) { if (client.Game.IsInGame()) { client.Game.LeaveGame(); } if (!client.RejoinMCP()) { client.Disconnect(); if (!client.Connect( _configuration.Realm, _configuration.KeyOwner, _configuration.GameFolder)) { return(false); } client.Login(account.Name, account.Password); } return(true); }
public async Task <List <MuleItem> > GetAllItemsOfCharacter(MuleManagerAccount account, Character character) { return((await _session .Query <MuleItem>() .Where(x => x.AccountName == account.Name && x.CharacterName == character.Name).ToListAsync()).ToList()); }