cyzhao il y a 4 ans
Parent
commit
9a0bd9acec

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

@@ -606,6 +606,11 @@ class CmdCode {
      * 查询当日在线时长信息
      */
     const active_getTodayOnlineInfos = 6504;
+    
+    /**
+     * 神庙抽奖
+     */
+    const active_shenmiaoDrawPrize = 6505;
 
 //    /**
 //     * 普通任务 - 完成任务
@@ -666,6 +671,11 @@ class CmdCode {
      * 开宝箱-减少冷却时间
      */
     const box_SubCoolDown = 6517;
+    
+    /**
+     * 获取神庙信息
+     */
+    const active_GetShenmiaoData = 6518;
     // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="排行榜操作码 - 66xx">

+ 10 - 0
Gameserver/Amfphp/base/ErrCode.php

@@ -903,6 +903,16 @@ class ErrCode {
      * 活动 - 兑换码已经使用过了
      */
     const active_activecode_used = 3952;
+    
+    /**
+     * 活动不存在
+     */
+    const active_activeNoExistent = 3953;
+    
+    /**
+     * 抽奖次数已经达到上限
+     */
+    const active_NewUserActiveNumLimit = 3954;
     // </editor-fold>
     //  
     // <editor-fold defaultstate="collapsed" desc="    战斗错误码 40xx ">

+ 40 - 1
Gameserver/Amfphp/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-05-08 16:14:32
+ // 日期: 2021-05-10 18:55:32
 ////////////////////
 
 /**
@@ -342,6 +342,22 @@ class GameConfig {
         return self::get_hash_item('item_taskcard', $itemid);
     }
     /**
+    * 
+    * @return \shenmiaoActiveIdTs
+    */
+    public static function shenmiaoActiveIdTs()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shenmiaoActiveIdTs');
+    }
+    /**
+    * @return \sm_shenmiaoActiveIdTs shenmiaoActiveIdTs item数据 
+    */
+    public static function shenmiaoActiveIdTs_getItem($itemid)
+    { 
+        return self::get_hash_item('shenmiaoActiveIdTs', $itemid);
+    }
+    /**
     * 系统邮件
     * @return \sysmail
     */
@@ -454,6 +470,22 @@ class GameConfig {
         return self::get_hash_item('gate_combat', $itemid);
     }
     /**
+    * 根据类型找id
+    * @return \shenmiaoTypeList
+    */
+    public static function shenmiaoTypeList()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shenmiaoTypeList');
+    }
+    /**
+    * @return \sm_shenmiaoTypeList shenmiaoTypeList itemArray 
+    */
+    public static function shenmiaoTypeList_getItemArray($key)
+    { 
+        return self::get_hash_item('shenmiaoTypeList', $key);
+    }
+    /**
     * 每日任务
     * @return \task_daily
     */
@@ -479,6 +511,13 @@ class GameConfig {
         return self::initValue($a, 'shenmiaoActiveTs');
     }
     /**
+    * @return \sm_shenmiaoActiveTs shenmiaoActiveTs item数据 
+    */
+    public static function shenmiaoActiveTs_getItem($itemid)
+    { 
+        return self::get_hash_item('shenmiaoActiveTs', $itemid);
+    }
+    /**
     * 英雄的升级——成长可消耗的道具表
     * @return \hero_levelexp_costitem
     */

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_eventAction.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-04-23 16:57:10
+ // 日期: 2021-05-10 15:45:34
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item_taskcard.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-05-08 10:59:41
+ // 日期: 2021-05-10 15:42:45
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_plot.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-05-08 13:34:13
+ // 日期: 2021-05-10 17:09:39
 ////////////////////
 
 

+ 10 - 1
Gameserver/Amfphp/model/Const/sm_shenmiao.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-05-08 15:43:27
+ // 日期: 2021-05-10 15:17:43
 ////////////////////
 
 
@@ -33,6 +33,15 @@ class sm_shenmiao
     */
     public $desc;
 
+    /**
+    * @var Int32  新手活动 =1,
+    *   常驻活动 = 2,
+    *   唤灵师活动 = 3,
+    *  言灵活动 = 4,
+    *    武器活动 = 5, default(0) 
+    */
+    public $type;
+
     /**
     * @var String 概率 例子:  
     */

+ 47 - 0
Gameserver/Amfphp/model/Const/sm_shenmiaoActiveIdTs.php

@@ -0,0 +1,47 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-05-08 15:38:54
+////////////////////
+
+
+/**
+ * Static Model shenmiaoActiveIdTs 
+ */
+class sm_shenmiaoActiveIdTs
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $tid;
+
+    /**
+    * @var Int32 1:唤灵师活动奖池、2:言灵活动奖池;  3:武器活动奖池。  
+    */
+    public $typeId;
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。 default(0) 
+    */
+    public $startTs;
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。 default(0) 
+    */
+    public $endTs;
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。 default(0) 
+    */
+    public $activeId;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 81 - 0
Gameserver/Amfphp/model/Const/sm_shenmiaoTypeList.php

@@ -0,0 +1,81 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-05-10 15:17:43
+////////////////////
+
+
+/**
+ * Static Model shenmiaoTypeList 根据类型找id
+ */
+class sm_shenmiaoTypeList
+{
+
+    /**
+    * @var String 活动类型id  
+    */
+    public $id;
+
+    /**
+    * @var String 活动名称  
+    */
+    public $name;
+
+    /**
+    * @var String 图片  
+    */
+    public $icon;
+
+    /**
+    * @var String 描述信息  
+    */
+    public $desc;
+
+    /**
+    * @var Int32  新手活动 =1,
+    *   常驻活动 = 2,
+    *   唤灵师活动 = 3,
+    *  言灵活动 = 4,
+    *    武器活动 = 5, default(0) 
+    */
+    public $type;
+
+    /**
+    * @var String 概率 例子:  
+    */
+    public $per;
+
+    /**
+    * @var String sr信息  
+    */
+    public $srList;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $ssrList;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $urList;
+
+    /**
+    * @var String 一次抽奖得消耗  道具id,num  
+    */
+    public $cost;
+
+    /**
+    * @var Int32 抽奖得折扣 没有得话就是0 default(0) 
+    */
+    public $discount;
+
+    /**
+    * @var String 额外字段  
+    */
+    public $etc;
+
+}
+

+ 9 - 0
Gameserver/Amfphp/model/User/Data_UserGame.php

@@ -100,6 +100,12 @@ class Data_UserGame extends HashSaver {
      * @var Info_College
      */
     public $college;
+    
+    /**
+     * 神庙
+     * @var Info_ShenMiao
+     */
+    public $shenmiao;
 
     /**
      * 用于给各个字段赋默认初始值
@@ -119,6 +125,8 @@ class Data_UserGame extends HashSaver {
 //        $this->task->initialize();                                              # 任务初始化
         $this->taskCardShop = new Info_TaskCard_Shop();
         $this->college->initialize();
+        $this->shenmiao->initialize();
+        
     }
 
     /**
@@ -143,6 +151,7 @@ class Data_UserGame extends HashSaver {
 //            $this->task = new Info_UserTask();                                   # 任务数据
             $this->taskCardShop = new Info_TaskCard_Shop();                     # 任务卡商店
             $this->college = new Info_College();
+            $this->shenmiao = new Info_ShenMiao();
         } else {                                                                # 实参
             parent::__construct($arg);                                          # 调用Object的构造函数
 //            $this->shopdata = new Info_UserShop($this->shopdata);

+ 57 - 0
Gameserver/Amfphp/model/User/Enum_Active.php

@@ -0,0 +1,57 @@
+<?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_Active
+ *
+ * @author cyzhao
+ */
+class Enum_Active extends Enum{
+
+    /**
+     * 新手活动
+     */
+    const NewWish = 1;
+
+    /**
+     * 常驻活动
+     */
+    const OpenWish= 2;
+    /**
+     * 唤灵师活动
+     */
+    const HuanlingshiActive= 3;
+    /**
+     * 言灵活动
+     */
+    const YanlingActive= 4;
+    /**
+     * 武器活动
+     */
+    const WuqiActive= 5;
+}
+
+class Enum_ActiveItemType extends Enum{
+
+    /**
+     * 
+     */
+    const Sr = 1;
+
+    /**
+     * 
+     */
+    const Ssr= 2;
+    /**
+     *
+     */
+    const Ur= 3;
+  
+}

+ 109 - 0
Gameserver/Amfphp/model/User/Info_ShenMiao.php

@@ -0,0 +1,109 @@
+<?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 Info_ShenMiao
+ *
+ * @author cyzhao
+ */
+class Info_ShenMiao extends Object_ext {
+    
+    /**
+     * 玩家新手阶段,抽奖次数
+     * @var type
+     */
+    //public $num = 0;
+
+    /**
+     * 活动信息
+     * @var type
+     */
+    public $activeDic = null;
+
+    /**
+     * 构造函数
+     * @param type $args
+     */
+    public function __construct($args = null) {    
+        if($args == null){
+            $this->activeDic = new stdClass();
+        } else {
+            parent::__construct($args);   
+        }                    
+    }
+    
+    public function initialize() {
+        //$this->initActiveItem();//创建账号 初始化活动信息
+    }
+    
+    /**
+     * 初始化活动信息
+     */
+    public function initActiveItem() { 
+        $nowTs = time();
+        
+        $enum = new Enum_Active();
+        $list = array_values($enum->getConstList());
+        foreach ($list as $type) {
+            if(StlUtil::dictHasProperty($this->activeDic, $type)){
+                if($type == Enum_Active::NewWish){
+                    if($this->activeDic->$type->totalNum >= glc()->UserWishNumLimit){
+                        StlUtil::dictRemove($this->activeDic, $type);
+                        StlUtil::dictPropertyRandom($dict);
+                    }
+                } else if($type > Enum_Active::HuanlingshiActive){//检测时间是否过期
+                    $shenmiaoMo = \GameConfig::shenmiao_getItem($this->activeDic->$type->id);
+                    if($shenmiaoMo->startTs >= $nowTs || $nowTs > $shenmiaoMo->endTs){
+                        $list = \GameConfig::shenmiaoTypeList_getItemArray($type);
+                        foreach ($list as $val) {                 
+                            if($val->startTs <=$nowTs && $nowTs<= $val->endTs){
+                                $item = new Ins_active();
+                                $item->id = $item->id;         
+                                $aDic->$type = $item;
+                            }                
+                        }
+                    }                                     
+                }
+            } else {
+                if($type == Enum_Active::NewWish || $type == Enum_Active::OpenWish){                            
+                    $dic = \GameConfig::shenmiaoTypeList_getItemArray($type)[0];      
+                    $item = new Ins_active();
+                    $item->id = $dic->id;         
+                    $aDic->$type = $item;
+                }else {
+                    $list = \GameConfig::shenmiaoTypeList_getItemArray($type);
+                    foreach ($list as $val) {                 
+                        if($val->startTs <=$nowTs && $nowTs<= $val->endTs){
+                            $item = new Ins_active();
+                            $item->id = $item->id;         
+                            $aDic->$type = $item;
+                        }                
+                    }
+                }
+            }                                 
+        }
+    }
+    
+    /**
+     * 新手 常驻
+     * @param type $type
+     */
+    public function createRegularActiveData($type) {
+        
+    }
+    /**
+     * 不定期
+     * @param type $type
+     */
+    public function createLrregularActiveData($type) {
+        
+    }
+    
+}

+ 57 - 0
Gameserver/Amfphp/model/User/Ins_active.php

@@ -0,0 +1,57 @@
+<?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 Ins_active
+ *
+ * @author cyzhao
+ */
+class Ins_active extends Object_ext{
+    
+    /**
+     * 活动id
+     * @var type
+     */
+    public $id=0; 
+
+    /**
+     * 抽奖次数--一次抽奖的次数记录,因为一次抽奖累计10次了也有必出
+     * @var type
+     */
+    public $num=0;
+
+    /**
+     * 累计次数,90次保底一次ur
+     * @var type
+     */
+    public $totalNum=0;
+
+    /**
+     * 每90次内是否已经出过ur了。0:否 1:是
+     * @var type
+     */
+    public $isUr = 0;
+    
+    public $isSsr = 0;
+
+    public function __construct($args = null) {
+        if($args == null){
+            
+        } else {
+            parent::__construct($args);
+        }
+        
+        
+    }
+
+    public function initialize() {
+        
+    }
+}

+ 306 - 2
Gameserver/Amfphp/process/ActiveProc.php

@@ -38,7 +38,10 @@ class ActiveProc {
                 return self::drawTiliGift();
             case CmdCode::active_get_regnum:                                    # 6516 查询当前全服注册人数
                 return self::getRegNumber();
-
+            case CmdCode::active_shenmiaoDrawPrize:                            # 6505 什么抽奖
+                return self::shenmiaoDrawPrize();
+            case CmdCode::active_GetShenmiaoData:
+                return self::GetShenmiaoData();
             default:
                 return Resp::err(ErrCode::cmd_err);
         }
@@ -54,7 +57,305 @@ class ActiveProc {
     }
 
 // <editor-fold defaultstate="collapsed" desc="    赠送体力    ">
-
+    
+    /**
+     * 获取神庙的主界面信息
+     */
+    static function GetShenmiaoData() {
+        $req = req();          
+        $shenmiaoInfo = $req->userInfo->game->shenmiao;
+        
+        $shenmiaoInfo->initActiveItem();
+        $req->userInfo->game->shenmiao = $shenmiaoInfo;
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array(#                                                 # 返回值
+                    'shenmiaoInfo' => $shenmiaoInfo,                 
+        ));
+    }
+    
+    /**
+     * 神庙抽奖
+     */
+    static function ShenmiaoDrawPrize() {
+        $req = req();
+        list($type,$num) = $req->paras;  
+        $shenmiaoInfo = $req->userInfo->game->shenmiao;
+        
+        my_Assert(!StlUtil::dictHasProperty($shenmiaoInfo->activeDic, $type), ErrCode::active_activeNoExistent);
+        
+        $list = array();      
+        if(Enum_Active::NewWish == $type){                     
+            my_Assert($shenmiaoInfo->activeDic->$type->num >= glc()->UserWishNumLimit, ErrCode::active_NewUserActiveNumLimit);
+            
+            $shenmiaoInfo->activeDic->$type->num += $num;   
+            $shenmiaoInfo->activeDic->$type->totalNum += $num;
+            
+            $shenmo = \GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);
+            if($shenmo->discount != 0){
+                $sList = explode(',', $shenmo->cost);
+                $costVal = $sList[1] - $sList[1]*$shenmo->discount/100;
+                $costStr = $sList[0].','.$costVal*$num;
+                StoreProc::AddMultiItemInStore($costStr);
+            }      
+            
+            $tag = false;
+            $n = 0;
+            for ($index = 0; $index < $num; $index++) {
+                $n+=1;
+                $itemType = self::activeRandom($shenmo->per, $shenmo); 
+                if($itemType >= 2){
+                    $tag = true;
+                }
+                if($n==10 && $tag == false){
+                    $list[] =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);
+                } else {
+                    $list[] =self::getActiveRandomItem($itemType, $shenmo);
+                }                            
+            }                             
+            if($shenmiaoInfo->activeDic->$type->totalNum == 10 && !in_array($shenmo->must, $list)){//首次10连抽有必出--临时
+                $list[0] = $shenmo->must;
+            }
+                
+            if($shenmiaoInfo->activeDic->$type->totalNum >= 20){
+                StlUtil::dictRemove($shenmiaoInfo->activeDic, $type);
+            }
+                                                       
+        } else if(Enum_Active::OpenWish == $type){            
+            $old = intval($shenmiaoInfo->activeDic->$type->totalNum/90);            
+            $shenmiaoInfo->activeDic->$type->totalNum += $num;
+            $new = intval($shenmiaoInfo->activeDic->$type->totalNum/90);        
+            $shenmo = \GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);            
+            if($num == 1){
+                $shenmiaoInfo->activeDic->$type->num += $num; 
+                StoreProc::AddMultiItemInStore($shenmo->cost);
+                  
+                if($shenmiaoInfo->activeDic->$type->num%10 == 0){
+                    if($shenmiaoInfo->activeDic->$type->num%90 == 0){
+                        if($shenmiaoInfo->activeDic->$type->Ur == 0){
+                            $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo);
+                            $list[] = $sid;
+                        } else {
+                            $shenmiaoInfo->activeDic->$type->Ur = 0;
+                        }                                             
+                    } else {
+                        if($shenmiaoInfo->activeDic->$type->Ssr == 0){
+                            $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);
+                            $list[] = $sid;
+                        } else {
+                            $shenmiaoInfo->activeDic->$type->Ssr = 0;
+                        }                      
+                    }                                                                                                     
+                } else {     
+                    $itemType = self::activeRandom($shenmo->per, $shenmo);
+                    $aid =self::getActiveRandomItem($type, $shenmo);           
+                    if($itemType == Enum_ActiveItemType::Ssr){
+                        $shenmiaoInfo->activeDic->$type->Ssr = 1;
+                    }
+                
+                    if($itemType == Enum_ActiveItemType::Ur){
+                        $shenmiaoInfo->activeDic->$type->Ssr = 1;
+                        $shenmiaoInfo->activeDic->$type->Ur = 1;
+                    }
+                     $list[] = $aid;
+                }             
+            } else {//10连抽
+                $sList = explode(',', $shenmo->cost);
+                $costStr = $sList[0].','.$sList[1]*$num;
+                StoreProc::AddMultiItemInStore($costStr);              
+                
+                $tag = false;
+                $n = 0;
+                for ($index1 = 0; $index1 < $num; $index1++) {
+                   $n+=1;
+                    $itemType = self::activeRandom($shenmo->per, $shenmo); 
+                    if($itemType >= 2){
+                        $tag = true;
+                    }
+                    if($n==10 && $tag == false){
+                        $list[] =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);
+                    } else {
+                        $list[] =self::getActiveRandomItem($itemType, $shenmo);
+                        if($itemType == Enum_ActiveItemType::Ur){
+                            $shenmiaoInfo->activeDic->$type->Ur = 1;
+                        }                      
+                    }  
+                }
+                
+                if($old != $new){//说明过了一个90次的抽奖
+                    if($shenmiaoInfo->activeDic->$type->Ur == 0){
+                        $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo); 
+                        $list[0] = $aid;
+                    } else {
+                        $shenmiaoInfo->activeDic->$type->Ur = 1;
+                    }
+                }                                             
+            }
+            
+        } else {
+            $old = intval($shenmiaoInfo->activeDic->$type->totalNum/90);        
+            $shenmiaoInfo->activeDic->$type->totalNum += $num;
+            $new = intval($shenmiaoInfo->activeDic->$type->totalNum/90);
+            if($num == 1){
+                $shenmiaoInfo->activeDic->$type->num += $num; 
+                StoreProc::AddMultiItemInStore($shenmo->cost);
+                  
+                if($shenmiaoInfo->activeDic->$type->num%10 == 0){
+                    if($shenmiaoInfo->activeDic->$type->num%90 == 0){
+                        if($shenmiaoInfo->activeDic->$type->Ur == 0){
+                            $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo);
+                            $list[] = $sid;
+                        } else {
+                            $shenmiaoInfo->activeDic->$type->Ur = 0;
+                        }                                             
+                    } else {
+                        if($shenmiaoInfo->activeDic->$type->Ssr == 0){
+                            $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);
+                            $list[] = $sid;
+                        } else {
+                            $shenmiaoInfo->activeDic->$type->Ssr = 0;
+                        }                      
+                    }                                                                                                     
+                } else {     
+                    $itemType = self::activeRandom($shenmo->per, $shenmo);
+                    $aid =self::getActiveRandomItem($type, $shenmo);           
+                    if($itemType == Enum_ActiveItemType::Ssr){
+                        $shenmiaoInfo->activeDic->$type->Ssr = 1;
+                    }
+                
+                    if($itemType == Enum_ActiveItemType::Ur){
+                        $shenmiaoInfo->activeDic->$type->Ssr = 1;
+                        $shenmiaoInfo->activeDic->$type->Ur = 1;
+                    }
+                     $list[] = $aid;
+                }
+            } else {
+                $sList = explode(',', $shenmo->cost);
+                $costStr = $sList[0].','.$sList[1]*$num;
+                StoreProc::AddMultiItemInStore($costStr);              
+                
+                $tag = false;
+                $n = 0;
+                for ($index1 = 0; $index1 < $num; $index1++) {
+                   $n+=1;
+                    $itemType = self::activeRandom($shenmo->per, $shenmo); 
+                    if($itemType >= 2){
+                        $tag = true;
+                    }
+                    if($n==10 && $tag == false){
+                        $list[] =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);
+                    } else {
+                        $list[] =self::getActiveRandomItem($itemType, $shenmo);
+                        if($itemType == Enum_ActiveItemType::Ur){
+                            $shenmiaoInfo->activeDic->$type->Ur = 1;
+                        }                      
+                    }  
+                }
+                
+                if($old != $new){//说明过了一个90次的抽奖
+                    if($shenmiaoInfo->activeDic->$type->Ur == 0){
+                        $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo); 
+                        $list[0] = $aid;
+                    } else {
+                        $shenmiaoInfo->activeDic->$type->Ur = 1;
+                    }
+                }
+            }
+            
+        }   
+        $req->userInfo->game->shenmiao = $shenmiaoInfo;
+        UserProc::updateUserInfo();
+        
+        return Resp::ok(array(#                                                 # 返回值
+                    'shenmiaoInfo' => $shenmiaoInfo,
+                    'list'=>$list,            
+        ));
+        
+    }
+    /**
+     * 
+     * @param type $randCtx
+     * @param sm_shenmiao $mo
+     * @return int
+     */
+    public static function activeRandom($randCtx,$mo) {
+        $rand = rand(1,10000);
+        
+        $type = 1;
+        $list = explode(',', $randCtx);
+        
+        $start = 0;
+        foreach ($list as $val) {
+            $end = $val + $start;
+            if($rand > $start && $rand <= $end){
+                break;
+            }
+            $type += 1;
+        }
+        return $type;
+        
+//        $id = 0;
+//        switch ($type) {
+//            case Enum_ActiveItemType::Sr:
+//                $id = array_rand($mo->srList);
+//                break;
+//            case Enum_ActiveItemType::Ssr:
+//                $id = array_rand($mo->ssrList);
+//
+//                break;
+//            case Enum_ActiveItemType::Ur:
+//                $id = array_rand($mo->urList);
+//                break;
+//            default:
+//                break;
+//        }      
+//        return $id;
+    }
+    
+    public static function getActiveRandomItem($type,$mo) {            
+        $id = 0;
+        switch ($type) {
+            case Enum_ActiveItemType::Sr:
+                $id = array_rand($mo->srList);              
+                break;
+            case Enum_ActiveItemType::Ssr:
+                $id = array_rand($mo->ssrList);              
+                break;
+            case Enum_ActiveItemType::Ur:
+                $id = array_rand($mo->urList);              
+                break;
+            default:
+                break;
+        }      
+        return $id;
+    }
+    
+    /**
+     * 
+     * @param type $activeType
+     * @param type $num
+     * @param type $shenmo
+     * @return type
+     */
+    public function DrawLottery($activeType,$num,$shenmo,$maxNum) {
+        $list = array();
+        $tag = false;
+            $n = 0;
+            for ($index = 0; $index < $num; $index++) {
+                $n+=1;
+                $itemType = self::activeRandom($shenmo->per, $shenmo); 
+                if($itemType >= 2){
+                    $tag = true;
+                }
+                if($n==10 && $tag == false){
+                    $list[] =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $mo);
+                } else {
+                    $list[] =self::getActiveRandomItem($itemType, $mo);
+                }                            
+            } 
+            return $list;
+    }
+    
     /**
      * [6515] 领取 赠送体力  
      */
@@ -376,4 +677,7 @@ class ActiveProc {
 
 // </editor-fold>
 //    
+    
+    
+    
 }

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

@@ -373,6 +373,8 @@ class StoreProc {
                 case 322:                                                       # 进阶材料
                 case 323:                                                       # 锻造材料
                 case 324:                                                       # 魂器
+                case 332:
+                case 333:
                     StoreProc::PutOverlyingItemInStore($itemId, $num);          # 直接进包裹items
                     CornerSignEventProc::OnBag_new_Material();
                     break;