SavemapHandler.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <iostream>
  16. #include <string>
  17. #include <vector>
  18. #include "core/SavemapHandler.h"
  19. #include "core/Logger.h"
  20. /**
  21. * Savemap handler singleton.
  22. */
  23. template<>SavemapHandler *Ogre::Singleton<SavemapHandler>::msSingleton = nullptr;
  24. int SavemapHandler::MAX_SAVE_SLOTS(15);
  25. std::string SavemapHandler::SAVE_PATH("save/");
  26. SavemapHandler::SavemapHandler(): current_savemap_(nullptr), savemaps_read_(false){}
  27. SavemapHandler::~SavemapHandler(){
  28. //TODO
  29. LOG_TRIVIAL("SavemapHandler destroyed.");
  30. }
  31. Savemap SavemapHandler::GetCurrentSavemap(){return *current_savemap_;}
  32. Savemap* SavemapHandler::GetSavemap(unsigned int slot){
  33. if (slot >= MAX_SAVE_SLOTS) return nullptr;
  34. if (!savemaps_read_) ReadSavemaps();
  35. return saved_savemaps_[slot];
  36. }
  37. std::vector<Savemap*> SavemapHandler::GetSavemaps(){
  38. if (!savemaps_read_) ReadSavemaps();
  39. return saved_savemaps_;
  40. }
  41. bool SavemapHandler::Save(unsigned int slot, const bool force){
  42. if (current_savemap_ == nullptr) return false;
  43. if (slot >= MAX_SAVE_SLOTS) return false;
  44. if (!savemaps_read_) ReadSavemaps();
  45. if (
  46. force == false && saved_savemaps_[slot]->IsEmpty() == false
  47. && current_savemap_->GetControlKey() != saved_savemaps_[slot]->GetControlKey()
  48. ) return false;
  49. else{
  50. saved_savemaps_[slot] = current_savemap_;
  51. saved_savemaps_[slot]->Write(slot, SAVE_PATH + std::to_string(slot) + ".xml");
  52. return true;
  53. }
  54. }
  55. bool SavemapHandler::Save(Savemap savemap, unsigned int slot, bool force){
  56. if (slot >= MAX_SAVE_SLOTS) return false;
  57. if (!savemaps_read_) ReadSavemaps();
  58. if (
  59. force == false && saved_savemaps_[slot]->IsEmpty() == false
  60. && savemap.GetControlKey() != saved_savemaps_[slot]->GetControlKey()
  61. ) return false;
  62. else{
  63. *current_savemap_ = savemap;
  64. saved_savemaps_[slot] = current_savemap_;
  65. saved_savemaps_[slot]->Write(slot, SAVE_PATH + std::to_string(slot) + ".xml");
  66. return true;
  67. }
  68. }
  69. void SavemapHandler::Release(){
  70. current_savemap_ = nullptr;
  71. saved_savemaps_.clear();
  72. savemaps_read_ = false;
  73. }
  74. void SavemapHandler::ReadSavemaps(){
  75. saved_savemaps_.clear();
  76. for (int i = 0; i < MAX_SAVE_SLOTS; i ++){
  77. Savemap* savemap = new Savemap();
  78. savemap->Read(SAVE_PATH + std::to_string(i) + ".xml");
  79. saved_savemaps_.push_back(savemap);
  80. }
  81. savemaps_read_ = true;
  82. }
  83. void SavemapHandler::SetData(const unsigned int bank, const unsigned int address, const int value){
  84. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  85. current_savemap_->SetData(bank, address, value);
  86. }
  87. void SavemapHandler::SetControlKey(const char* control){
  88. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  89. current_savemap_->SetControlKey(std::string(control));
  90. }
  91. void SavemapHandler::SetWindowColours(
  92. const unsigned int t_l_r, const unsigned int t_l_g, const unsigned int t_l_b,
  93. const unsigned int t_r_r, const unsigned int t_r_g, const unsigned int t_r_b,
  94. const unsigned int b_r_r, const unsigned int b_r_g, const unsigned int b_r_b,
  95. const unsigned int b_l_r, const unsigned int b_l_g, const unsigned int b_l_b
  96. ){
  97. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  98. current_savemap_->SetWindowColours(
  99. t_l_r, t_l_g, t_l_b, t_r_r, t_r_g, t_r_b, b_r_r, b_r_g, b_r_b, b_l_r, b_l_g, b_l_b
  100. );
  101. }
  102. void SavemapHandler::SetMoney(const unsigned int money){
  103. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  104. current_savemap_->SetMoney(money);
  105. }
  106. void SavemapHandler::SetGameTime(const unsigned int seconds){
  107. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  108. current_savemap_->SetGameTime(seconds);
  109. }
  110. void SavemapHandler::SetCountdownTime(const unsigned int seconds){
  111. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  112. current_savemap_->SetCountdownTime(seconds);
  113. }
  114. void SavemapHandler::SetKeyItem(const unsigned int item, const bool owned){
  115. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  116. current_savemap_->SetKeyItem(item, owned);
  117. }
  118. void SavemapHandler::SetParty(const int member_1, const int member_2, const int member_3){
  119. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  120. current_savemap_->SetParty(member_1, member_2, member_3);
  121. }
  122. void SavemapHandler::SetItem(
  123. const unsigned int slot, const unsigned int id, const unsigned int quantity
  124. ){
  125. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  126. current_savemap_->SetItem(slot, id, quantity);
  127. }
  128. void SavemapHandler::SetMateria(const unsigned int slot, const int id, const unsigned int ap){
  129. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  130. current_savemap_->SetMateria(slot, id, ap);
  131. }
  132. void SavemapHandler::SetESkillMateria(
  133. const unsigned slot, const unsigned int skill, const bool learned
  134. ){
  135. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  136. current_savemap_->SetESkillMateria(slot, skill, learned);
  137. }
  138. void SavemapHandler::SetMateriaStash(const unsigned int slot, const int id, const unsigned int ap){
  139. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  140. current_savemap_->SetMateriaStash(slot, id, ap);
  141. }
  142. void SavemapHandler::SetESkillMateriaStash(
  143. const unsigned slot, const unsigned int skill, const bool learned
  144. ){
  145. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  146. current_savemap_->SetESkillMateriaStash(slot, skill, learned);
  147. }
  148. void SavemapHandler::SetLocation(
  149. const float x, const float y, const float z,
  150. const unsigned int triangle, const int angle, const char* field, const char* name
  151. ){
  152. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  153. current_savemap_->SetLocation(x, y, z, triangle, angle, std::string(field), std::string(name));
  154. }
  155. void SavemapHandler::SetSetting(const char* key, const int value){
  156. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  157. current_savemap_->SetSetting(std::string(key), value);
  158. }
  159. bool SavemapHandler::IsSlotSettingSet(const unsigned int slot, const char* key){
  160. if (slot >= MAX_SAVE_SLOTS) return false;
  161. if (savemaps_read_ == false) ReadSavemaps();
  162. return saved_savemaps_[slot]->HasSetting(std::string(key));
  163. }
  164. int SavemapHandler::GetSlotSetting(const unsigned int slot, const char* key){
  165. if (slot >= MAX_SAVE_SLOTS) return 0;
  166. if (savemaps_read_ == false) ReadSavemaps();
  167. return saved_savemaps_[slot]->GetSetting(std::string(key));
  168. }
  169. void SavemapHandler::SetCharacterInfo(
  170. const unsigned int id, const int char_id, const char* name,
  171. const bool enabled, const bool locked,
  172. const unsigned int level, const unsigned int kills,
  173. const bool back_row, const unsigned int exp, const unsigned int exp_to_next,
  174. const unsigned int limit_level, const unsigned int limit_bar,
  175. const unsigned int weapon, const unsigned int armor, const int accessory
  176. ){
  177. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  178. current_savemap_->SetCharacterInfo(
  179. id, char_id, std::string(name), enabled, locked, level, kills, back_row, exp, exp_to_next,
  180. limit_level, limit_bar, weapon, armor, accessory
  181. );
  182. }
  183. void SavemapHandler::SetCharacterStat(
  184. const unsigned int id, const unsigned int stat, const unsigned int base, const unsigned int extra
  185. ){
  186. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  187. current_savemap_->SetCharacterStat(id, stat, base, extra);
  188. }
  189. void SavemapHandler::SetCharacterLimitLearned(
  190. const unsigned int id, const unsigned int level,
  191. const unsigned int technique, const bool learned, const unsigned int uses
  192. ){
  193. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  194. current_savemap_->SetCharacterLimitLearned(id, level, technique, learned, uses);
  195. }
  196. void SavemapHandler::SetCharacterMateria(
  197. const unsigned int id, const bool weapon, const unsigned int slot,
  198. const int materia, const unsigned int ap
  199. ){
  200. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  201. current_savemap_->SetCharacterMateria(id, weapon, slot, materia, ap);
  202. }
  203. void SavemapHandler::SetCharacterESkillMateria(
  204. const unsigned int id, const bool weapon, const unsigned int slot,
  205. const unsigned int skill, const bool learned
  206. ){
  207. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  208. current_savemap_->SetCharacterESkillMateria(id, weapon, slot, skill, learned);
  209. }
  210. void SavemapHandler::SetCharacterStatus(
  211. const unsigned int id, const unsigned int status, const bool inflicted
  212. ){
  213. if (current_savemap_ == nullptr) current_savemap_ = new Savemap();
  214. current_savemap_->SetCharacterStatus(id, status, inflicted);
  215. }
  216. bool SavemapHandler::IsSlotEmpty(const unsigned int slot){
  217. if (slot >= MAX_SAVE_SLOTS) return true;
  218. if (savemaps_read_ == false) ReadSavemaps();
  219. return saved_savemaps_[slot]->IsEmpty();
  220. }
  221. std::string SavemapHandler::GetSlotControlKey(const unsigned int slot){
  222. if (slot >= MAX_SAVE_SLOTS) return std::string("");
  223. if (savemaps_read_ == false) ReadSavemaps();
  224. return saved_savemaps_[slot]->GetControlKey();
  225. }
  226. unsigned int SavemapHandler::GetSlotWindowCornerColourComponent(
  227. const unsigned int slot, const unsigned int corner, const unsigned int comp
  228. ){
  229. if (slot >= MAX_SAVE_SLOTS) return 0;
  230. if (savemaps_read_ == false) ReadSavemaps();
  231. return saved_savemaps_[slot]->GetWindowCornerColourComponent(corner, comp);
  232. }
  233. unsigned int SavemapHandler::GetSlotMoney(const unsigned int slot){
  234. if (slot >= MAX_SAVE_SLOTS) return 0;
  235. if (savemaps_read_ == false) ReadSavemaps();
  236. return saved_savemaps_[slot]->GetMoney();
  237. }
  238. unsigned int SavemapHandler::GetSlotGameTime(const unsigned int slot){
  239. if (slot >= MAX_SAVE_SLOTS) return 0;
  240. if (savemaps_read_ == false) ReadSavemaps();
  241. return saved_savemaps_[slot]->GetGameTime();
  242. }
  243. unsigned int SavemapHandler::GetSlotCountdownTime(const unsigned int slot){
  244. if (slot >= MAX_SAVE_SLOTS) return 0;
  245. if (savemaps_read_ == false) ReadSavemaps();
  246. return saved_savemaps_[slot]->GetCountdownTime();
  247. }
  248. int SavemapHandler::GetSlotPartyMember(const unsigned int slot, const unsigned int pos){
  249. if (slot >= MAX_SAVE_SLOTS) return -1;
  250. if (savemaps_read_ == false) ReadSavemaps();
  251. return saved_savemaps_[slot]->GetPartyMember(pos);
  252. }
  253. unsigned int SavemapHandler::GetSlotItemAtPosId(const unsigned int slot, const unsigned int pos){
  254. if (slot >= MAX_SAVE_SLOTS) return 0;
  255. if (savemaps_read_ == false) ReadSavemaps();
  256. return saved_savemaps_[slot]->GetItemAtPosId(pos);
  257. }
  258. unsigned int SavemapHandler::GetSlotItemAtPosQty(const unsigned int slot, const unsigned int pos){
  259. if (slot >= MAX_SAVE_SLOTS) return 0;
  260. if (savemaps_read_ == false) ReadSavemaps();
  261. return saved_savemaps_[slot]->GetItemAtPosQty(pos);
  262. }
  263. bool SavemapHandler::GetSlotKeyItem(const unsigned int slot, const unsigned int id){
  264. if (slot >= MAX_SAVE_SLOTS) return false;
  265. if (savemaps_read_ == false) ReadSavemaps();
  266. return saved_savemaps_[slot]->GetKeyItem(id);
  267. }
  268. int SavemapHandler::GetSlotMateriaAtPosId(const unsigned int slot, const unsigned int pos){
  269. if (slot >= MAX_SAVE_SLOTS) return -1;
  270. if (savemaps_read_ == false) ReadSavemaps();
  271. return saved_savemaps_[slot]->GetMateriaAtPosId(pos);
  272. }
  273. unsigned int SavemapHandler::GetSlotMateriaAtPosAp(const unsigned int slot, const unsigned int pos){
  274. if (slot >= MAX_SAVE_SLOTS) return 0;
  275. if (savemaps_read_ == false) ReadSavemaps();
  276. return saved_savemaps_[slot]->GetMateriaAtPosAp(pos);
  277. }
  278. bool SavemapHandler::IsSlotMateriaAtPosESkill(const unsigned int slot, const unsigned int pos){
  279. if (slot >= MAX_SAVE_SLOTS) return 0;
  280. if (savemaps_read_ == false) ReadSavemaps();
  281. return saved_savemaps_[slot]->IsMateriaAtPosESkill(pos);
  282. }
  283. bool SavemapHandler::IsSlotMateriaAtPosESkillLearned(
  284. const unsigned int slot, const unsigned int pos, const unsigned int skill
  285. ){
  286. if (slot >= MAX_SAVE_SLOTS) return false;
  287. if (savemaps_read_ == false) ReadSavemaps();
  288. return saved_savemaps_[slot]->IsMateriaAtPosESkillLearned(pos, skill);
  289. }
  290. int SavemapHandler::GetSlotStashAtPosId(const unsigned int slot, const unsigned int pos){
  291. if (slot >= MAX_SAVE_SLOTS) return -1;
  292. if (savemaps_read_ == false) ReadSavemaps();
  293. return saved_savemaps_[slot]->GetStashAtPosId(pos);
  294. }
  295. unsigned int SavemapHandler::GetSlotStashAtPosAp(const unsigned int slot, const unsigned int pos){
  296. if (slot >= MAX_SAVE_SLOTS) return 0;
  297. if (savemaps_read_ == false) ReadSavemaps();
  298. return saved_savemaps_[slot]->GetStashAtPosAp(pos);
  299. }
  300. bool SavemapHandler::IsSlotStashAtPosESkill(const unsigned int slot, const unsigned int pos){
  301. if (slot >= MAX_SAVE_SLOTS) return false;
  302. if (savemaps_read_ == false) ReadSavemaps();
  303. return saved_savemaps_[slot]->IsStashAtPosESkill(pos);
  304. }
  305. bool SavemapHandler::IsSlotStashAtPosESkillLearned(
  306. const unsigned int slot, const unsigned int pos, const unsigned int skill
  307. ){
  308. if (slot >= MAX_SAVE_SLOTS) return false;
  309. if (savemaps_read_ == false) ReadSavemaps();
  310. return saved_savemaps_[slot]->IsStashAtPosESkillLearned(pos, skill);
  311. }
  312. float SavemapHandler::GetSlotLocationX(const unsigned int slot){
  313. if (slot >= MAX_SAVE_SLOTS) return 0.0f;
  314. if (savemaps_read_ == false) ReadSavemaps();
  315. return saved_savemaps_[slot]->GetLocationX();
  316. }
  317. float SavemapHandler::GetSlotLocationY(const unsigned int slot){
  318. if (slot >= MAX_SAVE_SLOTS) return 0.0f;
  319. if (savemaps_read_ == false) ReadSavemaps();
  320. return saved_savemaps_[slot]->GetLocationY();
  321. }
  322. float SavemapHandler::GetSlotLocationZ(const unsigned int slot){
  323. if (slot >= MAX_SAVE_SLOTS) return -1.0f;
  324. if (savemaps_read_ == false) ReadSavemaps();
  325. return saved_savemaps_[slot]->GetLocationZ();
  326. }
  327. unsigned int SavemapHandler::GetSlotLocationTriangle(const unsigned int slot){
  328. if (slot >= MAX_SAVE_SLOTS) return 0;
  329. if (savemaps_read_ == false) ReadSavemaps();
  330. return saved_savemaps_[slot]->GetLocationTriangle();
  331. }
  332. int SavemapHandler::GetSlotLocationAngle(const unsigned int slot){
  333. if (slot >= MAX_SAVE_SLOTS) return 0;
  334. if (savemaps_read_ == false) ReadSavemaps();
  335. return saved_savemaps_[slot]->GetLocationAngle();
  336. }
  337. std::string SavemapHandler::GetSlotLocationField(const unsigned int slot){
  338. if (slot >= MAX_SAVE_SLOTS) return "";
  339. if (savemaps_read_ == false) ReadSavemaps();
  340. return saved_savemaps_[slot]->GetLocationField();
  341. }
  342. std::string SavemapHandler::GetSlotLocationName(const unsigned int slot){
  343. if (slot >= MAX_SAVE_SLOTS) return "";
  344. if (savemaps_read_ == false) ReadSavemaps();
  345. return saved_savemaps_[slot]->GetLocationName();
  346. }
  347. int SavemapHandler::GetSlotCharacterCharId(const unsigned int slot, const unsigned int id){
  348. if (slot >= MAX_SAVE_SLOTS) return 0;
  349. if (savemaps_read_ == false) ReadSavemaps();
  350. return saved_savemaps_[slot]->GetCharacterCharId(id);
  351. }
  352. std::string SavemapHandler::GetSlotCharacterName(const unsigned int slot, const unsigned int id){
  353. if (slot >= MAX_SAVE_SLOTS) return "";
  354. if (savemaps_read_ == false) ReadSavemaps();
  355. return saved_savemaps_[slot]->GetCharacterName(id);
  356. }
  357. unsigned int SavemapHandler::GetSlotCharacterLevel(const unsigned int slot, const unsigned int id){
  358. if (slot >= MAX_SAVE_SLOTS) return 1;
  359. if (savemaps_read_ == false) ReadSavemaps();
  360. return saved_savemaps_[slot]->GetCharacterLevel(id);
  361. }
  362. unsigned int SavemapHandler::GetSlotCharacterKills(const unsigned int slot, const unsigned int id){
  363. if (slot >= MAX_SAVE_SLOTS) return 0;
  364. if (savemaps_read_ == false) ReadSavemaps();
  365. return saved_savemaps_[slot]->GetCharacterKills(id);
  366. }
  367. bool SavemapHandler::IsSlotCharacterEnabled(const unsigned int slot, const unsigned int id){
  368. if (slot >= MAX_SAVE_SLOTS) return false;
  369. if (savemaps_read_ == false) ReadSavemaps();
  370. return saved_savemaps_[slot]->IsCharacterEnabled(id);
  371. }
  372. bool SavemapHandler::IsSlotCharacterLocked(const unsigned int slot, const unsigned int id){
  373. if (slot >= MAX_SAVE_SLOTS) return false;
  374. if (savemaps_read_ == false) ReadSavemaps();
  375. return saved_savemaps_[slot]->IsCharacterLocked(id);
  376. }
  377. bool SavemapHandler::IsSlotCharacterBackRow(const unsigned int slot, const unsigned int id){
  378. if (slot >= MAX_SAVE_SLOTS) return false;
  379. if (savemaps_read_ == false) ReadSavemaps();
  380. return saved_savemaps_[slot]->IsCharacterBackRow(id);
  381. }
  382. unsigned int SavemapHandler::GetSlotCharacterExp(const unsigned int slot, const unsigned int id){
  383. if (slot >= MAX_SAVE_SLOTS) return 0;
  384. if (savemaps_read_ == false) ReadSavemaps();
  385. return saved_savemaps_[slot]->GetCharacterExp(id);
  386. }
  387. unsigned int SavemapHandler::GetSlotCharacterExpToNext(
  388. const unsigned int slot, const unsigned int id
  389. ){
  390. if (slot >= MAX_SAVE_SLOTS) return 0;
  391. if (savemaps_read_ == false) ReadSavemaps();
  392. return saved_savemaps_[slot]->GetCharacterExpToNext(id);
  393. }
  394. unsigned int SavemapHandler::GetSlotCharacterLimitLevel(
  395. const unsigned int slot, const unsigned int id
  396. ){
  397. if (slot >= MAX_SAVE_SLOTS) return 0;
  398. if (savemaps_read_ == false) ReadSavemaps();
  399. return saved_savemaps_[slot]->GetCharacterLimitLevel(id);
  400. }
  401. unsigned int SavemapHandler::GetSlotCharacterLimitBar(
  402. const unsigned int slot, const unsigned int id
  403. ){
  404. if (slot >= MAX_SAVE_SLOTS) return 0;
  405. if (savemaps_read_ == false) ReadSavemaps();
  406. return saved_savemaps_[slot]->GetCharacterLimitBar(id);
  407. }
  408. unsigned int SavemapHandler::GetSlotCharacterWeaponId(
  409. const unsigned int slot, const unsigned int id
  410. ){
  411. if (slot >= MAX_SAVE_SLOTS) return 0;
  412. if (savemaps_read_ == false) ReadSavemaps();
  413. return saved_savemaps_[slot]->GetCharacterWeaponId(id);
  414. }
  415. unsigned int SavemapHandler::GetSlotCharacterArmorId(
  416. const unsigned int slot, const unsigned int id
  417. ){
  418. if (slot >= MAX_SAVE_SLOTS) return 0;
  419. if (savemaps_read_ == false) ReadSavemaps();
  420. return saved_savemaps_[slot]->GetCharacterArmorId(id);
  421. }
  422. int SavemapHandler::GetSlotCharacterAccessoryId(const unsigned int slot, const unsigned int id){
  423. if (slot >= MAX_SAVE_SLOTS) return -1;
  424. if (savemaps_read_ == false) ReadSavemaps();
  425. return saved_savemaps_[slot]->GetCharacterAccessoryId(id);
  426. }
  427. unsigned int SavemapHandler::GetSlotCharacterStatBase(
  428. const unsigned int slot, const unsigned int id, const unsigned int stat
  429. ){
  430. if (slot >= MAX_SAVE_SLOTS) return 0;
  431. if (savemaps_read_ == false) ReadSavemaps();
  432. return saved_savemaps_[slot]->GetCharacterStatBase(id, stat);
  433. }
  434. unsigned int SavemapHandler::GetSlotCharacterStatExtra(
  435. const unsigned int slot, const unsigned int id, const unsigned int stat
  436. ){
  437. if (slot >= MAX_SAVE_SLOTS) return 0;
  438. if (savemaps_read_ == false) ReadSavemaps();
  439. return saved_savemaps_[slot]->GetCharacterStatExtra(id, stat);
  440. }
  441. unsigned int SavemapHandler::GetSlotCharacterLimitUses(
  442. const unsigned int slot, const unsigned int id, const unsigned int level
  443. ){
  444. if (slot >= MAX_SAVE_SLOTS) return 0;
  445. if (savemaps_read_ == false) ReadSavemaps();
  446. return saved_savemaps_[slot]->GetCharacterLimitUses(id, level);
  447. }
  448. bool SavemapHandler::IsSlotCharacterLimitLearned(
  449. const unsigned int slot, const unsigned int id, const unsigned int level, const unsigned int tech
  450. ){
  451. if (slot >= MAX_SAVE_SLOTS) return false;
  452. if (savemaps_read_ == false) ReadSavemaps();
  453. return saved_savemaps_[slot]->IsCharacterLimitLearned(id, level, tech);
  454. }
  455. int SavemapHandler::GetSlotCharacterMateriaId(
  456. const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos
  457. ){
  458. if (slot >= MAX_SAVE_SLOTS) return -1;
  459. if (savemaps_read_ == false) ReadSavemaps();
  460. return saved_savemaps_[slot]->GetCharacterMateriaId(id, weapon, pos);
  461. }
  462. unsigned int SavemapHandler::GetSlotCharacterMateriaAp(
  463. const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos
  464. ){
  465. if (slot >= MAX_SAVE_SLOTS) return 0;
  466. if (savemaps_read_ == false) ReadSavemaps();
  467. return saved_savemaps_[slot]->GetCharacterMateriaAp(id, weapon, pos);
  468. }
  469. bool SavemapHandler::IsSlotCharacterMateriaESkill(
  470. const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos
  471. ){
  472. if (slot >= MAX_SAVE_SLOTS) return false;
  473. if (savemaps_read_ == false) ReadSavemaps();
  474. return saved_savemaps_[slot]->IsCharacterMateriaESkill(id, weapon, pos);
  475. }
  476. bool SavemapHandler::IsSlotCharacterMateriaESkillLearned(
  477. const unsigned int slot, const unsigned int id, const bool weapon,
  478. const unsigned int pos, const unsigned int skill
  479. ){
  480. if (slot >= MAX_SAVE_SLOTS) return false;
  481. if (savemaps_read_ == false) ReadSavemaps();
  482. return saved_savemaps_[slot]->IsCharacterMateriaESkillLearned(id, weapon, pos, skill);
  483. }
  484. int SavemapHandler::GetSlotData(
  485. const unsigned int slot, const unsigned int bank, const unsigned int address
  486. ){
  487. if (slot >= MAX_SAVE_SLOTS) return false;
  488. if (savemaps_read_ == false) ReadSavemaps();
  489. return saved_savemaps_[slot]->GetData(bank, address);
  490. }