public IActionResult Delete(Guid id) { var rel = _characterRelationDao.FirstOrDefault(s => (s.CharacterRelationId == id) && (s.RelationType == CharacterRelationType.Friend)); var rel2 = _characterRelationDao.FirstOrDefault(s => (s.CharacterId == rel.RelatedCharacterId) && (s.RelatedCharacterId == rel.CharacterId) && (s.RelationType == CharacterRelationType.Friend)); _characterRelationDao.Delete(rel); _characterRelationDao.Delete(rel2); return(Ok()); }
public bool DeleteBazaar(long id, short count, string requestCharacterName) { var bzlink = _holder.BazaarItems.Values.FirstOrDefault(s => s.BazaarItem?.BazaarItemId == id); if (bzlink == null) { throw new ArgumentException(); } if ((bzlink.ItemInstance?.Amount - count < 0) || (count < 0)) { return(false); } if ((bzlink.ItemInstance?.Amount == count) && (requestCharacterName == bzlink.SellerName)) { _bazaarItemDao.Delete(bzlink.BazaarItem !.BazaarItemId); _holder.BazaarItems.TryRemove(bzlink.BazaarItem.BazaarItemId, out _); _itemInstanceDao.Delete(bzlink.ItemInstance.Id); } else { var item = (IItemInstanceDto)bzlink.ItemInstance !; item.Amount -= count; _itemInstanceDao.InsertOrUpdate(ref item); } return(true); }
public IActionResult Delete(Guid id) { var rel = _characterRelationDao.FirstOrDefault(s => (s.CharacterRelationId == id) && (s.RelationType == CharacterRelationType.Blocked)); _characterRelationDao.Delete(rel); return(Ok()); }
public bool DeleteWarehouseItem(Guid id) { var item = _warehouseItemDao.FirstOrDefault(s => s.Id == id); _warehouseItemDao.Delete(item.Id); _warehouseDao.Delete(item.WarehouseId); _itemInstanceDao.Delete(item.ItemInstanceId); return(true); }
public bool DeleteMail(long id, long characterId, bool senderCopy) { var mail = _parcelHolder[characterId][senderCopy][id]; _mailDao.Delete(mail.MailDto.MailId); if (mail.ItemInstance != null) { _itemInstanceDao.Delete(mail.ItemInstance.Id); } _parcelHolder[characterId][senderCopy].TryRemove(id, out var maildata); var receiver = _connectedAccountHttpClient.GetCharacter(characterId, null); Notify(1, receiver, maildata); return(true); }
public async Task <bool> DeleteMail(long id, long characterId, bool senderCopy) { var mail = _parcelHolder[characterId][senderCopy][id]; _mailDao.Delete(mail.MailDto.MailId); if (mail.ItemInstance != null) { _itemInstanceDao.Delete(mail.ItemInstance.Id); } _parcelHolder[characterId][senderCopy].TryRemove(id, out var maildata); if (maildata == null) { return(false); } var receiver = await _connectedAccountHttpClient.GetCharacterAsync(characterId, null).ConfigureAwait(false); Notify(1, receiver, maildata); return(true); }
public bool Delete(Guid id, out string errorMessage) { if (id == null) { throw new ArgumentNullException("id"); } if (id == Guid.Empty) { errorMessage = "GUID has empty value."; return(false); } try { return(linkDao.Delete(id, out errorMessage)); } catch (Exception ex) { WriteToLog(ex); errorMessage = "Sorry. Data access error. Сontact the developer."; return(false); } }
public virtual void Delete(T domainObject) { _dao.Delete(domainObject); }
public override void Execute(CRegPacket cRegPacket, ClientSession clientSession) { if (clientSession.Character.InExchangeOrTrade) { return; } var medal = clientSession.Character.StaticBonusList.FirstOrDefault(s => (s.StaticBonusType == StaticBonusType.BazaarMedalGold) || (s.StaticBonusType == StaticBonusType.BazaarMedalSilver)); var price = cRegPacket.Price * cRegPacket.Amount; var taxmax = price > 100000 ? price / 200 : 500; var taxmin = price >= 4000 ? 60 + (price - 4000) / 2000 * 30 > 10000 ? 10000 : 60 + (price - 4000) / 2000 * 30 : 50; var tax = medal == null ? taxmax : taxmin; var maxGold = _configuration.MaxGoldAmount; if (clientSession.Character.Gold < tax) { clientSession.SendPacket(new MsgPacket { Message = Language.Instance.GetMessageFromKey(LanguageKey.NOT_ENOUGH_MONEY, clientSession.Account.Language) }); return; } if ((cRegPacket.Amount <= 0) || clientSession.Character.InExchangeOrShop) { return; } var it = clientSession.Character.InventoryService.LoadBySlotAndType(cRegPacket.Slot, cRegPacket.Inventory == 4 ? 0 : (NoscorePocketType)cRegPacket.Inventory); if ((it == null) || !it.ItemInstance.Item.IsSoldable || (it.ItemInstance.BoundCharacterId != null) || (cRegPacket.Amount > it.ItemInstance.Amount)) { return; } if (price > (medal == null ? 100000000 : maxGold)) { clientSession.SendPacket(new MsgPacket { Message = Language.Instance.GetMessageFromKey(LanguageKey.PRICE_EXCEEDED, clientSession.Account.Language) }); return; } if ((medal == null) && (cRegPacket.Durability > 1)) { return; } short duration; switch (cRegPacket.Durability) { case 1: duration = 24; break; case 2: duration = 168; break; case 3: duration = 360; break; case 4: duration = 720; break; default: return; } var bazar = clientSession.Character.InventoryService.LoadBySlotAndType(cRegPacket.Slot, cRegPacket.Inventory == 4 ? NoscorePocketType.Equipment : (NoscorePocketType)cRegPacket.Inventory); IItemInstanceDto bazaaritem = bazar.ItemInstance; _itemInstanceDao.InsertOrUpdate(ref bazaaritem); var result = _bazaarHttpClient.AddBazaar(new BazaarRequest { ItemInstanceId = bazar.ItemInstance.Id, CharacterId = clientSession.Character.CharacterId, CharacterName = clientSession.Character.Name, HasMedal = medal != null, Price = cRegPacket.Price, IsPackage = cRegPacket.IsPackage != 0, Duration = duration, Amount = cRegPacket.Amount }); switch (result) { case LanguageKey.LIMIT_EXCEEDED: clientSession.SendPacket(new MsgPacket { Message = Language.Instance.GetMessageFromKey(LanguageKey.LIMIT_EXCEEDED, clientSession.Account.Language) }); break; case LanguageKey.OBJECT_IN_BAZAAR: if (bazar.ItemInstance.Amount == cRegPacket.Amount) { _inventoryItemInstanceDao.Delete(bazar.Id); clientSession.Character.InventoryService.DeleteById(bazar.ItemInstanceId); } else { clientSession.Character.InventoryService.RemoveItemAmountFromInventory(cRegPacket.Amount, bazar.ItemInstanceId); } clientSession.SendPacket(((InventoryItemInstance)null).GeneratePocketChange( cRegPacket.Inventory == 4 ? PocketType.Equipment : (PocketType)cRegPacket.Inventory, cRegPacket.Slot)); clientSession.Character.Gold -= tax; clientSession.SendPacket(clientSession.Character.GenerateGold()); clientSession.SendPacket(clientSession.Character.GenerateSay(Language.Instance.GetMessageFromKey( LanguageKey.OBJECT_IN_BAZAAR, clientSession.Account.Language), SayColorType.Yellow)); clientSession.SendPacket(new MsgPacket { Message = Language.Instance.GetMessageFromKey(LanguageKey.OBJECT_IN_BAZAAR, clientSession.Account.Language) }); clientSession.SendPacket(new RCRegPacket { Type = VisualType.Player }); break; } }
public virtual void Delete(TDomain obj) { _genericDao.SessionFactory = _SessionFactory; _genericDao.Delete(obj); }
public void Delete(string id) { baseDao.Delete(id); }