Ins_Pet.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_Pet 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 $qual;
  31. /**
  32. * 是否是新得到的 1:是的
  33. * @var type
  34. */
  35. public $isNew = 1;
  36. /**
  37. * 构造函数
  38. * @param type $args
  39. */
  40. public function __construct($args = null) {
  41. if($args !=null){
  42. parent::__construct($args);
  43. } else {
  44. }
  45. }
  46. /**
  47. * 配置
  48. * @return sm_pet
  49. */
  50. public function mo() {
  51. $mo = GameConfig::pet_getItem($this->typeId);
  52. my_Assert(null != $mo, ErrCode::err_const_no);
  53. return $mo;
  54. }
  55. public function petLevelMo() {
  56. $mo = GameConfig::pet_levelupgrade_getItem($this->mo()->rarity, $this->qual,$this->level);
  57. my_Assert(null != $mo, ErrCode::err_const_no);
  58. return $mo;
  59. }
  60. /*
  61. * 装备最大等级
  62. */
  63. public function Pet_MaxLevel() {
  64. $rarity = $this->mo()->rarity;
  65. $qual = $this->qual;
  66. $dic = GameConfig::pet_levelupgrade();
  67. $max = 0;
  68. foreach ($dic as $str => $mo) {
  69. if($mo->rarity == $rarity && $mo->qual == $qual){
  70. if($mo->level > $max){
  71. $max = $mo->level;
  72. }
  73. }
  74. }
  75. return $max;
  76. }
  77. }