Mam xnova 1.1a i nie zauważyłem różnicy między kontem normalnym a kontem pro.
Gdzie można ustawić co ma konto pro?
Mam xnova 1.1a i nie zauważyłem różnicy między kontem normalnym a kontem pro.
Gdzie można ustawić co ma konto pro?
Ostatnio edytowane przez DjJonder ; 13-09-2010 o 00:32
zależy co bys chciał zeby dodawało najlepiej przypatrz sie w innych silnikach ze np dodają oficerów i w tym przypadku usuwasz punkty oficerów![]()
... ...
W XNovie 1.1A konto Pro to tylko jedno pole w bazie danych, które jest bezużyteczne.
Obsługę konta Pro musisz sam napisać.
Chcę aby ktoś kto ma konto pro miał większą kolejkę budowy.
czyli
1. szuka czy zalogowany user ma w tabeli pros wartość 1.
2. jeśli tak to kolejka budowania = 7
jesli nie to kolejka budowania = 3.
Nie wiem jak wykonać punkt 1.
edytuję plik constants.php
próbowałem tak żeby się połączył z bazą danych i
ale nic nie daje. mógłby mnie ktos naprowadzić?Kod php:
if ($courentUser(pros == 1))
{
linijka odpowiedzialna za kolekę o wartości 7
}
else
{
linijka o wartości 3
}
Lepiej nie mieszaj nic w constants.php, bo na 100% z twoją znajomością PHP coś rozwalisz.
Najlepiej zrobić to w pliku odpowiedzialnym za budowę, czyli BatimentBuildingPage.php i w funkcjach które od wywołuje.
Tam musisz sprawdzić, czy w zmiennej $user wartość pros jest ustawiona na 1 (robisz to tak: $user['pros'] == 1, to co ty napisałeś to jakaś bzdura, która wywali Ci Syntax Error).
I wtedy robisz dodatkową zmienną, która będzie odpowiedzialna za limit kolejki.
zostawiłem constants.php w stanie przed edycją. w pliku BatimentBuildingPage.php dodałem
nie działa. oraz gdy zmieniam naKod php:
if ($CurrentUser['pros'] == 1 ) {
define('MAX_BUILDING_QUEUE_SIZE' , 10); // dla graczy z kontem pro
}
else
{
define('MAX_BUILDING_QUEUE_SIZE' , 7); // dla graczy bez konta pro
}
również nie działa.Kod php:
if ($User['pros'] == 1 ) {
define('MAX_BUILDING_QUEUE_SIZE' , 10); // dla graczy z kontem pro
}
else
{
define('MAX_BUILDING_QUEUE_SIZE' , 7); // dla graczybez kontea pro
}
oto plik BatimentBuildingPage.php :
a tu plik constants.php :Kod php:
<?php
/**
* BatimentBuildingPage.php
*
* @version 1.1
* @copyright 2008 by Chlorel for XNova
*/
function BatimentBuildingPage (&$CurrentPlanet, $CurrentUser) {
global $ProdGrid,$lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
CheckPlanetUsedFields ( $CurrentPlanet );
// Tables des batiments possibles par type de planete
$Allowed['1'] = array( 1, 2, 3, 4, 12, 14, 15, 16, 21, 22, 23, 24, 31, 33, 34, 35,38, 43, 44, 45, 46, 47);
$Allowed['3'] = array( 12, 14, 16, 21, 22, 23, 24, 34, 41, 42, 43, 45, 46, 47);
// Boucle d'interpretation des eventuelles commandes
if (isset($_GET['cmd'])) {
// On passe une commande
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
$Element = $_GET['building'];
$ListID = $_GET['listid'];
if ( isset ( $Element )) {
if ( !strchr ( $Element, ",") && !strchr ( $Element, " ") && !strchr ( $Element, "+") && !strchr ( $Element, "*") && !strchr ( $Element, "~") && !strchr ( $Element, "=") && !strchr ( $Element, ";") && !strchr ( $Element, "'") && !strchr ( $Element, "#") && !strchr ( $Element, "-") && !strchr ( $Element, "_") && !strchr ( $Element, "[") && !strchr ( $Element, "]") && !strchr ( $Element, ".") && !strchr ( $Element, ":"))
{
if (in_array( trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
}
}
} elseif ( isset ( $ListID )) {
$bDoItNow = true;
}
if ($bDoItNow == true) {
switch($TheCommand){
case 'cancel':
// Interrompre le premier batiment de la queue
CancelBuildingFromQueue ( $CurrentPlanet, $CurrentUser );
break;
case 'remove':
// Supprimer un element de la queue (mais pas le premier)
// $RemID -> element de la liste a supprimer
RemoveBuildingFromQueue ( $CurrentPlanet, $CurrentUser, $ListID );
break;
case 'insert':
// Insere un element dans la queue
AddBuildingToQueue ( $CurrentPlanet, $CurrentUser, $Element, true );
break;
case 'destroy':
// Detruit un batiment deja construit sur la planete !
AddBuildingToQueue ( $CurrentPlanet, $CurrentUser, $Element, false );
break;
default:
break;
} // switch
}
}
SetNextQueueElementOnTop ( $CurrentPlanet, $CurrentUser );
$Queue = ShowBuildingQueue ( $CurrentPlanet, $CurrentUser );
// On enregistre ce que l'on a modifié dans planet !
BuildingSavePlanetRecord ( $CurrentPlanet );
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$SubTemplate = gettemplate('buildings_builds_row');
$BuildingPage = "";
$zaehler = 1;
foreach($lang['tech'] as $Element => $ElementName) {
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
if ($CurrentPlanet["field_current"] < ($CurrentMaxFields - $Queue['lenght'])) {
$RoomIsOk = true;
} else {
$RoomIsOk = false;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
if ($zaehler == 1 || $zaehler % 3 == 1) {
$parse['tropen'] = '<tr>';
} else {
$parse['tropen'] = '';
}
$HaveRessources = IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, true, false);
$parse = array();
$parse['dpath'] = $dpath;
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = ($BuildingLevel == 0) ? "" : " (". $lang['level'] ." ". $BuildingLevel .")";
// show energy on BuildingPage
//================================
$BuildLevelFactor = $CurrentPlanet[ $resource[$Element]."_porcent" ];
$BuildTemp = $CurrentPlanet[ 'temp_max' ];
$CurrentBuildtLvl = $BuildingLevel;
$BuildLevel = ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1;
$Prod[3] = (floor(eval($ProdGrid[$Element]['formule']['deuterium']) * $game_config['resource_multiplier']));
$Prod[4] = (floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']));
if ($Element != 12) {
$ActualNeed = floor($Prod[4]);
} else {
$ActualNeed = floor($Prod[3]);
}
$BuildLevel++;
$Prod[3] = (floor(eval($ProdGrid[$Element]['formule']['deuterium']) * $game_config['resource_multiplier']));
$Prod[4] = (floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']));
if ($Element != 12) {
//$bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
//$bloc['build_prod_diff'] = colorNumber( pretty_number(floor($Prod[$BuildID] - $ActualProd)) );
//$bloc['build_need'] = colorNumber( pretty_number(floor($Prod[4])) );
$EnergyNeed = colorNumber( pretty_number(floor($Prod[4] - $ActualNeed)) );
} else {
//$bloc['build_prod'] = pretty_number(floor($Prod[4]));
//$bloc['build_prod_diff'] = colorNumber( pretty_number(floor($Prod[4] - $ActualProd)) );
//$bloc['build_need'] = colorNumber( pretty_number(floor($Prod[3])) );
$EnergyNeed = colorNumber( pretty_number(floor($Prod[3] - $ActualNeed)) );
}
if ($Element >= 1 && $Element <= 3) {
$parse['build_need_diff'] = "("."<font color=#FF0000>". $EnergyNeed." ".$lang['Energy']."</font>".")";
$BuildLevel = 0;
}elseif ($Element == 4 || $Element == 12) {
$parse['build_need_diff'] = "("."<font color=#00FF00>+". $EnergyNeed." ".$lang['Energy']."</font>".")";
$BuildLevel = 0;
}
//================================
$parse['n'] = $ElementName;
$parse['descriptions'] = $lang['res']['descriptions'][$Element];
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$parse['time'] = ShowBuildTime($ElementBuildTime);
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
$parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
$parse['click'] = '';
$NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
if ($Element == 31) {
// Spécial Laboratoire
if ($CurrentUser["b_tech_planet"] != 0 && // Si pas 0 y a une recherche en cours
$game_config['BuildLabWhileRun'] != 1) { // Variable qui contient le parametre
// On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config)
$parse['click'] = "<font color=#FF0000>". $lang['in_working'] ."</font>";
}
}
if ($parse['click'] != '') {
// Bin on ne fait rien, vu que l'on l'a deja fait au dessus !!
} elseif ($RoomIsOk && $CanBuildElement) {
if ($Queue['lenght'] == 0) {
if ($NextBuildLevel == 1) {
if ( $HaveRessources == true ) {
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['BuildFirstLevel'] ."</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>". $lang['BuildFirstLevel'] ."</font>";
}
} else {
if ( $HaveRessources == true ) {
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font>";
}
}
} else {
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['InBuildQueue'] ."</font></a>";
}
} elseif ($RoomIsOk && !$CanBuildElement) {
if ($NextBuildLevel == 1) {
$parse['click'] = "<font color=#FF0000>". $lang['BuildFirstLevel'] ."</font>";
} else {
$parse['click'] = "<font color=#FF0000>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font>";
}
} else {
$parse['click'] = "<font color=#FF0000>". $lang['NoMoreSpace'] ."</font>";
}
if ($zaehler % 3 == 0) {
$parse['trclose'] = '</tr>';
$zaehler++;
} else {
$parse['trclose'] = '';
$zaehler++;
}
$BuildingPage .= parsetemplate($SubTemplate, $parse);
}
}
}
$parse = $lang;
// Faut il afficher la liste de construction ??
if ($Queue['lenght'] > 0) {
$parse['BuildListScript'] = InsertBuildListScript ( "buildings" );
$parse['BuildList'] = $Queue['buildlist'];
} else {
$parse['BuildListScript'] = "";
$parse['BuildList'] = "";
}
$parse['planet_field_current'] = $CurrentPlanet["field_current"];
$parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet);
$parse['field_libre'] = $parse['planet_field_max'] - $CurrentPlanet['field_current'];
$parse['BuildingsList'] = $BuildingPage;
$page .= parsetemplate(gettemplate('buildings_builds'), $parse);
display($page, $lang['Builds']);
}
// -----------------------------------------------------------------------------------------------------------
// History version
// 1.0 Mise en module initiale (creation)
// 1.1 FIX interception cheat +1
// 1.2 FIX interception cheat destruction a -1
?>
i teraz to ja już nie wiem co robićKod php:
<?php
/**
* constants.php
*
* @version 1
* @copyright 2008 By Chlorel for XNova
*/
// ----------------------------------------------------------------------------------------------------------------
if ( defined('INSIDE') ) {
define('ADMINEMAIL' , "admin@xnova.fr");
define('GAMEURL' , "http://".$_SERVER['HTTP_HOST']."/");
// Definition du monde connu !
define('MAX_GALAXY_IN_WORLD' , 9);
define('MAX_SYSTEM_IN_GALAXY' , 499);
define('MAX_PLANET_IN_SYSTEM' , 15);
// Nombre de colones pour les rapports d'espionnage
define('SPY_REPORT_ROW' , 2);
define('MINURLOP' , 3);
// Cases données par niveau de Base Lunaire
define('FIELDS_BY_MOONBASIS_LEVEL', 4);
// Nombre maximum de colonie par joueur
define('MAX_PLAYER_PLANETS' , 21);
// Nombre maximum d'element dans la liste de construction de batiments
define('MAX_BUILDING_QUEUE_SIZE' , 7); // dla graczy z kontem pro
// *************************************
// Nombre maximum d'element dans une ligne de liste de construction flotte et defenses
define('MAX_FLEET_OR_DEFS_PER_ROW', 5000);
// Taux de depassement possible dans l'espace de stockage des hangards ...
// 1.0 pour 100% - 1.1 pour 110% etc ...
define('MAX_OVERFLOW' , 1.1);
// Affiche les administrateur dans la page des records ...
// 1 -> les affiche
// 0 -> les affiche pas
define('SHOW_ADMIN_IN_RECORDS' , 0);
// Valeurs de bases pour les colonies ou planetes fraichement crées
define('BASE_STORAGE_SIZE' , 100000);
define('BUILD_METAL' , 400);
define('BUILD_CRISTAL' , 200);
define('BUILD_DEUTERIUM' , 1);
// Debug Level
define('DEBUG', 1); // Debugging off
// Mot qui sont interdit a la saisie !
$ListCensure = array ( "<", ">", "script", "doquery", "http", "javascript", "'" );
} else {
die("Dostęp zablokowany!");
}
?>
ciekawy jest ten fragment kodu pliku BatimentBuildingPage.php :
może coś tu trzeba wykminić?Kod php:
SetNextQueueElementOnTop ( $CurrentPlanet, $CurrentUser );
$Queue = ShowBuildingQueue ( $CurrentPlanet, $CurrentUser );
// On enregistre ce que l'on a modifié dans planet !
BuildingSavePlanetRecord ( $CurrentPlanet );
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$SubTemplate = gettemplate('buildings_builds_row');
$BuildingPage = "";
$zaehler = 1;
Ostatnio edytowane przez DjJonder ; 16-09-2010 o 18:37 Powód: poprawki
W miarę dobrze wyłapałeś ten fragment kodu, jest jeszcze dla Ciebie nadzieja...
Najlepiej zrobisz, jeśli MAX_BUILDING_QUEUE_SIZE zamienisz na zmienną zastępczą, a przed tym ifem ustawisz ją tak jak zrobiłeś to tu:if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
Oczywiście define zamieniając na twoją zmienną.if ($User['pros'] == 1 ) {
define('MAX_BUILDING_QUEUE_SIZE' , 10); // dla graczy z kontem pro
}
else
{
define('MAX_BUILDING_QUEUE_SIZE' , 7); // dla graczybez kontea pro
}
STAWIAM PIWO!!!!!!! Męczyłem się z tym z 4 dni
ale się udało.
Aby zdefiniować kolejkę budowania dla graczy pro i zwykłych userów w Xnova 1.1A trzeba zrobić następująco:
Pliki:
1. constants.php (../includes/constants.php)
2. BatimentBuildingPage.php (../includes/functions/BatimentBuildingPage.php)
wykonać następująco:
1. w pliku constants.php znaleźć linijkę
2. w pliku BatimentBuildingPage.php znaleźć:Kod php:
define('MAX_BUILDING_QUEUE_SIZE' , 10);
// tu ustawiamy np. 10 lub więcej (gracz pro będzie miał 10 kolejek więc ustawiłem 10) chodzi o ustawienie tyle ile będzie miała największa wartość
przed nim (przed ifem) wstawiamy kod:Kod php:
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
ma to wyglądać takKod php:
if ($CurrentUser['pros'] == 1 ) {
define('MAX_KOLEJKA' , 10);
// dla graczy z kontem pro (dlatego w constants.php ustawialiśmy 10)
}
else
{
define('MAX_KOLEJKA' , 2); // dla graczy bez kontea pro
}
teraz zostaje nam tylko zmienienieKod php:
if ($CurrentUser['pros'] == 1 ) {
define('MAX_KOLEJKA' , 10);
// dla graczy z kontem pro (dlatego w constants.php ustawialiśmy 10)
}
else
{
define('MAX_KOLEJKA' , 2); // dla graczy bez kontea pro
}
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
na:Kod php:
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
kod po edycji (plik BatimentBuildingPage.php) powinien wygladac tak:Kod php:
if ($Queue['lenght'] < MAX_KOLEJKA ) {
U mnie pięknie śmiga więc i u was też powinno.Kod php:
if ($CurrentUser['pros'] == 1 ) {
define('MAX_KOLEJKA' , 10); // dla graczy z kontem pro
}
else
{
define('MAX_KOLEJKA' , 2); // dla graczy bez konta pro
}
if ($Queue['lenght'] < MAX_KOLEJKA ) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
Jeśli Admin tak uważa możena to przenieść do pradników
(mój pierwszy poradnik dzięki pomocy Glibnes'a)
Glibnes ---> Wielkie dzięki![]()
Proponuję podkleić temat.
@DjJonder: http://jastawiam.pl/
EDIT: Podklejone// Mateusz2598
Ostatnio edytowane przez Mateusz2598 ; 16-09-2010 o 20:52
Dla konto PRO można jeszcze dodać np. przycisk MAX w stoczni i obronie. W tym temacie macie jak dodać przycisk MAX: http://forum.mmocenter.pl/showthread.php?t=7988 Co do tego, aby było dla PRO trzeba dać odpowiedni warunek. W razie problemów pisać![]()
Aktualnie 1 użytkownik(ów) przegląda ten wątek. (0 zarejestrowany(ch) oraz 1 gości)
Zakładki