Przeglądaj źródła

关卡礼包奖励问题

cyzhao 1 rok temu
rodzic
commit
3bcc051d95

+ 25 - 0
Gameserver/App/model/User/EnumItemType.php

@@ -0,0 +1,25 @@
+<?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;
+
+/**
+ * 道具表里的类型
+ *
+ * @author c'y'zhao
+ */
+class EnumItemType extends Enum{
+    const gold = 1;
+    
+    const cash = 2;
+    
+    const tili = 3;
+    
+    
+    const tuzhi = 103;
+}

+ 25 - 1
Gameserver/App/process/ShopProc.php

@@ -45,7 +45,31 @@ class ShopProc {
                 $mo = GameConfig::shop_gategift_getItem($typeId);
                 my_Assert($mo != null, ErrCode::err_const_no);       
                 
-                StoreProc::AddMultiItemInStore($mo->reward);
+                $price = explode(';', $mo->reward);
+                foreach ($price as $value) {
+                    $item = explode(',', $value);
+                    if($item[0] == 99999){
+                        $dic = GameConfig::item();
+                        $list = array();
+                        foreach ($dic as $id => $item) {
+                            if($item->itemType == EnumItemType::tuzhi){
+                                $list[] = $item->typeId;
+                            }
+                        }
+                        
+                        $randNum = rand(0, count($list)-1);
+                        $tuzhiId = $list[$randNum];
+                        $gateGift[] = $tuzhiId.',1';
+                        
+                    } else {
+                        $gateGift[] = $item;
+                    }                                       
+                }
+                
+                foreach ($gateGift as $str) {
+                    StoreProc::AddMultiItemInStore($mo->reward);
+                }
+                                                               
                 ctx()->privateState->gateGiftReceived[] = $typeId;
                 
                 ctx()->baseInfo->charge_amt += $mo->curPrice;