|
@@ -10,58 +10,61 @@ class HeroProc {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 英雄处理逻辑分发
|
|
* 英雄处理逻辑分发
|
|
- * 所有的Proc中必须有这样一个方法
|
|
|
|
- * @param Req $req
|
|
|
|
|
|
+ * 所有的Proc中必须有这样一个方法
|
|
*/
|
|
*/
|
|
- static function procMain($req) {
|
|
|
|
- switch ($req->cmd) {
|
|
|
|
|
|
+ static function procMain() {
|
|
|
|
+ switch (req()->cmd) {
|
|
case CmdCode::cmd_hero_levelup: # [6301] 英雄升级
|
|
case CmdCode::cmd_hero_levelup: # [6301] 英雄升级
|
|
- return HeroProc::HeroLevelUpCostExpItem($req);
|
|
|
|
|
|
+ return HeroProc::HeroLevelUpCostExpItem();
|
|
|
|
+ // <editor-fold defaultstate="collapsed" desc="过时 接口">
|
|
case CmdCode::cmd_hero_stageup: # [6304] 英雄进阶 SABCD
|
|
case CmdCode::cmd_hero_stageup: # [6304] 英雄进阶 SABCD
|
|
- return HeroProc::HeroStageUp($req);
|
|
|
|
- // <editor-fold defaultstate="collapsed" desc="过时 接口">
|
|
|
|
|
|
+ return HeroProc::HeroStageUp();
|
|
|
|
+
|
|
// case CmdCode::cmd_hero_upstar: # [6305] 英雄升星
|
|
// case CmdCode::cmd_hero_upstar: # [6305] 英雄升星
|
|
-// return HeroProc::HeroUpStarByPieces($req);
|
|
|
|
|
|
+// return HeroProc::HeroUpStarByPieces();
|
|
// case CmdCode::cmd_hero_changelockstate: # [6306] 英雄-修改锁定状态
|
|
// case CmdCode::cmd_hero_changelockstate: # [6306] 英雄-修改锁定状态
|
|
-// return HeroProc::HeroChangelockstate($req);
|
|
|
|
|
|
+// return HeroProc::HeroChangelockstate();
|
|
// case CmdCode::cmd_hero_buyCollectHeroLimtCount: # [6312] 扩展英雄数量上限
|
|
// case CmdCode::cmd_hero_buyCollectHeroLimtCount: # [6312] 扩展英雄数量上限
|
|
-// return HeroProc::BuyHeroMaxCountLimt($req);
|
|
|
|
|
|
+// return HeroProc::BuyHeroMaxCountLimt();
|
|
|
|
+ // <editor-fold defaultstate="collapsed" desc="---------------英雄评论----------------">
|
|
|
|
+// case CmdCode::cmd_hero_GetDiscuss: # [6316]拉取英雄评论
|
|
|
|
+// return HeroDiscussProc::GetDiscusses();
|
|
|
|
+// case CmdCode::cmd_hero_PostDiscuss: # [6317]对英雄发表评论
|
|
|
|
+// return HeroDiscussProc::Post();
|
|
|
|
+// case CmdCode::cmd_hero_PraiseDiscuss: # [6318]给某条评论点赞
|
|
|
|
+// return HeroDiscussProc::PriaseMsg();
|
|
|
|
+// case CmdCode::cmd_hero_DeleteDiscuss: # [6319]删除评论
|
|
|
|
+// return HeroDiscussProc::DeletePost();
|
|
|
|
+// case CmdCode::cmd_hero_scoreit: # [6320]给某个英雄评分
|
|
|
|
+// return HeroDiscussProc::Score();
|
|
|
|
+ // </editor-fold>
|
|
|
|
+ // <editor-fold defaultstate="collapsed" desc=" 英雄的解锁与购买 ">
|
|
|
|
+// case CmdCode::cmd_hero_buyHero: # [6321]购买英雄
|
|
|
|
+// return HeroProc::BuyHeroByCostPieces();
|
|
|
|
+// case CmdCode::cmd_hero_upGodBlood: # [6322] 神血升级
|
|
|
|
+// return HeroProc::UpGodBloodHeroByPieces();
|
|
|
|
+// case CmdCode::cmd_hero_unlockByPieces: # [6323] 解锁碎片
|
|
|
|
+// return HeroProc::UnLockHeroByPieces();
|
|
|
|
+// </editor-fold>
|
|
// </editor-fold>
|
|
// </editor-fold>
|
|
# --------- 英雄技能 -----------
|
|
# --------- 英雄技能 -----------
|
|
case CmdCode::cmd_hero_upgradeSkillLevel: # [6314] 英雄的技能升级
|
|
case CmdCode::cmd_hero_upgradeSkillLevel: # [6314] 英雄的技能升级
|
|
- return HeroProc::UpgradeSkillLevel($req);
|
|
|
|
|
|
+ return HeroProc::UpgradeSkillLevel();
|
|
case CmdCode::cmd_hero_unlockSkill: # [6324] 英雄技能 - 解锁技能
|
|
case CmdCode::cmd_hero_unlockSkill: # [6324] 英雄技能 - 解锁技能
|
|
- return HeroProc::UnlockSkill($req);
|
|
|
|
|
|
+ return HeroProc::UnlockSkill();
|
|
case CmdCode::cmd_hero_skillLevel_onekeyupgrade: # [6325] 英雄技能 - 一键升级
|
|
case CmdCode::cmd_hero_skillLevel_onekeyupgrade: # [6325] 英雄技能 - 一键升级
|
|
- return HeroProc::OnekeyUpgradeSkillLevel($req);
|
|
|
|
|
|
+ return HeroProc::OnekeyUpgradeSkillLevel();
|
|
case CmdCode::cmd_hero_saveHeroTeamConfig: # [6315] 保存玩家战队数据
|
|
case CmdCode::cmd_hero_saveHeroTeamConfig: # [6315] 保存玩家战队数据
|
|
- return HeroProc::SaveHeroTeamConfig($req);
|
|
|
|
|
|
+ return HeroProc::SaveHeroTeamConfig();
|
|
|
|
+
|
|
|
|
+ // <editor-fold defaultstate="collapsed" desc=" 英雄升级 cyzhao ">
|
|
|
|
|
|
- // <editor-fold defaultstate="collapsed" desc="---------------英雄评论----------------">
|
|
|
|
|
|
|
|
- case CmdCode::cmd_hero_GetDiscuss: # [6316]拉取英雄评论
|
|
|
|
- return HeroDiscussProc::GetDiscusses($req);
|
|
|
|
- case CmdCode::cmd_hero_PostDiscuss: # [6317]对英雄发表评论
|
|
|
|
- return HeroDiscussProc::Post($req);
|
|
|
|
- case CmdCode::cmd_hero_PraiseDiscuss: # [6318]给某条评论点赞
|
|
|
|
- return HeroDiscussProc::PriaseMsg($req);
|
|
|
|
- case CmdCode::cmd_hero_DeleteDiscuss: # [6319]删除评论
|
|
|
|
- return HeroDiscussProc::DeletePost($req);
|
|
|
|
- case CmdCode::cmd_hero_scoreit: # [6320]给某个英雄评分
|
|
|
|
- return HeroDiscussProc::Score($req);
|
|
|
|
- // </editor-fold>
|
|
|
|
-#----------- 英雄的解锁与购买 --------------
|
|
|
|
- case CmdCode::cmd_hero_buyHero: # [6321]购买英雄
|
|
|
|
- return HeroProc::BuyHeroByCostPieces($req);
|
|
|
|
- case CmdCode::cmd_hero_upGodBlood: # [6322] 神血升级
|
|
|
|
- return HeroProc::UpGodBloodHeroByPieces($req);
|
|
|
|
case CmdCode::cmd_hero_StrengthenStar: # [6326] 升星cmd_hero_YanlinUpLevel
|
|
case CmdCode::cmd_hero_StrengthenStar: # [6326] 升星cmd_hero_YanlinUpLevel
|
|
- return HeroProc::StrengthenStar($req);
|
|
|
|
|
|
+ return HeroProc::StrengthenStar();
|
|
case CmdCode::cmd_hero_YanlinUpLevel: # [6327] 升级
|
|
case CmdCode::cmd_hero_YanlinUpLevel: # [6327] 升级
|
|
- return HeroProc::YanlinUpLevel($req);
|
|
|
|
-// case CmdCode::cmd_hero_unlockByPieces: # [6323] 解锁碎片
|
|
|
|
-// return HeroProc::UnLockHeroByPieces($req);
|
|
|
|
-
|
|
|
|
|
|
+ return HeroProc::YanlinUpLevel();
|
|
|
|
+// </editor-fold>
|
|
default: # err: 未知的命令码
|
|
default: # err: 未知的命令码
|
|
return Resp::err(ErrCode::cmd_err);
|
|
return Resp::err(ErrCode::cmd_err);
|
|
}
|
|
}
|
|
@@ -72,13 +75,12 @@ class HeroProc {
|
|
/**
|
|
/**
|
|
* [6324] 英雄技能解锁
|
|
* [6324] 英雄技能解锁
|
|
* @version 2020.1.13 至今未进行对接, 再次整理版
|
|
* @version 2020.1.13 至今未进行对接, 再次整理版
|
|
- * 2019.12.10 加班弄完第一版
|
|
|
|
- * @param req $req
|
|
|
|
|
|
+ * 2019.12.10 加班弄完第一版
|
|
*/
|
|
*/
|
|
- static function UnlockSkill($req) {
|
|
|
|
- list($huid, $mainSkillId, $subSkillId) = $req->paras; # 提取参数: 英雄的UID, 主技能Id, 要升级的子技能ID
|
|
|
|
|
|
+ static function UnlockSkill() {
|
|
|
|
+ list($huid, $mainSkillId, $subSkillId) = req()->paras; # 提取参数: 英雄的UID, 主技能Id, 要升级的子技能ID
|
|
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
$cHeros = $user->heros->collectHeros;
|
|
$cHeros = $user->heros->collectHeros;
|
|
my_default_Obj($cHeros);
|
|
my_default_Obj($cHeros);
|
|
my_Assert(CommUtil::isPropertyExists($cHeros, $huid), ErrCode::hero_no); # 1.检查是否存在要解锁的英雄
|
|
my_Assert(CommUtil::isPropertyExists($cHeros, $huid), ErrCode::hero_no); # 1.检查是否存在要解锁的英雄
|
|
@@ -105,17 +107,16 @@ class HeroProc {
|
|
|
|
|
|
/**
|
|
/**
|
|
* [6325] 英雄技能一键升级
|
|
* [6325] 英雄技能一键升级
|
|
- * @param req $req
|
|
|
|
*/
|
|
*/
|
|
- static function OnekeyUpgradeSkillLevel($req) {
|
|
|
|
- list($huid, $mainSkillId, $subSkillId, $targetSubSkillId, $costGold) = $req->paras; # 提取参数: 英雄的UID, 主技能ID, 要升级的子技能ID, 升级到的子技能ID, 升级要消耗的金币
|
|
|
|
|
|
+ static function OnekeyUpgradeSkillLevel() {
|
|
|
|
+ list($huid, $mainSkillId, $subSkillId, $targetSubSkillId, $costGold) = req()->paras; # 提取参数: 英雄的UID, 主技能ID, 要升级的子技能ID, 升级到的子技能ID, 升级要消耗的金币
|
|
|
|
|
|
- $user = $req->userInfo->game; # user引用#
|
|
|
|
|
|
+ $user = req()->userInfo->game; # user引用#
|
|
$collectHeros = $user->heros->collectHeros;
|
|
$collectHeros = $user->heros->collectHeros;
|
|
my_default_Obj($collectHeros); # 防御变量为空
|
|
my_default_Obj($collectHeros); # 防御变量为空
|
|
my_Assert(CommUtil::isPropertyExists($collectHeros, $huid), ErrCode::hero_no); # 1.检查是否存在要升级的英雄
|
|
my_Assert(CommUtil::isPropertyExists($collectHeros, $huid), ErrCode::hero_no); # 1.检查是否存在要升级的英雄
|
|
# # 2.判断英雄的该技能能否升级....
|
|
# # 2.判断英雄的该技能能否升级....
|
|
- $targetHero = new Ins_UserHero($cHeros->$huid); # 直接类型识别
|
|
|
|
|
|
+ $targetHero = new Ins_UserHero($collectHeros->$huid); # 直接类型识别
|
|
$targteHeroSkills = $targetHero->subSkills; # 取出这个英雄的技能数据
|
|
$targteHeroSkills = $targetHero->subSkills; # 取出这个英雄的技能数据
|
|
my_default_Arr($targteHeroSkills->$mainSkillId); # 保护数据结构
|
|
my_default_Arr($targteHeroSkills->$mainSkillId); # 保护数据结构
|
|
my_Assert(CommUtil::isInArray($targteHeroSkills->$mainSkillId, $subSkillId), "子技能id错误"); # 子技能id
|
|
my_Assert(CommUtil::isInArray($targteHeroSkills->$mainSkillId, $subSkillId), "子技能id错误"); # 子技能id
|
|
@@ -136,12 +137,11 @@ class HeroProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * [6314]英雄技能升级
|
|
|
|
- * @param req $req
|
|
|
|
|
|
+ * [6314]英雄技能升级
|
|
*/
|
|
*/
|
|
- static function UpgradeSkillLevel($req) {
|
|
|
|
- list($huid, $mainSkillId, $subSkillId) = $req->paras; # 提取参数: 英雄的UID, 主技能Id, 要升级的子技能Id
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
|
|
+ static function UpgradeSkillLevel() {
|
|
|
|
+ list($huid, $mainSkillId, $subSkillId) = req()->paras; # 提取参数: 英雄的UID, 主技能Id, 要升级的子技能Id
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
|
|
|
|
$collectHeros = $user->heros->collectHeros;
|
|
$collectHeros = $user->heros->collectHeros;
|
|
my_default_Obj($collectHeros); # 防御变量为空
|
|
my_default_Obj($collectHeros); # 防御变量为空
|
|
@@ -169,12 +169,11 @@ class HeroProc {
|
|
// <editor-fold defaultstate="collapsed" desc="英雄 强化">
|
|
// <editor-fold defaultstate="collapsed" desc="英雄 强化">
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6304 英雄 升阶(消耗碎片)
|
|
|
|
- * @param Req $req
|
|
|
|
|
|
+ * 6304 英雄 升阶(消耗碎片)
|
|
*/
|
|
*/
|
|
- static function HeroStageUp($req) {
|
|
|
|
- list($huid, $nextGrade) = $req->paras; # 提取参数: 英雄的UID,下一阶
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
|
|
+ static function HeroStageUp() {
|
|
|
|
+ list($huid, $nextGrade) = req()->paras; # 提取参数: 英雄的UID,下一阶
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
$collectHeros = $user->heros->collectHeros; # 角色容器
|
|
$collectHeros = $user->heros->collectHeros; # 角色容器
|
|
my_default_Obj($collectHeros); # 保证不为null
|
|
my_default_Obj($collectHeros); # 保证不为null
|
|
my_Assert(CommUtil::isPropertyExists($collectHeros, $huid), ErrCode::hero_no); # 1.检查是否存在要升级的英雄
|
|
my_Assert(CommUtil::isPropertyExists($collectHeros, $huid), ErrCode::hero_no); # 1.检查是否存在要升级的英雄
|
|
@@ -190,21 +189,20 @@ class HeroProc {
|
|
$collectHeros->$huid = $upHero; # 更新Hero数据
|
|
$collectHeros->$huid = $upHero; # 更新Hero数据
|
|
UserProc::updateUserInfo(); # 6.数据回存
|
|
UserProc::updateUserInfo(); # 6.数据回存
|
|
$resp = Resp::ok($upHero);
|
|
$resp = Resp::ok($upHero);
|
|
- SystemProc::insertHero_StageUp($req->zoneid, $req->uid, $user->baseInfo->name, # # 插入系统广播
|
|
|
|
|
|
+ SystemProc::insertHero_StageUp(req()->zoneid, req()->uid, $user->baseInfo->name, # # 插入系统广播
|
|
GameConfig::hero_getItem($upHero->typeId)->name, $upHero->grade);
|
|
GameConfig::hero_getItem($upHero->typeId)->name, $upHero->grade);
|
|
- self::CalcUserFightPower($req->zoneid, $req->uid, $req->userInfo->game); # 跟新战力统计
|
|
|
|
|
|
+ self::CalcUserFightPower(req()->zoneid, req()->uid, req()->userInfo->game); # 跟新战力统计
|
|
TaskProc::OnHeroGradeUp($upHero->typeId, $upHero->grade);
|
|
TaskProc::OnHeroGradeUp($upHero->typeId, $upHero->grade);
|
|
// var_dump($user->task->taskListDaily);
|
|
// var_dump($user->task->taskListDaily);
|
|
return $resp;
|
|
return $resp;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * [6301] 英雄升级 - 消耗经验道具,获得经验(按照经验提升等级)
|
|
|
|
- * @param Req $req
|
|
|
|
|
|
+ * [6301] 英雄升级 - 消耗经验道具,获得经验(按照经验提升等级)
|
|
*/
|
|
*/
|
|
- static function HeroLevelUpCostExpItem($req) {
|
|
|
|
- list($huid, $costItemId, $costNumber) = $req->paras; # 提取参数: 玩家英雄实例编号, 消耗的道具ID, 消耗的道具数量
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
|
|
+ static function HeroLevelUpCostExpItem() {
|
|
|
|
+ list($huid, $costItemId, $costNumber) = req()->paras; # 提取参数: 玩家英雄实例编号, 消耗的道具ID, 消耗的道具数量
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
$collectHeros = $user->heros->collectHeros; # 1. 检查是否存在要升级的英雄
|
|
$collectHeros = $user->heros->collectHeros; # 1. 检查是否存在要升级的英雄
|
|
my_default_Obj($collectHeros);
|
|
my_default_Obj($collectHeros);
|
|
my_Assert(is_int($costNumber) && $costNumber >= 1, ErrCode::paras_err); # 参数合法性判断
|
|
my_Assert(is_int($costNumber) && $costNumber >= 1, ErrCode::paras_err); # 参数合法性判断
|
|
@@ -231,13 +229,13 @@ class HeroProc {
|
|
if ($myPacketItems->$costItemId < 0) {
|
|
if ($myPacketItems->$costItemId < 0) {
|
|
$myPacketItems->$costItemId = 0;
|
|
$myPacketItems->$costItemId = 0;
|
|
}
|
|
}
|
|
- $req->userInfo->game->store->items = $myPacketItems; # 更新背包数据
|
|
|
|
|
|
+ req()->userInfo->game->store->items = $myPacketItems; # 更新背包数据
|
|
my_Assert($targetHero->xp >= 0, "英雄经验出错");
|
|
my_Assert($targetHero->xp >= 0, "英雄经验出错");
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
- TaskProc::OnHeroImprove();
|
|
|
|
|
|
+ TaskProc::OnHeroImprove(); # 事件检测
|
|
|
|
|
|
- self::CalcUserFightPower($req->zoneid, $req->uid, $req->userInfo->game); # 跟新战力统计
|
|
|
|
|
|
+ self::CalcUserFightPower(req()->zoneid, req()->uid, req()->userInfo->game); # 跟新战力统计
|
|
$ret = array(
|
|
$ret = array(
|
|
'hero' => $targetHero,
|
|
'hero' => $targetHero,
|
|
'store' => $user->store
|
|
'store' => $user->store
|
|
@@ -251,14 +249,13 @@ class HeroProc {
|
|
|
|
|
|
/**
|
|
/**
|
|
* [6315]保存队伍的战斗配置信息
|
|
* [6315]保存队伍的战斗配置信息
|
|
- * @param Req $req
|
|
|
|
*/
|
|
*/
|
|
- static function SaveHeroTeamConfig($req) {
|
|
|
|
- $teamsetting = $req->paras[0]; # 配置信息json文件
|
|
|
|
- $req->userInfo->game->heroTeamConfig = $teamsetting; # 更新配置
|
|
|
|
|
|
+ static function SaveHeroTeamConfig() {
|
|
|
|
+ $teamsetting = req()->paras[0]; # 配置信息json文件
|
|
|
|
+ req()->userInfo->game->heroTeamConfig = $teamsetting; # 更新配置
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
# # 添加到战斗力隐藏榜单中, for pvp back matchers, -wg 2017.07.13
|
|
# # 添加到战斗力隐藏榜单中, for pvp back matchers, -wg 2017.07.13
|
|
- self::CalcTeamFightPower($req->zoneid, $req->uid, $req->userInfo->game);
|
|
|
|
|
|
+ self::CalcTeamFightPower(req()->zoneid, req()->uid, req()->userInfo->game);
|
|
return Resp::ok(array('result' => "succeed"));
|
|
return Resp::ok(array('result' => "succeed"));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -267,458 +264,82 @@ class HeroProc {
|
|
// <editor-fold defaultstate="collapsed" desc="已过时代码">
|
|
// <editor-fold defaultstate="collapsed" desc="已过时代码">
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6323 解锁英雄
|
|
|
|
- * @param type $req
|
|
|
|
|
|
+ * 6323 解锁英雄
|
|
*/
|
|
*/
|
|
- static function UnLockHeroByPieces($req) {
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
- $heroModelId = $req->paras[0];
|
|
|
|
- $piecesId = $req->paras[1]; # 英雄碎片的ID
|
|
|
|
- $piecesNum = $req->paras[2];
|
|
|
|
- if (!CommUtil::isPropertyExists($user->heros, "recordUnLockHeroDic")) {
|
|
|
|
- $user->heros->recordUnLockHeroDic = ObjectInit();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $recordUnLockHeroDic = $user->heros->recordUnLockHeroDic;
|
|
|
|
-
|
|
|
|
- #检查是不是已经解锁过了
|
|
|
|
- $flag = 0;
|
|
|
|
- if (!CommUtil::isPropertyExists($recordUnLockHeroDic, $heroModelId)) {
|
|
|
|
|
|
+ static function UnLockHeroByPieces() {
|
|
|
|
+ Err(ErrCode::err_method_obsoleted, "策划未设定解锁功能-2021.5.6");
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
|
|
+ $heroModelId = req()->paras[0];
|
|
|
|
+ $piecesId = req()->paras[1]; # 英雄碎片的ID
|
|
|
|
+ $piecesNum = req()->paras[2];
|
|
|
|
+ my_default_Obj($user->heros->recordUnLockHeroDic); # 防御解锁列表未初始化,空对象
|
|
|
|
+ $recordUnLockHeroDic = $user->heros->recordUnLockHeroDic; # 已解锁记录
|
|
|
|
+ if (!CommUtil::isPropertyExists($recordUnLockHeroDic, $heroModelId)) { # 检查是不是已经解锁过了
|
|
$recordUnLockHeroDic->$heroModelId = 0;
|
|
$recordUnLockHeroDic->$heroModelId = 0;
|
|
}
|
|
}
|
|
- $flag = $recordUnLockHeroDic->$heroModelId;
|
|
|
|
- if ($flag == 1) {
|
|
|
|
- return Resp::err(ErrCode::hero_lockState);
|
|
|
|
- }
|
|
|
|
- #检查要解锁的英雄的常量配置是否存在
|
|
|
|
|
|
+ my_Assert(0 == $recordUnLockHeroDic->$heroModelId, ErrCode::hero_lockState); # 防御英雄已经解锁
|
|
|
|
+
|
|
$heroCfg = GameConfig::hero_getItem($heroModelId);
|
|
$heroCfg = GameConfig::hero_getItem($heroModelId);
|
|
- if (!$heroCfg) {
|
|
|
|
- return Resp::err(ErrCode::hero_const_no_err);
|
|
|
|
- }
|
|
|
|
- #检查需要消耗的碎片的常量配置是否存在
|
|
|
|
|
|
+ my_Assert(isset($heroCfg), ErrCode::hero_const_no_err); # 检查要解锁的英雄的常量配置是否存在
|
|
$piecesCfg = GameConfig::segment_getItem($piecesId);
|
|
$piecesCfg = GameConfig::segment_getItem($piecesId);
|
|
- if (!$piecesCfg) {
|
|
|
|
- return Resp::err(ErrCode::err_const_no);
|
|
|
|
- }
|
|
|
|
- # 5.检查道具的数量是否充足
|
|
|
|
|
|
+ my_Assert(isset($piecesCfg), ErrCode::err_const_no); # 检查需要消耗的碎片的常量配置是否存在
|
|
$myPacketItems = $user->store->segement;
|
|
$myPacketItems = $user->store->segement;
|
|
$requirePiecesNum = $heroCfg->unlockConditionId;
|
|
$requirePiecesNum = $heroCfg->unlockConditionId;
|
|
- # 检查道具数量是否充足
|
|
|
|
- $enoughPieces = false;
|
|
|
|
- if ($heroModelId == $piecesCfg->prototypeData && $requirePiecesNum == $piecesNum) {
|
|
|
|
- if (!CommUtil::isPropertyExists($myPacketItems, $piecesId)) { # 检查碎片
|
|
|
|
|
|
+ $enoughPieces = false; # 检查道具数量是否充足
|
|
|
|
+ my_Assert($heroModelId == $piecesCfg->prototypeData && $requirePiecesNum == $piecesNum, ErrCode ::paras_err);
|
|
|
|
+ if (!CommUtil::isPropertyExists($myPacketItems, $piecesId)) { # 检查碎片
|
|
|
|
+ $enoughPieces = false;
|
|
|
|
+ } else {
|
|
|
|
+ if ($myPacketItems->$piecesId < $requirePiecesNum) { # 5.检查道具的数量是否充足
|
|
$enoughPieces = false;
|
|
$enoughPieces = false;
|
|
} else {
|
|
} else {
|
|
- if ($myPacketItems->$piecesId < $requirePiecesNum) {
|
|
|
|
- $enoughPieces = false;
|
|
|
|
- } else {
|
|
|
|
- $enoughPieces = true;
|
|
|
|
- }
|
|
|
|
|
|
+ $enoughPieces = true;
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode ::paras_err, "error pieces para" . "req" . $piecesId . "_" . $requirePiecesNum . "/" . $piecesId . "_" . $piecesNum);
|
|
|
|
}
|
|
}
|
|
- if ($enoughPieces === true) {
|
|
|
|
- # 6.进行 # # 消耗道具
|
|
|
|
- $myPacketItems->$piecesId -= $requirePiecesNum;
|
|
|
|
- if ($myPacketItems->$piecesId < 0) {
|
|
|
|
- $myPacketItems->$piecesId = 0;
|
|
|
|
- }
|
|
|
|
- $recordUnLockHeroDic->$heroModelId = 1;
|
|
|
|
- $req->user->heros->recordUnLockHeroDic = $recordUnLockHeroDic;
|
|
|
|
- $req->userInfo->game->store->segement = $myPacketItems;
|
|
|
|
- UserProc::updateUserInfo(); # 回写数据
|
|
|
|
- return Resp::ok(array('result' => "OK")); //返回OK
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode::hero_godblood_notengoughitem);
|
|
|
|
|
|
+ my_Assert($enoughPieces, ErrCode::hero_godblood_notengoughitem);
|
|
|
|
+ $myPacketItems->$piecesId -= $requirePiecesNum;
|
|
|
|
+ if ($myPacketItems->$piecesId < 0) { # 6.进行 # # 消耗道具
|
|
|
|
+ $myPacketItems->$piecesId = 0;
|
|
}
|
|
}
|
|
|
|
+ $recordUnLockHeroDic->$heroModelId = 1;
|
|
|
|
+ req()->userInfo->game->heros->recordUnLockHeroDic = $recordUnLockHeroDic;
|
|
|
|
+ req()->userInfo->game->store->segement = $myPacketItems;
|
|
|
|
+ UserProc::updateUserInfo(); # 回写数据
|
|
|
|
+ return Resp::ok(array('result' => "OK")); # 返回OK
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* [6322] 英雄神血
|
|
* [6322] 英雄神血
|
|
- * @param Req $req
|
|
|
|
*/
|
|
*/
|
|
- static function UpGodBloodHeroByPieces($req) {
|
|
|
|
- return Resp::err(ErrCode::err_method_obsoleted);
|
|
|
|
|
|
+ static function UpGodBloodHeroByPieces() {
|
|
|
|
+ Err(ErrCode::err_method_obsoleted, "策划未设定神血功能-2021.5.6");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 英雄消耗碎片道具来升星
|
|
* 英雄消耗碎片道具来升星
|
|
* @param req $req
|
|
* @param req $req
|
|
*/
|
|
*/
|
|
- static function HeroUpStarByPieces($req) {
|
|
|
|
- $resp = Resp::err(ErrCode::err_method_notimplement);
|
|
|
|
- $g = glc();
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
- $huid = $req->paras[0]; # 英雄的UID
|
|
|
|
- $piecesId = $req->paras[1]; # 英雄碎片的ID
|
|
|
|
- $piecesNum = $req->paras[2];
|
|
|
|
- $diamondId = $req->paras[3]; # 升星石道具的ID
|
|
|
|
- $diamondNum = $req->paras[4];
|
|
|
|
- $moneyType = $req->paras[5]; # 升星消耗金钱的类型
|
|
|
|
- $moneyNum = $req->paras[6];
|
|
|
|
-
|
|
|
|
-# 1.检查是否存在要升级的英雄
|
|
|
|
- $collectHeros = $user->heros->collectHeros;
|
|
|
|
- if (!$collectHeros) {
|
|
|
|
- $collectHeros = ObjectInit();
|
|
|
|
- }
|
|
|
|
- if (!CommUtil::isPropertyExists($collectHeros, $huid)) {
|
|
|
|
- return Resp::err(ErrCode::hero_no);
|
|
|
|
- }
|
|
|
|
-# 2.检查是否已经达到最大星级
|
|
|
|
- isEditor() and $strengthHero = new Ins_UserHero();
|
|
|
|
- $strengthHero = $collectHeros->$huid;
|
|
|
|
- if ($strengthHero->curStar >= $g->Hero_Star_MaxStarLevel) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_maxstarlevel);
|
|
|
|
- }
|
|
|
|
-# 检查是否存在当前星级的升星消耗常量数据
|
|
|
|
- $lvs = GameConfig::heroextra_star_getItem($strengthHero->curStar);
|
|
|
|
- if (!$lvs) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_level_const_no_err);
|
|
|
|
- }
|
|
|
|
-# 3检查是否存在这个英雄的模板
|
|
|
|
- $heroModelId = $strengthHero->typeId;
|
|
|
|
-
|
|
|
|
- $heroCfg = GameConfig::hero_getItem($heroModelId);
|
|
|
|
- if (!$heroCfg) {
|
|
|
|
- return Resp::err(ErrCode::hero_const_no_err);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-# 4.检查道具的数量是否充足以及消耗数量是否一致
|
|
|
|
- $requireDiamondId = $lvs->itemid;
|
|
|
|
- $requireDiamondNum = 0;
|
|
|
|
- $arr_costDiamond = explode(";", $lvs->itemNum);
|
|
|
|
- foreach ($arr_costDiamond as $value) {
|
|
|
|
- $strArr = explode(",", $value);
|
|
|
|
- if (count($strArr) == 2) {
|
|
|
|
- $zhenxidu = $strArr[0];
|
|
|
|
- $num = $strArr[1];
|
|
|
|
- if ((int) $zhenxidu == $heroCfg->zhenxidu) {
|
|
|
|
- $requireDiamondNum = (int) $num;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-#检查碎片是否正确
|
|
|
|
- $requirePieceId = $piecesId;
|
|
|
|
- $requirePiecesNum = 0;
|
|
|
|
- $arr_costPieces = explode(";", $lvs->pieces);
|
|
|
|
- foreach ($arr_costPieces as $value) {
|
|
|
|
- $strArr = explode(",", $value);
|
|
|
|
- if (count($strArr) == 2) {
|
|
|
|
- $zhenxidu = $strArr[0];
|
|
|
|
- $num = $strArr[1];
|
|
|
|
- if ((int) $zhenxidu == $heroCfg->zhenxidu) {
|
|
|
|
- $requirePiecesNum = (int) $num;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $piecesCfg = GameConfig::item_getItem($piecesId);
|
|
|
|
- if (!$piecesCfg) {
|
|
|
|
- return Resp::err(ErrCode::err_const_no);
|
|
|
|
- }
|
|
|
|
- $pos = strpos($piecesCfg->icon, strval($heroModelId));
|
|
|
|
- if ($pos === false) {
|
|
|
|
- return Resp::err(ErrCode::paras_err, $piecesCfg->icon . "?" . $heroModelId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-# 4.检查道具的数量是否充足
|
|
|
|
- $myPacketItems = $user->store->items;
|
|
|
|
-#检查道具数量是否充足
|
|
|
|
- $enoughDiamond = false;
|
|
|
|
- $enoughPieces = false;
|
|
|
|
- if ($requirePieceId == $piecesId && $requirePiecesNum == $piecesNum) {
|
|
|
|
- #检查碎片
|
|
|
|
- if (!CommUtil::isPropertyExists($myPacketItems, $requirePieceId)) {
|
|
|
|
- $enoughPieces = false;
|
|
|
|
- } else {
|
|
|
|
- if ($myPacketItems->$requirePieceId < $requirePiecesNum) {
|
|
|
|
- $enoughPieces = false;
|
|
|
|
- } else {
|
|
|
|
- $enoughPieces = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode ::paras_err, #
|
|
|
|
- "error pieces para" . "req" . $requirePieceId . "_" . $requirePiecesNum . "/" . $piecesId . "_" . $piecesNum);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ($requireDiamondId == $diamondId && $requireDiamondNum == $diamondNum) {
|
|
|
|
- #检查升星石
|
|
|
|
- if (!CommUtil::isPropertyExists($myPacketItems, $requireDiamondId)) {
|
|
|
|
- $enoughDiamond = false;
|
|
|
|
- } else {
|
|
|
|
- if ($myPacketItems->$requireDiamondId < $requireDiamondNum) {
|
|
|
|
- $enoughDiamond = false;
|
|
|
|
- } else {
|
|
|
|
- $enoughDiamond = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode ::paras_err, #
|
|
|
|
- "error diamond para" . "req" . $requireDiamondId . "_" . $requireDiamondNum . "/" . $diamondId . "_" . $diamondNum);
|
|
|
|
- }
|
|
|
|
- if ($enoughDiamond === true && $enoughPieces === true) {
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode::hero_star_notengoughitem);
|
|
|
|
- }
|
|
|
|
-# 5.检查账户余额是否充足
|
|
|
|
-#检查消耗是否正确
|
|
|
|
- $enoughMoney = false;
|
|
|
|
-
|
|
|
|
- $requireMoneyType = "";
|
|
|
|
- $requireMoneyNum = 0;
|
|
|
|
- $arr_costMoney = explode(";", $lvs->cost);
|
|
|
|
- foreach ($arr_costMoney as $value) {
|
|
|
|
- $strArr = explode(",", $value);
|
|
|
|
- if (count($strArr) == 3) {
|
|
|
|
- $zhenxidu = $strArr[0];
|
|
|
|
- $type = $strArr[1];
|
|
|
|
- $num = $strArr[2];
|
|
|
|
- if ((int) $zhenxidu == $heroCfg->zhenxidu) {
|
|
|
|
- $requireMoneyType = $type;
|
|
|
|
- $requireMoneyNum = (int) $num;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ($requireMoneyType == $moneyType && $requireMoneyNum == $moneyNum) {
|
|
|
|
- if ($requireMoneyType === "gold") {
|
|
|
|
- if ($user->baseInfo->gold >= $requireMoneyNum) {
|
|
|
|
- $enoughMoney = true;
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode::notenough_gold_msg);
|
|
|
|
- }
|
|
|
|
- } else if ($requireMoneyType === "cash") {
|
|
|
|
- if ($user->baseInfo->cash >= $requireMoneyNum) {
|
|
|
|
- $enoughMoney = true;
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode::notenough_cash_msg);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode ::paras_err, $moneyType);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode ::paras_err, "error money para");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $bDeal = false;
|
|
|
|
- if ($enoughMoney === true) {
|
|
|
|
- if ($requireMoneyType === "gold") {
|
|
|
|
- $bDeal = Data_UserGame:: Consume_Gold($user->baseInfo, $requireMoneyNum);
|
|
|
|
- } else if ($requireMoneyType === "cash") {
|
|
|
|
- $bDeal = Data_UserGame:: Consume_Cash($user->baseInfo, $requireMoneyNum);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-# 6.进行消耗升星
|
|
|
|
- if ($bDeal) {
|
|
|
|
- $strengthHero->curStar += 1;
|
|
|
|
-
|
|
|
|
-# # 消耗道具
|
|
|
|
-
|
|
|
|
- $myPacketItems->$requireDiamondId -= $requireDiamondNum;
|
|
|
|
- if ($myPacketItems->$requireDiamondId < 0) {
|
|
|
|
- $myPacketItems->$requireDiamondId = 0;
|
|
|
|
- }
|
|
|
|
- $myPacketItems->$requirePieceId -= $requirePiecesNum;
|
|
|
|
- if ($myPacketItems->$requirePieceId < 0) {
|
|
|
|
- $myPacketItems->$requirePieceId = 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $req->userInfo->game->store->items = $myPacketItems;
|
|
|
|
-# 回写数据
|
|
|
|
- UserProc::updateUserInfo();
|
|
|
|
- $resp = Resp::ok($strengthHero);
|
|
|
|
-# 推送系统消息
|
|
|
|
-// SystemProc::insertHero_Star($req->zoneid, $req->uid, $user->name, $heroCfg->name, $strengthHero->curStar);
|
|
|
|
- }
|
|
|
|
- ActiveProc::ChangeTaskCount($req);
|
|
|
|
-
|
|
|
|
- return $resp;
|
|
|
|
|
|
+ static function HeroUpStarByPieces() {
|
|
|
|
+ Err(ErrCode::err_method_obsoleted, "策划未设定碎片升级功能-2021.5.6");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 英雄升星
|
|
* 英雄升星
|
|
* @param Req $req
|
|
* @param Req $req
|
|
*/
|
|
*/
|
|
- static function HeroUpStar($req) {
|
|
|
|
- $resp = Resp::err(ErrCode::err_method_notimplement);
|
|
|
|
- $g = glc();
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
- $huid = $req->paras[0]; # 英雄的UID
|
|
|
|
- $costHeroUids = $req->paras[1]; # 消耗掉的英雄UID
|
|
|
|
- $costGold = $req->paras[2];
|
|
|
|
-# 1.检查是否存在要升级的英雄
|
|
|
|
- $collectHeros = $user->heros->collectHeros;
|
|
|
|
- if (!$collectHeros) {
|
|
|
|
- $collectHeros = ObjectInit();
|
|
|
|
- }
|
|
|
|
- if (!CommUtil::isPropertyExists($collectHeros, $huid)) {
|
|
|
|
- return Resp::err(ErrCode::hero_no);
|
|
|
|
- }
|
|
|
|
-# 2.检查是否已经达到最大星级
|
|
|
|
- isEditor() and $strengthHero = new Ins_UserHero();
|
|
|
|
- $strengthHero = $collectHeros->$huid;
|
|
|
|
- if ($strengthHero->curStar >= $g->Hero_Star_MaxStarLevel) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_maxstarlevel);
|
|
|
|
- }
|
|
|
|
-# 检查是否存在当前星级的升星消耗常量数据
|
|
|
|
- $lvs = GameConfig::heroextra_star_getItem($strengthHero->curStar);
|
|
|
|
- if (!$lvs) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_level_const_no_err);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-# 3.检查消耗的英雄数量,以及玩家是否都存在这些英雄UID.
|
|
|
|
- $arr_costUID = explode(",", $costHeroUids);
|
|
|
|
- $checkCostHeroAllRight = true;
|
|
|
|
- if (count($arr_costUID) != $g->Hero_Star_MaxCostHeroCardNum) {
|
|
|
|
- $checkCostHeroAllRight = false;
|
|
|
|
- } else {
|
|
|
|
- foreach ($arr_costUID as $value) {
|
|
|
|
- if ($value == "" || !CommUtil::isPropertyExists($collectHeros, $value)) {
|
|
|
|
- $checkCostHeroAllRight = false;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!$checkCostHeroAllRight) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_costhero);
|
|
|
|
- }
|
|
|
|
-# 获得升星英雄的模板数据,取得它的元素类型
|
|
|
|
-# 检查是否存在这个英雄的模板
|
|
|
|
- $heroModelId = $strengthHero->typeId;
|
|
|
|
-
|
|
|
|
- $heroCfg = GameConfig::hero_getItem($heroModelId);
|
|
|
|
- if (!$heroCfg) {
|
|
|
|
- return Resp::err(ErrCode::hero_const_no_err);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $queryCostGold = $lvs->costGold;
|
|
|
|
- $costItemNum = $lvs->costItemNum;
|
|
|
|
-
|
|
|
|
-# 4.检查道具的数量是否充足
|
|
|
|
- $myPacketItems = $user->store->items;
|
|
|
|
- $checkHasEnoughItem = true;
|
|
|
|
- $costItemId = "";
|
|
|
|
- $record = ObjectInit();
|
|
|
|
- $keyxxx = "Hero_Star_CostItem_" . $heroCfg->yuansu;
|
|
|
|
-
|
|
|
|
- if (!CommUtil::isPropertyExists($g, $keyxxx)) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_noglobal_costitem);
|
|
|
|
- } else {
|
|
|
|
- $costItemId = $g->$keyxxx;
|
|
|
|
- }
|
|
|
|
-# 检查道具种类与消耗数量是否匹配
|
|
|
|
- $arr_costitemids = explode(",", $costItemId);
|
|
|
|
- $arr_costnums = explode(",", $costItemNum);
|
|
|
|
- if (count($arr_costitemids) != count($arr_costnums)) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_conststr_itemnotmathnum);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $index = 0;
|
|
|
|
-
|
|
|
|
- foreach ($arr_costitemids as $requireiItemId) {
|
|
|
|
-
|
|
|
|
- $requireCount = 0;
|
|
|
|
-
|
|
|
|
- if ($index < count($arr_costnums)) {
|
|
|
|
- $requireCount = $arr_costnums[$index];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $index += 1;
|
|
|
|
-# --判断对应的item是否存在相应的常量
|
|
|
|
-# 检查是否存在当前星级的升星消耗常量数据
|
|
|
|
- $itemcfg = GameConfig::item_getItem($requireiItemId);
|
|
|
|
- if (!$itemcfg) {
|
|
|
|
- return Resp::err(ErrCode::err_const_no);
|
|
|
|
- } else {
|
|
|
|
- if (!CommUtil::isPropertyExists($record, $requireiItemId)) {
|
|
|
|
- $record->$requireiItemId = intval($requireCount);
|
|
|
|
- } else {
|
|
|
|
- $count = intval($record->$requireiItemId) + intval($requireCount);
|
|
|
|
- $record->$requireiItemId = $count;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } foreach ($record as $key => $value) {
|
|
|
|
- if ($value > 0) {
|
|
|
|
- if (!CommUtil::isPropertyExists($myPacketItems, $key)) {
|
|
|
|
- $checkHasEnoughItem = false;
|
|
|
|
- break;
|
|
|
|
- } else {
|
|
|
|
- if ($myPacketItems->$key < $value) {
|
|
|
|
- $checkHasEnoughItem = false;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!$checkHasEnoughItem) {
|
|
|
|
- return Resp::err(ErrCode::hero_star_notengoughitem);
|
|
|
|
- }
|
|
|
|
-# 5.检查金币是否充足
|
|
|
|
- $bDeal = false; # 成交
|
|
|
|
- if ($queryCostGold != $costGold) {
|
|
|
|
- return Resp::err(ErrCode::paras_err);
|
|
|
|
- } else {
|
|
|
|
- if ($costGold > 0) {
|
|
|
|
- if ($user->baseInfo->gold < $costGold) {
|
|
|
|
- return Resp::err(ErrCode::notenough_gold_msg);
|
|
|
|
- } else {
|
|
|
|
- $bDeal = Data_UserGame:: Consume_Gold($user->baseInfo, $costGold);
|
|
|
|
- }
|
|
|
|
- } else if ($costGold == 0) {
|
|
|
|
- $bDeal = true;
|
|
|
|
- } else {
|
|
|
|
- return Resp::err(ErrCode::paras_err);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-# 6.进行消耗升星
|
|
|
|
- if ($bDeal) {
|
|
|
|
- $strengthHero->curStar += 1;
|
|
|
|
-# 消耗卡牌
|
|
|
|
- foreach ($arr_costUID as $value) {
|
|
|
|
- if ($value == "") {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- unset($collectHeros->$value);
|
|
|
|
- }
|
|
|
|
-# # 消耗道具
|
|
|
|
- foreach ($record as $key => $value) {
|
|
|
|
- $myPacketItems->$key -= $value;
|
|
|
|
- if ($myPacketItems->$key < 0) {
|
|
|
|
- $myPacketItems->$key = 0;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $req->userInfo->game->store->items = $myPacketItems;
|
|
|
|
-# 回写数据
|
|
|
|
- UserProc::updateUserInfo();
|
|
|
|
- $resp = Resp::ok($strengthHero);
|
|
|
|
-# 推送系统消息
|
|
|
|
-// SystemProc::insertHero_Star($req->zoneid, $req->uid, $user->name, $heroCfg->name, $strengthHero->curStar);
|
|
|
|
- }
|
|
|
|
- ActiveProc::ChangeTaskCount($req);
|
|
|
|
-
|
|
|
|
- return $resp;
|
|
|
|
|
|
+ static function HeroUpStar() {
|
|
|
|
+ Err(ErrCode::err_method_obsoleted, "策划未设定升星功能-2021.5.6");
|
|
}
|
|
}
|
|
|
|
|
|
// </editor-fold>
|
|
// </editor-fold>
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6321 购买英雄 消耗碎片
|
|
|
|
- * @param req $req
|
|
|
|
|
|
+ * 6321 购买英雄 消耗碎片
|
|
*/
|
|
*/
|
|
- static function BuyHeroByCostPieces($req) {
|
|
|
|
- list($heroModelId, $costType, $costMoneyNum, $piecesId, $piecesNum) = $req->paras; # 提取参数
|
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
|
|
+ static function BuyHeroByCostPieces() {
|
|
|
|
+ Err(ErrCode::err_method_obsoleted, "策划未设定碎片功能-2021.5.6");
|
|
|
|
+ list($heroModelId, $costType, $costMoneyNum, $piecesId, $piecesNum) = req()->paras; # 提取参数
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
$collectHeros = $user->heros->collectHeros;
|
|
$collectHeros = $user->heros->collectHeros;
|
|
my_default_Obj($collectHeros);
|
|
my_default_Obj($collectHeros);
|
|
foreach ($collectHeros as $key => $value) { # 检查玩家是否已经拥有此类英雄
|
|
foreach ($collectHeros as $key => $value) { # 检查玩家是否已经拥有此类英雄
|
|
@@ -754,22 +375,21 @@ class HeroProc {
|
|
|
|
|
|
# 4.消耗来获得英雄
|
|
# 4.消耗来获得英雄
|
|
$myPacketItems->$piecesId -= $requirePiecesNum; # 消耗道具
|
|
$myPacketItems->$piecesId -= $requirePiecesNum; # 消耗道具
|
|
- $req->userInfo->game->store->items = $myPacketItems; # 回存背包
|
|
|
|
|
|
+ req()->userInfo->game->store->items = $myPacketItems; # 回存背包
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
- $resp = HeroProc::GetHero($req);
|
|
|
|
- SystemProc::GetHero($req->zoneid, $user->baseInfo, $heroModelId); # 插入系统广播消息
|
|
|
|
|
|
+ $resp = HeroProc::GetHero();
|
|
|
|
+ SystemProc::GetHero(req()->zoneid, $user->baseInfo, $heroModelId); # 插入系统广播消息
|
|
return $resp;
|
|
return $resp;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 购买玩家可以收集的英雄的数量上限
|
|
|
|
- * @param req $req
|
|
|
|
|
|
+ * 购买玩家可以收集的英雄的数量上限
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
- static function BuyHeroMaxCountLimt($req) {
|
|
|
|
- list($buyNum, $costCash) = $req->paras; # 提取参数: 数量, 花费钻石
|
|
|
|
|
|
+ static function BuyHeroMaxCountLimt() {
|
|
|
|
+ list($buyNum, $costCash) = req()->paras; # 提取参数: 数量, 花费钻石
|
|
$g = glc();
|
|
$g = glc();
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
|
|
|
+ $user = req()->userInfo->game; # user引用
|
|
if (!CommUtil::isPropertyExists($user->heros, "maxCollectCount")) {
|
|
if (!CommUtil::isPropertyExists($user->heros, "maxCollectCount")) {
|
|
$user->heros->maxCollectCount = $g->Game_CollectHero_BasicMaxCount;
|
|
$user->heros->maxCollectCount = $g->Game_CollectHero_BasicMaxCount;
|
|
}
|
|
}
|
|
@@ -789,14 +409,13 @@ class HeroProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 获得英雄(测试已经OK)
|
|
|
|
- * @param req $req
|
|
|
|
|
|
+ * 获得英雄(测试已经OK)
|
|
*/
|
|
*/
|
|
- static function GetHero($req) {
|
|
|
|
- $heroModelId = $req->paras[0]; # 英雄的模板ID
|
|
|
|
|
|
+ static function GetHero() {
|
|
|
|
+ $heroModelId = req()->paras[0]; # 英雄的模板ID
|
|
$heroCfg = GameConfig::hero_getItem($heroModelId); # 1.检查是否存在这个英雄的模板
|
|
$heroCfg = GameConfig::hero_getItem($heroModelId); # 1.检查是否存在这个英雄的模板
|
|
my_Assert(null != $heroCfg, ErrCode::hero_const_no_err);
|
|
my_Assert(null != $heroCfg, ErrCode::hero_const_no_err);
|
|
- $hero = self::AddHeroTFromStore($req, $heroModelId); # 创建英雄
|
|
|
|
|
|
+ $hero = self::AddHeroTFromStore(req(), $heroModelId); # 创建英雄
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
$result = array('result' => "succeed", 'heros' => $hero); # 4. 设置返回值
|
|
$result = array('result' => "succeed", 'heros' => $hero); # 4. 设置返回值
|
|
return Resp::ok($result);
|
|
return Resp::ok($result);
|
|
@@ -874,9 +493,8 @@ class HeroProc {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (null != $wp) {
|
|
if (null != $wp) {
|
|
- $req = req();
|
|
|
|
- $wuid = StoreProc::PutEquipInStore($wp->typeId, $req);
|
|
|
|
- $req->userInfo->game->store->equipment->$wuid->herouid = $uid;
|
|
|
|
|
|
+ $wuid = StoreProc::PutEquipInStore($wp->typeId);
|
|
|
|
+ req()->userInfo->game->store->equipment->$wuid->herouid = $uid;
|
|
$hero->equip->weapon = array("itemuid" => $wuid);
|
|
$hero->equip->weapon = array("itemuid" => $wuid);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -947,13 +565,12 @@ class HeroProc {
|
|
|
|
|
|
/**
|
|
/**
|
|
* [6306] 英雄-更改英雄的锁定状态
|
|
* [6306] 英雄-更改英雄的锁定状态
|
|
- * (测试已经OK)
|
|
|
|
- * @param type $req
|
|
|
|
|
|
+ * (测试已经OK)
|
|
*/
|
|
*/
|
|
- static function HeroChangelockstate($req) {
|
|
|
|
- $gamedata = $req->userInfo->game;
|
|
|
|
- $heroUID = $req->paras[0]; # 玩家英雄实例编号
|
|
|
|
- $lockstate = $req->paras[1]; # 玩家英雄锁定状态
|
|
|
|
|
|
+ static function HeroChangelockstate() {
|
|
|
|
+ $gamedata = req()->userInfo->game;
|
|
|
|
+ $heroUID = req()->paras[0]; # 玩家英雄实例编号
|
|
|
|
+ $lockstate = req()->paras[1]; # 玩家英雄锁定状态
|
|
$collectHeros = $gamedata->heros->collectHeros;
|
|
$collectHeros = $gamedata->heros->collectHeros;
|
|
my_default_Obj($collectHeros); # 默认值
|
|
my_default_Obj($collectHeros); # 默认值
|
|
my_Assert(CommUtil::isPropertyExists($collectHeros, $heroUID), ErrCode::hero_no);
|
|
my_Assert(CommUtil::isPropertyExists($collectHeros, $heroUID), ErrCode::hero_no);
|
|
@@ -964,22 +581,20 @@ class HeroProc {
|
|
return Resp::ok(ObjectInit()); # 4. 设置返回值
|
|
return Resp::ok(ObjectInit()); # 4. 设置返回值
|
|
}
|
|
}
|
|
|
|
|
|
- /* * 6326
|
|
|
|
- * 言灵升星
|
|
|
|
- * @param req $req
|
|
|
|
- * @return type
|
|
|
|
|
|
+ /** 6326
|
|
|
|
+ * 言灵升星 2021.4(cyzhao)
|
|
|
|
+ * @return resp
|
|
*/
|
|
*/
|
|
-
|
|
|
|
- static function StrengthenStar($req) {
|
|
|
|
- list($yanlingUid, $uidList) = $req->paras;
|
|
|
|
- $store = $req->userInfo->game->store;
|
|
|
|
|
|
+ static function StrengthenStar() {
|
|
|
|
+ list($yanlingUid, $uidList) = req()->paras;
|
|
|
|
+ $store = req()->userInfo->game->store;
|
|
my_Assert(StlUtil::dictHasProperty($store->yanling, $yanlingUid), ErrCode::hero_yanling_notfound);
|
|
my_Assert(StlUtil::dictHasProperty($store->yanling, $yanlingUid), ErrCode::hero_yanling_notfound);
|
|
my_Assert(!in_array($yanlingUid, $uidList), ErrCode::hero_yanling_repeat);
|
|
my_Assert(!in_array($yanlingUid, $uidList), ErrCode::hero_yanling_repeat);
|
|
my_Assert($store->yanling->$yanlingUid->starLv < 5, ErrCode::hero_yanling_repeat);
|
|
my_Assert($store->yanling->$yanlingUid->starLv < 5, ErrCode::hero_yanling_repeat);
|
|
|
|
|
|
$tag = true;
|
|
$tag = true;
|
|
foreach ($uidList as $costUid) {
|
|
foreach ($uidList as $costUid) {
|
|
- if (StlUtil::dictHasProperty($store->yanling, $costUid)) { // 校验是否是同类型
|
|
|
|
|
|
+ if (StlUtil::dictHasProperty($store->yanling, $costUid)) { # 校验是否是同类型
|
|
$confDic = GameConfig::item_yanling_getItem($store->yanling->$costUid->typeId);
|
|
$confDic = GameConfig::item_yanling_getItem($store->yanling->$costUid->typeId);
|
|
my_Assert(null != $confDic, ErrCode::hero_const_no_err);
|
|
my_Assert(null != $confDic, ErrCode::hero_const_no_err);
|
|
if ($confDic->type != GameConfig::item_yanling_getItem($store->yanling->$yanlingUid->typeId)->type) {
|
|
if ($confDic->type != GameConfig::item_yanling_getItem($store->yanling->$yanlingUid->typeId)->type) {
|
|
@@ -1010,23 +625,22 @@ class HeroProc {
|
|
$store->yanling->$yanlingUid->typeId = $dic->nextId;
|
|
$store->yanling->$yanlingUid->typeId = $dic->nextId;
|
|
}
|
|
}
|
|
|
|
|
|
- $req->userInfo->game->store = $store;
|
|
|
|
|
|
+ req()->userInfo->game->store = $store;
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
- return Resp::ok(array('store' => $req->userInfo->game->store,));
|
|
|
|
|
|
+ return Resp::ok(array('store' => req()->userInfo->game->store,));
|
|
}
|
|
}
|
|
|
|
|
|
/** 6327
|
|
/** 6327
|
|
- * 言灵升级
|
|
|
|
- * @param req $req
|
|
|
|
|
|
+ * 言灵升级 2021.4(cyzhao)
|
|
*/
|
|
*/
|
|
- static function YanlinUpLevel($req) {
|
|
|
|
- list($yanlingUid, $type) = $req->paras; # 参数: 言灵uid,升级类型:1/5级.
|
|
|
|
- $store = $req->userInfo->game->store;
|
|
|
|
|
|
+ static function YanlinUpLevel() {
|
|
|
|
+ list($yanlingUid, $type) = req()->paras; # 参数: 言灵uid,升级类型:1/5级.
|
|
|
|
+ $store = req()->userInfo->game->store;
|
|
my_Assert(StlUtil::dictHasProperty($store->yanling, $yanlingUid), ErrCode::hero_yanling_notfound);
|
|
my_Assert(StlUtil::dictHasProperty($store->yanling, $yanlingUid), ErrCode::hero_yanling_notfound);
|
|
$allDic = GameConfig::yanlingLeve();
|
|
$allDic = GameConfig::yanlingLeve();
|
|
$maxLevel = count((array) $allDic);
|
|
$maxLevel = count((array) $allDic);
|
|
$curlv = $store->yanling->$yanlingUid->level;
|
|
$curlv = $store->yanling->$yanlingUid->level;
|
|
- my_Assert($curlv <= $req->userInfo->game->baseInfo->level, "请提升指挥官等级."); # 言灵等级不能超过指挥官等级.-gwang 2021.4.20
|
|
|
|
|
|
+ my_Assert($curlv <= req()->userInfo->game->baseInfo->level, "请提升指挥官等级."); # 言灵等级不能超过指挥官等级.-gwang 2021.4.20
|
|
my_Assert($curlv < $maxLevel, ErrCode::hero_yanling_levelMax);
|
|
my_Assert($curlv < $maxLevel, ErrCode::hero_yanling_levelMax);
|
|
|
|
|
|
$maxLv = $curlv + $type;
|
|
$maxLv = $curlv + $type;
|
|
@@ -1041,19 +655,19 @@ class HeroProc {
|
|
$goldNum += $mo->goldCost;
|
|
$goldNum += $mo->goldCost;
|
|
$pointNum += $mo->pointCost;
|
|
$pointNum += $mo->pointCost;
|
|
}
|
|
}
|
|
- my_Assert(Data_UserGame::Consume_Gold($req->userInfo->game->baseInfo, $goldNum), ErrCode::notenough_gold_msg);
|
|
|
|
- my_Assert(Data_UserGame::Consume_ResPoint($req->userInfo->game->baseInfo, $pointNum), ErrCode::notenough_resPoint);
|
|
|
|
|
|
+ my_Assert(Data_UserGame::Consume_Gold(req()->userInfo->game->baseInfo, $goldNum), ErrCode::notenough_gold_msg);
|
|
|
|
+ my_Assert(Data_UserGame::Consume_ResPoint(req()->userInfo->game->baseInfo, $pointNum), ErrCode::notenough_resPoint);
|
|
|
|
|
|
$store->yanling->$yanlingUid->level += $type; # 增加等级
|
|
$store->yanling->$yanlingUid->level += $type; # 增加等级
|
|
if ($store->yanling->$yanlingUid->level > $maxLevel) {
|
|
if ($store->yanling->$yanlingUid->level > $maxLevel) {
|
|
$store->yanling->$yanlingUid->level = $maxLevel;
|
|
$store->yanling->$yanlingUid->level = $maxLevel;
|
|
}
|
|
}
|
|
TaskProc::OnYanlingLevelUp($store->yanling->$yanlingUid->typeId, $store->yanling->$yanlingUid->level); # 言灵升级
|
|
TaskProc::OnYanlingLevelUp($store->yanling->$yanlingUid->typeId, $store->yanling->$yanlingUid->level); # 言灵升级
|
|
- $req->userInfo->game->store = $store;
|
|
|
|
|
|
+ req()->userInfo->game->store = $store;
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
- return Resp::ok(array('store' => $req->userInfo->game->store, #
|
|
|
|
- 'gold' => $req->userInfo->game->baseInfo->gold, #
|
|
|
|
- 'resPoint' => $req->userInfo->game->baseInfo->resPoint));
|
|
|
|
|
|
+ return Resp::ok(array('store' => req()->userInfo->game->store, #
|
|
|
|
+ 'gold' => req()->userInfo->game->baseInfo->gold, #
|
|
|
|
+ 'resPoint' => req()->userInfo->game->baseInfo->resPoint));
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|
|
@@ -1085,8 +699,7 @@ class HeroProc {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //todo: 这里的战斗力榜被总战力榜征用了key, 重启PVP机制时再
|
|
|
|
-// gMem()->zadd(MemKey_GameRun::Game_FightPowerRank_zset($zoneid), array($uid => $fp));
|
|
|
|
|
|
+ //todo: 这里的战斗力榜被总战力榜征用了key, 重启PVP机制时再
|
|
}
|
|
}
|
|
return $fp;
|
|
return $fp;
|
|
}
|
|
}
|
|
@@ -1132,8 +745,8 @@ class HeroProc {
|
|
$v = $kv[1];
|
|
$v = $kv[1];
|
|
$factor[$k] = $v;
|
|
$factor[$k] = $v;
|
|
}
|
|
}
|
|
-// todo: 哈哈, 奇葩的命名方案, 多处使用的命名不一致, 坑!
|
|
|
|
- $a = (int) (self::calcHeroProperty($hero, 'hp') * $factor ["hp"] //
|
|
|
|
|
|
+
|
|
|
|
+ $a = (int) (self::calcHeroProperty($hero, 'hp') * $factor ["hp"] //// todo: 哈哈, 奇葩的命名方案, 多处使用的命名不一致, 坑!
|
|
+ $hero->level * 10);
|
|
+ $hero->level * 10);
|
|
return $a;
|
|
return $a;
|
|
}
|
|
}
|