private static bool FeedPetWithItem(MsgInformationEx MsgDTO, PetRecord pet, DriftBottleItemModel item) { if (item.Attributes == null) { MsgSender.PushMsg(MsgDTO, "该物品无法投喂!"); return(false); } if (!item.Attributes.Contains(pet.Attribute)) { MsgSender.PushMsg(MsgDTO, $"{pet.Name}说不想吃这个东西(请喂食正确特性的物品)"); return(false); } var honorRecord = ItemCollectionRecord.Get(MsgDTO.FromQQ); if (!honorRecord.CheckItem(item.Name)) { MsgSender.PushMsg(MsgDTO, "你没有该物品!", true); return(false); } var resMsg = $"{pet.Name}兴奋的吃掉了 {item.Name},并打了个饱嗝\r\n"; pet.LastFeedTime = DateTime.Now; resMsg += pet.ExtGain(MsgDTO, item.Exp); honorRecord.ItemConsume(item.Name); honorRecord.Update(); MsgSender.PushMsg(MsgDTO, resMsg); return(true); }
private bool SellItem(MsgInformationEx MsgDTO, DriftBottleItemModel item, int count = 1) { var record = ItemCollectionRecord.Get(MsgDTO.FromQQ); if (!record.CheckItem(item.Name, count)) { MsgSender.PushMsg(MsgDTO, "你的背包里没有足够多的该物品!"); return(false); } var price = HonorSvc.GetItemPrice(item, MsgDTO.FromQQ); var msg = $"贩卖 {item.Name}*{count} 将获得 {(price * count).CurencyFormat()},是否确认贩卖?"; if (!WaiterSvc.WaitForConfirm(MsgDTO, msg)) { MsgSender.PushMsg(MsgDTO, "交易取消!"); return(false); } var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ); TransHelper.SellItemToShop(item.Name, osPerson, count); osPerson.Update(); MsgSender.PushMsg(MsgDTO, $"贩卖成功!你当前拥有金币 {osPerson.Golds.CurencyFormat()}"); return(true); }