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"); $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(); }