Bot.cpp 17 KB

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