Ins_Equip.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 Ins_Equip
  10. *
  11. * @author c'y'zhao
  12. */
  13. class Ins_Equip extends Object_ext{
  14. /**
  15. * 实例唯一编号
  16. */
  17. public $uid = 0;
  18. /*
  19. * 模板数据编号
  20. */
  21. public $typeId = 0;
  22. /*
  23. * 等级
  24. */
  25. public $level = 1;
  26. /**
  27. * 宝石槽
  28. * @var type
  29. */
  30. public $gemSetSlot;
  31. /**
  32. * 品质
  33. * @var type
  34. */
  35. public $qual;
  36. /**
  37. * 构造函数
  38. * @param type $args
  39. */
  40. public function __construct($args = null) {
  41. if($args !=null){
  42. parent::__construct($args);
  43. } else {
  44. $this->gemSetSlot = new \stdClass();
  45. }
  46. }
  47. /**
  48. * 配置
  49. * @return sm_equip
  50. */
  51. public function mo() {
  52. $mo = GameConfig::equip_getItem($this->typeId);
  53. my_Assert(null != $mo, ErrCode::err_const_no);
  54. return $mo;
  55. }
  56. public function equipLevelMo() {
  57. $mo = GameConfig::equip_levelupgrade_getItem($this->mo()->rarity, $this->qual,$this->mo()->position,$this->level);
  58. my_Assert(null != $mo, ErrCode::err_const_no);
  59. return $mo;
  60. }
  61. /*
  62. * 装备最大等级
  63. */
  64. public function Equip_MaxLevel() {
  65. $rarity = $this->mo()->rarity;
  66. $qual = $this->qual;
  67. $posId = $this->mo()->position;
  68. $dic = GameConfig::equip_levelupgrade();
  69. $max = 0;
  70. foreach ($dic as $str => $mo) {
  71. if($mo->rarity == $rarity && $mo->qual == $qual && $mo->posId == $posId){
  72. if($mo->level > $max){
  73. $max = $mo->level;
  74. }
  75. }
  76. }
  77. return $max;
  78. }
  79. }