当前位置: 首页>>代码示例>>PHP>>正文


PHP Weapon::loadWeapon方法代码示例

本文整理汇总了PHP中Weapon::loadWeapon方法的典型用法代码示例。如果您正苦于以下问题:PHP Weapon::loadWeapon方法的具体用法?PHP Weapon::loadWeapon怎么用?PHP Weapon::loadWeapon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon::loadWeapon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadHeroFromObject

 function loadHeroFromObject($obj)
 {
     $returnHero = new Hero();
     $returnHero->ID = $obj->ID;
     $returnHero->OwnerID = $obj->OwnerID;
     $returnHero->PartyID = $obj->PartyID;
     $returnHero->Race = Race::loadRace($obj->Race);
     $returnHero->Name = $obj->Name;
     $returnHero->HeroClass = HeroClass::loadHeroClass($obj->Class);
     $returnHero->MaxHP = $obj->MaxHP;
     $returnHero->CurrentHP = floor($obj->CurrentHP);
     $returnHero->Level = $obj->Level;
     $returnHero->CurrentXP = $obj->CurrentXP;
     $returnHero->LevelUpXP = $obj->LevelUpXP;
     $returnHero->Str = $obj->Str;
     $returnHero->Dex = $obj->Dex;
     $returnHero->Con = $obj->Con;
     $returnHero->Intel = $obj->Intel;
     $returnHero->Wis = $obj->Wis;
     $returnHero->Cha = $obj->Cha;
     $returnHero->Fte = $obj->Fte;
     $returnHero->Weapon = Weapon::loadWeapon($obj->WeaponID);
     $returnHero->Kills = $obj->Kills;
     $returnHero->Status = $obj->Status;
     $returnHero->StatusTime = new DateTime($obj->StatusTime);
     $returnHero->DateOfBirth = new DateTime($obj->DateOfBirth);
     $now = new DateTime('now');
     $returnHero->Age = $returnHero->DateOfBirth->diff($now)->format('%a');
     $returnHero->StatusETA = $returnHero->StatusTime->diff($now)->format('%R%a days, %H:%I:%S');
     if (substr($returnHero->StatusETA, 0, 1) == '+') {
         $returnHero->StatusETA = "None";
     }
     return $returnHero;
 }
开发者ID:kroony,项目名称:squealing-funicular,代码行数:34,代码来源:hero.php

示例2: loadSaleFromObject

 function loadSaleFromObject($obj)
 {
     $returnSale = new Sale();
     $returnSale->ID = $obj->ID;
     $returnSale->SellerID = $obj->SellerID;
     $returnSale->ItemType = $obj->ItemType;
     $returnSale->ItemID = $obj->ItemID;
     $returnSale->Price = $obj->Price;
     $returnSale->Created = new DateTime($obj->Created);
     //load the actual object for sale
     if ($returnSale->ItemType == "Weapon") {
         $returnSale->Item = Weapon::loadWeapon($returnSale->ItemID);
     }
     return $returnSale;
 }
开发者ID:kroony,项目名称:squealing-funicular,代码行数:15,代码来源:sale.php

示例3:

 } else {
     if ($_REQUEST['action'] == "changeWeapon") {
         $weapon = Weapon::loadWeapon($_REQUEST['WeaponID']);
         // @TODO also check that weapon is currently unassigned,
         // so people like me cannot cheat and assign a weapon twice
         if ($weapon->UserID == $currentUID) {
             $hero->Weapon = $weapon;
             $hero->SaveHero();
             $smarty->assign("hero", $hero);
             $smarty->assign("message", $hero->Name . " has equipped " . $weapon->Name);
         } else {
             $smarty->assign("error", "That does not belong to you.");
         }
     } else {
         if ($_REQUEST['action'] == "editWeaponName") {
             $weapon = Weapon::loadWeapon($_REQUEST['WeaponID']);
             if ($weapon->UserID == $currentUID) {
                 $oldName = $weapon->Name;
                 $weapon->Name = $_REQUEST['weaponName'];
                 $weapon->save();
                 $smarty->assign("message", $oldName . " was renamed to " . $weapon->Name);
                 $hero->Weapon = $weapon;
                 $smarty->assign("hero", $hero);
             } else {
                 $smarty->assign("error", "You can't rename what does not belong to you.");
             }
         } else {
             if ($_REQUEST['action'] == "levelUp") {
                 if ($hero->canLevelUp()) {
                     if ($hero->Status == "") {
                         $hero->Status = "Level Up";
开发者ID:kroony,项目名称:squealing-funicular,代码行数:31,代码来源:viewHero.php

示例4: GenerateHero

 function GenerateHero($level)
 {
     //Race
     $this->Race = $this->GenerateRace();
     echo "Race: " . $this->Race->Name . "<br />";
     //Name
     $this->Name = $this->Race->generateHeroName();
     echo "Name: " . $this->Name . "<br />";
     //Attributes
     echo "Str ";
     $this->Str = $this->GenerateAtribute($this->Race->StrBon);
     //include bonuses argument and level argument
     echo "Dex ";
     $this->Dex = $this->GenerateAtribute($this->Race->DexBon);
     echo "Con ";
     $this->Con = $this->GenerateAtribute($this->Race->ConBon);
     echo "Int ";
     $this->Intel = $this->GenerateAtribute($this->Race->IntelBon);
     echo "Wis ";
     $this->Wis = $this->GenerateAtribute($this->Race->WisBon);
     echo "Cha ";
     $this->Cha = $this->GenerateAtribute($this->Race->ChaBon);
     echo "Fte ";
     $this->Fte = $this->GenerateAtribute($this->Race->FteBon);
     //Class
     $this->HeroClass = $this->GenerateHeroClass();
     echo "<br />Class: " . $this->HeroClass->Name . " HD: D" . $this->HeroClass->HD . "<br />";
     //HP
     $this->MaxHP = $this->HeroClass->HD + $this->calculateAttributeBonus($this->Con);
     //base the multiplyer on HD and con
     $this->CurrentHP = $this->MaxHP;
     echo "Hit Points: " . $this->CurrentHP . "/" . $this->MaxHP . "<br />";
     //Level
     $this->Level = 1;
     echo "Level:" . $this->Level . "<br />";
     //XP
     $XPBonus = rand(0, $this->Fte);
     $this->CurrentXP = 0;
     $this->LevelUpXP = 100 - $XPBonus;
     echo "XP: " . $this->CurrentXP . "/" . $this->LevelUpXP . " Luck Bonus: " . $XPBonus . "<br />";
     //check for levelup
     if ($level > 1) {
         $i = 0;
         while ($i < $level - 1) {
             if ($this->forceLevelUP()) {
                 $i++;
             } else {
                 break;
             }
         }
     }
     //generate weapon
     $this->Weapon = Weapon::loadWeapon(rand(1, 9));
 }
开发者ID:ndroo,项目名称:squealing-funicular,代码行数:54,代码来源:hero.php

示例5: User

$user = new User();
$user = $user->load($currentUID);
$heroController = new heroController();
$userChaBonus = $heroController->getChaModForUser($currentUID);
$smarty->assign("userChaBonus", $userChaBonus);
//html header
$smarty->display("css/css.tpl");
$weaponController = new weaponController();
//menu
$smarty->assign("currentpage", "inventory");
$smarty->assign("help", "This page displays all the weapon you have. Weapons can be scrapped if not required, so long as they are not currently equipped.\n\t\t\t\t\t  Clicking the Weapon Name will allow you to upgrade and rename the weapon. \n\t\t\t\t\t  Clicking a heroes name will show more detailed information about that hero.");
$smarty->assign("helpTitle", "Weapons Page Help");
include_once "menu.php";
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == "scrap") {
        $scrapWeapon = Weapon::loadWeapon($_REQUEST['ID']);
        if ($scrapWeapon->UserID == $currentUID) {
            if (!is_numeric($scrapWeapon->GetHeroIDFromWeapon())) {
                $user->gold += $scrapWeapon->getScrapValue($userChaBonus);
                $user->Save();
                $scrapWeapon->delete();
                $smarty->assign("message", $scrapWeapon->Name . " has been scrapped for " . $scrapWeapon->getScrapValue($userChaBonus) . "gp");
            } else {
                $smarty->assign("error", "Can not scrap equipped weapons");
            }
        } else {
            $smarty->assign("error", "This is not your weapon to scrap");
        }
    }
}
$tmpHero = new Hero();
开发者ID:kroony,项目名称:squealing-funicular,代码行数:31,代码来源:inventory.php


注:本文中的Weapon::loadWeapon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。