Info_Map.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 玩家关卡地图数据
  5. * @author gwang
  6. * @deprecated since 2022.3 换开放地图版转 Info_NewMap->Ins_FootHold
  7. * @version
  8. * 1.0.0 Created at 2021年3月2日14:32:52 关卡分三层处理 大陆->区域->关卡.
  9. */
  10. class Info_Map extends Object_ext {
  11. /**
  12. * 大陆数据
  13. * @var dict<int,Ins_Mainland>
  14. */
  15. public $mainlands;
  16. /**
  17. * 战斗关卡记录--1.记录剧情关卡记录;2.副本唤灵师关卡 3.副本武器关卡 4.副本言灵关卡
  18. * @param type $arg
  19. */
  20. public $battleRecord = array();
  21. function __construct($arg = null) {
  22. if (null === $arg) {
  23. // $this->battleRecord = new \stdClass();
  24. // $arr = array();
  25. // $arr[] = 1;
  26. // $arr[] = 2;
  27. // $arr[] = 3;
  28. // $arr[] = 4;
  29. // foreach ($arr as $key) {
  30. // $this->battleRecord->$key = array();
  31. // }
  32. // 直接初始化8个大陆的基本数据
  33. $this->mainlands = ObjectInit();
  34. foreach (GameConfig::gate_mainland() as $id => $land) {
  35. $ins = new Ins_Mainland();
  36. $ins->landId = $id;
  37. if (1 == $id) { # 第一个大陆, 直接开启第一个区域
  38. $zones = explode(',', $land->containZones);
  39. $zoneid = $zones[0];
  40. $zone = new Ins_Mapzone();
  41. $zone->zoneid = $zoneid;
  42. $zonecfg = GameConfig::gate_zone_getItem($zoneid);
  43. my_Assert($zonecfg, ErrCode::err_const_no);
  44. $gateIds = explode(',', $zonecfg->contains);
  45. $zone->gates[] = $gateIds[0];
  46. $ins->normal->$zoneid = $zone;
  47. }
  48. $this->mainlands->$id = $ins;
  49. }
  50. } else {
  51. parent::__construct($arg);
  52. }
  53. }
  54. public function addBattleRecord($gateId) {
  55. if (!in_array($gateId, $this->battleRecord)) {
  56. if (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2001) {
  57. $type = Enum_TargetStatistics::HuanLingShiGateId_ComUserNum;
  58. } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2002) {
  59. $type = Enum_TargetStatistics::WeaponGateId_ComUserNum;
  60. } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2003) {
  61. $type = Enum_TargetStatistics::YanLingGateId_ComUserNum;
  62. } else {
  63. $type = Enum_TargetStatistics::storyGateId_ComUserNum;
  64. }
  65. $arr = $this->battleRecord;
  66. $arr[] = $gateId;
  67. $this->battleRecord = $arr;
  68. StatisticsProc::TargetStatistics($type, $gateId);
  69. }
  70. }
  71. public function addBattleNumRecord($gateId, $ret) {
  72. if (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2001) {
  73. $type = Enum_TargetStatistics::HuanLingShiGateId_BattleNum;
  74. } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2002) {
  75. $type = Enum_TargetStatistics::WeaponGateId_BattleNum;
  76. } elseif (strlen($gateId) == 8 && substr($gateId, 0, 3) == 2003) {
  77. $type = Enum_TargetStatistics::YanLingGateId_BattleNum;
  78. } else {
  79. $type = Enum_TargetStatistics::storyGateId_BattleNum;
  80. }
  81. $battleNum = 0;
  82. $passNum = 0;
  83. if ($ret == true) {
  84. $battleNum = 1;
  85. $passNum = 1;
  86. } else {
  87. $battleNum = 1;
  88. $passNum = 0;
  89. }
  90. $ctx = $battleNum . "/" . $passNum;
  91. StatisticsProc::TargetStatistics($type, $gateId, $ctx);
  92. }
  93. }