cyzhao пре 2 месеци
родитељ
комит
d4b2fb2400

+ 25 - 0
Gameserver/App/base/CmdCode.php

@@ -426,6 +426,31 @@ class CmdCode {
      * 解锁孵化位置
      */
     const store_pet_unlockBreedLocation = 6432;
+    
+    /**
+     * 6433 区域等级升级
+     */
+    const store_pet_areaLevelUpgrade = 6433;   
+    
+    /**
+     * 6434 更换派遣宠物
+     */
+    const store_pet_replaceDispatchPet = 6434;
+    
+    /**
+     * 6435 删除全部派遣宠物
+     */
+    const store_pet_removeDispatchPet = 6435;
+    
+    /**
+     * 6436 领取探索奖励
+     */
+    const store_pet_receiveReward = 6436;
+    
+    /**
+     * 6437 点击派遣按钮
+     */
+    const store_pet_dispatchPet = 6437;
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="商城操作码 - 65xx">
 

+ 37 - 12
Gameserver/App/base/ErrCode.php

@@ -531,12 +531,12 @@ class ErrCode {
      * 合成材料不能参与此次合成
      */
     const user_store_equip_composeMaterialErr = 3318;
-    
+
     /**
      * 已达最高品阶
      */
     const user_store_equip_qualMaxLimit = 3319;
-    
+
     /**
      * 不存在该灵宠
      */
@@ -546,7 +546,7 @@ class ErrCode {
      * 该灵宠已被选择出战
      */
     const user_store_NotSelectPet_fight = 3321;
-    
+
     /**
      * 该灵宠已被选择助战
      */
@@ -556,31 +556,56 @@ class ErrCode {
      * 该区域最多展示8个灵宠
      */
     const user_store_ShowPetNumLimit = 3323;
-    
+
     /**
      * 没有可以孵化的位置
      */
     const user_store_NoBreedSlot = 3324;
-    
+
     /**
      * 不存在可以加速孵化的灵宠蛋
      */
     const user_store_NoExistBreedEgg = 3325;
-    
+
     /**
      * 孵化位置未解锁
      */
     const user_store_SlotNotUnlocked = 3326;
-    
+
     /**
      * 已经完成孵化
      */
     const user_store_CompleteBreed = 3327;
-    
+
     /**
      * 未完成孵化
      */
     const user_store_NoCompleteBreed = 3328;
+
+    /**
+     * 当前区域派遣灵宠数量已达上限
+     */
+    const user_store_dispatchPetNumLimit = 3329;
+
+    /**
+     * 该灵宠不擅长探索当前区域
+     */
+    const user_store_dispatchPetErr = 3330;
+
+    /**
+     * 探索中无法更换灵宠
+     */
+    const user_store_CannotReplaced_tsLimit = 3331;
+
+    /**
+     * 没有可以领取的产出奖励
+     */
+    const user_store_CannotReceiveReward = 3332;
+    
+    /**
+     * 至少派遣一只宠物进行探索
+     */
+    const user_store_addDispatchPet = 3333;
 // </editor-fold>
 //
 //   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">
@@ -707,22 +732,22 @@ class ErrCode {
      * 活跃点数量不足
      */
     const active_pointNotEnough = 3516;
-    
+
     /**
      * 连续在线礼包缺少配置数据
      */
     const onlinegift_constno_err = 3517;
-    
+
     /**
      * 抽奖券购买数量超出上限
      */
     const active_flipCardLotteru_buyNumLimit = 3518;
-    
+
     /**
      * 伤害值未达标不能领取该奖励
      */
     const active_worldBoss_notClaimRewards = 3519;
-    
+
     /**
      * 功能未解锁
      */

+ 143 - 0
Gameserver/App/model/User/Enum_FunType.php

@@ -0,0 +1,143 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Enum_FunUnlockType
+ *
+ * @author c'y'zhao
+ */
+class Enum_FunType {
+    /// <summary>
+    /// 设置
+    /// </summary>
+    const SheZhi = 1;
+    /// <summary>
+    /// 公告
+    /// </summary>
+    const Announcement = 2;
+    /// <summary>
+    /// 邮件
+    /// </summary>
+    const Mail = 3;
+
+    /// <summary>
+    /// 排行榜
+    /// </summary>
+    const Rank = 4;
+
+    /// <summary>
+    /// 活动--日常周常 任务
+    /// </summary>
+    const ActiveTask = 5;
+
+    /// <summary>
+    /// 限时活动
+    /// </summary>
+    const Happy_7Day = 6;
+
+    /// <summary>
+    /// 关卡下的宝箱
+    /// </summary>
+    const GateBox = 7;
+
+    /// <summary>
+    /// 扫荡按钮功能
+    /// </summary>
+    const SweepBotton = 8;
+
+    /// <summary>
+    /// 关卡挑战按钮
+    /// </summary>
+    const FightBotton = 9;
+    /// <summary>
+    /// 金币购买
+    /// </summary>
+    const Gold_Buy = 10;
+
+    /// <summary>
+    /// 元宝购买
+    /// </summary>
+    const Cash_Buy = 11;
+
+    /// <summary>
+    /// 体力购买
+    /// </summary>
+    const Tili_Buy = 12;
+
+    /// <summary>
+    /// 坊市
+    /// </summary>
+    const Shop = 13;
+
+    /// <summary>
+    /// 装备
+    /// </summary>
+    const Equip = 14;
+
+    /// <summary>
+    /// 挑战
+    /// </summary>
+    const Challange = 15;
+
+    /// <summary>
+    /// 启灵
+    /// </summary>
+    const Qiling = 16;
+
+    /// <summary>
+    /// 首充
+    /// </summary>
+    const FirstRecharge = 17;
+   
+    /// <summary>
+    /// 妖雾重现
+    /// </summary>
+    const YaoWuChongXian = 18;
+
+    /// <summary>
+    /// 仙途历练
+    /// </summary>
+    const Experience = 19;
+
+    /// <summary>
+    /// 仙树寻宝
+    /// </summary>
+    const Lottery = 20;
+
+    /// <summary>
+    /// 新手7日签到
+    /// </summary>
+    const Day7_Sign_NewPlayer = 21;
+
+    /// <summary>
+    /// 在线礼包
+    /// </summary>
+    const OnlineInfos = 22;
+
+    /// <summary>
+    /// 元宝购买限时贩售活动
+    /// </summary>
+    const YuanBaoBuyItemInfos = 23;
+
+    /// <summary>
+    /// 金蛇献瑞
+    /// </summary>
+    const FlipCardLottery = 24;
+
+    /// <summary>
+    /// 世界boss
+    /// </summary>
+    const WorldBoss = 25;
+    
+    /**
+     * 宠物功能
+     */
+    const Pet = 26;
+}

+ 1 - 0
Gameserver/App/model/User/Info_Store.php

@@ -123,6 +123,7 @@ class Info_Store extends Object_ext {
 
     public function __construct($arg = null) {
         if ($arg == null) {
+            $this->exploreArea = new \stdClass();
             $this->petUids_supportFight_position = new \stdClass();
                        
             $this->items = new \stdClass();

+ 24 - 7
Gameserver/App/model/User/Ins_ExploreArea.php

@@ -30,6 +30,23 @@ class Ins_ExploreArea extends Object_ext{
      */
     public $startTs = 0;       
     
+    /**
+     * 探索结束时间
+     */
+    public $endTs = 0; 
+    
+    /**
+     * 产出
+     * @var type
+     */
+    public $output_num = 0;
+
+    /**
+     * 时间
+     * @var type
+     */
+    public $output_ts = 0;
+    
     /**
      * 派遣宠物uid
      * @var type
@@ -40,7 +57,7 @@ class Ins_ExploreArea extends Object_ext{
      * 未解锁
      * @var type
      */
-    public $unlock = 0;
+    //public $unlock = 0;
 
     /**
      * 构造函数
@@ -56,11 +73,11 @@ class Ins_ExploreArea extends Object_ext{
     
     /**
      * 配置
-     * @return sm_pet_egg
+     * @return sm_pet_area_level
      */
-//    public function mo() {
-//        $mo = GameConfig::pet_egg_getItem($this->eggId);
-//        my_Assert(null != $mo, ErrCode::err_const_no);
-//        return $mo;
-//    }
+    public function mo() {
+        $mo = GameConfig::pet_area_level_getItem($this->areaId, $this->level);
+        my_Assert(null != $mo, ErrCode::err_const_no);
+        return $mo;
+    }
 }

+ 296 - 0
Gameserver/App/process/PetProc.php

@@ -0,0 +1,296 @@
+<?php
+
+namespace loyalsoft;
+
+/**
+ * Description of PetProc
+ *
+ * @author Administrator
+ */
+class PetProc {
+
+    public static function InitArea() {
+        $isUnlock = FightProc::isFunUnlock(Enum_FunType::Pet);
+        if (!$isUnlock) {
+            return;
+        }
+        $dic = GameConfig::pet_area();
+        if ($dic != null && count(StlUtil::dictToArray(ctx()->store->exploreArea, 1)) == 0) {
+            foreach ($dic as $areaId => $arr) {
+                $ins_exploreArea = new Ins_ExploreArea();
+                $ins_exploreArea->areaId = $areaId;
+                ctx()->store()->exploreArea->$areaId = $ins_exploreArea;
+            }
+        }
+    }
+
+    /**
+     * 6433 区域等级升级
+     * @return Resp
+     */
+    public static function Pet_AreaLevelUpgrade() {
+        list($areaId) = req()->paras;
+
+        if (!StlUtil::dictHasProperty(ctx()->store->exploreArea, $areaId)) {
+            $ins_ExploreArea = new Ins_ExploreArea();
+            $ins_ExploreArea->areaId = $areaId;
+            ctx()->store->exploreArea->$areaId = $ins_ExploreArea;
+        }
+        $vo = new Ins_ExploreArea(ctx()->store->exploreArea->$areaId);
+        $vo->level += 1;
+
+        my_Assert(ctx()->baseInfo->gold >= $vo->mo()->unlockArea_gold, ErrCode::notenough_gold_msg);
+        my_Assert(ctx()->baseInfo->level >= $vo->mo()->unlockArea_userLv, ErrCode::user_levelnotenough_msg);
+
+        ctx()->base()->Consume_Gold($vo->mo()->unlockArea_gold);
+        ctx()->store->exploreArea->$areaId = $vo;
+        UserProc::updateUserInfo();
+
+        return Resp::ok(array(
+                    'gold' => ctx()->baseInfo->gold,
+                    'store' => ctx()->store,
+        ));
+    }
+
+    /**
+     * 
+     * @param Ins_ExploreArea $ins_ExploreArea
+     */
+    public static function GetAreaOutPutInfo(&$ins_ExploreArea, $outPut_type) {
+        $num = $ins_ExploreArea->mo()->output_num; //等级带来的
+        $ts = $ins_ExploreArea->mo()->output_time; //等级带来的
+
+        if (count($ins_ExploreArea->explorePetList) > 0) {
+            $list = $ins_ExploreArea->explorePetList;
+            foreach ($list as $petUid) {
+                $ins_pet = new Ins_Pet(ctx()->store->$petUid);
+                $typeId = $ins_pet->mo()->type;
+                $qual = $ins_pet->qual;
+
+                $pet_exploreoutputMo = GameConfig::pet_exploreoutput_getItem($typeId, $qual);
+                if ($pet_exploreoutputMo->exploreOutput != null) {
+                    $sList = explode(';', $pet_exploreoutputMo->exploreOutput);
+                    foreach ($sList as $str) {
+                        $s = explode(',', $str);
+                        if ((int) $s[0] == $ins_ExploreArea->areaId) {
+                            $num += (int) $s[1];
+                            $ts += (int) $s[2];
+                        }
+                    }
+                }
+            }
+        }
+
+        return ($outPut_type == 1) ? $num : $ts;
+    }
+
+    /**
+     * 6434 更换派遣宠物
+     * @return Resp
+     */
+    public static function ReplaceDispatchPet_old() {
+        list($areaId, $petUid, $exploreType) = req()->paras;
+
+        $vo = new Ins_ExploreArea(ctx()->store->exploreArea->$areaId);
+
+        if (StlUtil::arrayContains($vo->explorePetList, $petUid)) {
+            StlUtil::arrayRemove($vo->explorePetList, $petUid);
+        } else {
+            my_Assert(count($vo->explorePetList) < $vo->mo()->dispatchPetNum, ErrCode::user_store_dispatchPetNumLimit);
+            $petDic = ctx()->store->pet;
+            my_Assert(StlUtil::dictHasProperty($petDic, $petUid), ErrCode::user_store_NotExistPet);
+
+            $ins_pet = new Ins_Pet($petDic->$petUid);
+            $mo = GameConfig::pet_exploreoutput_getItem($ins_pet->mo()->type, $ins_pet->qual);
+            my_Assert(null != $mo, ErrCode::err_const_no);
+
+            $sList = explode(';', $mo->exploreOutput);
+            $tag = false;
+            foreach ($sList as $key => $value) {
+                $str = explode(',', $value);
+                if ($str[0] == $areaId) {
+                    $tag = true;
+                    break;
+                }
+            }
+            my_Assert($tag, ErrCode::user_store_dispatchPetErr);
+            $vo->explorePetList[] = $petUid;
+        }
+
+        my_Assert($exploreType == 1 && now() - $vo->startTs < 10 * 60, ErrCode::user_store_CannotReplaced_tsLimit);
+
+        //开始探索
+        if (count($vo->explorePetList) == 0) {
+            $vo->startTs = 0;
+            $vo->endTs = 0;
+            $vo->output_num = 0;
+            $vo->output_ts = 0;
+        } else {
+            if ($vo->startTs == 0) {
+                $vo->startTs = now();
+            }
+
+            $ts = self::GetAreaOutPutInfo($vo, 2);
+            $num = self::GetAreaOutPutInfo($vo, 1);
+            $vo->endTs = $vo->startTs + $ts;
+            $vo->output_num = $num;
+            $vo->output_ts = $vo->endTs - $vo->startTs;
+        }
+
+        ctx()->store->exploreArea->$areaId = $vo;
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'store' => ctx()->store,
+        ));
+    }
+
+    /**
+     * 6434 更换派遣宠物  废弃
+     * @return Resp
+     */
+    public static function ReplaceDispatchPet() {
+        list($areaId, $petUid) = req()->paras;
+
+        $vo = new Ins_ExploreArea(ctx()->store->exploreArea->$areaId);
+
+        if (StlUtil::arrayContains($vo->explorePetList, $petUid)) {
+            StlUtil::arrayRemove($vo->explorePetList, $petUid);
+        } else {
+            my_Assert(count($vo->explorePetList) < $vo->mo()->dispatchPetNum, ErrCode::user_store_dispatchPetNumLimit);
+            $petDic = ctx()->store->pet;
+            my_Assert(StlUtil::dictHasProperty($petDic, $petUid), ErrCode::user_store_NotExistPet);
+
+            $ins_pet = new Ins_Pet($petDic->$petUid);
+            $mo = GameConfig::pet_exploreoutput_getItem($ins_pet->mo()->type, $ins_pet->qual);
+            my_Assert(null != $mo, ErrCode::err_const_no);
+
+            $sList = explode(';', $mo->exploreOutput);
+            $tag = false;
+            foreach ($sList as $key => $value) {
+                $str = explode(',', $value);
+                if ($str[0] == $areaId) {
+                    $tag = true;
+                    break;
+                }
+            }
+            my_Assert($tag, ErrCode::user_store_dispatchPetErr);
+            $vo->explorePetList[] = $petUid;
+        }
+
+        my_Assert($exploreType == 1 && now() - $vo->startTs < 10 * 60, ErrCode::user_store_CannotReplaced_tsLimit);
+
+        ctx()->store->exploreArea->$areaId = $vo;
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'store' => ctx()->store,
+        ));
+    }
+
+    /**
+     * 派遣宠物
+     * @return Resp
+     */
+    public static function DispatchPet() {
+        list($areaId, $petUidList) = req()->paras;
+
+        $ins_ExploreArea = new Ins_ExploreArea(ctx()->store->exploreArea->$areaId);
+        $ins_ExploreArea->explorePetList = $petUidList;
+
+        if ($ins_ExploreArea->startTs > 0 && $ins_ExploreArea->endTs > 0) {//说明是更换
+            //my_Assert(count($ins_ExploreArea->explorePetList) > 0, ErrCode::user_store_addDispatchPet);                  
+            my_Assert(now() - $ins_ExploreArea->startTs < 10 * 60, ErrCode::user_store_CannotReplaced_tsLimit);
+        }
+
+        if (count($petUidList) == 0) {
+            $ins_ExploreArea->startTs = 0;
+            $ins_ExploreArea->endTs = 0;
+            $ins_ExploreArea->output_num = 0;
+            $ins_ExploreArea->output_ts = 0;
+        } else {
+            if ($ins_ExploreArea->startTs == 0) {
+                $ins_ExploreArea->startTs = now();
+            }
+
+            $ts = self::GetAreaOutPutInfo($ins_ExploreArea, 2);
+            $num = self::GetAreaOutPutInfo($ins_ExploreArea, 1);
+            $ins_ExploreArea->endTs = $ins_ExploreArea->startTs + $ts;
+            $ins_ExploreArea->output_num = $num;
+            $ins_ExploreArea->output_ts = $ins_ExploreArea->endTs - $ins_ExploreArea->startTs;
+        }
+   
+        ctx()->store->exploreArea->$areaId = $ins_ExploreArea;
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'store' => ctx()->store,
+        ));
+    }
+
+    /**
+     * 6435 删除全部派遣宠物
+     */
+    public static function RemoveDispatchPet() {
+        list($areaId) = req()->paras;
+
+        $vo = new Ins_ExploreArea(ctx()->store->exploreArea->$areaId);
+        $vo->explorePetList = array();
+        $vo->startTs = 0;
+        $vo->endTs = 0;
+        $vo->output_num = 0;
+        $vo->output_ts = 0;
+
+        ctx()->store->exploreArea->$areaId = $vo;
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'store' => ctx()->store,
+        ));
+    }
+
+    /**
+     * 6436 领取探索奖励
+     */
+    public static function Pet_ReceiveReward() {
+        list($areaId) = req()->paras;
+
+        $vo = new Ins_ExploreArea(ctx()->store->exploreArea->$areaId);
+
+        my_Assert($vo->startTs > 0 && now() - $vo->startTs > 10 * 60, ErrCode::user_store_CannotReceiveReward);
+
+        $tt = now() - $vo->startTs;
+        if (now() >= $vo->endTs) {
+            $tt = $vo->endTs - $vo->startTs;
+        }
+
+        $ts_n = $vo->output_ts / $vo->output_num;
+        $num = intval($tt *= $ts_n);
+        $goodsStr = $vo->mo()->reward_fixed . ',' . $num;
+        StoreProc::AddMultiItemInStore($goodsStr);
+
+        $reward = explode(',', $vo->mo()->reward_extra);
+        $randNum = rand(1, $reward[2]);
+        if ($randNum <= $reward[2]) {
+            StoreProc::AddMultiItemInStore($reward[0] . ',' . $reward[1]);
+        }
+
+        //$vo->explorePetList = array();             
+        $vo->startTs = 0;
+        $vo->endTs = 0;
+        $vo->output_num = 0;
+        $vo->output_ts = 0;
+
+        ctx()->store->exploreArea->$areaId = $vo;
+
+        UserProc::updateUserInfo();
+        return Resp::ok(array(
+                    'gold' => ctx()->baseInfo->gold,
+                    'cash' => ctx()->baseInfo->cash,
+                    'reward' => StoreProc::$reward,
+                    'reward_Gem' => StoreProc::$reward_Gem,
+                    'reward_equip' => StoreProc::$reward_equip,
+                    'store' => ctx()->store,
+        ));
+    }
+}

+ 11 - 0
Gameserver/App/process/StoreProc.php

@@ -85,6 +85,16 @@ class StoreProc {
                 return StoreProc::Pet_ReceiveBreedPet();    
             case CmdCode::store_pet_unlockBreedLocation:                        # 6432 解锁孵化位置
                 return StoreProc::Pet_UnlockBreedLocation();
+            case CmdCode::store_pet_areaLevelUpgrade:                           # 6433 区域等级升级
+                return PetProc::Pet_UnlockBreedLocation();         
+            case CmdCode::store_pet_replaceDispatchPet:                         # 6434 点击宠物 更换派遣宠物  废弃
+                return PetProc::ReplaceDispatchPet();
+            case CmdCode::store_pet_removeDispatchPet:                          # 6435 删除全部派遣宠物
+                return PetProc::RemoveDispatchPet();
+            case CmdCode::store_pet_receiveReward:                              # 6436 领取探索奖励
+                return PetProc::Pet_ReceiveReward();    
+            case CmdCode::store_pet_dispatchPet:                                # 6437 点击派遣宠物
+                return PetProc::DispatchPet();
             default:
                 Err(ErrCode::cmd_err);
         }
@@ -1774,6 +1784,7 @@ class StoreProc {
                 case 602://灵蛇果
                 case 802://灵蛇贺岁券    
                 case 901:
+                case 103://宠物蛋    
                     self::PutItemsInStore($itemId, $num);
 //                    if ($itemMo->itemType == 100) {//图纸
 //                        self::checkEquipUpgradeTip();//废弃