StoreModel.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * Description of StoreModel
  5. * 玩家背包/仓库数据模型
  6. * @author gwang
  7. */
  8. class StoreModel extends Object_ext {
  9. /**
  10. * 其他道具
  11. * @var array
  12. */
  13. public $items;
  14. /**
  15. * 已获得英雄卡牌道具,不叠加
  16. * @var array
  17. */
  18. public $cards;
  19. /**
  20. * 装备, 能强化升级, 独立于其它道具
  21. * @var type
  22. */
  23. public $equipment;
  24. /**
  25. * @var 言灵,能强化升级, 独立于其它道具
  26. */
  27. public $yanling;
  28. /**
  29. * 宝箱
  30. * @var array
  31. */
  32. public $boxes;
  33. /**
  34. * 英雄碎片,叠加
  35. * @var object
  36. * @deprecated since version 0
  37. */
  38. public $segement;
  39. // /**
  40. // * 七宗罪元素(炼金元素)
  41. // * @var object
  42. // * @deprecated since version 0
  43. // */
  44. // public $element;
  45. /**
  46. * 石头,叠加
  47. * @var object
  48. * @deprecated since version 0
  49. */
  50. public $stones;
  51. /**
  52. * 玩家注册时初始化
  53. */
  54. public function initialize() {
  55. $this->boxes = GameConfig::primordial_data()->User_Store_boxes;
  56. //array('701001' => 0, '702002' => 0, '703003' => 0, '704004' => 0);
  57. $this->cards = ArrayInit();
  58. $this->items = JsonUtil::decode(GameConfig::primordial_data()->User_Store_items); # 初始含有一张黄金通知书
  59. $this->equipment = JsonUtil::decode(GameConfig::primordial_data()->User_Store_equipment); # 装备初始化数据
  60. $this->yanling = JsonUtil::decode(GameConfig::primordial_data()->User_Store_yanling); # 言灵初始化数据
  61. $this->segement = JsonUtil::decode(GameConfig::primordial_data()->User_Store_segment); # 碎片
  62. $this->stones = ObjectInit();
  63. // $this->element = GameConfig::primordial_data()->User_Store_element;
  64. //array('388001' => 0, '388002' => 0, '388003' => 0, '388004' => 0, '388005' => 0, '388006' => 0, '388007' => 0);
  65. }
  66. /**
  67. * 返回指定物品的数量
  68. */
  69. function GetItemCount($typeId) {
  70. if (property_exists($this->items, $typeId)) {
  71. return $this->items->$typeId;
  72. }
  73. return 0;
  74. }
  75. }