예제 #1
0
        public static void SellItemToShop(string itemName, OSPerson osPerson, int count = 1)
        {
            var price = HonorSvc.GetItemPrice(HonorSvc.FindItem(itemName), osPerson.QQNum);

            osPerson.Golds += price * count;
            var record = ItemCollectionRecord.Get(osPerson.QQNum);

            record.ItemConsume(itemName, count);
            record.Update();
        }
예제 #2
0
파일: OSPerson.cs 프로젝트: Dolany/DolanyAI
        public static OSPerson GetPerson(long QQNum)
        {
            var osPerson = MongoService <OSPerson> .GetOnly(p => p.QQNum == QQNum);

            if (osPerson == null)
            {
                osPerson = new OSPerson {
                    QQNum = QQNum
                };
                MongoService <OSPerson> .Insert(osPerson);
            }

            osPerson.HonorNames ??= new List <string>();

            if (osPerson.Level != 0)
            {
                return(osPerson);
            }

            osPerson.Level = 1;
            osPerson.MaxHP = 50;

            return(osPerson);
        }
예제 #3
0
        public static void SellHonorToShop(ItemCollectionRecord record, string honorName, OSPerson osPerson)
        {
            var price = HonorSvc.GetHonorPrice(honorName, osPerson.QQNum);

            osPerson.Golds += price;
            var honorCollection = record.HonorCollections[honorName];

            for (var i = 0; i < honorCollection.Items.Count; i++)
            {
                var(key, value)            = honorCollection.Items.ElementAt(i);
                honorCollection.Items[key] = value - 1;
            }
        }