Bot.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  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->set_str_base(50);
  25. info->set_sta_base(20);
  26. info->set_wis_base(20);
  27. info->set_intel_base(20);
  28. info->set_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)
  267. continue;
  268. if (!member->Alive())
  269. continue;
  270. int8 percent = (int8)(((float)member->GetHP() / member->GetTotalHP()) * 100);
  271. if (percent <= threshold) {
  272. if (spell) {
  273. SetTarget(member);
  274. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  275. return spell;
  276. }
  277. }
  278. }
  279. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  280. }
  281. return 0;
  282. }
  283. Spell* Bot::GetTauntSpell() {
  284. if (taunt_spells.size() == 0)
  285. return 0;
  286. // If not the main tank and taunts are turned off return out
  287. if (main_tank != this && !CanTaunt)
  288. return 0;
  289. Spell* spell = 0;
  290. map<int32, int8>::iterator itr;
  291. for (itr = taunt_spells.begin(); itr != taunt_spells.end(); itr++) {
  292. spell = master_spell_list.GetSpell(itr->first, itr->second);
  293. if (spell && IsSpellReady(spell)) {
  294. return spell;
  295. }
  296. }
  297. return 0;
  298. }
  299. Spell* Bot::GetDetauntSpell() {
  300. if (detaunt_spells.size() == 0)
  301. return 0;
  302. if (!GetTarget() || !GetTarget()->IsNPC())
  303. return 0;
  304. NPC* target = (NPC*)GetTarget();
  305. Entity* hated = target->Brain()->GetMostHated();
  306. if (hated == this) {
  307. Spell* spell = 0;
  308. map<int32, int8>::iterator itr;
  309. for (itr = detaunt_spells.begin(); itr != detaunt_spells.end(); itr++) {
  310. spell = master_spell_list.GetSpell(itr->first, itr->second);
  311. if (spell && IsSpellReady(spell)) {
  312. return spell;
  313. }
  314. }
  315. }
  316. return 0;
  317. }
  318. Spell* Bot::GetHoTWardSpell() {
  319. if (hot_ward_spells.size() == 0)
  320. return 0;
  321. // Get an available spell
  322. Spell* spell = 0;
  323. map<int32, int8>::iterator itr;
  324. for (itr = hot_ward_spells.begin(); itr != hot_ward_spells.end(); itr++) {
  325. spell = master_spell_list.GetSpell(itr->first, itr->second);
  326. if (spell && IsSpellReady(spell)) {
  327. break;
  328. }
  329. }
  330. // No spell available, return out
  331. if (!spell)
  332. return 0;
  333. // There was a spell so find a group member that needs healing
  334. int8 threshold = GetHealThreshold();
  335. GroupMemberInfo* gmi = GetGroupMemberInfo();
  336. PlayerGroup* group = world.GetGroupManager()->GetGroup(gmi->group_id);
  337. if (group)
  338. {
  339. group->MGroupMembers.readlock(__FUNCTION__, __LINE__);
  340. deque<GroupMemberInfo*>* members = group->GetMembers();
  341. if(!members)
  342. return 0;
  343. for (int8 i = 0; i < members->size(); i++) {
  344. Entity* member = members->at(i)->member;
  345. int8 percent = 0;
  346. if (member->GetHP() > 0)
  347. percent = (int8)(((float)member->GetHP() / member->GetTotalHP()) * 100);
  348. if (percent <= 99 && percent > threshold) {
  349. if (spell) {
  350. SetTarget(member);
  351. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  352. return spell;
  353. }
  354. }
  355. }
  356. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  357. }
  358. return 0;
  359. }
  360. Spell* Bot::GetDebuffSpell() {
  361. if (debuff_spells.size() == 0)
  362. return 0;
  363. Spell* spell = 0;
  364. map<int32, int8>::iterator itr;
  365. for (itr = debuff_spells.begin(); itr != debuff_spells.end(); itr++) {
  366. spell = master_spell_list.GetSpell(itr->first, itr->second);
  367. if (spell && IsSpellReady(spell)) {
  368. // If target already has this effect on them then continue to the next spell
  369. if (((Entity*)GetTarget())->GetSpellEffect(itr->first))
  370. continue;
  371. return spell;
  372. }
  373. }
  374. return 0;
  375. }
  376. Spell* Bot::GetCombatBuffSpell() {
  377. return 0;
  378. }
  379. Spell* Bot::GetDoTSpell() {
  380. if (dot_spells.size() == 0)
  381. return 0;
  382. Spell* spell = 0;
  383. map<int32, int8>::iterator itr;
  384. for (itr = dot_spells.begin(); itr != dot_spells.end(); itr++) {
  385. spell = master_spell_list.GetSpell(itr->first, itr->second);
  386. if (spell && IsSpellReady(spell)) {
  387. // If target already has this effect on them then continue to the next spell
  388. if (((Entity*)GetTarget())->GetSpellEffect(itr->first))
  389. continue;
  390. return spell;
  391. }
  392. }
  393. return 0;
  394. }
  395. Spell* Bot::GetBuffSpell() {
  396. if (buff_spells.size() == 0)
  397. return 0;
  398. Spell* spell = 0;
  399. Entity* target = 0;
  400. map<int32, int8>::iterator itr;
  401. for (itr = buff_spells.begin(); itr != buff_spells.end(); itr++) {
  402. spell = master_spell_list.GetSpell(itr->first, itr->second);
  403. if (spell && IsSpellReady(spell)) {
  404. target = 0;
  405. if (spell->GetSpellData()->target_type == SPELL_TARGET_SELF)
  406. target = this;
  407. if (spell->GetSpellData()->target_type == SPELL_TARGET_GROUP_AE)
  408. target = this;
  409. if (spell->GetSpellData()->target_type == SPELL_TARGET_ENEMY && spell->GetSpellData()->friendly_spell == 1)
  410. target = (main_tank != NULL) ? main_tank : GetOwner();
  411. if (!target)
  412. continue;
  413. if (!target->Alive())
  414. continue;
  415. // If target already has this effect on them then continue to the next spell
  416. if (target->GetSpellEffect(itr->first))
  417. continue;
  418. SetTarget(target);
  419. return spell;
  420. }
  421. }
  422. return 0;
  423. }
  424. Spell* Bot::GetRezSpell() {
  425. if (rez_spells.size() == 0)
  426. return 0;
  427. GroupMemberInfo* gmi = GetGroupMemberInfo();
  428. if (!gmi)
  429. return 0;
  430. Entity* target = 0;
  431. PlayerGroup* group = world.GetGroupManager()->GetGroup(gmi->group_id);
  432. if (group)
  433. {
  434. group->MGroupMembers.readlock(__FUNCTION__, __LINE__);
  435. deque<GroupMemberInfo*>* members = group->GetMembers();
  436. for (int8 i = 0; i < members->size(); i++) {
  437. Entity* member = members->at(i)->member;
  438. if (member && !member->Alive() && member->IsPlayer()) {
  439. PendingResurrection* rez = members->at(i)->client->GetCurrentRez();
  440. if (rez->active)
  441. continue;
  442. target = member;
  443. break;
  444. }
  445. }
  446. group->MGroupMembers.releasereadlock(__FUNCTION__, __LINE__);
  447. }
  448. if (!target)
  449. return 0;
  450. Spell* spell = 0;
  451. map<int32, int8>::iterator itr;
  452. for (itr = rez_spells.begin(); itr != rez_spells.end(); itr++) {
  453. spell = master_spell_list.GetSpell(itr->first, itr->second);
  454. if (spell && IsSpellReady(spell)) {
  455. SetTarget(target);
  456. return spell;
  457. }
  458. }
  459. return 0;
  460. }
  461. Spell* Bot::GetCureSpell() {
  462. return 0;
  463. }
  464. int8 Bot::GetHealThreshold() {
  465. int8 ret = 0;
  466. switch (GetAdventureClass()) {
  467. case PRIEST:
  468. case CLERIC:
  469. case TEMPLAR:
  470. case INQUISITOR:
  471. case DRUID:
  472. case WARDEN:
  473. case FURY:
  474. case SHAMAN:
  475. case MYSTIC:
  476. case DEFILER:
  477. ret = 70;
  478. break;
  479. default:
  480. ret = 30;
  481. break;
  482. }
  483. return ret;
  484. }
  485. bool Bot::ShouldMelee() {
  486. bool ret = true;
  487. switch (GetAdventureClass()) {
  488. case PRIEST:
  489. case CLERIC:
  490. case TEMPLAR:
  491. case INQUISITOR:
  492. case DRUID:
  493. case WARDEN:
  494. case FURY:
  495. case SHAMAN:
  496. case MYSTIC:
  497. case DEFILER:
  498. case MAGE:
  499. case SORCERER:
  500. case WIZARD:
  501. case WARLOCK:
  502. case ENCHANTER:
  503. case ILLUSIONIST:
  504. case COERCER:
  505. case SUMMONER:
  506. case CONJUROR:
  507. case NECROMANCER:
  508. ret = false;
  509. break;
  510. default:
  511. ret = true;
  512. break;
  513. }
  514. if (GetTarget() == GetOwner())
  515. ret = false;
  516. return ret;
  517. }
  518. void Bot::Camp(bool immediate) {
  519. // Copy from COMMAND_GROUP_LEAVE
  520. GroupMemberInfo* gmi = GetGroupMemberInfo();
  521. if (gmi) {
  522. int32 group_id = gmi->group_id;
  523. world.GetGroupManager()->RemoveGroupMember(group_id, this);
  524. if (!world.GetGroupManager()->IsGroupIDValid(group_id)) {
  525. // leader->Message(CHANNEL_COLOR_GROUP, "%s has left the group.", client->GetPlayer()->GetName());
  526. }
  527. else {
  528. world.GetGroupManager()->GroupMessage(group_id, "%s has left the group.", GetName());
  529. }
  530. }
  531. if(!immediate)
  532. {
  533. GetZone()->PlayAnimation(this, 538);
  534. SetVisualState(540);
  535. GetZone()->Despawn(this, 5000);
  536. }
  537. if (!GetOwner())
  538. return;
  539. Client* client = GetZone()->GetClientBySpawn(GetOwner());
  540. if (client)
  541. client->GetPlayer()->SpawnedBots.erase(BotIndex);
  542. }
  543. void Bot::ChangeLevel(int16 old_level, int16 new_level) {
  544. if (new_level < 1)
  545. return;
  546. if (GetLevel() != new_level) {
  547. SetLevel(new_level);
  548. if (GetGroupMemberInfo()) {
  549. UpdateGroupMemberInfo();
  550. world.GetGroupManager()->SendGroupUpdate(GetGroupMemberInfo()->group_id);
  551. }
  552. }
  553. if (GetPet()) {
  554. NPC* pet = (NPC*)GetPet();
  555. if (pet->GetMaxPetLevel() == 0 || new_level <= pet->GetMaxPetLevel()) {
  556. pet->SetLevel(new_level);
  557. GetZone()->PlayAnimation(pet, 1753);
  558. }
  559. }
  560. // level up animation
  561. GetZone()->PlayAnimation(this, 1753);
  562. //player->GetSkills()->IncreaseAllSkillCaps(5 * (new_level - old_level));
  563. GetNewSpells();
  564. //SendNewSpells(player->GetAdventureClass());
  565. //SendNewSpells(classes.GetBaseClass(player->GetAdventureClass()));
  566. //SendNewSpells(classes.GetSecondaryBaseClass(player->GetAdventureClass()));
  567. ChangePrimaryWeapon();
  568. ChangeSecondaryWeapon();
  569. ChangeRangedWeapon();
  570. GetInfoStruct()->set_level(new_level);
  571. // GetPlayer()->SetLevel(new_level);
  572. 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__);
  573. SetTotalHPBase(new_level*new_level * 2 + 40);
  574. SetTotalPowerBase((sint32)(new_level*new_level*2.1 + 45));
  575. CalculateBonuses();
  576. SetHP(GetTotalHP());
  577. SetPower(GetTotalPower());
  578. GetInfoStruct()->set_agi_base(new_level * 2 + 15);
  579. GetInfoStruct()->set_intel_base(new_level * 2 + 15);
  580. GetInfoStruct()->set_wis_base(new_level * 2 + 15);
  581. GetInfoStruct()->set_str_base(new_level * 2 + 15);
  582. GetInfoStruct()->set_sta_base(new_level * 2 + 15);
  583. GetInfoStruct()->set_cold_base((int16)(new_level*1.5 + 10));
  584. GetInfoStruct()->set_heat_base((int16)(new_level*1.5 + 10));
  585. GetInfoStruct()->set_disease_base((int16)(new_level*1.5 + 10));
  586. GetInfoStruct()->set_mental_base((int16)(new_level*1.5 + 10));
  587. GetInfoStruct()->set_magic_base((int16)(new_level*1.5 + 10));
  588. GetInfoStruct()->set_divine_base((int16)(new_level*1.5 + 10));
  589. GetInfoStruct()->set_poison_base((int16)(new_level*1.5 + 10));
  590. /*UpdateTimeStampFlag(LEVEL_UPDATE_FLAG);
  591. GetPlayer()->SetCharSheetChanged(true);
  592. Message(CHANNEL_COLOR_EXP, "You are now level %i!", new_level);
  593. LogWrite(WORLD__DEBUG, 0, "World", "Player: %s leveled from %u to %u", GetPlayer()->GetName(), old_level, new_level);
  594. GetPlayer()->GetSkills()->SetSkillCapsByType(1, 5 * new_level);
  595. GetPlayer()->GetSkills()->SetSkillCapsByType(3, 5 * new_level);
  596. GetPlayer()->GetSkills()->SetSkillCapsByType(6, 5 * new_level);
  597. GetPlayer()->GetSkills()->SetSkillCapsByType(13, 5 * new_level);
  598. */
  599. }