Init_Packet_Items, "UsrInit"); } public function __construct($arg = null) { if ($arg == null) { $this->petUids_supportFight_position = new \stdClass(); $this->items = new \stdClass(); $this->gemStore = new \stdClass(); $this->equip = new \stdClass(); $this->equipLocation = new \stdClass(); $this->pet = new \stdClass(); $this->equipPosition = new \stdClass(); for ($i = 1; $i <= 6; $i++) { $equip = new Ins_EquipPosition(); $equip->typeId = $i; $this->equipPosition->$i = $equip; } $this->gemEquip = new \stdClass(); for ($k = 1; $k <= 3; $k++) { $item = new \stdClass(); for ($j = 1; $j <= 6; $j++) { $item->$j = new \stdClass(); } $this->gemEquip->$k = $item; } $str = GameConfig::glc2()->Pet_BreedLocationUnlockInfo; $this->breedEggLocation = new \stdClass(); if ($str != null) { $list = explode(';', $str); foreach ($list as $value) { $s = explode(',', $value); $k = $s[0]; $ins_breed = new Ins_BreedEggSlot(); $ins_breed->uid = $k; $ins_breed->unlock = 0; if ($s[1] == 0) { $ins_breed->unlock = 1; } $this->breedEggLocation->$k = $ins_breed; } } $this->initExploreArea(); } else { parent::__construct($arg); } } public function removeItem($itemId, $num) { if (StlUtil::dictHasProperty($this->items, $itemId)) { $this->items->$itemId -= $num; if ($this->items->$itemId <= 0) { unset($this->items->$itemId); } } } /** * @return 产生下一个唯一ID */ public function nextUID() { return $this->cuid++; } public function initExploreArea() { if($this->exploreArea == null){ $this->exploreArea = new \stdClass(); } $exploreAreas = GameConfig::pet_area(); foreach ($exploreAreas as $areaId => $areaArr) { if(!StlUtil::dictHasProperty($this->exploreArea, $areaId)){ $Ins_ExploreArea = new Ins_ExploreArea($areaArr[0]); $this->exploreArea->$areaId = $Ins_ExploreArea; } else { $Ins_ExploreArea = new Ins_ExploreArea($this->exploreArea->$areaId); if(StlUtil::dictHasProperty($Ins_ExploreArea, "output_num")){ StlUtil::dictRemove($Ins_ExploreArea,"output_num"); } $this->exploreArea->$areaId = $Ins_ExploreArea; } } } }