コード例 #1
0
ファイル: play.php プロジェクト: ammark/DemoGame-PHP
/**
 * @param Ship $someShip
 */
function printShipSummary($someShip)
{
    echo 'Ship Name: ' . $someShip->getName();
    echo '<hr/>';
    $someShip->sayHello();
    echo '<hr/>';
    echo $someShip->getNameAndSpecs(false);
    echo '<hr/>';
    echo $someShip->getNameAndSpecs(true);
}
コード例 #2
0
ファイル: Ship.php プロジェクト: avallete/PHPool
function show_stats_ship(Ship $ship, $key)
{
    $weapons = $ship->getWeapons();
    echo "<div>";
    echo "<div style='float:left;'>";
    echo '<h4>[ Name ] : ' . $ship->getName() . '(' . $key . ')' . '</h4>';
    echo '<ul>';
    echo '<li>[ PV ] : ' . $ship->getPv() . '</li>';
    echo '<li>[ Vitesse ] :' . $ship->getCm() . '</li>';
    echo '<li>[ Manoeuvre ] : ' . $ship->getManeuver() . '</li>';
    echo '<li>[ Shield ] : ' . $ship->getShield() . '</li>';
    echo '<li>[ PP ] : ' . $ship->getPp() . '</li>';
    echo '</ul>';
    echo "<div>";
    echo '<h4> Weapons</h4>';
    echo "<ul>";
    show_stats_weapons($weapons);
    echo '</ul>';
    echo "</div>";
    ?>
			<p>
	       <form action="weapon.php" method="POST">
	       <?php 
    echo '<input type="hidden" name="ship" value="' . $key . '"">';
    ?>
	            <select style='width:150px;' name="weapon" id="ID">
					<?php 
    display_weapon_name($weapons);
    ?>
	            </select>
	           <input type='submit' name='submit' value="set_weapon">
	        </form>
	        </p>
		<?php 
    echo "</div>";
    echo "</div>";
}
コード例 #3
0
 function displayFitting($home)
 {
     global $smarty;
     //require_once("common/includes/class.dogma.php");
     $kll_id = $home->kll_id;
     //echo "here";
     //echo self::$oper;
     self::$shipStats = new shipstats();
     $urlsettings = edkURI::parseURI();
     self::$simpleurl = $urlsettings[0][2];
     //echo "-> ".self::$simpleurl;
     $fitter = new fitting($kll_id);
     $theFit = $fitter->displayFitting();
     if ($home->kll_id) {
         $km = Cacheable::factory('Kill', $home->kll_id);
     } else {
         $km = new Kill($home->kll_external_id, true);
         $km = $home->kill->getID();
     }
     if (!$km->exists()) {
         $html = "That kill doesn't exist.";
         $home->page->setContent($html);
         $home->page->generate($html);
         exit;
     }
     //echo "-->".$km->getExternalID()."<br />";
     if ($km->getExternalID() != 0) {
         //echo "Yes<br />";
         self::$extid = $km->getExternalID();
     } else {
         //echo "No<br />";
         $qry = new DBQuery();
         $qry->execute("SELECT kll_external_id FROM kb3_kills WHERE kll_id = '" . $home->kll_id . "';");
         $row = $qry->getRow();
         if ($row['kll_external_id'] != 0) {
             //echo "Yes ".$row['kll_external_id']."br />";
             self::$extid = $row['kll_external_id'];
         } else {
             //echo "No<br />";
             self::$extid = 0;
         }
     }
     fittingTools::source($kll_id, $km->getExternalID());
     $corp = "";
     $alli = "";
     $char = "";
     $ship = "";
     $weap = "";
     $topdamage = 0;
     $maxdamage = -1;
     foreach ($km->getInvolved() as $inv) {
         /*echo "<pre>";
         		print_r($inv);
         		echo "</pre>";*/
         if ($inv->getDamageDone() > $maxdamage) {
             if ($km->getFBPilotID() == $inv->getPilotID()) {
                 $maxdamage = $inv->getDamageDone();
                 //$topdamage = $inv;
                 $corp = $inv->getCorpID();
                 $alli = $inv->getAllianceID();
                 $char = $inv->getPilotID();
                 $ship = $inv->getShipID();
                 $weap = $inv->getWeaponID();
                 $fcorp = $inv->getCorpID();
                 $falli = $inv->getAllianceID();
                 $fchar = $inv->getPilotID();
                 $fship = $inv->getShipID();
                 $fweap = $inv->getWeaponID();
             } else {
                 $maxdamage = $inv->getDamageDone();
                 //$topdamage = $inv;
                 $corp = $inv->getCorpID();
                 $alli = $inv->getAllianceID();
                 $char = $inv->getPilotID();
                 $ship = $inv->getShipID();
                 $weap = $inv->getWeaponID();
             }
         } else {
             if ($km->getFBPilotID() == $inv->getPilotID()) {
                 $fcorp = $inv->getCorpID();
                 $falli = $inv->getAllianceID();
                 $fchar = $inv->getPilotID();
                 $fship = $inv->getShipID();
                 $fweap = $inv->getWeaponID();
             }
         }
     }
     $plt = new Pilot($char);
     $charIcon = $plt->getPortraitURL(64);
     $charName = $plt->getName();
     $charURL = edkURI::page('pilot_detail', $char, 'plt_id');
     $clt = new Corporation($corp, false);
     $corpIcon = $clt->getPortraitURL(32);
     $corpName = $clt->getName();
     $corpURL = edkURI::page('corp_detail', $corp, 'crp_id');
     $alt = new Alliance($alli, false);
     $alliIcon = $alt->getPortraitURL(32);
     $alliName = $alt->getName();
     $alliURL = edkURI::page('alliance_detail', $corp, 'all_id');
     $slt = new Ship($ship);
     $shipIcon = $slt->getImage(32);
     $shipName = $slt->getName();
     $shipURL = edkURI::page('invtype', $ship, 'id');
     $ilt = new Item($weap);
     $weapIcon = $ilt->getIcon(32);
     $weapURL = edkURI::page('invtype', $weap, 'id');
     $smarty->assign('topgetCorpID', $corp);
     $smarty->assign('topgetAllianceID', $alli);
     $smarty->assign('topgetPilotID', $char);
     $smarty->assign('topgetShipID', $ship);
     $smarty->assign('topgetWeaponID', $weap);
     $smarty->assign('topgetCorpIcon', $corpIcon);
     $smarty->assign('topgetAllianceIcon', $alliIcon);
     $smarty->assign('topgetPilotIcon', $charIcon);
     $smarty->assign('topgetShipIcon', $shipIcon);
     $smarty->assign('topgetWeaponIcon', $weapIcon);
     $smarty->assign('topgetCorpName', $corpName);
     $smarty->assign('topgetAllianceName', $alliName);
     $smarty->assign('topgetPilotName', $charName);
     $smarty->assign('topgetShipName', $shipName);
     $smarty->assign('topgetCorpURL', $corpURL);
     $smarty->assign('topgetAllianceURL', $alliURL);
     $smarty->assign('topgetPilotURL', $charURL);
     $smarty->assign('topgetShipURL', $shipURL);
     $smarty->assign('topgetWeaponURL', $weapURL);
     $fplt = new Pilot($fchar);
     $fcharIcon = $fplt->getPortraitURL(64);
     $fcharName = $fplt->getName();
     $fcharURL = edkURI::page('pilot_detail', $fchar, 'plt_id');
     $fclt = new Corporation($fcorp, false);
     $fcorpIcon = $fclt->getPortraitURL(32);
     $fcorpName = $fclt->getName();
     $fcorpURL = edkURI::page('corp_detail', $fcorp, 'crp_id');
     $falt = new Alliance($falli, false);
     $falliIcon = $falt->getPortraitURL(32);
     $falliName = $falt->getName();
     $falliURL = edkURI::page('alliance_detail', $fcorp, 'all_id');
     $fslt = new Ship($fship);
     $fshipIcon = $fslt->getImage(32);
     $fshipName = $fslt->getName();
     $fshipURL = edkURI::page('invtype', $fship, 'id');
     $filt = new Item($fweap);
     $fweapIcon = $filt->getIcon(32);
     $fweapURL = edkURI::page('invtype', $fweap, 'id');
     $smarty->assign('fingetCorpID', $fcorp);
     $smarty->assign('fingetAllianceID', $falli);
     $smarty->assign('fingetPilotID', $fchar);
     $smarty->assign('fingetShipID', $fship);
     $smarty->assign('fingetWeaponID', $fweap);
     $smarty->assign('fingetCorpIcon', $fcorpIcon);
     $smarty->assign('fingetAllianceIcon', $falliIcon);
     $smarty->assign('fingetPilotIcon', $fcharIcon);
     $smarty->assign('fingetShipIcon', $fshipIcon);
     $smarty->assign('fingetWeaponIcon', $fweapIcon);
     $smarty->assign('fingetCorpName', $fcorpName);
     $smarty->assign('fingetAllianceName', $falliName);
     $smarty->assign('fingetPilotName', $fcharName);
     $smarty->assign('fingetShipName', $fshipName);
     $smarty->assign('fingetCorpURL', $fcorpURL);
     $smarty->assign('fingetAllianceURL', $falliURL);
     $smarty->assign('fingetPilotURL', $fcharURL);
     $smarty->assign('fingetShipURL', $fshipURL);
     $smarty->assign('fingetWeaponURL', $fweapURL);
     //echo self::$extid."<br />";
     //echo "-> ".edkURI::page('pilot_detail', $km->getVictimID(), 'plt_id');
     $plt = new Pilot($km->getVictimID());
     $victimPortrait = $plt->getPortraitURL(64);
     $victimURL = edkURI::page('pilot_detail', $km->getVictimID(), 'plt_id');
     $victimExtID = $plt->getExternalID();
     $victimCorpURL = edkURI::page('corp_detail', $km->getVictimCorpID(), 'crp_id');
     $victimCorpName = $km->getVictimCorpName();
     $victimAllianceURL = edkURI::page('alliance_detail', $km->getVictimAllianceID(), 'all_id');
     $victimAllianceName = $km->getVictimAllianceName();
     $victimDamageTaken = $km->getDamageTaken();
     $getISKLoss = number_format($km->getISKLoss());
     $smarty->assign('victimDamageTaken', $victimDamageTaken);
     $corp = new Corporation($km->getVictimCorpID(), false);
     //echo $corp->getPortraitURL(32);
     $alliance = new Alliance($km->getVictimAllianceID(), false);
     //echo $alliance->getPortraitURL(32);
     if ($km->isClassified()) {
         //Admin is able to see classified Systems
         if ($home->page->isAdmin()) {
             $system = $km->getSystem()->getName() . ' (Classified)';
             $region = $km->getSystem()->getRegionName();
             $systemURL = edkURI::page('system_detail', $km->getSystem()->getID(), 'sys_id');
             $systemSecurity = $km->getSystem()->getSecurity(true);
         } else {
             $system = 'Classified';
             $region = $km->getSystem()->getRegionName();
             $systemURL = "";
             $systemSecurity = '0.0';
         }
     } else {
         $system = $km->getSystem()->getName();
         $region = $km->getSystem()->getRegionName();
         $systemURL = edkURI::page('system_detail', $km->getSystem()->getID(), 'sys_id');
         $systemSecurity = $km->getSystem()->getSecurity(true);
     }
     // Ship detail
     $ship = $km->getVictimShip();
     $shipclass = $ship->getClass();
     $shipname = $ship->getName();
     $victimShipClassName = $shipclass->getName();
     $timeStamp = $km->getTimeStamp();
     $victimShipID = edkURI::page('invtype', $ship->getExternalID(), 'id');
     if ($home->page->isAdmin()) {
         $smarty->assign('ship', $ship);
     }
     self::$shipStats->setPilotName($km->getVictimName());
     self::$shipStats->setPilotCorp($victimCorpName);
     self::$shipStats->setPilotAlliance($victimAllianceName);
     self::$shipStats->setPilotShip($shipname);
     self::$shipStats->setPilotLoc($system);
     self::$shipStats->setPilotLocReg($region);
     self::$shipStats->setPilotLocSec($systemSecurity);
     self::$shipStats->setPilotDate($timeStamp);
     self::$shipStats->setPilotDam($victimDamageTaken);
     self::$shipStats->setPilotCos($getISKLoss);
     self::$shipStats->setPilotShipClass($victimShipClassName);
     self::$shipStats->setCorpPort($corp->getPortraitURL(32));
     self::$shipStats->setAlliPort($alliance->getPortraitURL(32));
     self::$shipStats->setPilotPort($victimPortrait);
     self::$shipStats->setPilotNameURL($victimURL);
     self::$shipStats->setPilotCorpURL($victimCorpURL);
     self::$shipStats->setPilotAllianceURL($victimAllianceURL);
     self::$shipStats->setPilotShipURL($victimShipID);
     self::$shipStats->setPilotLocURL($systemURL);
     fittingTools::getShipStats($shipname);
     fittingTools::moduleInfo($theFit);
     /*fittingTools::getModuleStats();*/
     fittingTools::returnShipSkills();
     fittingTools::shipEffects();
     fittingTools::setlevel5Skills();
     fittingTools::getExtraStats();
     fittingTools::getCPUandPowerValues();
     $html = fittingTools::displayShipStats($shipname, 100, 100);
     return $html;
 }