|
@@ -38,7 +38,10 @@ class ActiveProc {
|
|
return self::drawTiliGift();
|
|
return self::drawTiliGift();
|
|
case CmdCode::active_get_regnum: # 6516 查询当前全服注册人数
|
|
case CmdCode::active_get_regnum: # 6516 查询当前全服注册人数
|
|
return self::getRegNumber();
|
|
return self::getRegNumber();
|
|
-
|
|
|
|
|
|
+ case CmdCode::active_shenmiaoDrawPrize: # 6505 什么抽奖
|
|
|
|
+ return self::shenmiaoDrawPrize();
|
|
|
|
+ case CmdCode::active_GetShenmiaoData:
|
|
|
|
+ return self::GetShenmiaoData();
|
|
default:
|
|
default:
|
|
return Resp::err(ErrCode::cmd_err);
|
|
return Resp::err(ErrCode::cmd_err);
|
|
}
|
|
}
|
|
@@ -54,7 +57,305 @@ class ActiveProc {
|
|
}
|
|
}
|
|
|
|
|
|
// <editor-fold defaultstate="collapsed" desc=" 赠送体力 ">
|
|
// <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] 领取 赠送体力
|
|
* [6515] 领取 赠送体力
|
|
*/
|
|
*/
|
|
@@ -376,4 +677,7 @@ class ActiveProc {
|
|
|
|
|
|
// </editor-fold>
|
|
// </editor-fold>
|
|
//
|
|
//
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|