|
@@ -67,19 +67,154 @@ class FightProc {
|
|
|
my_Assert($gateMo != null, ErrCode::err_const_no);
|
|
|
|
|
|
if ($type == 1) {//巡逻
|
|
|
- ctx()->gates->xunluo_StartTs = now();
|
|
|
+ $curTs = now();
|
|
|
+ $startTs = ctx()->gates->xunluo_StartTs;
|
|
|
+ $ts = $curTs - $startTs;
|
|
|
+ $ts2 = intval($ts / 60); //总的分钟数
|
|
|
+
|
|
|
+ $fenzhong = intval($ts2 / 10); //有几个10分钟
|
|
|
+ $gold = 0;
|
|
|
+ $exp = 0;
|
|
|
+ $price = "";
|
|
|
+ if ($fenzhong > 0) {
|
|
|
+ $gold = intval($gateMo->gold_xunluo / 6 * $fenzhong);
|
|
|
+ $exp = intval($gateMo->exp_xunluo / 6 * $fenzhong);
|
|
|
+ $price = "1," . $gold . ';' . "4," . $exp;
|
|
|
+ }
|
|
|
+
|
|
|
+ $itemStr = explode(';', $gateMo->xunluo_item_ts);
|
|
|
+ $itemId = 0;
|
|
|
+ $itemNum = 0;
|
|
|
+
|
|
|
+ $tempTs = 0;
|
|
|
+ foreach ($itemStr as $s) {
|
|
|
+ $arr = explode('-', $s);
|
|
|
+ $tsItemArr = explode(',', $arr[0]);
|
|
|
+ $sTs = $tsItemArr[0]; //开始时间
|
|
|
+ $eTs = $tsItemArr[1]; //终止时间
|
|
|
+ $produceTs = $tsItemArr[2]; //间隔
|
|
|
+ while (true) {
|
|
|
+ $tempTs += $produceTs;
|
|
|
+ if ($tempTs <= $eTs && $tempTs <= $ts2) {
|
|
|
+ $sList = explode(',', $arr[1]);
|
|
|
+ $itemId = $sList[0];
|
|
|
+ $itemNum += $sList[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs >= $ts2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs >= $eTs) {
|
|
|
+ $tempTs = $eTs;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs >= $ts2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($itemNum > 0) {
|
|
|
+ $price = $price . ";" . $itemId . ',' . $itemNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ //---------------------------
|
|
|
+ $tuzhiStr = explode(';', $gateMo->xunluo_tuzhi_ts);
|
|
|
+ $tuzhiId = 0;
|
|
|
+ $tuzhiNum = 0;
|
|
|
+
|
|
|
+ $tempTs2 = 0;
|
|
|
+ foreach ($tuzhiStr as $s) {
|
|
|
+ $arr = explode('-', $s);
|
|
|
+ $tsItemArr = explode(',', $arr[0]);
|
|
|
+ $sTs = $tsItemArr[0]; //开始时间
|
|
|
+ $eTs = $tsItemArr[1]; //终止时间
|
|
|
+ $produceTs = $tsItemArr[2]; //间隔
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ $tempTs2 += $produceTs;
|
|
|
+ if ($tempTs2 <= $eTs && $tempTs2 <= $ts2) {
|
|
|
+ $sList = explode(',', $arr[1]);
|
|
|
+ $tuzhiId = $sList[0];
|
|
|
+ $tuzhiNum += $sList[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs2 >= $ts2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs2 >= $eTs) {
|
|
|
+ $tempTs2 = $eTs;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs2 >= $ts2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($tuzhiNum > 0) {
|
|
|
+ $price = $price . ";" . $tuzhiId . ',' . $tuzhiNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ //---------------------
|
|
|
+ $equipStr = explode(';', $gateMo->xunluo_equip_ts);
|
|
|
+ $equipId = 0;
|
|
|
+ $equipNum = 0;
|
|
|
+
|
|
|
+ $tempTs3 = 0;
|
|
|
+ foreach ($equipStr as $s) {
|
|
|
+ $arr = explode('-', $s);
|
|
|
+ $tsItemArr = explode(',', $arr[0]);
|
|
|
+ $sTs = $tsItemArr[0]; //开始时间
|
|
|
+ $eTs = $tsItemArr[1]; //终止时间
|
|
|
+ $produceTs = $tsItemArr[2]; //间隔
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ $tempTs3 += $produceTs;
|
|
|
+ if ($tempTs3 <= $eTs && $tempTs3 <= $ts2) {
|
|
|
+ $sList = explode(',', $arr[1]);
|
|
|
+ $equipId = $sList[0];
|
|
|
+ $equipNum += $sList[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs3 >= $ts2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs3 >= $eTs) {
|
|
|
+ $tempTs3 = $eTs;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tempTs3 >= $ts2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($equipNum > 0) {
|
|
|
+ $price = $price . ";" . $equipId . ',' . $equipNum;
|
|
|
+ }
|
|
|
+ StoreProc::AddMultiItemInStore($price);
|
|
|
} else {//快速巡逻
|
|
|
+ my_Assert(ctx()->gates->xunluo_quick_buyRecord < $gateMo->xueluo_quick_num, ErrCode::err_const_no);
|
|
|
ctx()->gates->xunluo_quick_buyRecord += 1;
|
|
|
ctx()->baseInfo->Consume_tili(15);
|
|
|
+ ctx()->baseInfo->Consume_tili(15);
|
|
|
+ StoreProc::AddMultiItemInStore($gateMo->xueluo_quick_reward);
|
|
|
}
|
|
|
|
|
|
UserProc::updateUserInfo();
|
|
|
$ret = array(
|
|
|
'ok' => 1,
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
);
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
|
-
|
|
|
+ public static function FightDailyClear() {
|
|
|
+ ctx()->gates->xunluo_quick_buyRecord = 0;
|
|
|
+ }
|
|
|
/**
|
|
|
* 剧情回存
|
|
|
* @return type
|