StoreModel.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 $taskcards;
  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 $stones;
  45. /**
  46. * 玩家注册时初始化
  47. */
  48. public function initialize() {
  49. $this->boxes = GameConfig::primordial_data()->User_Store_boxes;
  50. //array('701001' => 0, '702002' => 0, '703003' => 0, '704004' => 0);
  51. $this->taskcards = ObjectInit();
  52. $this->items = JsonUtil::decode(GameConfig::primordial_data()->User_Store_items); # 初始含有一张黄金通知书
  53. $this->equipment = JsonUtil::decode(GameConfig::primordial_data()->User_Store_equipment); # 装备初始化数据
  54. $this->yanling = JsonUtil::decode(GameConfig::primordial_data()->User_Store_yanling); # 言灵初始化数据
  55. $this->segement = JsonUtil::decode(GameConfig::primordial_data()->User_Store_segment); # 碎片
  56. // $this->stones = ObjectInit();
  57. // $this->element = GameConfig::primordial_data()->User_Store_element;
  58. //array('388001' => 0, '388002' => 0, '388003' => 0, '388004' => 0, '388005' => 0, '388006' => 0, '388007' => 0);
  59. }
  60. /**
  61. * 返回指定物品的数量
  62. */
  63. function GetItemCount($typeId) {
  64. if (property_exists($this->items, $typeId)) {
  65. return $this->items->$typeId;
  66. }
  67. return 0;
  68. }
  69. }