AugmentationData.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver.datatables;
  16. import java.io.File;
  17. import java.util.Map;
  18. import java.util.StringTokenizer;
  19. import java.util.logging.Level;
  20. import java.util.logging.Logger;
  21. import javax.xml.parsers.DocumentBuilderFactory;
  22. import javolution.util.FastList;
  23. import javolution.util.FastMap;
  24. import net.sf.l2j.Config;
  25. import net.sf.l2j.gameserver.model.L2Augmentation;
  26. import net.sf.l2j.gameserver.model.L2Skill;
  27. import net.sf.l2j.gameserver.skills.Stats;
  28. import net.sf.l2j.util.Rnd;
  29. import org.w3c.dom.Document;
  30. import org.w3c.dom.NamedNodeMap;
  31. import org.w3c.dom.Node;
  32. /**
  33. * This class manages the augmentation data and can also create new augmentations.
  34. *
  35. * @author durgus
  36. * edited by Gigiikun
  37. */
  38. public class AugmentationData
  39. {
  40. private static final Logger _log = Logger.getLogger(AugmentationData.class.getName());
  41. public static final AugmentationData getInstance()
  42. {
  43. return SingletonHolder._instance;
  44. }
  45. // =========================================================
  46. // Data Field
  47. // stats
  48. private static final int STAT_START = 1;
  49. private static final int STAT_END = 14560;
  50. private static final int STAT_BLOCKSIZE = 3640;
  51. //private static final int STAT_NUMBEROF_BLOCKS = 4;
  52. private static final int STAT_SUBBLOCKSIZE = 91;
  53. //private static final int STAT_NUMBEROF_SUBBLOCKS = 40;
  54. // skills
  55. private static final int BLUE_START = 14561;
  56. // private static final int PURPLE_START = 14578;
  57. // private static final int RED_START = 14685;
  58. private static final int SKILLS_BLOCKSIZE = 178;
  59. // basestats
  60. private static final int BASESTAT_STR = 16341;
  61. private static final int BASESTAT_CON = 16342;
  62. private static final int BASESTAT_INT = 16343;
  63. private static final int BASESTAT_MEN = 16344;
  64. private FastList<?> _augmentationStats[];
  65. private Map<Integer, FastList<augmentationSkill>> _blueSkills;
  66. private Map<Integer, FastList<augmentationSkill>> _purpleSkills;
  67. private Map<Integer, FastList<augmentationSkill>> _redSkills;
  68. // =========================================================
  69. // Constructor
  70. private AugmentationData()
  71. {
  72. _log.info("Initializing AugmentationData.");
  73. _augmentationStats = new FastList[4];
  74. _augmentationStats[0] = new FastList<augmentationStat>();
  75. _augmentationStats[1] = new FastList<augmentationStat>();
  76. _augmentationStats[2] = new FastList<augmentationStat>();
  77. _augmentationStats[3] = new FastList<augmentationStat>();
  78. _blueSkills = new FastMap<Integer, FastList<augmentationSkill>>();
  79. _purpleSkills = new FastMap<Integer, FastList<augmentationSkill>>();
  80. _redSkills = new FastMap<Integer, FastList<augmentationSkill>>();
  81. for (int i = 1; i <= 10; i++)
  82. {
  83. _blueSkills.put(i, new FastList<augmentationSkill>());
  84. _purpleSkills.put(i, new FastList<augmentationSkill>());
  85. _redSkills.put(i, new FastList<augmentationSkill>());
  86. }
  87. load();
  88. // Use size*4: since theres 4 blocks of stat-data with equivalent size
  89. _log.info("AugmentationData: Loaded: " + (_augmentationStats[0].size() * 4) + " augmentation stats.");
  90. for (int i = 1; i <= 10; i++)
  91. {
  92. _log.info("AugmentationData: Loaded: " + _blueSkills.get(i).size() + " blue, " + _purpleSkills.get(i).size() + " purple and "
  93. + _redSkills.get(i).size() + " red skills for lifeStoneLevel " + i);
  94. }
  95. }
  96. // =========================================================
  97. // Nested Class
  98. public class augmentationSkill
  99. {
  100. private int _skillId;
  101. private int _skillLevel;
  102. private int _augmentationSkillId;
  103. public augmentationSkill(int skillId, int skillLevel, int augmentationSkillId)
  104. {
  105. _skillId = skillId;
  106. _skillLevel = skillLevel;
  107. _augmentationSkillId = augmentationSkillId;
  108. }
  109. public L2Skill getSkill()
  110. {
  111. return SkillTable.getInstance().getInfo(_skillId, _skillLevel);
  112. }
  113. public int getAugmentationSkillId()
  114. {
  115. return _augmentationSkillId;
  116. }
  117. }
  118. public class augmentationStat
  119. {
  120. private Stats _stat;
  121. private int _singleSize;
  122. private int _combinedSize;
  123. private float _singleValues[];
  124. private float _combinedValues[];
  125. public augmentationStat(Stats stat, float sValues[], float cValues[])
  126. {
  127. _stat = stat;
  128. _singleSize = sValues.length;
  129. _singleValues = sValues;
  130. _combinedSize = cValues.length;
  131. _combinedValues = cValues;
  132. }
  133. public int getSingleStatSize()
  134. {
  135. return _singleSize;
  136. }
  137. public int getCombinedStatSize()
  138. {
  139. return _combinedSize;
  140. }
  141. public float getSingleStatValue(int i)
  142. {
  143. if (i >= _singleSize || i < 0)
  144. return _singleValues[_singleSize - 1];
  145. return _singleValues[i];
  146. }
  147. public float getCombinedStatValue(int i)
  148. {
  149. if (i >= _combinedSize || i < 0)
  150. return _combinedValues[_combinedSize - 1];
  151. return _combinedValues[i];
  152. }
  153. public Stats getStat()
  154. {
  155. return _stat;
  156. }
  157. }
  158. // =========================================================
  159. // Method - Private
  160. @SuppressWarnings("unchecked")
  161. private final void load()
  162. {
  163. // Load the skillmap
  164. // Note: the skillmap data is only used when generating new augmentations
  165. // the client expects a different id in order to display the skill in the
  166. // items description...
  167. try
  168. {
  169. int badAugmantData = 0;
  170. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  171. factory.setValidating(false);
  172. factory.setIgnoringComments(true);
  173. File file = new File(Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_skillmap.xml");
  174. if (!file.exists())
  175. {
  176. if (Config.DEBUG)
  177. _log.info("The augmentation skillmap file is missing.");
  178. return;
  179. }
  180. Document doc = factory.newDocumentBuilder().parse(file);
  181. for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
  182. {
  183. if ("list".equalsIgnoreCase(n.getNodeName()))
  184. {
  185. for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
  186. {
  187. if ("augmentation".equalsIgnoreCase(d.getNodeName()))
  188. {
  189. NamedNodeMap attrs = d.getAttributes();
  190. int skillId = 0, augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
  191. int skillLvL = 0;
  192. String type = "blue";
  193. for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
  194. {
  195. if ("skillId".equalsIgnoreCase(cd.getNodeName()))
  196. {
  197. attrs = cd.getAttributes();
  198. skillId = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
  199. }
  200. else if ("skillLevel".equalsIgnoreCase(cd.getNodeName()))
  201. {
  202. attrs = cd.getAttributes();
  203. skillLvL = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
  204. }
  205. else if ("type".equalsIgnoreCase(cd.getNodeName()))
  206. {
  207. attrs = cd.getAttributes();
  208. type = attrs.getNamedItem("val").getNodeValue();
  209. }
  210. }
  211. if (skillId == 0)
  212. {
  213. if (Config.DEBUG)
  214. _log.log(Level.SEVERE, "Bad skillId in augmentation_skillmap.xml in the augmentationId:"
  215. + augmentationId);
  216. badAugmantData++;
  217. continue;
  218. }
  219. else if (skillLvL == 0)
  220. {
  221. if (Config.DEBUG)
  222. _log.log(Level.SEVERE, "Bad skillLevel in augmentation_skillmap.xml in the augmentationId:"
  223. + augmentationId);
  224. badAugmantData++;
  225. continue;
  226. }
  227. int k = 1;
  228. while ((augmentationId - k * SKILLS_BLOCKSIZE) >= BLUE_START)
  229. k++;
  230. if (type.equalsIgnoreCase("blue"))
  231. _blueSkills.get(k).add(new augmentationSkill(skillId, skillLvL, augmentationId));
  232. else if (type.equalsIgnoreCase("purple"))
  233. _purpleSkills.get(k).add(new augmentationSkill(skillId, skillLvL, augmentationId));
  234. else
  235. _redSkills.get(k).add(new augmentationSkill(skillId, skillLvL, augmentationId));
  236. }
  237. }
  238. }
  239. }
  240. if (badAugmantData != 0)
  241. _log.info("AugmentationData: " + badAugmantData + " bad skill(s) were skipped.");
  242. }
  243. catch (Exception e)
  244. {
  245. _log.log(Level.SEVERE, "Error parsing augmentation_skillmap.xml.", e);
  246. return;
  247. }
  248. // Load the stats from xml
  249. for (int i = 1; i < 5; i++)
  250. {
  251. try
  252. {
  253. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  254. factory.setValidating(false);
  255. factory.setIgnoringComments(true);
  256. File file = new File(Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_stats" + i + ".xml");
  257. if (!file.exists())
  258. {
  259. if (Config.DEBUG)
  260. _log.info("The augmentation stat data file " + i + " is missing.");
  261. return;
  262. }
  263. Document doc = factory.newDocumentBuilder().parse(file);
  264. for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
  265. {
  266. if ("list".equalsIgnoreCase(n.getNodeName()))
  267. {
  268. for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
  269. {
  270. if ("stat".equalsIgnoreCase(d.getNodeName()))
  271. {
  272. NamedNodeMap attrs = d.getAttributes();
  273. String statName = attrs.getNamedItem("name").getNodeValue();
  274. float soloValues[] = null, combinedValues[] = null;
  275. for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
  276. {
  277. if ("table".equalsIgnoreCase(cd.getNodeName()))
  278. {
  279. attrs = cd.getAttributes();
  280. String tableName = attrs.getNamedItem("name").getNodeValue();
  281. StringTokenizer data = new StringTokenizer(cd.getFirstChild().getNodeValue());
  282. FastList<Float> array = new FastList<Float>();
  283. while (data.hasMoreTokens())
  284. array.add(Float.parseFloat(data.nextToken()));
  285. if (tableName.equalsIgnoreCase("#soloValues"))
  286. {
  287. soloValues = new float[array.size()];
  288. int x = 0;
  289. for (float value : array)
  290. soloValues[x++] = value;
  291. }
  292. else
  293. {
  294. combinedValues = new float[array.size()];
  295. int x = 0;
  296. for (float value : array)
  297. combinedValues[x++] = value;
  298. }
  299. }
  300. }
  301. // store this stat
  302. ((FastList<augmentationStat>) _augmentationStats[(i - 1)]).add(new augmentationStat(Stats.valueOfXml(statName), soloValues, combinedValues));
  303. }
  304. }
  305. }
  306. }
  307. }
  308. catch (Exception e)
  309. {
  310. _log.log(Level.SEVERE, "Error parsing augmentation_stats" + i + ".xml.", e);
  311. return;
  312. }
  313. }
  314. }
  315. // =========================================================
  316. // Properties - Public
  317. /**
  318. * Generate a new random augmentation
  319. * @param item
  320. * @param lifeStoneLevel
  321. * @param lifeSoneGrade
  322. * @return L2Augmentation
  323. */
  324. public L2Augmentation generateRandomAugmentation(int lifeStoneLevel, int lifeStoneGrade)
  325. {
  326. // Note that stat12 stands for stat 1 AND 2 (same for stat34 ;p )
  327. // this is because a value can contain up to 2 stat modifications
  328. // (there are two short values packed in one integer value, meaning 4 stat modifications at max)
  329. // for more info take a look at getAugStatsById(...)
  330. // Note: lifeStoneGrade: (0 means low grade, 3 top grade)
  331. // First: determine whether we will add a skill/baseStatModifier or not
  332. // because this determine which color could be the result
  333. int skill_Chance = 0;
  334. int stat34 = 0;
  335. boolean generateSkill = false;
  336. int resultColor = 0;
  337. boolean generateGlow = false;
  338. //lifestonelevel is used for stat Id and skill level, but here the max level is 10
  339. if (lifeStoneLevel > 10)
  340. lifeStoneLevel = 10;
  341. switch (lifeStoneGrade)
  342. {
  343. case 0:
  344. skill_Chance = Config.AUGMENTATION_NG_SKILL_CHANCE;
  345. if (Rnd.get(1, 100) <= Config.AUGMENTATION_NG_GLOW_CHANCE)
  346. generateGlow = true;
  347. break;
  348. case 1:
  349. skill_Chance = Config.AUGMENTATION_MID_SKILL_CHANCE;
  350. if (Rnd.get(1, 100) <= Config.AUGMENTATION_MID_GLOW_CHANCE)
  351. generateGlow = true;
  352. break;
  353. case 2:
  354. skill_Chance = Config.AUGMENTATION_HIGH_SKILL_CHANCE;
  355. if (Rnd.get(1, 100) <= Config.AUGMENTATION_HIGH_GLOW_CHANCE)
  356. generateGlow = true;
  357. break;
  358. case 3:
  359. skill_Chance = Config.AUGMENTATION_TOP_SKILL_CHANCE;
  360. if (Rnd.get(1, 100) <= Config.AUGMENTATION_TOP_GLOW_CHANCE)
  361. generateGlow = true;
  362. }
  363. if (Rnd.get(1, 100) <= skill_Chance)
  364. generateSkill = true;
  365. else if (Rnd.get(1, 100) <= Config.AUGMENTATION_BASESTAT_CHANCE)
  366. stat34 = Rnd.get(BASESTAT_STR, BASESTAT_MEN);
  367. // Second: decide which grade the augmentation result is going to have:
  368. // 0:yellow, 1:blue, 2:purple, 3:red
  369. // The chances used here are most likely custom,
  370. // whats known is: you cant have yellow with skill(or baseStatModifier)
  371. // noGrade stone can not have glow, mid only with skill, high has a chance(custom), top allways glow
  372. if (stat34 == 0 && !generateSkill)
  373. {
  374. resultColor = Rnd.get(0, 100);
  375. if (resultColor <= (15 * lifeStoneGrade) + 40)
  376. resultColor = 1;
  377. else
  378. resultColor = 0;
  379. }
  380. else
  381. {
  382. resultColor = Rnd.get(0, 100);
  383. if (resultColor <= (10 * lifeStoneGrade) + 5 || stat34 != 0)
  384. resultColor = 3;
  385. else if (resultColor <= (10 * lifeStoneGrade) + 10)
  386. resultColor = 1;
  387. else
  388. resultColor = 2;
  389. }
  390. // Third: Calculate the subblock offset for the choosen color,
  391. // and the level of the lifeStone
  392. // from large number of retail augmentations:
  393. // no skill part
  394. // Id for stat12:
  395. // A:1-910 B:911-1820 C:1821-2730 D:2731-3640 E:3641-4550 F:4551-5460 G:5461-6370 H:6371-7280
  396. // Id for stat34(this defines the color):
  397. // I:7281-8190(yellow) K:8191-9100(blue) L:10921-11830(yellow) M:11831-12740(blue)
  398. // you can combine I-K with A-D and L-M with E-H
  399. // using C-D or G-H Id you will get a glow effect
  400. // there seems no correlation in which grade use which Id except for the glowing restriction
  401. // skill part
  402. // Id for stat12:
  403. // same for no skill part
  404. // A same as E, B same as F, C same as G, D same as H
  405. // A - no glow, no grade LS
  406. // B - weak glow, mid grade LS?
  407. // C - glow, high grade LS?
  408. // D - strong glow, top grade LS?
  409. // is neither a skill nor basestat used for stat34? then generate a normal stat
  410. int stat12 = 0;
  411. if (stat34 == 0 && !generateSkill)
  412. {
  413. int temp = Rnd.get(2, 3);
  414. int colorOffset = resultColor * (10 * STAT_SUBBLOCKSIZE) + temp * STAT_BLOCKSIZE + 1;
  415. int offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + colorOffset;
  416. stat34 = Rnd.get(offset, offset + STAT_SUBBLOCKSIZE - 1);
  417. if (generateGlow && lifeStoneGrade >= 2)
  418. offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + (temp - 2) * STAT_BLOCKSIZE + lifeStoneGrade
  419. * (10 * STAT_SUBBLOCKSIZE) + 1;
  420. else
  421. offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + (temp - 2) * STAT_BLOCKSIZE + Rnd.get(0, 1)
  422. * (10 * STAT_SUBBLOCKSIZE) + 1;
  423. stat12 = Rnd.get(offset, offset + STAT_SUBBLOCKSIZE - 1);
  424. }
  425. else
  426. {
  427. int offset;
  428. if (!generateGlow)
  429. offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + Rnd.get(0, 1) * STAT_BLOCKSIZE + 1;
  430. else
  431. offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + Rnd.get(0, 1) * STAT_BLOCKSIZE + (lifeStoneGrade + resultColor) / 2
  432. * (10 * STAT_SUBBLOCKSIZE) + 1;
  433. stat12 = Rnd.get(offset, offset + STAT_SUBBLOCKSIZE - 1);
  434. }
  435. // generate a skill if neccessary
  436. L2Skill skill = null;
  437. if (generateSkill)
  438. {
  439. augmentationSkill temp = null;
  440. switch (resultColor)
  441. {
  442. case 1: // blue skill
  443. temp = _blueSkills.get(lifeStoneLevel).get(Rnd.get(0, _blueSkills.get(lifeStoneLevel).size() - 1));
  444. skill = temp.getSkill();
  445. stat34 = temp.getAugmentationSkillId();
  446. break;
  447. case 2: // purple skill
  448. temp = _purpleSkills.get(lifeStoneLevel).get(Rnd.get(0, _purpleSkills.get(lifeStoneLevel).size() - 1));
  449. skill = temp.getSkill();
  450. stat34 = temp.getAugmentationSkillId();
  451. break;
  452. case 3: // red skill
  453. temp = _redSkills.get(lifeStoneLevel).get(Rnd.get(0, _redSkills.get(lifeStoneLevel).size() - 1));
  454. skill = temp.getSkill();
  455. stat34 = temp.getAugmentationSkillId();
  456. break;
  457. }
  458. }
  459. if (Config.DEBUG)
  460. _log.info("Augmentation success: stat12=" + stat12 + "; stat34=" + stat34 + "; resultColor=" + resultColor + "; level="
  461. + lifeStoneLevel + "; grade=" + lifeStoneGrade);
  462. return new L2Augmentation(((stat34 << 16) + stat12), skill);
  463. }
  464. public class AugStat
  465. {
  466. private Stats _stat;
  467. private float _value;
  468. public AugStat(Stats stat, float value)
  469. {
  470. _stat = stat;
  471. _value = value;
  472. }
  473. public Stats getStat()
  474. {
  475. return _stat;
  476. }
  477. public float getValue()
  478. {
  479. return _value;
  480. }
  481. }
  482. /**
  483. * Returns the stat and basestat boni for a given augmentation id
  484. * @param augmentationId
  485. * @return
  486. */
  487. public FastList<AugStat> getAugStatsById(int augmentationId)
  488. {
  489. FastList<AugStat> temp = new FastList<AugStat>();
  490. // An augmentation id contains 2 short vaues so we gotta seperate them here
  491. // both values contain a number from 1-16380, the first 14560 values are stats
  492. // the 14560 stats are devided into 4 blocks each holding 3640 values
  493. // each block contains 40 subblocks holding 91 stat values
  494. // the first 13 values are so called Solo-stats and they have the highest stat increase possible
  495. // after the 13 Solo-stats come 78 combined stats (thats every possible combination of the 13 solo stats)
  496. // the first 12 combined stats (14-26) is the stat 1 combined with stat 2-13
  497. // the next 11 combined stats then are stat 2 combined with stat 3-13 and so on...
  498. // to get the idea have a look @ optiondata_client-e.dat - thats where the data came from :)
  499. int stats[] = new int[2];
  500. stats[0] = 0x0000FFFF & augmentationId;
  501. stats[1] = (augmentationId >> 16);
  502. for (int i = 0; i < 2; i++)
  503. {
  504. // its a stat
  505. if (stats[i] >= STAT_START && stats[i] <= STAT_END)
  506. {
  507. int block = 0;
  508. while (stats[i] > STAT_BLOCKSIZE)
  509. {
  510. stats[i] -= STAT_BLOCKSIZE;
  511. block++;
  512. }
  513. int subblock = 0;
  514. while (stats[i] > STAT_SUBBLOCKSIZE)
  515. {
  516. stats[i] -= STAT_SUBBLOCKSIZE;
  517. subblock++;
  518. }
  519. if (stats[i] < 14) // solo stat
  520. {
  521. augmentationStat as = ((augmentationStat) _augmentationStats[block].get((stats[i] - 1)));
  522. temp.add(new AugStat(as.getStat(), as.getSingleStatValue(subblock)));
  523. }
  524. else
  525. // twin stat
  526. {
  527. stats[i] -= 13; // rescale to 0 (if first of first combined block)
  528. int x = 12; // next combi block has 12 stats
  529. int rescales = 0; // number of rescales done
  530. while (stats[i] > x)
  531. {
  532. stats[i] -= x;
  533. x--;
  534. rescales++;
  535. }
  536. // get first stat
  537. augmentationStat as = ((augmentationStat) _augmentationStats[block].get(rescales));
  538. if (rescales == 0)
  539. temp.add(new AugStat(as.getStat(), as.getCombinedStatValue(subblock)));
  540. else
  541. temp.add(new AugStat(as.getStat(), as.getCombinedStatValue((subblock * 2) + 1)));
  542. // get 2nd stat
  543. as = ((augmentationStat) _augmentationStats[block].get(rescales + stats[i]));
  544. if (as.getStat() == Stats.CRITICAL_DAMAGE)
  545. temp.add(new AugStat(as.getStat(), as.getCombinedStatValue(subblock)));
  546. else
  547. temp.add(new AugStat(as.getStat(), as.getCombinedStatValue(subblock * 2)));
  548. }
  549. }
  550. // its a base stat
  551. else if (stats[i] >= BASESTAT_STR && stats[i] <= BASESTAT_MEN)
  552. {
  553. switch (stats[i])
  554. {
  555. case BASESTAT_STR:
  556. temp.add(new AugStat(Stats.STAT_STR, 1.0f));
  557. break;
  558. case BASESTAT_CON:
  559. temp.add(new AugStat(Stats.STAT_CON, 1.0f));
  560. break;
  561. case BASESTAT_INT:
  562. temp.add(new AugStat(Stats.STAT_INT, 1.0f));
  563. break;
  564. case BASESTAT_MEN:
  565. temp.add(new AugStat(Stats.STAT_MEN, 1.0f));
  566. break;
  567. }
  568. }
  569. }
  570. return temp;
  571. }
  572. @SuppressWarnings("synthetic-access")
  573. private static class SingletonHolder
  574. {
  575. protected static final AugmentationData _instance = new AugmentationData();
  576. }
  577. }