From 966cf3b023e24dab1d6c23243fbb5d5137d45a20 Mon Sep 17 00:00:00 2001 From: wangwei01 Date: Fri, 26 Apr 2019 11:26:11 +0800 Subject: [PATCH] 1 --- webapp/bootstrap/init.php | 33 +++++++++++++- webapp/classes/Quest.php | 8 ++-- webapp/controller/EquipController.class.php | 4 +- webapp/controller/RoleController.class.php | 48 +++++++++++---------- webapp/controller/SignController.class.php | 8 ++-- 5 files changed, 67 insertions(+), 34 deletions(-) diff --git a/webapp/bootstrap/init.php b/webapp/bootstrap/init.php index ec5b1df..ed759fc 100644 --- a/webapp/bootstrap/init.php +++ b/webapp/bootstrap/init.php @@ -4,7 +4,38 @@ ini_set('date.timezone','Asia/Shanghai'); require 'phpcommon/common.php'; define('TEAMID_KEY', 'team_uuid:'); - +//每日任务 +define('QUEST_DAY_LOGIN', 71001); +define('QUEST_DAY_SHARE', 71002); +define('QUEST_DAY_FIGHT', 71003); +define('QUEST_DAY_SUPPLY', 71004); +define('QUEST_DAY_UPDATEEQUIP', 71005); +define('QUEST_DAY_TEAM', 71006); +define('QUEST_DAY_RANK', 71007); +define('QUEST_DAY_ALIVE', 71008); +define('QUEST_DAY_HARM', 71009); +define('QUEST_DAY_KILL', 71010); +define('QUEST_DAY_GAME', 71011); +define('QUEST_DAY_HELP', 71012); +define('QUEST_DAY_COMPLETE', 71013); +//成就 +define('QUEST_SUM_LOGIN', 72001); +define('QUEST_SUM_SHARE', 72002); +define('QUEST_SUM_FIGHT', 72003); +define('QUEST_SUM_SUPPLY', 72004); +define('QUEST_SUM_EQUIPMAX', 72005); +define('QUEST_SUM_TEAM', 72006); +define('QUEST_SUM_TEAMWIM', 72007); +define('QUEST_SUM_FRITEAMWIN', 72008); +define('QUEST_SUM_ALIVE', 72009); +define('QUEST_SUM_HARM', 72010); +define('QUEST_SUM_KILL', 72011); +define('QUEST_SUM_SNIPEKILL', 72012); +define('QUEST_SUM_RIFLEKILL', 72013); +define('QUEST_SUM_PISTOLKILL', 72014); +define('QUEST_SUM_SUBMACKILL', 72015); +define('QUEST_SUM_GAME', 72016); +define('QUEST_SUM_HELP', 72017); require 'config_loader.php'; diff --git a/webapp/classes/Quest.php b/webapp/classes/Quest.php index 56e1917..2e7833e 100644 --- a/webapp/classes/Quest.php +++ b/webapp/classes/Quest.php @@ -57,13 +57,13 @@ class Quest{ if ($q['condition'] == 7 && $quest_type == 1) { if($quest_num <= $q['value']) { $quest_state = 1; - $this->triggerQuest(71013, 1, 1, $account_id); + $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); } } else { if ($row['quest_num'] + $quest_num >= $q['value']) { $quest_num = $q['value']; $quest_state = 1; - $this->triggerQuest(71013, 1, 1, $account_id); + $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); } else { $quest_num = $row['quest_num'] + $quest_num; $quest_state = 0; @@ -89,13 +89,13 @@ class Quest{ if ($q['condition'] == 7 && $quest_type == 1) { if($quest_num <= $q['value']) { $quest_state = 1; - $this->triggerQuest(71013, 1, 1, $account_id); + $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); } } else { if ($quest_num >= $q['value']) { $quest_num = $q['value']; $quest_state = 1; - $this->triggerQuest(71013, 1, 1, $account_id); + $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); } } $ret = $conn->execScript('INSERT INTO quest(accountid, quest_id, quest_num, quest_type, quest_state) ' . diff --git a/webapp/controller/EquipController.class.php b/webapp/controller/EquipController.class.php index 1e8e394..43eb403 100644 --- a/webapp/controller/EquipController.class.php +++ b/webapp/controller/EquipController.class.php @@ -151,9 +151,9 @@ class EquipController{ } } $quest = new classes\Quest(); - $quest->triggerQuest(71005, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_UPDATEEQUIP, 1, 1, $account_id); if ($e['equip_nextlevel'] == 10) { - $quest->triggerQuest(72005, 2, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_EQUIPMAX, 2, 1, $account_id); } echo json_encode(array( 'errcode' => 0, diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 985354b..584b06b 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -50,6 +50,7 @@ class RoleController{ 'harm' => 0, 'add_HP' => 0, 'alive_time' => 0, + 'coin_num' => 0, )); } else { echo json_encode(array( @@ -63,6 +64,7 @@ class RoleController{ 'harm' => $row['harm'], 'add_HP' => $row['add_HP'], 'alive_time' => $row['alive_time'], + 'coin_num' => $row['coin_num'] )); } } @@ -160,33 +162,33 @@ class RoleController{ )); //刷新任务 $quest = new classes\Quest(); - $quest->triggerQuest(71003, 1, 1, $account_id); - $quest->triggerQuest(71008, 1, $alive_time, $account_id); - $quest->triggerQuest(71009, 1, $harm, $account_id); - $quest->triggerQuest(71010, 1, $kills, $account_id); - $quest->triggerQuest(71011, 1, 1, $account_id); - $quest->triggerQuest(71012, 1, $rescue_member, $account_id); - $quest->triggerQuest(72003, 1, 1, $account_id); - $quest->triggerQuest(72009, 1, $alive_time, $account_id); - $quest->triggerQuest(72010, 1, $harm, $account_id); - $quest->triggerQuest(72011, 1, $kills, $account_id); - $quest->triggerQuest(72016, 1, 1, $account_id); - $quest->triggerQuest(72017, 1, $rescue_member, $account_id); - $quest->triggerQuest(72012, 1, $snipe_kill, $account_id); - $quest->triggerQuest(72013, 1, $rifle_kill, $account_id); - $quest->triggerQuest(72014, 1, $pistol_kill, $account_id); - $quest->triggerQuest(72015, 1, $submachine_kill, $account_id); + $quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_ALIVE, 1, $alive_time, $account_id); + $quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id); + $quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id); + $quest->triggerQuest(QUEST_DAY_GAME, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_HELP, 1, $rescue_member, $account_id); + $quest->triggerQuest(QUEST_SUM_FIGHT, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_ALIVE, 1, $alive_time, $account_id); + $quest->triggerQuest(QUEST_SUM_HARM, 1, $harm, $account_id); + $quest->triggerQuest(QUEST_SUM_KILL, 1, $kills, $account_id); + $quest->triggerQuest(QUEST_SUM_GAME, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_HELP, 1, $rescue_member, $account_id); + $quest->triggerQuest(QUEST_SUM_SNIPEKILL, 1, $snipe_kill, $account_id); + $quest->triggerQuest(QUEST_SUM_RIFLEKILL, 1, $rifle_kill, $account_id); + $quest->triggerQuest(QUEST_SUM_PISTOLKILL, 1, $pistol_kill, $account_id); + $quest->triggerQuest(QUEST_SUM_SUBMACKILL, 1, $submachine_kill, $account_id); if ($team_status != 0 && $rank <= 5) { - $quest->triggerQuest(71007, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_RANK, 1, 1, $account_id); } if ($team_status == 1 && $rank == 1) { - $quest->triggerQuest(72007, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_TEAMWIM, 1, 1, $account_id); } if ($team_status == 2) { - $quest->triggerQuest(71006, 1, 1, $account_id); - $quest->triggerQuest(72006, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_TEAM, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_TEAM, 1, 1, $account_id); if ($rank == 1) { - $quest->triggerQuest(72008, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_FRITEAMWIN, 1, 1, $account_id); } } } @@ -237,8 +239,8 @@ class RoleController{ return; } $quest = new classes\Quest(); - $quest->triggerQuest(71002, 1, 1, $account_id); - $quest->triggerQuest(72002, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_SHARE, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_SHARE, 1, 1, $account_id); } } diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 41c0c7d..cdb8ea7 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -70,8 +70,8 @@ class SignController{ ':coin_num' => $num )); $quest = new classes\Quest(); - $quest->triggerQuest(71001, 1, 1, $account_id); - $quest->triggerQuest(72001, 2, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_LOGIN, 2, 1, $account_id); } else { if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['sign_time']) > 0) { $sign_days = $row['sign_days'] + 1; @@ -99,8 +99,8 @@ class SignController{ ':coin_num' => $num )); $quest = new classes\Quest(); - $quest->triggerQuest(71001, 1, 1, $account_id); - $quest->triggerQuest(72001, 2, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id); + $quest->triggerQuest(QUEST_SUM_LOGIN, 2, 1, $account_id); //刷新每日任务 $rowCount = $conn->execQueryRowCount('SELECT * FROM quest WHERE accountid=:accountid;', array(