Register for your free account! | Forgot your password?

You last visited: Today at 18:19

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[How To] Shaiya Web Service

Discussion on [How To] Shaiya Web Service within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old 05/22/2013, 16:00   #16
 
[GM]SkyLine.™'s Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 147
Received Thanks: 174
Problem has been fixed.
[GM]SkyLine.™ is offline  
Old 05/22/2013, 17:05   #17
 
elite*gold: 0
Join Date: Oct 2005
Posts: 184
Received Thanks: 84
Quote:
Originally Posted by castor4878 View Post
The is online. It offers a solution for generic recreation.

wow thank you
Psycnosis is offline  
Old 05/28/2013, 15:08   #18
 
elite*gold: 0
Join Date: May 2010
Posts: 342
Received Thanks: 87
Awesome work ! It still exist Brain nice !
Just one question, how can we do it for Armor ??? cuz i read weapon weapon and in script there is no hp mp sp...
In this case if we should to add something to do it, could you healp us with the Clue to do it xD ? please

Thx U much see ya
_Diavolino_ is offline  
Old 05/29/2013, 21:26   #19
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
The reroll page presented of the tutorial allows to set the orange stats to their maximal values.

But what if we want to limit the number of these maximized stats?
I received a request with that question, indeed it's something we may want to use.

The required changes are not very hard, the question is more where and how this additional control should be done?

A good programming practice is to create a dedicated function to manage this specific request. The function will be as simple as "count the maximixed orange stats for this item". Its purpose seems to be very specific and so we may want to insert it into the reroll function itself. It would be a bad idea. Even if a function seems useful to a single service, decouple the function of the service, both will be more readable and maintainable.

We so create a new function "countMaxedOrangeStat" in the inc/functions.php file:

Code:
/**
*	Count maximixed stat of given item
*	@param	itemID	the identifier of item (dbo.CharItems.RowID) of interest
*	@return the number of already maximized orange stats, or -1 if error
*/
function countMaxedOrangeStat($itemID){
	global $pdo;
//	read current craftname ('StDxRcInWsLcHpMpSpLp') and max. value
	$craft = null;
	$maxSt = 99;
	$smt = 'SELECT ci.Craftname,it.ReqWis '.
		'FROM PS_GameData.dbo.CharItems ci '.
		'JOIN PS_GameDefs.dbo.Items it ON it.ItemID=ci.itemID '.
		'WHERE ci.RowID=?';
	if (($query = $pdo->prepare($smt)) == null)
		return -1;
	if ($query->bindValue(1, $itemID, PDO::PARAM_INT) && $query->execute()){
		if (($row = $query->fetch(PDO::FETCH_NUM)) != null){
			$craft = $row[0];
			$maxSt = intval($row[1]);
		}
		$query->closeCursor();
	}
	$query = null;
	if ($craft == null) // item doesn't exist
		return -1;
//	make sure craft is a valid craft-string
	$craft = normaliseCraft($craft);
//	extract each stat & test them
	$maxed = 0;
	for ($k = 0; $k < 6; $k++){
		if (getOrangeValue($craft, $k * 2, 1) >= $maxSt)
			$maxed++;
	}
	return $maxed;
}
Now we can simply modifiy the reroll workflow to insert a new test, for instance:
Code:
//	verify number of yet maximized stat
	if (countMaxedOrangeStat($itemID) > 2){
		dieWithAlert('The operation is not allowed (2 stats are yet maximized).');
	}
this test is inserted in the tests flow of the reroll.php page, before the actual reroll (before the "// start recreation" comment).
castor4878 is offline  
Thanks
7 Users
Old 06/02/2013, 11:00   #20
 
elite*gold: 0
Join Date: Jan 2011
Posts: 8
Received Thanks: 27
you will get errors if you enable (short_open_tag) in MVC mode.

Quote:
Originally Posted by castor4878 View Post
  • short_open_tag (line 211) allows to use the "‹?" open block tag and not only "‹?php" one. I set it to "On".


.
short opening PHP tag (<? ?>) are allowed or not. If you want to use PHP with XML, you can disable this option in order to use <?Xml ?>.

you will get errors if you enable (short_open_tag) in MVC mode.

such a multi-language menu.


PHP Code:
<?php
class Appli {
    
// *************************************************************************
    // * G E S T I O N   M E N U S   A U   F O R M A T   X M L                 *
    // *************************************************************************
 
    /**
     * @var string   par défaut fr, 
     *               mais on peut utiliser une autre langue si nécessaire
     */
    
var $langue 'fr';
 
    
/**
     * @var string   pointe sur le fichier xml contenant le menu à générer
     */
    
var $menuFile null;
 
    
/**
     * @param   string $file   méthode pour indiquer le fichier XML de menu
     */
    
function setMenuFile($file) {
        
$this->menuFile $file;
    }
 
    
/**
     * Génère une suite de liens, généralement pour un menu ou dans un nav.../nav
     *
     * @param  array   $options    tableau des options possibles pour ce menu
     * @param  string  $separateur rien si on veut pas de séparateur
     * @param  string  $activeOption une des valeurs du tableau d'options pour 
                       indiquer l'option non cliquable
     * @return string  chaîne prête à afficher
     */
    
function barreDeMenu($options$separateur=' | '$activeOption=null$parameters=null) {
        
$output = array();
        
$menu simplexml_load_file($this->menuFile);
        foreach (
$options AS $key => $val) {
            
$menuItems $menu->xpath("//menuitem[@id='$val']/option[@lang='" 
                       
$this->langue "']|//menuitem[@id='$val']/url");
            if (!empty(
$menuItems) && count($menuItems) == 2) {
                
$text $menuItems[0];
                
$link $menuItems[1];
                if (
$val != $activeOption) {
                    
$output[] = "<a href='" $link $parameters "'>" $text "</a>";
                } else {
                    
$output[] = "<a style='color:#ff6600;'>" $text "</a>";
                }
            }
        }
        
// on renvoie le tableau implosé en mettant chaque item séparé 
        // par le séparateur proposé en option
        
return implode($separateur$output);
    }
}
HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<menu>
     <menuitem id="aires">
    <option lang="fr">AIRES de service</option>
    <option lang="en">parking spots for motorhomes/RVs</option>
    <option lang="de">Wohnmobil Stellplätze</option>
    <option lang="es">los áreas de servicio</option>
    <option lang="it">Servizi per i camper</option>
    <option lang="nl">Diensten voor motorhomes</option>
    <option lang="ru">сервисных автодома</option>
    <url>index.php?page=aires/accueil</url>
</menuitem>

    <menuitem id="accueil">
        <option lang="fr">accueil site</option>
        <url>index.php?page=accueil</url>
    </menuitem>
 
    <menuitem id="contact">
        <option lang="fr">nous contacter</option>
        <url>index.php?page=nousContacter</url>
    </menuitem>
 
    <menuitem id="itineraire">
        <option lang="fr">itinéraire d'accès</option>
        <url>index.php?page=itineraireAcces</url>
    </menuitem>
 
    <menuitem id="visite">
        <option lang="fr">visite en photos</option>
        <url>index.php?page=visiteEnPhotos</url>
    </menuitem>
 
    <menuitem id="alentours">
        <option lang="fr">à voir aux alentours</option>
        <url>index.php?page=aVoirAlentours</url>
    </menuitem>
 
    <menuitem id="livredor">
        <option lang="fr">livre d'or</option>
        <url>index.php?page=livreDOr</url>
    </menuitem>
</menu>
For the menu options in several languages ​​are displayed in a language other than French, simply change the language reference:

HTML Code:
$Appli->langue='en'
algaracan22 is offline  
Old 06/02/2013, 16:22   #21
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
You are right the PHP short tag can not in some cases be used together with xml files.
but:

1) the tag "<?xml ?>" is not required when an explicit xml declaration is provided, eg:
Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang=... >
2) it's up to you to not process, server side, the .xml files by the PHP processor.
(Cf apache conf/mime.types file, known by 100% of webmasters).

In your example, the xml stream is processed by the function (I suggest to re-read its spec.)
This function is used to parse any valid xml stream, and thus including those starting with '<?xml version="1.0" ... ?>' and returns an xml abstraction (a Traversable interface close to the DOM paradigm).

Your xml file is so never processed as a php file and thus the short tag does not prevent your menu to work.

edit:

Quote:
you will get errors if you enable (short_open_tag) in MVC mode.
is so incorrect.
furthermore, 'MVC' (model-view-controller) is a pattern (by extension, one can say, a design), not a mode.
castor4878 is offline  
Thanks
2 Users
Old 06/04/2013, 16:41   #22
 
elite*gold: 0
Join Date: Sep 2011
Posts: 9
Received Thanks: 3
hey all, i have a quite basic problem, i've downloaded the SQL Server native client from the microsoft page, successfully installed and i still don't see the sqlsrv table, did all stept by step like the tutorial, any idea?
[GM]Razor is offline  
Old 06/04/2013, 22:22   #23
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
the tutorial includes, step by step, several steps until the reading of a table (master_user), so either you miss some steps or some were not successful.
you should provide more info to allow us to answer.
castor4878 is offline  
Thanks
2 Users
Old 06/05/2013, 06:10   #24
 
elite*gold: 0
Join Date: Sep 2011
Posts: 9
Received Thanks: 3
SQLSRV30.EXE need Windows 7, Windows Server 2008 R2, Windows Server 2008 Service Pack 2, Windows Vista Service Pack 2 to run, i have Windows XP SP3.. it work if i extract this program with WinRAR or 7z? i think this is the problem...
[GM]Razor is offline  
Old 06/05/2013, 10:38   #25
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
the unpacker needs one of these OS (unless you change the required system verion in the version resource) and yes you can extract the libraries with winrar or 7z.
they could work under XP but the OS version is not the key point.

the constraints come from:
SQL Server: the client 3.0 is required if you're using SQL SVR 2012, while client 2.0 can be used with SQL 2000, 2005 & 2008 (all tested).
Apache / PHP: client 2.0 supports PHP 5.2, client 3.0 supports PHP 5.3 & 5.4
castor4878 is offline  
Thanks
2 Users
Old 06/05/2013, 13:37   #26
 
elite*gold: 0
Join Date: Sep 2011
Posts: 9
Received Thanks: 3
so. i use 2005 SQL so i should get php 5.2 and SQL SVR 2.0 right?
[GM]Razor is offline  
Old 06/06/2013, 17:18   #27
 
elite*gold: 0
Join Date: Jun 2013
Posts: 9
Received Thanks: 5
hey guys, any idea why my xampp do not display the CSS menu? o.o
Mwindo is offline  
Old 06/29/2013, 13:37   #28
 
treica's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 525
Received Thanks: 805
tried this out but cannot get it working either the ranking script...everything gives could not find driver. I don't know why but i followed your tutorial and everything started from one shoot.

treica is offline  
Old 07/18/2013, 06:28   #29
 
GM.Triest's Avatar
 
elite*gold: 0
Join Date: Feb 2009
Posts: 192
Received Thanks: 151
For some reason, PDO won't work for me. Yay.
GM.Triest is offline  
Old 07/18/2013, 23:24   #30
 
castor4878's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 717
Received Thanks: 3,357
"For some reason" is a bit not self explanatory ...

from the use of a distro that doesn't include the generic PDO driver to invalid arguments used in the call of a PDO's method, that's a lot of possibilities.
the tutorial explains which componants are mandatory (generic & MSSQL specific drivers), how to load them (thru mysql.ini) and how to verify that they are actually loaded and usable.

not confirm that you perform these steps, or not indicate which failed, prevents any help.
castor4878 is offline  
Thanks
3 Users

Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.