Bot.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. #include "Bot.h"
  2. #include "BotBrain.h"
  3. #include "../Trade.h"
  4. #include "../../common/Log.h"
  5. #include "../WorldDatabase.h"
  6. #include "../classes.h"
  7. #include "../SpellProcess.h"
  8. extern WorldDatabase database;
  9. extern MasterSpellList master_spell_list;
  10. extern World world;
  11. extern Classes classes;
  12. Bot::Bot() : NPC() {
  13. SetBrain(new BotBrain(this));
  14. BotID = 0;
  15. ShowHelm = true;
  16. ShowCloak = true;
  17. CanTaunt = false;
  18. combat_target = 0;
  19. main_tank = 0;
  20. //AddPrimaryEntityCommand("hail", 10000, "hail", "", 0, 0);
  21. AddSecondaryEntityCommand("invite bot", 10000, "invite", "", 0, 0);
  22. AddSecondaryEntityCommand("bot inventory", 10000, "bot inv list", "", 0, 0);
  23. InfoStruct* info = GetInfoStruct();
  24. info->str_base = 50;
  25. info->sta_base = 20;
  26. info->wis_base = 20;
  27. info->intel_base = 20;
  28. info->agi_base = 20;
  29. }
  30. Bot::~Bot() {
  31. }
  32. void Bot::GiveItem(int32 item_id) {
  33. Item* master_item = master_item_list.GetItem(item_id);
  34. Item* item = 0;
  35. if (master_item)
  36. item = new Item(master_item);
  37. if (item) {
  38. int8 slot = GetEquipmentList()->GetFreeSlot(item);
  39. if (slot != 255) {
  40. GetEquipmentList()->AddItem(slot, item);
  41. SetEquipment(item, slot);
  42. database.SaveBotItem(BotID, item_id, slot);
  43. if (slot == 0) {
  44. ChangePrimaryWeapon();
  45. if (IsBot())
  46. LogWrite(PLAYER__ERROR, 0, "Bot", "Changing bot primary weapon.");
  47. }
  48. CalculateBonuses();
  49. }
  50. }
  51. }
  52. void Bot::RemoveItem(Item* item) {
  53. int8 slot = GetEquipmentList()->GetSlotByItem(item);
  54. if (slot != 255) {
  55. GetEquipmentList()->RemoveItem(slot, true);
  56. SetEquipment(0, slot);
  57. }
  58. }
  59. void Bot::TradeItemAdded(Item* item) {
  60. int8 slot = GetEquipmentList()->GetFreeSlot(item);
  61. if (slot == 255 && item->slot_data.size() > 0) {
  62. slot = item->slot_data[0];
  63. AddItemToTrade(slot);
  64. }
  65. }
  66. void Bot::AddItemToTrade(int8 slot) {
  67. Item* item = GetEquipmentList()->GetItem(slot);
  68. if (trading_slots.count(slot) == 0 && item && trade) {
  69. trade->AddItemToTrade(this, item, 1, 255);
  70. trading_slots.insert(slot);
  71. }
  72. }
  73. bool Bot::CheckTradeItems(map<int8, TradeItemInfo>* list) {
  74. if (!list) {
  75. LogWrite(PLAYER__ERROR, 0, "Bot", "CheckTradeItems did not recieve a valid list of items");
  76. return false;
  77. }
  78. bool ret = true;
  79. map<int8, TradeItemInfo>::iterator itr;
  80. for (itr = list->begin(); itr != list->end(); itr++) {
  81. Item* item = itr->second.item;
  82. if (item) {
  83. if (!CanEquipItem(item)) {
  84. // No slots means not equipable so reject the trade
  85. ret = false;
  86. break;
  87. }
  88. }
  89. }
  90. return ret;
  91. }
  92. void Bot::FinishTrade() {
  93. trading_slots.clear();
  94. }
  95. bool Bot::CanEquipItem(Item* item) {
  96. if (item) {
  97. if (item->IsArmor() || item->IsWeapon() || item->IsFood() || item->IsRanged() || item->IsShield() || item->IsBauble() || item->IsAmmo() || item->IsThrown()) {
  98. int16 override_level = item->GetOverrideLevel(GetAdventureClass(), GetTradeskillClass());
  99. if (override_level > 0 && override_level <= GetLevel()) {
  100. LogWrite(PLAYER__ERROR, 0, "Bot", "Passed in override_level check");
  101. return true;
  102. }
  103. if (item->CheckClass(GetAdventureClass(), GetTradeskillClass()))
  104. if (item->CheckLevel(GetAdventureClass(), GetTradeskillClass(), GetLevel())) {
  105. LogWrite(PLAYER__ERROR, 0, "Bot", "Passed in normal check");
  106. return true;
  107. }
  108. }
  109. }
  110. return false;
  111. }
  112. void Bot::MessageGroup(string msg) {
  113. GroupMemberInfo* gmi = GetGroupMemberInfo();
  114. if (gmi)
  115. world.GetGroupManager()->GroupChatMessage(gmi->group_id, this, msg.c_str());
  116. }
  117. void Bot::GetNewSpells() {
  118. vector<Spell*> spells;
  119. vector<Spell*>* spells1 = master_spell_list.GetSpellListByAdventureClass(GetAdventureClass(), GetLevel(), 1);
  120. vector<Spell*>* spells2 = master_spell_list.GetSpellListByAdventureClass(classes.GetBaseClass(GetAdventureClass()), GetLevel(), 1);
  121. vector<Spell*>* spells3 = master_spell_list.GetSpellListByAdventureClass(classes.GetSecondaryBaseClass(GetAdventureClass()), GetLevel(), 1);
  122. spells.insert(spells.end(), spells1->begin(), spells1->end());
  123. spells.insert(spells.end(), spells2->begin(), spells2->end());
  124. spells.insert(spells.end(), spells3->begin(), spells3->end());
  125. vector<Spell*>::iterator itr;
  126. map<int32, int8>* spell_list = 0;
  127. for (itr = spells.begin(); itr != spells.end(); itr++) {
  128. switch ((*itr)->GetSpellData()->spell_type) {
  129. case SPELL_TYPE_DD:
  130. spell_list = &dd_spells;
  131. break;
  132. case SPELL_TYPE_DOT:
  133. spell_list = &dot_spells;
  134. break;
  135. case SPELL_TYPE_HEAL:
  136. spell_list = &heal_spells;
  137. break;
  138. case SPELL_TYPE_HOT_WARD:
  139. spell_list = &hot_ward_spells;
  140. break;
  141. case SPELL_TYPE_DEBUFF:
  142. spell_list = &debuff_spells;
  143. break;
  144. case SPELL_TYPE_BUFF:
  145. spell_list = &buff_spells;
  146. break;
  147. case SPELL_TYPE_COMBATBUFF:
  148. spell_list = &combat_buff_spells;
  149. break;
  150. case SPELL_TYPE_TAUNT:
  151. spell_list = &taunt_spells;
  152. break;
  153. case SPELL_TYPE_DETAUNT:
  154. spell_list = &detaunt_spells;
  155. break;
  156. case SPELL_TYPE_REZ:
  157. LogWrite(PLAYER__ERROR, 0, "Bot", "Adding rez spell.");
  158. spell_list = &rez_spells;
  159. break;
  160. case SPELL_TYPE_CURE:
  161. spell_list = &cure_spells;
  162. break;
  163. default:
  164. spell_list = 0;
  165. break;
  166. }
  167. if (spell_list && spell_list->count((*itr)->GetSpellID()) == 0)
  168. (*spell_list)[(*itr)->GetSpellID()] = 1;
  169. }
  170. safe_delete(spells1);
  171. safe_delete(spells2);
  172. safe_delete(spells3);
  173. }
  174. Entity* Bot::GetCombatTarget() {
  175. Spawn* target = GetZone()->GetSpawnByID(combat_target);
  176. if (target && target->IsEntity())
  177. return (Entity*)target;
  178. combat_target = 0;
  179. return 0;
  180. }
  181. Spell* Bot::SelectSpellToCast(float distance) {
  182. Spell* spell = 0;
  183. map<int32, int8>::iterator itr;
  184. // Heal
  185. spell = GetHealSpell();
  186. if (spell)
  187. return spell;
  188. // Taunt
  189. spell = GetTauntSpell();
  190. if (spell)
  191. return spell;
  192. // Detaunt
  193. spell = GetDetauntSpell();
  194. if (spell)
  195. return spell;
  196. // Hot/Ward
  197. spell = GetHoTWardSpell();
  198. if (spell)
  199. return spell;
  200. // Debuff
  201. spell = GetDebuffSpell();
  202. if (spell)
  203. return spell;
  204. // Combat Buff
  205. spell = GetCombatBuffSpell();
  206. if (spell)
  207. return spell;
  208. // DoT
  209. spell = GetDoTSpell();
  210. if (spell)
  211. return spell;
  212. // DD
  213. spell = GetDDSpell();
  214. if (spell)
  215. return spell;
  216. return 0;
  217. }
  218. void Bot::SetRecast(Spell* spell, int32 time) {
  219. recast_times[spell->GetSpellID()] = time;
  220. }
  221. bool Bot::IsSpellReady(Spell* spell) {
  222. if (recast_times.count(spell->GetSpellID()) > 0) {
  223. if (recast_times[spell->GetSpellID()] > Timer::GetCurrentTime2())
  224. return false;
  225. }
  226. return true;
  227. }
  228. Spell* Bot::GetDDSpell() {
  229. if (dd_spells.size() == 0)
  230. return 0;
  231. Spell* spell = 0;
  232. map<int32, int8>::iterator itr;
  233. for (itr = dd_spells.begin(); itr != dd_spells.end(); itr++) {
  234. spell = master_spell_list.GetSpell(itr->first, itr->second);
  235. if (spell && IsSpellReady(spell)) {
  236. return spell;
  237. }
  238. }
  239. return 0;
  240. }
  241. Spell* Bot::GetHealSpell() {
  242. if (heal_spells.size() == 0)
  243. return 0;
  244. // Get an available heal spell
  245. Spell* spell = 0;
  246. map<int32, int8>::iterator itr;
  247. for (itr = heal_spells.begin(); itr != heal_spells.end(); itr++) {
  248. spell = master_spell_list.GetSpell(itr->first, itr->second);
  249. if (spell && IsSpellReady(spell)) {
  250. break;
  251. }
  252. }
  253. // No heal available, return out
  254. if (!spell)
  255. return 0;
  256. // There was a heal spell so find a group member that needs healing
  257. int8 threshold = GetHealThreshold();
  258. GroupMemberInfo* gmi = GetGroupMemberInfo();
  259. PlayerGroup* group = world.GetGroupManager()->GetGroup(gmi->group_id);
  260. if (group)
  261. {
  262. group->MGroupMembers.readlock(__FUNCTION__, __LINE__);
  263. deque<GroupMemberInfo*>* members = group->GetMembers();
  264. for (int8 i = 0; i < members->size(); i++) {
  265. Entity* member = members->at(i)->member;
  266. if (!member->Alive())
  267. continue;
  268. int8 percent = (int8)(((float)member->GetHP() / member->GetTotalHP()) * 100);
  269. if (percent <= threshold) {
  270. if (spell) {
  271. SetTarget(member);
  272. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  273. return spell;
  274. }
  275. }
  276. }
  277. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  278. }
  279. return 0;
  280. }
  281. Spell* Bot::GetTauntSpell() {
  282. if (taunt_spells.size() == 0)
  283. return 0;
  284. // If not the main tank and taunts are turned off return out
  285. if (main_tank != this && !CanTaunt)
  286. return 0;
  287. Spell* spell = 0;
  288. map<int32, int8>::iterator itr;
  289. for (itr = taunt_spells.begin(); itr != taunt_spells.end(); itr++) {
  290. spell = master_spell_list.GetSpell(itr->first, itr->second);
  291. if (spell && IsSpellReady(spell)) {
  292. return spell;
  293. }
  294. }
  295. return 0;
  296. }
  297. Spell* Bot::GetDetauntSpell() {
  298. if (detaunt_spells.size() == 0)
  299. return 0;
  300. if (!GetTarget() || !GetTarget()->IsNPC())
  301. return 0;
  302. NPC* target = (NPC*)GetTarget();
  303. Entity* hated = target->Brain()->GetMostHated();
  304. if (hated == this) {
  305. Spell* spell = 0;
  306. map<int32, int8>::iterator itr;
  307. for (itr = detaunt_spells.begin(); itr != detaunt_spells.end(); itr++) {
  308. spell = master_spell_list.GetSpell(itr->first, itr->second);
  309. if (spell && IsSpellReady(spell)) {
  310. return spell;
  311. }
  312. }
  313. }
  314. return 0;
  315. }
  316. Spell* Bot::GetHoTWardSpell() {
  317. if (hot_ward_spells.size() == 0)
  318. return 0;
  319. // Get an available spell
  320. Spell* spell = 0;
  321. map<int32, int8>::iterator itr;
  322. for (itr = hot_ward_spells.begin(); itr != hot_ward_spells.end(); itr++) {
  323. spell = master_spell_list.GetSpell(itr->first, itr->second);
  324. if (spell && IsSpellReady(spell)) {
  325. break;
  326. }
  327. }
  328. // No spell available, return out
  329. if (!spell)
  330. return 0;
  331. // There was a spell so find a group member that needs healing
  332. int8 threshold = GetHealThreshold();
  333. GroupMemberInfo* gmi = GetGroupMemberInfo();
  334. PlayerGroup* group = world.GetGroupManager()->GetGroup(gmi->group_id);
  335. if (group)
  336. {
  337. group->MGroupMembers.readlock(__FUNCTION__, __LINE__);
  338. deque<GroupMemberInfo*>* members = group->GetMembers();
  339. for (int8 i = 0; i < members->size(); i++) {
  340. Entity* member = members->at(i)->member;
  341. int8 percent = 0;
  342. if (member->GetHP() > 0)
  343. percent = (int8)(((float)member->GetHP() / member->GetTotalHP()) * 100);
  344. if (percent <= 99 && percent > threshold) {
  345. if (spell) {
  346. SetTarget(member);
  347. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  348. return spell;
  349. }
  350. }
  351. }
  352. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  353. }
  354. return 0;
  355. }
  356. Spell* Bot::GetDebuffSpell() {
  357. if (debuff_spells.size() == 0)
  358. return 0;
  359. Spell* spell = 0;
  360. map<int32, int8>::iterator itr;
  361. for (itr = debuff_spells.begin(); itr != debuff_spells.end(); itr++) {
  362. spell = master_spell_list.GetSpell(itr->first, itr->second);
  363. if (spell && IsSpellReady(spell)) {
  364. // If target already has this effect on them then continue to the next spell
  365. if (((Entity*)GetTarget())->GetSpellEffect(itr->first))
  366. continue;
  367. return spell;
  368. }
  369. }
  370. return 0;
  371. }
  372. Spell* Bot::GetCombatBuffSpell() {
  373. return 0;
  374. }
  375. Spell* Bot::GetDoTSpell() {
  376. if (dot_spells.size() == 0)
  377. return 0;
  378. Spell* spell = 0;
  379. map<int32, int8>::iterator itr;
  380. for (itr = dot_spells.begin(); itr != dot_spells.end(); itr++) {
  381. spell = master_spell_list.GetSpell(itr->first, itr->second);
  382. if (spell && IsSpellReady(spell)) {
  383. // If target already has this effect on them then continue to the next spell
  384. if (((Entity*)GetTarget())->GetSpellEffect(itr->first))
  385. continue;
  386. return spell;
  387. }
  388. }
  389. return 0;
  390. }
  391. Spell* Bot::GetBuffSpell() {
  392. if (buff_spells.size() == 0)
  393. return 0;
  394. Spell* spell = 0;
  395. Entity* target = 0;
  396. map<int32, int8>::iterator itr;
  397. for (itr = buff_spells.begin(); itr != buff_spells.end(); itr++) {
  398. spell = master_spell_list.GetSpell(itr->first, itr->second);
  399. if (spell && IsSpellReady(spell)) {
  400. target = 0;
  401. if (spell->GetSpellData()->target_type == SPELL_TARGET_SELF)
  402. target = this;
  403. if (spell->GetSpellData()->target_type == SPELL_TARGET_GROUP_AE)
  404. target = this;
  405. if (spell->GetSpellData()->target_type == SPELL_TARGET_ENEMY && spell->GetSpellData()->friendly_spell == 1)
  406. target = (main_tank != NULL) ? main_tank : GetOwner();
  407. if (!target)
  408. continue;
  409. if (!target->Alive())
  410. continue;
  411. // If target already has this effect on them then continue to the next spell
  412. if (target->GetSpellEffect(itr->first))
  413. continue;
  414. SetTarget(target);
  415. return spell;
  416. }
  417. }
  418. return 0;
  419. }
  420. Spell* Bot::GetRezSpell() {
  421. if (rez_spells.size() == 0)
  422. return 0;
  423. GroupMemberInfo* gmi = GetGroupMemberInfo();
  424. if (!gmi)
  425. return 0;
  426. Entity* target = 0;
  427. PlayerGroup* group = world.GetGroupManager()->GetGroup(gmi->group_id);
  428. if (group)
  429. {
  430. group->MGroupMembers.readlock(__FUNCTION__, __LINE__);
  431. deque<GroupMemberInfo*>* members = group->GetMembers();
  432. for (int8 i = 0; i < members->size(); i++) {
  433. Entity* member = members->at(i)->member;
  434. if (member && !member->Alive() && member->IsPlayer()) {
  435. PendingResurrection* rez = members->at(i)->client->GetCurrentRez();
  436. if (rez->active)
  437. continue;
  438. target = member;
  439. break;
  440. }
  441. }
  442. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  443. }
  444. if (!target)
  445. return 0;
  446. Spell* spell = 0;
  447. map<int32, int8>::iterator itr;
  448. for (itr = rez_spells.begin(); itr != rez_spells.end(); itr++) {
  449. spell = master_spell_list.GetSpell(itr->first, itr->second);
  450. if (spell && IsSpellReady(spell)) {
  451. SetTarget(target);
  452. return spell;
  453. }
  454. }
  455. return 0;
  456. }
  457. Spell* Bot::GetCureSpell() {
  458. return 0;
  459. }
  460. int8 Bot::GetHealThreshold() {
  461. int8 ret = 0;
  462. switch (GetAdventureClass()) {
  463. case PRIEST:
  464. case CLERIC:
  465. case TEMPLAR:
  466. case INQUISITOR:
  467. case DRUID:
  468. case WARDEN:
  469. case FURY:
  470. case SHAMAN:
  471. case MYSTIC:
  472. case DEFILER:
  473. ret = 70;
  474. break;
  475. default:
  476. ret = 30;
  477. break;
  478. }
  479. return ret;
  480. }
  481. bool Bot::ShouldMelee() {
  482. bool ret = true;
  483. switch (GetAdventureClass()) {
  484. case PRIEST:
  485. case CLERIC:
  486. case TEMPLAR:
  487. case INQUISITOR:
  488. case DRUID:
  489. case WARDEN:
  490. case FURY:
  491. case SHAMAN:
  492. case MYSTIC:
  493. case DEFILER:
  494. case MAGE:
  495. case SORCERER:
  496. case WIZARD:
  497. case WARLOCK:
  498. case ENCHANTER:
  499. case ILLUSIONIST:
  500. case COERCER:
  501. case SUMMONER:
  502. case CONJUROR:
  503. case NECROMANCER:
  504. ret = false;
  505. break;
  506. default:
  507. ret = true;
  508. break;
  509. }
  510. if (GetTarget() == GetOwner())
  511. ret = false;
  512. return ret;
  513. }
  514. void Bot::Camp() {
  515. // Copy from COMMAND_GROUP_LEAVE
  516. GroupMemberInfo* gmi = GetGroupMemberInfo();
  517. if (gmi) {
  518. int32 group_id = gmi->group_id;
  519. world.GetGroupManager()->RemoveGroupMember(group_id, this);
  520. if (!world.GetGroupManager()->IsGroupIDValid(group_id)) {
  521. // leader->Message(CHANNEL_COLOR_GROUP, "%s has left the group.", client->GetPlayer()->GetName());
  522. }
  523. else {
  524. world.GetGroupManager()->GroupMessage(group_id, "%s has left the group.", GetName());
  525. }
  526. }
  527. GetZone()->PlayAnimation(this, 538);
  528. SetVisualState(540);
  529. GetZone()->Despawn(this, 5000);
  530. if (!GetOwner())
  531. return;
  532. Client* client = GetZone()->GetClientBySpawn(GetOwner());
  533. if (client)
  534. client->GetPlayer()->SpawnedBots.erase(BotIndex);
  535. }
  536. void Bot::ChangeLevel(int16 old_level, int16 new_level) {
  537. if (new_level < 1)
  538. return;
  539. if (GetLevel() != new_level) {
  540. SetLevel(new_level);
  541. if (GetGroupMemberInfo()) {
  542. UpdateGroupMemberInfo();
  543. world.GetGroupManager()->SendGroupUpdate(GetGroupMemberInfo()->group_id);
  544. }
  545. }
  546. if (GetPet()) {
  547. NPC* pet = (NPC*)GetPet();
  548. if (pet->GetMaxPetLevel() == 0 || new_level <= pet->GetMaxPetLevel()) {
  549. pet->SetLevel(new_level);
  550. GetZone()->PlayAnimation(pet, 1753);
  551. }
  552. }
  553. // level up animation
  554. GetZone()->PlayAnimation(this, 1753);
  555. //player->GetSkills()->IncreaseAllSkillCaps(5 * (new_level - old_level));
  556. GetNewSpells();
  557. //SendNewSpells(player->GetAdventureClass());
  558. //SendNewSpells(classes.GetBaseClass(player->GetAdventureClass()));
  559. //SendNewSpells(classes.GetSecondaryBaseClass(player->GetAdventureClass()));
  560. ChangePrimaryWeapon();
  561. ChangeSecondaryWeapon();
  562. ChangeRangedWeapon();
  563. GetInfoStruct()->level = new_level;
  564. // GetPlayer()->SetLevel(new_level);
  565. LogWrite(MISC__TODO, 1, "TODO", "Get new HP/POWER/stat based on default values from DB\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
  566. SetTotalHPBase(new_level*new_level * 2 + 40);
  567. SetTotalPowerBase((sint32)(new_level*new_level*2.1 + 45));
  568. CalculateBonuses();
  569. SetHP(GetTotalHP());
  570. SetPower(GetTotalPower());
  571. GetInfoStruct()->agi_base = new_level * 2 + 15;
  572. GetInfoStruct()->intel_base = new_level * 2 + 15;
  573. GetInfoStruct()->wis_base = new_level * 2 + 15;
  574. GetInfoStruct()->str_base = new_level * 2 + 15;
  575. GetInfoStruct()->sta_base = new_level * 2 + 15;
  576. GetInfoStruct()->cold_base = (int16)(new_level*1.5 + 10);
  577. GetInfoStruct()->heat_base = (int16)(new_level*1.5 + 10);
  578. GetInfoStruct()->disease_base = (int16)(new_level*1.5 + 10);
  579. GetInfoStruct()->mental_base = (int16)(new_level*1.5 + 10);
  580. GetInfoStruct()->magic_base = (int16)(new_level*1.5 + 10);
  581. GetInfoStruct()->divine_base = (int16)(new_level*1.5 + 10);
  582. GetInfoStruct()->poison_base = (int16)(new_level*1.5 + 10);
  583. SetHPRegen((int)(new_level*.75) + (int)(new_level / 10) + 3);
  584. SetPowerRegen(new_level + (int)(new_level / 10) + 4);
  585. GetInfoStruct()->poison_base = (int16)(new_level*1.5 + 10);
  586. /*UpdateTimeStampFlag(LEVEL_UPDATE_FLAG);
  587. GetPlayer()->SetCharSheetChanged(true);
  588. Message(CHANNEL_COLOR_EXP, "You are now level %i!", new_level);
  589. LogWrite(WORLD__DEBUG, 0, "World", "Player: %s leveled from %u to %u", GetPlayer()->GetName(), old_level, new_level);
  590. GetPlayer()->GetSkills()->SetSkillCapsByType(1, 5 * new_level);
  591. GetPlayer()->GetSkills()->SetSkillCapsByType(3, 5 * new_level);
  592. GetPlayer()->GetSkills()->SetSkillCapsByType(6, 5 * new_level);
  593. GetPlayer()->GetSkills()->SetSkillCapsByType(13, 5 * new_level);
  594. */
  595. }