Advertisement
Kaiquegabriel

spells php

Jul 25th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.10 KB | None | 0 0
  1. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  2. <?php header("Content-Type: text/html; charset=ISO-8859-1",true);
  3. if(!defined('INITIALIZED'))
  4. exit;
  5. $file = "/home/otserv/data/spells/spells.xml"; //This shows the place where PHP must read from
  6. $lastinstant = "Undead Legion"; //End of the last instand spell
  7. $lastconjur = "Thunderstorm"; //End of the last conjure spell
  8. $lastrne = "Drunkness"; //End of the last rune
  9.  
  10. $title = "Olderian Spells";
  11. ?>
  12. <html>
  13. <head>
  14. <style type="text/css">
  15. <!--
  16. .sorc {
  17. background-color: #FF9900;
  18. font-weight: bold;
  19. }
  20. .msorc {
  21. background-color: #FF3300;
  22. font-weight: bold;
  23. }
  24. .druid {
  25. background-color: #0099FF;
  26. font-weight: bold;
  27. }
  28. .edruid {
  29. background-color: #0066FF;
  30. font-weight: bold;
  31. }
  32. .pally {
  33. background-color: #666600;
  34. font-weight: bold;
  35. }
  36. .epally {
  37. background-color: #663300;
  38. font-weight: bold;
  39. }
  40. .knight {
  41. background-color: #000000;
  42. font-weight: bold;
  43. }
  44. .eknight {
  45. background-color: #ffffff;
  46. font-weight: bold;
  47. }
  48. body,td,th {
  49. font-family: Verdana, Arial, Helvetica, sans-serif;
  50. font-size: 12px;
  51. color: #FFFFFF;
  52. }
  53. .border {
  54. border: 1px solid #FFFFFF;
  55. }
  56. .all {
  57. background-color: #006600;
  58. font-weight: bold;
  59. }
  60. -->
  61. </style>
  62. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title><?php echo $title; ?>Aerasdasd</title></head>
  63. <body>
  64. <br>
  65. <h1>Spells</h1>
  66. <?php
  67. $searched = "\"";
  68. $searchname = "name\"";
  69. $searchwords = "words=\"";
  70. $searchlvl = "lvl=\"";
  71. $searchmlvl = "maglv=\"";
  72. $searchmanapercent = "manapercent=\"";
  73. $searchmana = "mana=\"";
  74. $searchvoc = "<vocation name=\"";
  75. $searchcount = "conjureCount=\"";
  76. $searchend = "</instant>";
  77.  
  78. function VoCshorter($var){
  79. if($var == "Sorcerer"){
  80. return "<span class=\"sorc\">Sorc</span>";
  81. } elseif($var == "Master Sorcerer"){
  82. return "<span class=\"msorc\">Ma. Sorc</span>";
  83. } elseif($var == "Paladin"){
  84. return "<span class=\"pally\">Pally</span>";
  85. } elseif($var == "Royal Paladin"){
  86. return "<span class=\"epally\">Ro. Pally</span>";
  87. } elseif($var == "Druid"){
  88. return "<span class=\"druid\">Druid</span>";
  89. } elseif($var == "Elder Druid"){
  90. return "<span class=\"edruid\">El. Druid</span>";
  91. } elseif($var == "Knight"){
  92. return "<span class=\"knight\">Knight</span>";
  93. } elseif($var == "Elite Knight"){
  94. return "<span class=\"eknight\">El. Knight</span>";
  95. } else {
  96. return "$var";
  97. }
  98. }
  99. $f = @fopen($file, "r");
  100.  
  101. if(!$f){
  102. print("<font color=\"red\"><b>Sorry, but we have encountered an error.<b></font><br><br>\n\n");
  103. } else {
  104. $contents = fread($f, filesize($file));
  105. $temp = explode("<instant", $contents);
  106. print("<b>Instant Spells: </b><br>");
  107. $i = 1;
  108. print("<table border=0 cellspacing=3 cellpadding=3 bgcolor=#ebd9c6 class=border>");
  109. print("<tr height=15 bgcolor='#dec0a1'><td width=160><b>Name</b></td>");
  110. print("<td width=160><b>Words</b></td>");
  111. print("<td align=center width=80><b>Level</b></td>");
  112. print("<td align=center width=80><b>Mana</b></td>");
  113. print("<td align=center width=452><b>Vocation</b></td></tr>");
  114. while($temp[$i] && $instantname[$i-1]!=$lastinstant)
  115. {
  116. $temp2 = explode($searchname, $temp[$i]);
  117. $temp3 = explode($searched, $temp2[0]);
  118. $instantname[$i] = $temp3[1];
  119. $temp2 = explode($searchwords, $temp[$i]);
  120. $temp3 = explode($searched, $temp2[1]);
  121. $instantwords[$i] = $temp3[0];
  122. $temp2 = explode($searchlvl, $temp[$i]);
  123. $temp3 = explode($searched, $temp2[1]);
  124. $instantlvl[$i] = $temp3[0];
  125. $temp2 = explode($searchmana, $temp[$i]);
  126. $temp3 = explode($searched, $temp2[1]);
  127. $instantmana[$i] = $temp3[0];
  128.  
  129. if($instantname[$i]!="Summon Creature"){
  130.  
  131. print("<tr height=20><td>$instantname[$i]</td>");
  132. print("<td>$instantwords[$i]</td>");
  133. if($instantlvl[$i] == ''){
  134. print("<td align=center>0</td>");
  135. } else {
  136. print("<td align=center>$instantlvl[$i]</td>");
  137. }
  138. if($instantmana[$i]>0){
  139. print("<td align=center>$instantmana[$i]</td>");
  140. } else {
  141. $temp2 = explode($searchmanapercent, $temp[$i]);
  142. $temp3 = explode($searched, $temp2[1]);
  143. $instantmanapercent[$i] = $temp3[0];
  144.  
  145. if($instantmanapercent[$i] > 0){
  146. print("<td align=center>$instantmanapercent[$i]%</td>");
  147. } else {
  148. print("<td align=center>No mana</td>");
  149. }
  150. }
  151. } else {
  152. print("<tr><td>$instantname[$i]</td>");
  153. print("<td>$instantwords[$i]</td>");
  154. print("<td align=center>$instantlvl[$i]</td>");
  155. print("<td align=center>Variable</td>");
  156. }
  157.  
  158. $j = 1;
  159. print("<td>");
  160. if($instantname[$i]=="House Guest List" || $instantname[$i]=="House Subowner List" || $instantname[$i]=="House Door List" || $instantname[$i]=="House Kick"){
  161. echo "<span class=\"all\">All vocations</span>";
  162. }
  163. if($instantname[$i] == $lastinstant){
  164. $temp4 = explode($searchend, $temp[$i]);
  165. $temp5 = explode("<vocation name=\"", $temp4[0]);
  166. while($temp5[$j]){
  167. $temp6 = explode($searched, $temp5[$j]);
  168. if($temp5[$j+1]){
  169. $vars = VoCshorter($temp6[0]);
  170. print("$vars, ");
  171. } else {
  172. $vars = VoCshorter($temp6[0]);
  173. print("$vars ");
  174. }
  175. $j++;
  176. }
  177.  
  178. } else {
  179. $temp3 = explode("<vocation name=\"", $temp[$i]);
  180. while($temp3[$j]){
  181. $temp4 = explode($searched, $temp3[$j]);
  182. $tempora = $temp3[1];
  183. if($temp3[$j+1]){
  184. $vars = VoCshorter($temp4[0]);
  185. print("$vars, ");
  186. } else {
  187. $vars = VoCshorter($temp4[0]);
  188. print("$vars ");
  189. }
  190. $j++;
  191. }
  192. }
  193. print("</td></tr>");
  194.  
  195. $i++;
  196.  
  197. }
  198.  
  199. print("</table>");
  200. $temp = explode("<conjure", $contents);
  201. print("<br><br><b>Conjure Spells: </b><br>");
  202. $i = 1;
  203. print("<table border=0 cellspacing=0 cellpadding=2 bgcolor=#282828 class=border>");
  204. print("<tr height=15 bgcolor='#333333'><td width=160><b>Name</b></td>");
  205. print("<td width=160><b>Words</b></td>");
  206. print("<td align=center width=80><b>MLevel</b></td>");
  207. print("<td align=center width=80><b>Mana</b></td>");
  208. print("<td align=center width=120><b>Charges</b></td>");
  209. print("<td width=328><b>Vocation</b></td></tr>");
  210.  
  211. while($temp[$i] && $runename[$i-1]!=$lastconjur){
  212. $temp2 = explode($searchname, $temp[$i]);
  213. $temp3 = explode($searched, $temp2[0]);
  214. $runename[$i] = $temp3[1];
  215. $temp2 = explode($searchwords, $temp[$i]);
  216. $temp3 = explode($searched, $temp2[1]);
  217. $runewords[$i] = $temp3[0];
  218. $temp2 = explode($searchlvl, $temp[$i]);
  219. $temp3 = explode($searched, $temp2[1]);
  220. $runelvl[$i] = $temp3[0];
  221. $temp2 = explode($searchmana, $temp[$i]);
  222. $temp3 = explode($searched, $temp2[1]);
  223. $runemana[$i] = $temp3[0];
  224. $temp2 = explode($searchcount, $temp[$i]);
  225. $temp3 = explode($searched, $temp2[1]);
  226. $runecount[$i] = $temp3[0];
  227. print("<tr height=20><td>$runename[$i]</td>");
  228. print("<td>$runewords[$i]</td>");
  229. $getname = $runename[$i];
  230.  
  231. print("<td align=center>$runelvl[$i]</td>");
  232. if($runemana[$i]>0){
  233. print("<td align=center>$runemana[$i]</td>");
  234. } else {
  235. print("<td align=center>lol no mana needed? (BUG)</td>");
  236. }
  237.  
  238. $j = 1;
  239. if($runecount[$i] > 0){
  240. print("<td align=center>$runecount[$i]</td>");
  241. } else {
  242. print("<td align=center>No charges</td>");
  243. }
  244. print("<td>");
  245. if($runename[$i] == $lastconjur){
  246. $temp4 = explode($searchend, $temp[$i]);
  247. $temp5 = explode("<vocation name=\"", $temp4[0]);
  248. $mine = "";
  249. while($temp5[$j]){
  250. $temp6 = explode($searched, $temp5[$j]);
  251. if($temp5[$j+1]){
  252. $vars = VoCshorter($temp6[0]);
  253. print("$vars, ");
  254. } else {
  255. $vars = VoCshorter($temp6[0]);
  256. print("$vars ");
  257. }
  258. $j++;
  259. }
  260.  
  261. } else {
  262. $temp3 = explode("<vocation name=\"", $temp[$i]);
  263. while($temp3[$j]){
  264. $temp4 = explode($searched, $temp3[$j]);
  265. if($temp3[$j+1]){
  266. $vars = VoCshorter($temp4[0]);
  267. print("$vars, ");
  268. } else {
  269. $vars = VoCshorter($temp4[0]);
  270. print("$vars ");
  271. }
  272. $j++;
  273. }
  274. }
  275. print("</td></tr>\n");
  276.  
  277. $i++;
  278.  
  279. }
  280.  
  281. print("</table>");
  282. $temp = explode("<rune", $contents);
  283. print("<br><br><b>Runes: </b><br>");
  284. $i = 1;
  285. print("<table border=0 cellspacing=0 cellpadding=2 bgcolor=#282828 class=border>");
  286. print("<tr height=15 bgcolor='#333333'><td width=200><b>Name</b></td>");
  287. print("<td align=left width=90><b>MLevel</b></td>");
  288. print("<td align=left width=650><b>Level</b></td>");
  289.  
  290. while($temp[$i] && $runename[$i-1]!=$lastrne){
  291. $temp2 = explode($searchname, $temp[$i]);
  292. $temp3 = explode($searched, $temp2[0]);
  293. $runename[$i] = $temp3[1];
  294. $temp2 = explode($searchlvl, $temp[$i]);
  295. $temp3 = explode($searched, $temp2[1]);
  296. $runelvl[$i] = $temp3[0];
  297. $temp2 = explode($searchmlvl, $temp[$i]);
  298. $temp3 = explode($searched, $temp2[1]);
  299. $runemlvl[$i] = $temp3[0];
  300. print("<tr height=20><td>$runename[$i]</td>");
  301. if($runemlvl[$i] == ''){
  302. print("<td align=left><span class=\"msorc\">??</span></td>");
  303. } else {
  304. print("<td align=left>$runemlvl[$i]</td>");
  305. }
  306. if($runelvl[$i] == ''){
  307. print("<td align=left><span class=\"msorc\">??</span></td>");
  308. } else {
  309. print("<td align=left>$runelvl[$i]</td>\n");
  310. }
  311. print("</tr>");
  312. $i++;
  313. }
  314. }
  315. print("</table>");
  316. ?>
  317. </body>
  318. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement