Przeglądaj źródła

宝石手动替换和宝箱概率调整

cyzhao 1 rok temu
rodzic
commit
290aef6a57

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-04-24 14:51:36
+ // 日期: 2024-04-25 17:22:06
 ////////////////////
 
 /**

+ 1 - 1
Gameserver/App/model/Const/sm_predicate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-04-24 11:17:26
+ // 日期: 2024-04-25 14:02:47
 ////////////////////
 
 

+ 35 - 17
Gameserver/App/process/ShopProc.php

@@ -164,9 +164,10 @@ class ShopProc {
                     $str = explode(',', $value);
                     $allNum += $str[1];
                 }
-                mt_srand((double)microtime()*1000000);
+
                 $allNum *= 10;
                 for ($i = 0; $i < $buyNum; $i++) {
+                    mt_srand((double) microtime() * 1000000);
                     $buyCount = 0;
                     if ($mo->type == 1) {
                         $user->privateState->buyNum_ShopBoxCommon += 1;
@@ -197,6 +198,24 @@ class ShopProc {
                             $end += $str[1] * 10;
                             if ($randNum > $start && $randNum <= $end) {
                                 $qual = $str[0];
+                                if ($qual == 4) {//自己加的控制概率的代码 多个出的紫色宝石 降低概率
+                                    $descRand = mt_rand(1, 100);
+                                    if ($descRand > 20 && $descRand <= 100) {
+                                        $qual = 3;
+                                    }
+                                }
+                                if ($qual == 5) {//自己加的控制概率的代码 多个出的金色宝石 降低概率
+                                    $descRand = mt_rand(1, 100);
+                                    if ($descRand > 10 && $descRand <= 100) {
+                                        $qual = 4;
+                                    }
+                                }
+                                if ($qual == 6) {//自己加的控制概率的代码 多个出的金色宝石 降低概率
+                                    $descRand = mt_rand(1, 100);
+                                    if ($descRand > 8 && $descRand <= 100) {
+                                        $qual = 4;
+                                    }
+                                }
                                 break;
                             }
                             $start = $end;
@@ -363,20 +382,20 @@ class ShopProc {
                 StoreProc::AddMultiItemInStore($mo->reward);
 
                 break;
-            
+
             case EnumShopGift::MonthCard_Shop:
                 $mo = GameConfig::shop_monthcard_getItem($typeId);
                 my_Assert($mo != null, ErrCode::err_const_no);
-                                             
+
                 //$user->privateState->monthCardShop_Received[] = $typeId;                             
-                if($typeId == 1){
+                if ($typeId == 1) {
                     my_Assert($user->privateState->monthCardShop_ts == 0, ErrCode::err_const_no);
                     $user->privateState->monthCardShop_ts = now();
                     StoreProc::AddMultiItemInStore($mo->buy_reward);
                 } else {
                     my_Assert($user->privateState->honourCardShop_ts == 0, ErrCode::err_const_no);
                     $user->privateState->honourCardShop_ts = now();
-                }                            
+                }
                 break;
             default:
                 break;
@@ -408,33 +427,32 @@ class ShopProc {
         ctx()->privateState->junbeiShopNumRecord = new \stdClass();
 
         ctx()->privateState->dailyShop_GuangGaoNum = 0;
-        ctx()->privateState->dailyShop_GuangGaoTs = 0;      
-        self::ShopMonthClear();                
+        ctx()->privateState->dailyShop_GuangGaoTs = 0;
+        self::ShopMonthClear();
     }
 
     /**
      * 月卡按照时间记录的一个月后清理
      */
-    public static function ShopMonthClear(){
-        $monthTs = 30*24*60*60;
-        
-        if(ctx()->privateState->monthCardShop_ts > 0){
-            if(now() - ctx()->privateState->monthCardShop_ts >= $monthTs){
+    public static function ShopMonthClear() {
+        $monthTs = 30 * 24 * 60 * 60;
+
+        if (ctx()->privateState->monthCardShop_ts > 0) {
+            if (now() - ctx()->privateState->monthCardShop_ts >= $monthTs) {
                 ctx()->privateState->monthCardShop_ts = 0;
             } else {
                 EmailProc::SendMonthCardRewardMail($zoneid, $uid, $reward);
             }
-            
-        }                
+        }
 //        if(ctx()->privateState->monthCardShop_ts >0 && now() - ctx()->privateState->monthCardShop_ts >= $monthTs){
 //            ctx()->privateState->monthCardShop_ts = 0;
 //        }
-        
-        if(ctx()->privateState->honourCardShop_ts >0 && now() - ctx()->privateState->honourCardShop_ts >= $monthTs){
+
+        if (ctx()->privateState->honourCardShop_ts > 0 && now() - ctx()->privateState->honourCardShop_ts >= $monthTs) {
             ctx()->privateState->honourCardShop_ts = 0;
         }
     }
-    
+
     /**
      * 每日商城随机6个道具
      * @return type

+ 17 - 9
Gameserver/App/process/StoreProc.php

@@ -460,19 +460,27 @@ class StoreProc {
                 break;
             case 3://手动
                 my_Assert(count((array) $dic) >= 5, ErrCode::user_store_GemCanotSet);
-                my_Assert(StlUtil::dictHasProperty($dic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
-                $replace_ins_Gem = new Ins_Gem($dic->$replaceUId);
+                my_Assert(StlUtil::dictHasProperty($user->store->gemStore, $replaceUId), ErrCode::user_store_NoExistGemReplace);
+                $replace_ins_Gem = new Ins_Gem($user->store->gemStore->$replaceUId);
                 //$id = $replace_ins_Gem->uid;
-                if ($tag_gem != null) {//如果有u那
+                if ($tag_gem != null) {//如果有u那                                    
                     my_Assert($replace_ins_Gem->uid == $tag_gem->uid, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
                     //有U一样的,则点击正好是这个直接替换                  
-                    //$user->store->gemStore->$id = $replace_ins_Gem;
-                    $dic->$replaceUId = $ins_gem;
-                } else {
-                    //$user->store->gemStore->$id = $replace_ins_Gem;
-                    $dic->$replaceUId = $ins_gem;
+                    //$user->store->gemStore->$id = $replace_ins_Gem;                                       
+                    $dic->$tag_index = $ins_gem;
+                } else {                  
+                    $go_index = 0;
+                    foreach ($dic as $index => $g) {                      
+                        if ($g->uid == $replaceUId) {
+                            $go_index = $index;
+                            break;
+                        }
+                    }
+                  
+                    my_Assert($go_index > 0, ErrCode::user_store_NoExistGemReplace);                   
+                    $dic->$go_index = $ins_gem;
                 }
-                //StlUtil::dictRemove($user->store->gemStore, $uid);
+              
                 break;
             case 4://不能
                 //1.小品阶替大品阶  或是  相等的,在不满的时候不允许    2. //满的  相等不允许替