cyzhao преди 4 години
родител
ревизия
7d3a6b5b92

+ 9 - 0
Gameserver/Amfphp/base/CmdCode.php

@@ -583,6 +583,15 @@ class CmdCode {
      */
     const cmd_store_yanling_upgrade = 6420;
 
+    /**
+     * 武器升级
+     */
+    const cmd_store__weapon_upgrade = 6421;
+    
+    /**
+     * 武器突破
+     */
+    const cmd_store__weapon_tupo = 6422;
 // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 65xx">

+ 38 - 0
Gameserver/Amfphp/model/User/Enum_UpgradeType.php

@@ -0,0 +1,38 @@
+<?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_UpgradeType
+ *
+ * @author cyzhao
+ */
+class Enum_UpgradeType extends Enum{
+    
+    /**
+     * 唤灵师
+     */
+    const Huanlingshi = 1;
+
+    /**
+     * 言灵
+     */
+    const YanLing = 2;
+    
+    /**
+     * 武器
+     */
+    const Wuqi= 3;
+    
+    /**
+     * 天赋
+     */
+    const talent = 4;
+   
+}

+ 1 - 1
Gameserver/Amfphp/model/User/Ins_Weapon.php

@@ -26,7 +26,7 @@ class Ins_Weapon extends Object_ext {
     public $level=1;
     
     /**
-     * 
+     * 经验
      * @var type
      */
     public $exp=0;

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

@@ -258,7 +258,7 @@ class HeroProc {
     }
 
     /**
-     * 突破
+     * 唤灵师突破
      */
     static function tupo() {   
         list($uid) = req()->paras;

+ 81 - 0
Gameserver/Amfphp/process/StoreProc.php

@@ -59,10 +59,91 @@ class StoreProc {
                 return self::CallYanlingByBook();
             case CmdCode::cmd_store_yanling_upgrade:                            # 6420 言灵进阶
                 return self::YanlingUpgrade();
+            case CmdCode::cmd_store__weapon_upgrade:                            # 6421武器升级
+                return self::weaponUpgrade();
+            case CmdCode::cmd_store__weapon_tupo:                            # 6421武器升级
+                return self::weaponTupo();    
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    /**
+     * 武器升级
+     */
+    static function weaponUpgrade() {
+        list($uid,$prizeCtx) = req()->paras;                                        # 参数 言灵uid(指定进阶的言灵实例id)
+        $user = req()->userInfo->game;
+        $equipment =  $user->store->equipment;
+          
+        my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::hero_no); # 玩家拥有此英雄
+        $myPacketItems = $user->store->items;
+        $list = explode(';', $prizeCtx);
+        $total = 0;
+        foreach ($list as $key => $val) {
+            $ctxList = explode(',', $val);
+            $costItemId = $ctxList[0];
+            $costNumber = $ctxList[1];
+            my_Assert(CommUtil::isPropertyExists($myPacketItems,$costItemId), ErrCode::store_itemnotenough); # 
+            my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough);# 检查道具的数量,在背包中是否充足
+            $mo = GameConfig::item_stones_getItem($costItemId);
+            my_Assert($mo != null, ErrCode::err_const_no);
+            
+            StoreProc::removeItemFromStore($user->store, $costItemId, $costNumber);                      
+            $total += $mo->baseExp*$costNumber;
+        }
+        
+        $equipVo = new Ins_Weapon($equipment->$uid);
+        $equipVo->exp += $total;
+        $curlevel = self::Upgrade($equipVo->exp);
+        $equipVo->level = $curlevel;     
+        $user->store->equipment->$uid = $equipVo;
+         
+        req()->userInfo->game->store->items = $myPacketItems;                    # 更新背包数据
+                                                                
+        UserProc::updateUserInfo();                                             # 回写玩家数据 
+        return Resp::ok(array(
+                    "store" => $user->store, #                                  # 目前来看只涉及到items变化
+        ));
+    }
+    /**
+     * 
+     * @param type $xp
+     * @param type $type
+     * @return type
+     */
+    static function Upgrade($xp,$type = 3) {
+        $curLv = 0;
+        $heroLvDic = GameConfig::weapon_levelexp();
+        $f = (array) $heroLvDic;     
+        ksort($f); 
+        foreach ($f as $lv => $mo) {
+            if($xp < $mo->needExp){
+                $curLv = $lv-1;
+                break;
+            }
+            
+            if($lv>=glc()->Weapon_Upgrade_BasicMaxLevel){
+                $curLv = glc()->Weapon_Upgrade_BasicMaxLevel;
+                break;
+            }
+        }
+        
+        return $curLv;
+    }
+
+
+    /**
+     * 武器突破
+     */
+    static function weaponTupo() {
+        list($yanlingUid) = req()->paras;                                        # 参数 言灵uid(指定进阶的言灵实例id)
+        $user = req()->userInfo->game;
+        
+        UserProc::updateUserInfo();                                             # 回写玩家数据 
+        return Resp::ok(array(
+                    "store" => $user->store, #                                  # 目前来看只涉及到items变化
+        ));
+    }
 
     /**
      * [6420] 言灵进阶