Info_Store.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of Info_Store
  10. *
  11. * @author c'y'zhao
  12. */
  13. class Info_Store extends Object_ext {
  14. /**
  15. * 道具
  16. * @var \stdClass()
  17. */
  18. public $items;
  19. /**
  20. * 宝石在背包库的唯一id
  21. * @var type
  22. */
  23. public $gemLength = 0;
  24. /**
  25. * 宝石背包
  26. * \stdClass()
  27. */
  28. public $gemStore;
  29. /**
  30. * 装备界面默认页
  31. * @var int
  32. */
  33. public $equipPag = 1;
  34. /**
  35. * 装备背包数据
  36. * @var \stdClass()
  37. */
  38. public $equip;
  39. /**
  40. * 装备部位--废弃
  41. * @var \stdClass()
  42. */
  43. public $equipPosition;
  44. /**
  45. * 6个装备部位
  46. * @var type
  47. */
  48. public $equipLocation;
  49. /**
  50. * 宝石装备的信息--废弃
  51. * @var \stdClass()
  52. */
  53. public $gemEquip;
  54. /**
  55. * 装备信息 装备不跟hero走--废弃
  56. * @var type
  57. */
  58. //public $equipPosition = null;
  59. public $gemComposeNum = 0;
  60. /**
  61. * @var int current UID
  62. */
  63. public $cuid = 10000;
  64. /**
  65. * @var int $petUid
  66. */
  67. public $petUid = 1;
  68. /**
  69. * 宠物背包数据
  70. */
  71. public $pet;
  72. /**
  73. * 选中要在主界面显示的灵宠
  74. */
  75. #[ArrayType]
  76. public $mainShowPetList = array();
  77. /**
  78. * 出战位置 宠物id
  79. * @var type
  80. */
  81. public $petUid_fight_position = 0;
  82. /**
  83. * 助战
  84. * @var type
  85. */
  86. public $petUids_supportFight_position;
  87. /**
  88. * 孵蛋坑位信息
  89. * @var type
  90. */
  91. public $breedEggLocation;
  92. /**
  93. * 宠物探索区域
  94. * @var type
  95. */
  96. public $exploreArea;
  97. public function initialize() {
  98. StoreProc::AddMultiItemInStore(glc()->Init_Packet_Items, "UsrInit");
  99. }
  100. public function __construct($arg = null) {
  101. if ($arg == null) {
  102. $this->exploreArea = new \stdClass();
  103. $this->petUids_supportFight_position = new \stdClass();
  104. $this->items = new \stdClass();
  105. $this->gemStore = new \stdClass();
  106. $this->equip = new \stdClass();
  107. $this->equipLocation = new \stdClass();
  108. $this->pet = new \stdClass();
  109. $this->equipPosition = new \stdClass();
  110. for ($i = 1; $i <= 6; $i++) {
  111. $equip = new Ins_EquipPosition();
  112. $equip->typeId = $i;
  113. $this->equipPosition->$i = $equip;
  114. }
  115. $this->gemEquip = new \stdClass();
  116. for ($k = 1; $k <= 3; $k++) {
  117. $item = new \stdClass();
  118. for ($j = 1; $j <= 6; $j++) {
  119. $item->$j = new \stdClass();
  120. }
  121. $this->gemEquip->$k = $item;
  122. }
  123. $str = GameConfig::glc2()->Pet_BreedLocationUnlockInfo;
  124. $this->breedEggLocation = new \stdClass();
  125. if($str != null){
  126. $list = explode(';', $str);
  127. foreach ($list as $value) {
  128. $s = explode(',', $value);
  129. $k = $s[0];
  130. $ins_breed = new Ins_BreedEggSlot();
  131. $ins_breed->uid = $k;
  132. $ins_breed->unlock = 0;
  133. if($s[1] == 0){
  134. $ins_breed->unlock = 1;
  135. }
  136. $this->breedEggLocation->$k = $ins_breed;
  137. }
  138. }
  139. } else {
  140. parent::__construct($arg);
  141. }
  142. }
  143. public function removeItem($itemId, $num) {
  144. if (StlUtil::dictHasProperty($this->items, $itemId)) {
  145. $this->items->$itemId -= $num;
  146. if ($this->items->$itemId <= 0) {
  147. unset($this->items->$itemId);
  148. }
  149. }
  150. }
  151. /**
  152. * @return 产生下一个唯一ID
  153. */
  154. public function nextUID() {
  155. return $this->cuid++;
  156. }
  157. }