Пример #1
0
 public function action_index()
 {
     if ($this->model->isOnline() > 0) {
         throw new Exception($this->view->getVal("l_accisonline"));
     }
     if (empty($_SESSION["mwccharacter"])) {
         throw new Exception($this->view->getVal("l_err_nochar"));
     }
     $charInfo = $this->model->chracterInfo($_SESSION["mwccharacter"], $_SESSION["mwcuser"]);
     $needZen = ($charInfo[$this->configs["rescolumn"]] + 1) * $this->configs["resZen"];
     if ($needZen > $this->configs["maxZenPrice"]) {
         $needZen = $this->configs["maxZenPrice"];
     }
     if (isset($_REQUEST["gotores"])) {
         if ($charInfo["cLevel"] < $this->configs["lvlRes"]) {
             throw new Exception($this->view->getVal("l_err_nolevel"));
         }
         if ($charInfo["Money"] < $needZen) {
             throw new Exception($this->view->getVal("l_err_nozen"));
         }
         $this->model->getRes($this->configs);
         Tools::go($this->view->getAdr() . "page/freepoints.html");
     }
     $this->view->add_dict($this->configs)->set("zen4res", Tools::number($needZen, 0))->out("index", get_class($this));
 }
Пример #2
0
 public function action_index()
 {
     $this->view->add_dict("login");
     if (empty($_SESSION["mwcuser"]) && empty($_SESSION["mwcpwd"])) {
         if (isset($_REQUEST["secure-Btn"])) {
             $login = !empty($_POST["username"]) ? $_POST["username"] : NULL;
             $pwd = !empty($_POST["password"]) ? $_POST["password"] : NULL;
             if (!is_null($login) && !is_null($pwd)) {
                 if ($this->model->auth($login, $pwd)) {
                     Tools::go($this->view->getAdr() . "page/" . $this->configs["pageIn"] . ".html");
                 } else {
                     $_GET["p"] = "error";
                     $_GET["get"] = 8;
                 }
             }
         }
         $this->view->out("login", "login");
     } else {
         $characters = $this->model->getCharacters();
         $characters[-1] = "...";
         if (isset($_REQUEST["chosedchar"]) && in_array($_POST["chosedchar"], $characters)) {
             $_SESSION["mwccharacter"] = $_POST["chosedchar"];
         }
         if (!empty($_SESSION["mwccharacter"])) {
             $choosed = $_SESSION["mwccharacter"];
         } else {
             $choosed = -1;
         }
         $money = $this->model->aboutUser();
         $money["mwc_bankZ"] = Tools::number($money["mwc_bankZ"], 0);
         $money["mwc_credits"] = Tools::number($money["mwc_credits"], 0);
         $this->view->set("charlist", html_::select($characters, "chosedchar", $choosed, "class='selectbox' onchange='loginarea.submit()'"))->add_dict($money)->out("userPanel", "login");
         if (isset($_REQUEST["btn-out"])) {
             unset($_SESSION["mwcuser"], $_SESSION["mwcpwd"], $_SESSION["mwcpoints"], $_SESSION["mwccharacter"]);
             Tools::go($this->view->getAdr());
         }
     }
 }
Пример #3
0
 public function action_knowmoney()
 {
     $data = $this->model->aboutUser();
     //получаем данные по состоянию акка вообще
     echo Tools::number($data["mwc_bankZ"], 0) . "::" . Tools::number($data["Money"], 0);
 }
Пример #4
0
 public function action_inlist()
 {
     if (!empty($_POST)) {
         $alloweds = explode(",", $this->configs["uGroups"]);
         $isallow = 0;
         if (in_array($_SESSION["mwcpoints"], $alloweds)) {
             $isallow = 1;
             $user = $this->model->aboutUser($_SESSION["mwcuser"]);
         } else {
             $user["mwc_bankZ"] = 0;
         }
         $harm_ = "build/" . tbuild . "/_dat/items/harmony.php";
         if (file_exists($harm_)) {
             require $harm_;
         } else {
             $harm = array();
         }
         if (!empty($_POST["itemname"])) {
             $params["name"] = $_POST["itemname"];
         }
         $params["lvlf"] = (int) $_POST["lvlf"];
         $params["lvlt"] = (int) $_POST["lvlt"];
         if (!empty($_POST["isExc"])) {
             $params["isExc"] = 1;
         }
         if (!empty($_POST["pn"])) {
             $params["pn"] = (int) $_POST["pn"];
         } else {
             $params["pn"] = 1;
         }
         if (!empty($_POST["isAnc"])) {
             $params["isAnc"] = 1;
         }
         if (!empty($_POST["isSkill"])) {
             $params["isSkill"] = 1;
         }
         if (!empty($_POST["isOpt"])) {
             $params["isOpt"] = 1;
         }
         if (!empty($_POST["isPVP"])) {
             $params["isPVP"] = 1;
         }
         if (!empty($_POST["isHarmony"])) {
             $params["isHarmony"] = 1;
         }
         $count = $this->model->getCount($params);
         if ($count > 0) {
             $pp = Tools::paginate($count, $this->configs["itemPp"], $params["pn"]);
             $params["min"] = $pp["min"];
             $params["max"] = $pp["max"];
             if ($pp["count"] > 1) {
                 for ($i = 0; $i < $pp["count"]; $i++) {
                     if ($i + 1 == $params["pn"]) {
                         $this->view->set("isactive", "color:white");
                     } else {
                         $this->view->set("isactive", "");
                     }
                     $this->view->set("i", $i + 1)->out("paginator_c", "webshop");
                 }
                 $this->view->setFContainer("pcontent", true)->out("pmain", "webshop");
             }
             $list = $this->model->getlist($params);
             $ai = new ArrayIterator($list);
             foreach ($ai as $vals) {
                 if (!empty($vals["col_isExc"])) {
                     $vals["col_Name"] = "Excellent " . $vals["col_Name"];
                 }
                 if (!empty($vals["col_isAnc"])) {
                     $vals["col_Name"] = "Ancient " . $vals["col_Name"];
                 }
                 if (!empty($vals["col_isSkill"])) {
                     $vals["col_Name"] .= " + skill";
                 }
                 if (!empty($vals["col_isOpt"])) {
                     $vals["col_Name"] .= " + options";
                 }
                 if (!empty($vals["col_isPVP"])) {
                     $vals["col_Name"] .= " + PvP";
                 }
                 if (!empty($vals["col_isHarmony"])) {
                     $vals["col_Name"] .= " + harmony";
                 }
                 if (!empty($vals["col_isSock"])) {
                     $vals["col_Name"] .= " with sockets";
                 }
                 switch ($vals["col_level"]) {
                     case 0:
                     case 1:
                     case 2:
                         $cls = "I_Normal_l";
                         break;
                     case 3:
                     case 4:
                     case 5:
                     case 6:
                         $cls = "I_Normal3_l";
                         break;
                     case 7:
                     case 8:
                         $cls = "I_Normal7_l";
                         break;
                     case 9:
                     case 10:
                     case 11:
                     case 12:
                     case 13:
                     case 14:
                     case 15:
                         $cls = "I_plus9_l";
                         break;
                     default:
                         $cls = "I_Normal_l";
                         break;
                 }
                 if ($vals["col_user"] == $_SESSION["mwcuser"]) {
                     $this->view->set("vizby", "display:none");
                     $this->view->set("vizdr", "");
                 } elseif ($isallow > 0) {
                     if ($user["mwc_bankZ"] >= $vals["col_prise"]) {
                         $this->view->set("vizby", "");
                     } else {
                         $this->view->set("vizby", "display:none");
                     }
                     $this->view->set("vizdr", "display:none");
                 } else {
                     $this->view->set("vizby", "display:none");
                     $this->view->set("vizdr", "display:none");
                 }
                 //todo : запилить возможность одмином снимать вещи
                 $vals["col_Name"] = "<span class='{$cls}'>{$vals["col_Name"]}</span>";
                 $vals["col_prise"] = Tools::number($vals["col_prise"], 0) . " Zen";
                 $this->view->add_dict($vals)->set("img", itemShow($vals["col_hex"], $harm, 2, 0, array("address" => $this->view->getAdr(), "theme" => $this->view->getVal("theme"))))->out("center", "webshop");
             }
             if ($pp > 1) {
                 $this->view->out("pmain", "webshop");
             }
         }
     } else {
         echo "empty post";
     }
 }