فهرست منبع

fixed: 初始英雄添加言灵数据.

gwang 5 سال پیش
والد
کامیت
0caa799840
3فایلهای تغییر یافته به همراه15 افزوده شده و 2 حذف شده
  1. 11 1
      Gameserver/Amfphp/model/User/UserGameHeroModel.php
  2. 1 1
      Gameserver/Amfphp/process/HeroProc.php
  3. 3 0
      Gameserver/Amfphp/test.php

+ 11 - 1
Gameserver/Amfphp/model/User/UserGameHeroModel.php

@@ -56,10 +56,20 @@ class UserGameHeroModel extends Object_ext {
         $this->recordMaxUID = 0;
         $this->collectHeros = ObjectInit();                                     # 初始化英雄集合
         $hids = GameConfig::primordial_data()->User_Heros;                      # 设置初始英雄
-        foreach ($hids as $heroModelId) {
+        my_Assert(null != $hids, ErrCode::err_const_no);
+        foreach ($hids as $heroModelId_yanlingid) {
+            list( $heroModelId, $yanlingId) = explode('_', $heroModelId_yanlingid);
             $uid = HeroProc::CreateNewGameHeroUID($this->collectHeros, $this->recordMaxUID);
             $this->recordMaxUID = $uid;
             $hero = HeroProc::getGameHeroModelInstance($heroModelId, $uid);
+            // 初始化言灵
+            $yanlingMo = GameConfig::item_yanling_getItem($yanlingId);
+            my_Assert(null != $yanlingMo, ErrCode::err_const_no);
+            $yl_uid = StoreProc::PutYanLingInStore($yanlingMo->typeId, req());
+            req()->userInfo->game->store->yanling->$yl_uid->herouid = $uid;
+            $position = $yanlingMo->position;
+            $hero->yanling->$position = array("itemuid" => $yl_uid);            # 装备位置
+
             $this->collectHeros->$uid = $hero;
             $this->displayHeroUID = $uid;
             $this->firendSupportHeroUID = $uid;

+ 1 - 1
Gameserver/Amfphp/process/HeroProc.php

@@ -1011,7 +1011,7 @@ class HeroProc {
         //  取可用武器中第一个初始化 -- 策划要求初始英雄要带有武器 -- 王刚 2020年1月
         $wp = null;
         $arr = GameConfig::item_weapon();
-        sort($arr);
+        sort($arr);       // todo: 排序不正常
         foreach ($arr as $id => $mo) {
 //            isEditor() and $mo = new \sm_item_weapon();
             if ($mo->hero_id == $hero->typeId) {

+ 3 - 0
Gameserver/Amfphp/test.php

@@ -9,3 +9,6 @@ include __DIR__ . '/main.php';
 echoLine("phpver:" . PHP_VERSION);
 
 
+$arr = GameConfig::item_weapon();
+sort($arr);
+var_dump($arr);