Advertisement
Guest User

Untitled

a guest
Aug 25th, 2024
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. #define ENABLE_GM_FLAG_IF_TEST_SERVER
  2. // #define ENABLE_GM_FLAG_FOR_LOW_WIZARD
  3. void CHARACTER::SetPlayerProto(const TPlayerTable * t)
  4. {
  5. if (!GetDesc() || !*GetDesc()->GetHostName())
  6. sys_err("cannot get desc or hostname");
  7. else
  8. SetGMLevel();
  9.  
  10. m_PlayerSlots = std::make_unique<PlayerSlotT>(); // @fixme199
  11. m_bCharType = CHAR_TYPE_PC;
  12.  
  13. m_dwPlayerID = t->id;
  14.  
  15. m_iAlignment = t->lAlignment;
  16. m_iRealAlignment = t->lAlignment;
  17.  
  18. m_points.voice = t->voice;
  19.  
  20. m_points.skill_group = t->skill_group;
  21.  
  22. m_pointsInstant.bBasePart = t->part_base;
  23. SetPart(PART_HAIR, t->parts[PART_HAIR]);
  24.  
  25. m_points.iRandomHP = t->sRandomHP;
  26. m_points.iRandomSP = t->sRandomSP;
  27.  
  28. // REMOVE_REAL_SKILL_LEVLES
  29. if (m_pSkillLevels)
  30. M2_DELETE_ARRAY(m_pSkillLevels);
  31.  
  32. m_pSkillLevels = M2_NEW TPlayerSkill[SKILL_MAX_NUM];
  33. thecore_memcpy(m_pSkillLevels, t->skills, sizeof(TPlayerSkill) * SKILL_MAX_NUM);
  34. // END_OF_REMOVE_REAL_SKILL_LEVLES
  35.  
  36. if (t->lMapIndex >= 10000)
  37. {
  38. m_posWarp.x = t->lExitX;
  39. m_posWarp.y = t->lExitY;
  40. m_lWarpMapIndex = t->lExitMapIndex;
  41. }
  42.  
  43. SetRealPoint(POINT_PLAYTIME, t->playtime);
  44. m_dwLoginPlayTime = t->playtime;
  45. SetRealPoint(POINT_ST, t->st);
  46. SetRealPoint(POINT_HT, t->ht);
  47. SetRealPoint(POINT_DX, t->dx);
  48. SetRealPoint(POINT_IQ, t->iq);
  49.  
  50. SetPoint(POINT_ST, t->st);
  51. SetPoint(POINT_HT, t->ht);
  52. SetPoint(POINT_DX, t->dx);
  53. SetPoint(POINT_IQ, t->iq);
  54.  
  55. SetPoint(POINT_STAT, t->stat_point);
  56. SetPoint(POINT_SKILL, t->skill_point);
  57. SetPoint(POINT_SUB_SKILL, t->sub_skill_point);
  58. SetPoint(POINT_HORSE_SKILL, t->horse_skill_point);
  59.  
  60. SetPoint(POINT_STAT_RESET_COUNT, t->stat_reset_count);
  61.  
  62. SetPoint(POINT_LEVEL_STEP, t->level_step);
  63. SetRealPoint(POINT_LEVEL_STEP, t->level_step);
  64.  
  65. SetRace(t->job);
  66.  
  67. SetLevel(t->level);
  68. SetExp(t->exp);
  69. SetGold(t->gold);
  70. #ifdef ENABLE_CHEQUE_SYSTEM
  71. SetCheque(t->cheque);
  72. #endif
  73.  
  74. SetMapIndex(t->lMapIndex);
  75. SetXYZ(t->x, t->y, t->z);
  76.  
  77. ComputePoints();
  78.  
  79. SetHP(t->hp);
  80. SetSP(t->sp);
  81. SetStamina(t->stamina);
  82.  
  83. #ifndef ENABLE_GM_FLAG_IF_TEST_SERVER
  84. if (!test_server)
  85. #endif
  86. {
  87. #ifdef ENABLE_GM_AFFECTS
  88. if (GetGMLevel() == GM_IMPLEMENTOR)
  89. {
  90. m_afAffectFlag.Set(AFF_YMIR_IMPLEMENTOR);
  91. m_bPKMode = PK_MODE_PROTECT;
  92. }
  93. else if (GetGMLevel() == GM_HIGH_WIZARD)
  94. {
  95. m_afAffectFlag.Set(AFF_YMIR_HIGH_WIZARD);
  96. m_bPKMode = PK_MODE_PROTECT;
  97. }
  98. else if (GetGMLevel() == GM_GOD)
  99. {
  100. m_afAffectFlag.Set(AFF_YMIR_GOD);
  101. m_bPKMode = PK_MODE_PROTECT;
  102. }
  103. else if (GetGMLevel() == GM_LOW_WIZARD)
  104. {
  105. m_afAffectFlag.Set(AFF_YMIR_LOW_WIZARD);
  106. m_bPKMode = PK_MODE_PROTECT;
  107. }
  108. #else
  109. #ifdef ENABLE_GM_FLAG_FOR_LOW_WIZARD
  110. if (GetGMLevel() > GM_PLAYER)
  111. #else
  112. if (GetGMLevel() > GM_LOW_WIZARD)
  113. #endif
  114. {
  115. m_afAffectFlag.Set(AFF_YMIR);
  116. m_bPKMode = PK_MODE_PROTECT;
  117. }
  118. #endif
  119. }
  120.  
  121. if (GetLevel() < PK_PROTECT_LEVEL)
  122. m_bPKMode = PK_MODE_PROTECT;
  123.  
  124. SetHorseData(t->horse);
  125.  
  126. if (GetHorseLevel() > 0)
  127. UpdateHorseDataByLogoff(t->logoff_interval);
  128.  
  129. thecore_memcpy(m_aiPremiumTimes, t->aiPremiumTimes, sizeof(t->aiPremiumTimes));
  130.  
  131. m_dwLogOffInterval = t->logoff_interval;
  132.  
  133. sys_log(0, "PLAYER_LOAD: %s PREMIUM %d %d, LOGGOFF_INTERVAL %u PTR: %p", t->name, m_aiPremiumTimes[0], m_aiPremiumTimes[1], t->logoff_interval, this);
  134.  
  135. if (GetGMLevel() != GM_PLAYER)
  136. {
  137. LogManager::instance().CharLog(this, GetGMLevel(), "GM_LOGIN", "");
  138. sys_log(0, "GM_LOGIN(gmlevel=%d, name=%s(%d), pos=(%d, %d)", GetGMLevel(), GetName(), GetPlayerID(), GetX(), GetY());
  139. }
  140.  
  141. #ifdef __PET_SYSTEM__
  142. if (m_petSystem)
  143. {
  144. m_petSystem->Destroy();
  145. delete m_petSystem;
  146. }
  147.  
  148. m_petSystem = M2_NEW CPetSystem(this);
  149. #endif
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement