Esempio n. 1
0
        /// <summary>
        /// 提取技能或放生得到经验
        /// </summary>
        /// <param name="player">角色</param>
        /// <param name="id">宠物唯一标识</param>
        /// <param name="petsid">宠物</param>
        /// <param name="ft">操作方式</param>
        /// <param name="pl">宠物所有位置</param>
        /// <param name="gs">操作</param>
        public static void PetExp(PlayerBusiness player, string id, string petsid, FinanceType ft, GoodsSource gs, int pl,int level)
        {
            GameConfig gc = GameConfigAccess.Instance.FindOneById(petsid);
            if (gc == null)
                return;

            Variant v = gc.Value;
            if (v == null)
                return;

            //角色得到经验
            int p1exp = v.GetIntOrDefault("P1exp");
            //宠物取得经验
            int p2exp = v.GetIntOrDefault("P2exp");

            if (p1exp > 0)
            {
                player.AddExperience(p1exp, ft);
            }

            if (p2exp > 0 && player.Pet != null)
            {
                player.AddPetExp(player.Pet, p2exp, true, (int)ft);
            }

            player.AddLog(Actiontype.PetRemove, petsid, level, gs, id, pl);
        }
Esempio n. 2
0
 /// <summary>
 /// 经验宝珠
 /// </summary>
 /// <param name="player"></param>
 /// <param name="c"></param>
 /// <param name="number"></param>
 /// <returns></returns>
 private static bool UseAddExp(PlayerBusiness player, GameConfig c, int number = 1)
 {
     //检查使用限制..
     //if (!SupplyLimit(note, c)) return;
     int p1exp = c.Value.GetIntOrDefault("P1exp") * number;
     if (p1exp > 0)
     {
         player.AddExperience(p1exp, FinanceType.UseGoods);
         return true;
     }
     int p2exp = c.Value.GetIntOrDefault("P2exp") * number;
     if (p2exp > 0)
     {
         if (player.Pet == null)
         {
             //没有出战的宠物不能使用
             player.Call(GoodsCommand.UseGoodsR, false, TipManager.GetMessage(GoodsReturn.UseAddExp));
             return false;
         }
         return player.AddPetExp(player.Pet, p2exp, true,(int)FinanceType.UseGoods);
     }
     int m1exp = c.Value.GetIntOrDefault("M1exp") * number;
     if (m1exp > 0)
     {
         if (player.Mounts == null)
         {
             player.Call(GoodsCommand.UseGoodsR, false, TipManager.GetMessage(GoodsReturn.NoMounts));
             return false;
         }
         return player.AddMounts(m1exp, GoodsSource.DoubleUse);
     }
     return false;
 }