public function run() { global $request; $em = \Shared\DoctrineHelper::getEntityManager(); $idPlayer = $this->objPlayer->getId(); $codeVerif = $request->request->get("numeroVerif"); $objSuppressionPersonnage = \Site\SiteHelper::getSuppressionPersonnageRepository()->findByIdPlayerAndNumeroVerif($this->objPlayer->getId(), $codeVerif); if ($objSuppressionPersonnage !== null) { if (\Player\PlayerHelper::haveGuild($idPlayer) == false) { $objPlayerIndex = \Player\PlayerHelper::getPlayerIndexRepository()->find($this->objAccount->getId()); if ($objPlayerIndex->getPid1() == $idPlayer) { $func = "setPid1"; } else { if ($objPlayerIndex->getPid2() == $idPlayer) { $func = "setPid2"; } else { if ($objPlayerIndex->getPid3() == $idPlayer) { $func = "setPid3"; } else { if ($objPlayerIndex->getPid4() == $idPlayer) { $func = "setPid4"; } } } } $objPlayerIndex->{$func}(0); $em->persist($objPlayerIndex); \Player\PlayerHelper::getMarriageRepository()->deleteByIdPlayer($idPlayer); \Player\PlayerHelper::getItemRepository()->deleteByOwnerId($idPlayer, ["EQUIPMENT", "INVENTORY"]); $objPlayerDelete = new \Player\Entity\PlayerDeleted(); $oldReflection = new \ReflectionObject($this->objPlayer); $newReflection = new \ReflectionObject($objPlayerDelete); foreach ($oldReflection->getProperties() as $property) { if ($newReflection->hasProperty($property->getName())) { $newProperty = $newReflection->getProperty($property->getName()); $newProperty->setAccessible(true); $newProperty->setValue($objPlayerDelete, $property->getValue($this->objPlayer)); } } $em->persist($objPlayerDelete); \Player\PlayerHelper::getMessengerListRepository()->deleteByNamePlayer($this->objPlayer->getName()); $em->remove($this->objPlayer); $em->remove($objSuppressionPersonnage); $em->flush(); $Tableau_Retour_Json = array('result' => true); } else { $em->remove($objSuppressionPersonnage); $em->flush(); $Tableau_Retour_Json = array('result' => false, 'reasons' => "Le joueur est membre ou chef d'une guilde."); } } else { $Tableau_Retour_Json = array('result' => false, 'reasons' => "Le code de vérification n'est pas le bon."); } echo json_encode($Tableau_Retour_Json); }
public function run() { global $request; $idPlayer = $request->query->get("id"); $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($idPlayer); $haveGuild = \Player\PlayerHelper::haveGuild($objPlayer->getId()); $this->arrayTemplate["objPlayer"] = $objPlayer; $this->arrayTemplate["haveGuild"] = $haveGuild; $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); }
public function run() { global $request; $idPlayer = $request->query->get("id"); $templateEquipement = $this->objTwig->loadTemplate("playerEquipement.html5.twig"); $tailleImageEquipement = getimagesize("../../images/equipement.png"); $objItemArme = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(4, 4, $idPlayer, "EQUIPMENT", true); $objItemArmure = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(0, 0, $idPlayer, "EQUIPMENT", true); $objItemCasque = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(1, 1, $idPlayer, "EQUIPMENT", true); $objItemBouclier = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(10, 10, $idPlayer, "EQUIPMENT", true); $objItemBracelet = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(3, 3, $idPlayer, "EQUIPMENT", true); $objItemBoucle = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(6, 6, $idPlayer, "EQUIPMENT", true); $objItemCollier = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(5, 5, $idPlayer, "EQUIPMENT", true); $objItemChaussure = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(2, 2, $idPlayer, "EQUIPMENT", true); $objItemFleche = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(9, 9, $idPlayer, "EQUIPMENT", true); $objItemSpecial1 = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(7, 7, $idPlayer, "EQUIPMENT", true); $objItemSpecial2 = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(8, 8, $idPlayer, "EQUIPMENT", true); $objItemJambiere = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(23, 23, $idPlayer, "EQUIPMENT", true); $viewEquipement = $templateEquipement->render(["tailleImageEquipementWidth" => $tailleImageEquipement[0], "tailleImageEquipementHeight" => $tailleImageEquipement[1], "objItemArme" => $objItemArme, "objItemArmure" => $objItemArmure, "objItemCasque" => $objItemCasque, "objItemBouclier" => $objItemBouclier, "objItemBracelet" => $objItemBracelet, "objItemBoucle" => $objItemBoucle, "objItemCollier" => $objItemCollier, "objItemChaussure" => $objItemChaussure, "objItemFleche" => $objItemFleche, "objItemSpecial1" => $objItemSpecial1, "objItemSpecial2" => $objItemSpecial2, "objItemJambiere" => $objItemJambiere]); $arrObjItems = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(0, 180, $idPlayer, "INVENTORY"); $arrObjItemsPage1 = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(0, 45, $idPlayer, "INVENTORY"); $templateEntrepotPage1 = $this->objTwig->loadTemplate("ajaxInventairePage.html5.twig"); $viewEntrepotPage1 = $templateEntrepotPage1->render(["arrObjItems" => $arrObjItemsPage1, "iDepart" => 0]); $templateInventaire = $this->objTwig->loadTemplate("playerInventaire.html5.twig"); $viewInventaire = $templateInventaire->render(["objAccount" => $this->objAccount, "viewInventairePage1" => $viewEntrepotPage1, "arrObjItems" => $arrObjItems, "idPlayer" => $idPlayer]); $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($idPlayer); $objPlayerIndex = \Player\PlayerHelper::getPlayerIndexRepository()->find($objPlayer->getId()); $calculateGrade = \Player\PlayerHelper::calculateGrade($objPlayer->getAlignment()); $isConnected = \Player\PlayerHelper::isConnected($objPlayer, 30); $haveGuild = \Player\PlayerHelper::haveGuild($objPlayer->getId()); $localisation = json_decode(\Localisation::localize(0, $objPlayer, $isConnected)); $objMarriage = \Player\PlayerHelper::getMarriageRepository()->findMariageByIdPlayer($objPlayer->getId()); $this->arrayTemplate["viewEquipement"] = $viewEquipement; $this->arrayTemplate["viewInventaire"] = $viewInventaire; $this->arrayTemplate["objPlayer"] = $objPlayer; $this->arrayTemplate["objPlayerIndex"] = $objPlayerIndex; $this->arrayTemplate["localisation"] = $localisation; $this->arrayTemplate["isConnected"] = $isConnected; $this->arrayTemplate["calculateGrade"] = $calculateGrade; $this->arrayTemplate["objAccount"] = $this->objAccount; $this->arrayTemplate["haveGuild"] = $haveGuild; $this->arrayTemplate["objMarriage"] = $objMarriage; $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); }
public function run() { global $request; $em = \Shared\DoctrineHelper::getEntityManager(); $playerId = \Encryption::decrypt($request->request->get("id_personnage")); $titre = $request->request->get("texte_titre"); $description = $request->request->get("texte_description"); $prix = trim($request->request->get("prix")); $idDevise = $request->request->get("id_devise"); if (is_numeric($prix)) { $objPlayer = parent::VerifMonJoueur($playerId); if (\Player\PlayerHelper::haveGuild($objPlayer->getId()) === false) { $objPlayerIndex = \Player\PlayerHelper::getPlayerIndexRepository()->find($this->objAccount->getId()); $playerIndexPid = 0; if ($objPlayerIndex->getPid1() == $objPlayer->getId()) { $playerIndexPid = 1; } else { if ($objPlayerIndex->getPid2() == $objPlayer->getId()) { $playerIndexPid = 2; } else { if ($objPlayerIndex->getPid3() == $objPlayer->getId()) { $playerIndexPid = 3; } else { if ($objPlayerIndex->getPid4() == $objPlayer->getId()) { $playerIndexPid = 4; } } } } if ($playerIndexPid != 0) { $objMarchePersonnage = new \Site\Entity\MarchePersonnages(); $objMarchePersonnage->setIdProprietaire($this->objAccount->getId()); $objMarchePersonnage->setIdPersonnage($objPlayer->getId()); $objMarchePersonnage->setPid($playerIndexPid); $em->persist($objMarchePersonnage); $em->flush(); $func = "setPid" . $playerIndexPid; $objPlayerIndex->{$func}("9999999"); $em->persist($objPlayerIndex); $objPlayer->setIdAccount(0); $em->persist($objPlayer); $objMarcheArticles = new \Site\Entity\MarcheArticles(); $objMarcheArticles->setDesignation($titre); $objMarcheArticles->setDescription($description); $objMarcheArticles->setCategorie(1); $objMarcheArticles->setIdentifiantArticle($objMarchePersonnage->getId()); $objMarcheArticles->setPrix($prix); $objMarcheArticles->setDevise($idDevise); $objMarcheArticles->setDateAjout(new \DateTime(date("Y-m-d H:i:s"))); $objMarcheArticles->setIp($this->ipAdresse); $em->persist($objMarcheArticles); $objLogsMarcheMiseEnVente = new \Site\Entity\LogsMarcheMiseEnVente(); $objLogsMarcheMiseEnVente->setIdCompte($this->objAccount->getId()); $objLogsMarcheMiseEnVente->setIdPersonnage($playerId); $objLogsMarcheMiseEnVente->setPrix($prix); $objLogsMarcheMiseEnVente->setDevise($idDevise); $objLogsMarcheMiseEnVente->setDate(new \DateTime(date("Y-m-d H:i:s"))); $objLogsMarcheMiseEnVente->setIp($this->ipAdresse); $em->persist($objLogsMarcheMiseEnVente); $em->flush(); $Tableau_Retour_Json = array('result' => true, 'reasons' => ""); } else { $Tableau_Retour_Json = array('result' => false, 'reasons' => "Ce personnage n'existe pas."); } } else { $Tableau_Retour_Json = array('result' => false, 'reasons' => "Le perso ne doit pas avoir de guilde."); } } else { $Tableau_Retour_Json = array('result' => false, 'reasons' => "Vous n'avez pas indiquer un chiffre."); } echo json_encode($Tableau_Retour_Json); }