Donnabot's GOTA_Extender_Custom

GOTA_Extender_Custom to go with my fork of GOTA_Extender

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/7492/35116/Donnabot%27s%20GOTA_Extender_Custom.js

  1. doLog = function() {
  2. };
  3. log("Logging killed.", "initialize");
  4.  
  5. animatedCoins.init = function(b, a, e, g) {
  6. if (isWeb()) {
  7. var c,
  8. d,
  9. f,
  10. h,
  11. k = { images: ["/images/animations/coin_flip.png"], animations: { all: [0, 32] }, frames: { regX: 0, height: 60, count: 33, regY: 0, width: 61 } },
  12. m = {
  13. images: ["/images/animations/coin_sparkle.png"],
  14. animations: { all: { frames: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] } },
  15. frames: [
  16. [0, 0, 128, 128, 0, 0, 0], [128, 0, 128, 128, 0, 0, 0], [256, 0, 128, 128, 0, 0, 0], [384, 0, 128, 128, 0, 0, 0], [512, 0, 128, 128, 0, 0, 0], [640, 0, 128, 128, 0, 0, 0], [768, 0, 128, 128, 0, 0, 0], [896, 0, 128, 128, 0, 0, 0], [0, 128, 128, 128, 0, 0, 0],
  17. [128, 128, 128, 128, 0, 0, 0], [256, 128, 128, 128, 0, 0, 0], [384, 128, 128, 128, 0, 0, 0], [512, 128, 128, 128, 0, 0, 0], [640, 128, 128, 128, 0, 0, 0], [768, 128, 128, 128, 0, 0, 0]
  18. ]
  19. },
  20. l,
  21. n,
  22. p = false;
  23.  
  24. //EXTENDER :: Modification, seriously?
  25. // bugfix: b.offset is undefined (offset from button to silver visually)
  26. if (null === b || void 0 === b || b.length == 0) {
  27. return;
  28. } else if (null === a || void 0 === a) {
  29. return;
  30. } else {
  31. if (null === e || void 0 === e)
  32. e = [
  33. 0,
  34. 0
  35. ];
  36. if (null === g || void 0 === g) g = [0, 0];
  37. d = $("<canvas>").attr({ id: "animatedCoins", "class": "coinCanvasAnimation", width: "130", height: "120" }).prependTo($("body"));
  38. c = d[0];
  39. h = $("<canvas>").attr({ id: "animatedCoinsSparkle", "class": "coinCanvasAnimation", width: "130", height: "120" }).prependTo($("body"));
  40. f = h[0];
  41. c = new createjs.Stage(c);
  42. f = new createjs.Stage(f);
  43. null === b.offset() ? (h.remove(), d.remove(), console.warn("animatedCoins: startingElement.offset() is null. Exiting script.")) : null === a.offset() ? (h.remove(), d.remove(),
  44. console.warn("animatedCoins: endingElement.offset() is null. Exiting script.")) : (d.offset({ left: b.offset().left + e[0], top: b.offset().top + e[1] }), h.offset({ left: b.offset().left + e[0], top: b.offset().top + e[1] }), e = new createjs.SpriteSheet(k), m = new createjs.SpriteSheet(m), l = new createjs.Sprite(e), l.x = 30, l.y = 25, n = new createjs.Sprite(m), l.on("animationend", function(c, f) {
  45. c.visible = false;
  46. doLog("animation end");
  47. null === b.offset() ? (h.remove(), d.remove(), console.error("animatedCoins: startingElement.offset() is null")) :
  48. null === a.offset() ? (h.remove(), d.remove(), console.error("animatedCoins: endingElement.offset() is null")) : (h.offset({ left: a.offset().left + g[0], top: a.offset().top + g[1] }), n.visible = true, n.gotoAndPlay("all"), l.stop(), p = true);
  49. }), n.on("animationend", function(a, b) {
  50. n.visible = false;
  51. p && (n.stop(), d.fadeOut(500, function(a) { d.remove(); }), h.remove());
  52. }), l.gotoAndPlay("all"), n.gotoAndPlay("all"), f.addChild(n), c.addChild(l), createjs.Ticker.setFPS(30), createjs.Ticker.addEventListener("tick", c), createjs.Ticker.addEventListener("tick",
  53. f), $(d).animate({ left: a.offset().left + g[0], top: a.offset().top + g[1] }, 1E3));
  54. }
  55. }
  56. };
  57. log("Animated coins fixed.", "initialize");
  58.  
  59. doInstantSpeedUp = function doInstantSpeedUp(c, a, callback) {
  60. var b = buildingById(c),
  61. d = getCurrentSpeedUpType(b.producing_archetype_id, b.recipe_symbol);
  62.  
  63. // EXTENDER :: Modification
  64. if (instantSpeedCost(b.build_remaining, d) > 0) {
  65. console.log('EXTENDER :: The instant speed up costs money. Exiting...');
  66. return false;
  67. }
  68.  
  69. if (false == hasGold(instantSpeedCost(b.build_remaining, d), function() {
  70. doInstantSpeedUp(c, true, callback);
  71. }, a) && true != a) return false;
  72. playSound("coins");
  73. return speedBuild(-1, c, callback);
  74. };
  75. log("Instant speed up returns if gold is required.", "initialize");
  76.  
  77. doFinishProduction = function doFinishProduction(b, callback) {
  78. var a = buildingByItemId(b), c = itemFromId(a.producing_archetype_id);
  79. userContext.lastFinish = a.symbol;
  80. doLog("doFinishProduction: building_id=" + b + " symbol=" + a.symbol + " producing=" + c.symbol);
  81. "Upgrade" !== c.slot && (analytics.track("Production Finish", { building_symbol: a.symbol, item_symbol: c.symbol, item_category: c.slot }), analytics.wizardtrack("Production Finish", { building_symbol: a.symbol, item_symbol: c.symbol, item_category: c.slot }));
  82. var d = "finish-" + b;
  83. userLock(d) && (playSound("build"),
  84. isWeb() && $("#collect_" + a.symbol).html(""), $.ajax({
  85. url: "/play/finish_production/" + b,
  86. dataType: "JSON",
  87. success: function(a) {
  88. //console.debug("Logging server response for doFinishProduction: ", a);
  89.  
  90. doLog("doFinishProduction: succeess ");
  91. freeLock(d);
  92. var c = buildingByItemId(b, a.building);
  93. userContext.playerData.character = a.character;
  94. userContext.playerData.user.money = a.user.money;
  95. userContext.playerData.stat.onboarding = a.stat.onboarding;
  96. userContext.playerData.stat.num_items_produced = a.stat.num_items_produced;
  97. userContext.playerData.stat.produced_stone = a.stat.produced_stone;
  98. userContext.playerData.stat.building_upgrades_finished =
  99. a.stat.building_upgrades_finished;
  100. c.producing_archetype_id = null;
  101. c.modifier = null;
  102. c.recipe_symbol = null;
  103. var f = extractItemBySymbol(playerInventory, c.symbol);
  104. f.effective_upgrade_level = a.building.effective_upgrade_level;
  105. f.producing_archetype_id = null;
  106. f.modifier = null;
  107. f.recipe_symbol = null;
  108.  
  109. // EXTENDER :: Modification, execute current code ONLY if there's a produced item returned!
  110. if (a.produced_item) {
  111. if (userContext.intCurrentRecipeIndex = null,
  112. doLog("doFinishProduction: data.produced_item.id=" + a.produced_item.id + " quantity=" + a.produced_item.quantity),
  113. insertInventoryFromItem(playerInventory, a.produced_item),
  114. theNewItem = extractItemById(playerInventory, a.produced_item.id), 1 == a.is_loot) {
  115. 0 < a.enhanced_loot_roll
  116. ? dialogAlert({
  117. style: "alert",
  118. text: "The result of your production (enhanced) is: " + a.produced_full_name,
  119. items: [theNewItem],
  120. heading: "You have produced...",
  121. button1: "Okay"
  122. }) : dialogAlert({
  123. style: "alert",
  124. text: "The result of your production is: " + a.produced_full_name,
  125. items: [theNewItem],
  126. heading: "You have produced...",
  127. button1: "Okay"
  128. });
  129. } else if (0 < a.affix_chance) {
  130. var m;
  131. m = "" + ("You have a " + a.affix_chance_from_stats +
  132. "% chance to produce a superior-quality item from your talents, equipment and buildings.");
  133. a.bonus_item_name && (m += " Your " + a.bonus_item_name + " adds another +" + a.affix_chance_from_bonus + "% chance to produce a superior-quality item from your talents, equipment and buildings.");
  134. m = a.affix_roll1 <= a.affix_chance && a.affix_roll2 <= a.affix_chance ? m + "<p/>Critical Success! You obtained a superb result!" : a.affix_roll1 > a.affix_chance && a.affix_roll2 > a.affix_chance ? m + "<p/>You obtained a normal result." : m + "<p/>Success! You obtained a good result.";
  135. dialogAlert({ style: "alert", text: m, items: [theNewItem], heading: a.produced_full_name, button1: "Okay" });
  136. }
  137.  
  138. userContext.newBldgOrUpgrade = true;
  139. var q;
  140.  
  141. "Upgrade" != theNewItem.slot ?
  142. (userContext.newProducedItem = theNewItem, isWeb()
  143. && $("#collect_" + f.symbol).html(renderUpgradeCollect(f)),
  144. isWeb() && $("#build_panel_action_" + f.id).html(renderBuildPanelAction(f)),
  145. isWeb() && $("#speed_button_" + f.id).hide())
  146. : q = theNewItem.symbol;
  147.  
  148. isWeb() ? (renderBuildingInventory(userContext.playerData),
  149. renderBuildingsOnScreen(userContext.playerData))
  150. : (f = null, f = null == q
  151. ? { symbol: c.symbol, status: "idle" }
  152. : { symbol: c.symbol, status: "idle", upgrade: q },
  153. iosSignal("finish_production", "update", f),
  154. isAndroid()
  155. && mobileCooldownDataSignal([{ mode: "building", symbol: c.symbol }]),
  156. refreshActiveBuildingPanel(),
  157. $("#building_tab_prod, .buildingupgradetree").fadeTo("slow", "1"));
  158.  
  159. uiEvent("do_finish_production");
  160. uiEvent("building_panel_" + userContext.activeBuildingPanel);
  161. a.produced_item && ("stacks_of_coins" == a.produced_item.symbol ? retrievePlayerData(!0, function (a) {
  162. userContext.playerData.quests = a.quests;
  163. reRenderQuestActionItems()
  164. }) : "stacks_of_coins" == a.produced_item.symbol && (userContext.playerData.stat.ftpe_decorative_blade = 1));
  165.  
  166. "Upgrade" == theNewItem.slot && buildingUpgradePanel(c.symbol);
  167. updatePlayerInfo(userContext.playerData);
  168. updateAllStatus();
  169. } else {
  170.  
  171. // EXTENDER :: Modification ...
  172. console.debug("This building is still producing! Building: ", a.building);
  173. }
  174.  
  175. if (typeof callback == "function") {
  176. //console.debug("Calling callback... ");
  177. callback();
  178. }
  179. }
  180. }));
  181. };
  182. log("Finish production and call callback if any. Fix bug.", "initialize");
  183.  
  184. doProduction = function(c, a, b, d, g, callback) {
  185. userContext.lastFinish = null;
  186. null == b && (b = 1);
  187. doLog("doProduction: symbol=" + c + " producer=" + a + " quantity=" + b);
  188. var p = null, f = "", m = null, q = "", k = null, D = null;
  189. uiEvent("start_production");
  190. null == userContext.playerData.stat.num_shop_items_started && (userContext.playerData.stat.num_shop_items_started = 0);
  191. userContext.playerData.stat.num_shop_items_started += 1;
  192. for (var u = 0; u < userContext.recipeData.length; u++)
  193. if (console.log("DEBUG: n=" + userContext.recipeData[u].category + ", symbol: " +
  194. userContext.recipeData[u].output), g == userContext.recipeData[u].symbol || null == g && (userContext.recipeData[u].output == c || userContext.recipeData[u].output_loot == c) && userContext.recipeData[u].category == a) {
  195. p = userContext.recipeData[u];
  196. p.output == c ? (k = itemFromSymbol(c), q = k.full_name) : (p.output_loot == c && (m = c), q = p.name);
  197. D = u;
  198. components = userContext.recipeData[u].input.split(",");
  199. quantity_components = userContext.recipeData[u].input_quantity.split(",");
  200. var s = itemFromSymbol(userContext.recipeData[u].category);
  201. if (true ==
  202. userContext.recipeData[u].unlocked) {
  203. if (1 < userContext.recipeData[u].input.length)
  204. for (s = 0; s < components.length; s++) {
  205. var y = itemFromSymbol(components[s]), w = false;
  206. 0 == s && true == userContext.recipeData[u].evolution && (w = true);
  207. w = sumInventoryQuantity(y.symbol, w);
  208. if (parseInt(quantity_components[s]) * b > w) {
  209. "" == f && (f = "You need more of the following:<p/>");
  210. f += "<div>";
  211. if (4 <= userContext.playerData.character.level)
  212. switch (components[s]) {
  213. case "stone":
  214. case "iron":
  215. case "fur":
  216. case "ore":
  217. case "horse":
  218. case "riverways_fish_consumable":
  219. case "smallfolk":
  220. case "wood":
  221. case "cloth":
  222. case "grains":
  223. w =
  224. parseInt(quantity_components[s]) * b - w;
  225. if (cost_item = itemFromSymbol("pennyroyal")) var z = cost_item.price_perk_points * w;
  226. f += '<div id="basic_resource_' + components[s] + '">';
  227. f += itemMiniView(y, { extra_styles: "left:-70px", quantity_override: w });
  228. f += '<span style="position: relative; left: 250px; top: -88px" class="btnwrap btnmed btnprice" onclick="getBasicResource(\'' + components[s] + "'," + w + ',true);"><span class="btnedge"><a class="btngold">Get Now</a><em>for</em><strong>' + z + "</strong></span></span>";
  229. f += "</div>";
  230. break;
  231. default:
  232. f += itemMiniView(y);
  233. }
  234. f += "</div>";
  235. f += "<p>" + y.howto + "</p>";
  236. }
  237. }
  238. } else f = "You need <em>" + s.full_name + "</em> to produce that.";
  239. break;
  240. }
  241. if ("" != f) doAlert("Requirements: " + q, f), analytics.track("Production Blocked-Resources", { item_symbol: c }), analytics.wizardtrack("Production Blocked-Resources", { item_symbol: c });
  242. else if (p && hasMoney(p.craft_cost * b, function() { doProduction(c, a, b, d, g); })) {
  243. f = JSON.parse(JSON.stringify(userContext.playerData.inventory));
  244. u = [];
  245. p.output == c ? (k = itemFromSymbol(c), q = k.full_name) : (p.output_loot ==
  246. c && (m = c), q = p.name);
  247. components = p.input.split(",");
  248. quantity_components = p.input_quantity.split(",");
  249. s = itemFromSymbol(p.category);
  250. if (true == p.unlocked && (userContext.intCurrentRecipeIndex = D, 1 < p.input.length)) for (s = 0; s < components.length; s++) y = itemFromSymbol(components[s]), w = false, 0 == s && true == p.evolution && (w = true), depleteItems(y.symbol, parseInt(quantity_components[s]) * b, null, u, w);
  251. q = "";
  252. D = null;
  253. for (s = 0; s < u.length; s++)
  254. if (y = itemFromSymbol(u[s].symbol), u[s].full_name != y.full_name)
  255. D = JSON.parse(JSON.stringify(u[s])),
  256. q += "[" + u[s].full_name + "]";
  257. else if (itemHasSeals(u[s]) && (!u[s].preserve_attributes || false == u[s].preserve_attributes)) D = JSON.parse(JSON.stringify(u[s])), y = generateSealNameList(u[s]), q += "[" + u[s].full_name + " : " + y + "]";
  258.  
  259. // EXTENDER :: Modification
  260. if (true != d && null != D && !production.superiorMaterials) {
  261. return playerInventory = JSON.parse(JSON.stringify(f)), userContext.playerData.inventory = playerInventory, dialogAlert({
  262. style: "confirm",
  263. margin_top: 100,
  264. items: [D],
  265. button2: "Not Now",
  266. button2_action: function() { closeAlert(); },
  267. button1: "Confirm",
  268. button1_action: function() {
  269. closeAlert();
  270. return doProduction(c, a, b, true, g);
  271. },
  272. heading: "Confirm Superior Materials",
  273. text: "Producing this item now will consume superior versions of your materials: " + q + "<p/>Are you sure you want to contribute superior versions of materials to produce this item?"
  274. }), false;
  275. }
  276.  
  277. var I = buildingBySymbol(userContext.activeBuildingPanel);
  278. I.build_remaining = p.craft_duration * b;
  279. I.original_build_seconds = p.craft_duration * b;
  280. I.build_progress = 0;
  281. "" != p.output && (I.producing_archetype_id = itemFromSymbol(p.output).id);
  282. I.recipe_symbol = p.symbol;
  283. I.action_sub_id = b;
  284. f = renderBuildingConstruction(I);
  285. isWeb() && $("#bc_" + I.id).html(f);
  286. displayBuildingCooldown(I);
  287. "Upgrade" == itemFromId(I.producing_archetype_id).slot ? buildingUpgradePanel(userContext.activeBuildingPanel, true, false) : (buildingUpgradePanel(userContext.activeBuildingPanel, true, false, true), buildingTabProd(), isWeb() && $("#collect_" + I.symbol).html(renderUpgradeCollect(I)));
  288. p = "/play/set_production";
  289. p = (m ? p + ("?loot_symbol=" + m + "&producer_symbol=" + a) : k ? p + ("/" + c + "?producer_symbol=" + a) : p + ("?producer_symbol=" + a)) + ("&quantity=" + b);
  290. g && (p += "&recipe_symbol=" + g);
  291. //console.debug("Tampering with the url: ", p);
  292.  
  293. $.ajax({
  294. url: p,
  295. dataType: "JSON",
  296. success: function(a) {
  297. // EXTENDER :: Modification
  298. if (!a.num_shop_items_started && a.status) {
  299. //console.debug("Server responded with: ", a);
  300. return;
  301. }
  302.  
  303. userContext.prodProgressShow = null;
  304. userContext.playerData.stat.num_shop_items_started = a.num_shop_items_started;
  305. updateAllStatus();
  306. uiEvent("do_production");
  307. isWeb() || iosSignal("building", "cooldown", mobileCooldownData({ mode: "building", symbol: I.symbol, flag: "production_started" }));
  308.  
  309. // EXTENDER :: Modification
  310. if (typeof callback == "function") {
  311. callback();
  312. }
  313. }
  314. });
  315. }
  316. };
  317. log("Do production and call callback if any. Inject superior materials condition.", "initialize");
  318.  
  319. buildTimerUpdate = function(c, a, b) {
  320.  
  321. $("#timer-" + c).html(renderBuildTime(a));
  322. $("#timer-panel-" + c).html(renderBuildTime(a));
  323.  
  324. percent = 100 - 100 * (a / b);
  325. $("#progress-" + c).html('<span style="width:' + percent + '%;"></span>');
  326.  
  327. var d = buildingById(c);
  328. d.build_remaining = a;
  329. markup = renderBuildPanelAction(d);
  330.  
  331. //console.debug("Debugging building: " + d.symbol + ", " +
  332. //"build time remaining: " + a + " ms, " +
  333. //"original build seconds: " + b + " ms");
  334.  
  335. $("#speed_button_" + c).show();
  336. $("#build_panel_action_" + c).html(markup);
  337. $("#production_timer_" + c).html(renderBuildTime(d.build_remaining, true));
  338. $("#production_timer_upper_" +
  339. c).html(renderBuildTime(d.build_remaining));
  340. $("#production_progress_" + c).css({ width: percent + "%" });
  341. $("#duration_long_" + c).html(durationLong(buildTimerDescription(d), a, b));
  342. a--;
  343. userContext.doBuildId == c && (300 >= a ?
  344. ($("#speed_up_skip_block").hide(),
  345. $("#speed_up_skip_use").show()) :
  346. ($("#speed_up_skip_use").hide(),
  347. $("#speed_up_skip_block").show()),
  348. $(".speed_building_" + c).html() != renderSpeedUpButton(c) && $(".speed_building_" + c).html(renderSpeedUpButton(c)));
  349.  
  350. d.cooldown = a;
  351. d.original_cooldown_seconds = b;
  352. displayBuildingCooldown(d);
  353. 0 < a || (closeSpeedUp(), finalizeBuildingConstruction(d), clearBuildingTimer(d.symbol));
  354.  
  355. // EXTENDER :: Modification REVISE
  356. if (a == 300 - 10) {
  357. doInstantSpeedUp(c, false, function() {
  358. setTimeout(function() {
  359. doFinishProduction(d.item_id, function(){
  360. setTimeout(function() {
  361. production.attempt(d.symbol);
  362. }, production.queueDelay);
  363. });
  364. }, (production.queueDelay));
  365. });
  366. } else if (a < 300 - 30) {
  367. clearTimeout(userContext.buildingTimer[d.symbol]);
  368. doInstantSpeedUp(c, false, function() {
  369. doFinishProduction(d.item_id, function(){
  370. setTimeout(function() {
  371. production.attempt(d.symbol);
  372. }, production.queueDelay);
  373. });
  374. });
  375. }
  376. };
  377. log("Build custom timer update. Speed up and finish automatically, grab production item if any and execute.", "initialize");
  378.  
  379. doCollect = function(c) {
  380. lock_name = "collect-" + c;
  381. if (userLock(lock_name)) {
  382. var a = buildingByItemId(c);
  383. 0 < predictCollect(a) && (playSound("coins"), isWeb() && animatedCoins.init($("#collectbtn"), $("#silver"), [-10, -40], [-72, -44]));
  384. uiEvent("collect_" + buildingSymbolFromItemId(c), userContext.PlayerData);
  385. the_url = "/play/collect_building/" + c + "?client_seqnum=" + userContext.player_data_seqnum;
  386.  
  387. isWeb() || showSpinner();
  388. $.ajax({
  389. url: the_url,
  390. dataType: "JSON",
  391. success: function(b) {
  392. freeLock(lock_name);
  393. doLog("doCollect: building_id=" +
  394. c + " data.money=" + b.money);
  395. updateSilver(b.money);
  396. updateBaseTime(b.base_time);
  397. a.last_collected_at = b.last_collected_at;
  398. userContext.playerData.stat.buildings_collected = b.buildings_collected;
  399. userContext.playerData.stat.onboarding = b.onboarding;
  400. isWeb() || (iosSignal("building_collected"), hideSpinner());
  401. isWeb() && $("#collect_" + a.symbol).html(renderUpgradeCollect(a));
  402. buildingUpgradePanel(a.symbol);
  403. b = renderBuildingOwned(a);
  404. isWeb() && $("#bc_" + a.id).html(b);
  405. updateAllStatus();
  406. questListings();
  407.  
  408. // EXTENDER :: Modification
  409. closeModalLarge('modal_dialogs_top');
  410. }
  411. });
  412. }
  413. };
  414. log("Close dialog when silver is collected.", "initialize");
  415.  
  416. claimDaily = function() {
  417. showSpinner();
  418. $.ajax({
  419. url: "/play/advice_claim_daily",
  420. dataType: "JSON",
  421. success: function(c) {
  422. //console.debug("Logging response from the server: ", c);
  423. hideSpinner();
  424.  
  425. // EXTENDER :: Modification
  426. // bugfix: undefined silver and gold
  427. if (c.status && c.status == "OK") {
  428. return;
  429. }
  430.  
  431. $("#claimed_holder").html("<h5>Claimed</h5>");
  432. updateSilver(c.total_silver);
  433. updateGold(c.total_gold);
  434. $(".claimrewardchest").hide();
  435. $("#daily_reward_statview").html(itemStatViewFromSymbol(c.item, { produce: "Continue", produce_callback: "welcomeClaimed" }));
  436. $("#dailynewsbtn").removeClass("btnglow");
  437.  
  438. var a = buildingBySymbol("keep");
  439. userContext.playerData.stat.daily_streak_claimed = userContext.playerData.stat.daily_streak;
  440. a && $("#bc_" + a.id).html(renderBuildingOwned(a));
  441. isWeb() || iosSignal("daily_reward_claimed", null, c.item);
  442.  
  443. // EXTENDER :: Modification
  444. $(".welcomemodal").hide();
  445. log("Daily reward claimed: " + c.item + ", gold: " + c.gold + ", silver: " + c.silver, "CLAIM_DAILY", true);
  446. }
  447. });
  448.  
  449. return false;
  450. };
  451. log("Claim daily updates money only if claimed. Close when ready.", "initialize");
  452.  
  453. finishAll = function() {
  454. log("Checking buildings...");
  455.  
  456. var btn = $("#extender_finishBtn a");
  457. if (btn && btn.length > 0) btn.text("Finishing...");
  458.  
  459. for (var i = 0; i < userContext.buildingsData.length; i++) {
  460. var b = userContext.buildingsData[i];
  461. if(b.symbol === "keep"){
  462. continue;
  463. }
  464.  
  465. if (buildingFinished(b)) {
  466. log("Attempt to finish production on " + b.symbol);
  467. doFinishProduction(b.item_id, finishAll);
  468. return;
  469. }
  470. }
  471.  
  472. if (btn && btn.length > 0) btn.text("Finished");
  473. log("All buildings are now finished.");
  474. inform('Done');
  475. };
  476. log("Finish all buildings whole different way, make use of doFinish callback.", "initialize");
  477.  
  478. applySelectedUpgrade = function(c, a, callback) {
  479. lock_name = "upgrade-" + c.id;
  480. userContext.lastFinish = null;
  481.  
  482. var b;
  483.  
  484. if (0 < c.gold && null == a)
  485. doGoldUnlock(c.id, function() {
  486. applySelectedUpgrade(c, true, callback);
  487. });
  488. else if (hasMoney(c.silver, function() {
  489. applySelectedUpgrade(c, a, c.silver);
  490. }) && userLock(lock_name)) {
  491. var d = buildingUpgradeResourceCheck(c.building_id, c.id);
  492. if (isWeb()) {
  493. if (null != d.markup && "" != d.markup) {
  494. doAlert("Resources Required", "You need additional resources to construct that upgrade:<p/>" + d.markup);
  495. return false;
  496. }
  497. } else if (null !=
  498. d.strMissingComponentText) {
  499. if (isAndroid()) {
  500. iosSignal("building", "upgrade_fail", d);
  501. return false;
  502. }
  503. return d;
  504. }
  505. b = d.item;
  506. playSound("build");
  507. var g = buildingById(c.building_id);
  508. itemFromSymbol(g.symbol);
  509. d = extractItemBySymbol(userContext.playerData.inventory, g.symbol).upgrade_level - 1;
  510. 0 > d && (d = 0);
  511. userContext.buildIndex++;
  512. g.build_progress = 0;
  513. g.producing_archetype_id = b.id;
  514. $.ajax({
  515. url: "/play/apply_upgrade/" + c.id,
  516. dataType: "JSON",
  517. success: function(result) {
  518. freeLock(lock_name);
  519. if (result.resource_list)
  520. for (var i = 0; i < result.resource_list.length; i++) {
  521. var m =
  522. extractItemBySymbol(playerInventory, result.resource_list[i]);
  523. m && (m.quantity -= parseInt(result.resource_quantities[i]));
  524. }
  525. updateSilver(result.money);
  526. updateBaseTime(result.base_time);
  527. userContext.playerData.stat.onboarding = result.onboarding;
  528. userContext.playerData.stat.building_upgrades_added = result.building_upgrades_added;
  529. g.build_remaining = result.build_remaining;
  530. g.original_build_seconds = result.original_build_seconds;
  531. displayBuildingCooldown(g);
  532. isWeb() && buildingUpgradePanel(g.symbol);
  533. result = renderBuildingConstruction(g);
  534. $("#bc_" + g.id).html(result);
  535. uiEvent("add_" +
  536. userContext.activeBuildingPanel, userContext.PlayerData);
  537. selectedUpgrade = extractItemBySymbol(playerInventory, b.symbol);
  538. q_upgrade = 1;
  539. selectedUpgrade && (q_upgrade = selectedUpgrade.quantity + 1);
  540. $("#addbtn_container").html(addButtonUpgrade(b, false, q_upgrade));
  541. isWeb() ? selectUpgrade(userContext.activeUpgrade) : iosSignal("building", "cooldown", mobileCooldownData({ mode: "building", symbol: g.symbol, flag: "production_started" }));
  542. questListings();
  543. analytics.track("Building Apply-Upgrade", {
  544. building: userContext.activeBuildingPanel,
  545. upgrade: itemData[itemById[c.id]].symbol,
  546. cost: itemData[itemById[c.id]].cost
  547. });
  548. analytics.wizardtrack("Building Apply-Upgrade", { building: userContext.activeBuildingPanel, upgrade: itemData[itemById[c.id]].symbol, cost: itemData[itemById[c.id]].cost }); // EXTENDER :: Modification
  549.  
  550. // EXTENDER :: Modification
  551. if (typeof callback == "function") {
  552. callback();
  553. }
  554. }
  555. });
  556. }
  557.  
  558. return false;
  559. };
  560. log("Do upgrade and call callback function.", "initialize");
  561.  
  562. speedBuild = function speedBuild(c, a, callback) {
  563. $("#modal_dialogs_top2").hide();
  564. doLog("speedBuild: speed_item=" + c + " item_id=" + a);
  565. $.ajax({
  566. url: "/play/build_now/" + a + "?complete=" + c,
  567. dataType: "JSON",
  568. success: function(b) {
  569. //console.debug("Logging server response for speedBuild: ", b);
  570.  
  571. userContext.playerData.user.money = b.user.money;
  572. userContext.playerData.stat.onboarding = b.stat.onboarding;
  573. userContext.playerData.chapter = b.chapter;
  574. var d = buildingById(a, b.building);
  575. doLog("speedBuild: speed_item:");
  576. doLog(b.speed_item);
  577. b.speed_item && insertInventoryFromItem(userContext.playerData.inventory,
  578. b.speed_item);
  579. insertInventoryFromItem(userContext.playerData.inventory, b.produced_item);
  580. logLastItem("speedBuild:A");
  581. userContext.buildingsData && (userContext.playerData.buildings = userContext.buildingsData);
  582. playerInventory && (userContext.playerData.inventory = playerInventory);
  583. userContext.chapterData = b.chapter;
  584. d && (analytics.track("SpeedUp-Building", { building: d.symbol, speed_item: c }), analytics.wizardtrack("SpeedUp-Building", { building: d.symbol, speed_item: c }));
  585. userContext.buildIndex++;
  586. logLastItem("speedBuild:B");
  587. finalizeBuildingConstruction(d);
  588. isItemBuildingUpgrade(d) || null == d.producing_archetype_id && null == d.recipe_symbol ? (renderBuildingInventory(userContext.playerData, buildingUpgradePanel, userContext.activeBuildingPanel, true), isWeb() || iosSignal("building", "cooldown", mobileCooldownData({ mode: "building", symbol: d.symbol, flag: "speed_up" }))) : (userContext.craftingItemFinished = true, renderBuildingInventory(userContext.playerData, buildingUpgradePanelProd, userContext.activeBuildingPanel, true), $("#collect_" + d.symbol).html(renderUpgradeCollect(d)),
  589. $("#build_panel_action_" + d.id).html(renderBuildPanelAction(d)), $("#speed_button_" + d.id).hide());
  590. renderBuildingsOnScreen(userContext.playerData);
  591. d && uiEvent("building_panel_" + d.symbol);
  592.  
  593. // EXTENDER :: Modification
  594. if (typeof (callback) == "function") {
  595. callback();
  596. }
  597. }
  598. });
  599. };
  600. log("Speed build is what actually calls the callback (not doInstantSpeedUp).", "initialize");
  601.  
  602. doTrain = function doTrain(a, b, c) {
  603. if(userContext.setSwornSword.upgrade_points > 0){
  604. $.ajaxQueue({
  605. url: "/play/train/" + b + "?attribute=" + a + "&client_seqnum=" + userContext.player_data_seqnum,
  606. dataType: "JSON",
  607. success: function(d) {
  608. log("TRAINED " + c +".","TRAINING");
  609. }
  610. });
  611. }else{
  612. log("no points on " + c + ".","TRAINING");
  613. }
  614. };
  615.  
  616. doAdventure = function doAdventure(c, a, b, callback) {
  617. //console.debug("First passed parameter: ", c);
  618. // EXTENDER : Modfification
  619. if (userContext.setSwornSword && userContext.setSwornSword.damage && userContext.setSwornSword.damage == 4) {
  620. warn("Sworn sword has 4 wounds. Adventure will not continue.");
  621. return;
  622. }
  623.  
  624. //console.debug("Logging parameters of doAdventure: ", c, a, b);
  625.  
  626. if (void 0 != userContext.setSwornSword && void 0 != userContext.setSwornSword.batch_type && 0 != userContext.setSwornSword.batch_type)
  627. return 1 == userContext.setSwornSword.batch_type && (!1 == b && prepareAdvPartyTimeout(), $.ajax({
  628. url: "/play/batch_set_sworn_sword_target?batch_type=1&ss_id=" + userContext.setSwornSword.id + "&batch_action=" + a + "&target_symbol=" + c,
  629. dataType: "JSON",
  630. success: function(a) {
  631. questClose();
  632. showAdvPartyResponse(a);
  633. uiEvent("ss_adventure_party");
  634. return !0;
  635. },
  636. error: function(b) {
  637. 400 ==
  638. b.status ? advPartyFail() : 409 == b.status ? setTimeout(function() { doAdventure(c, a, !0); }, 5E3) : spinTimeout();
  639. }
  640. })), !1;
  641. $.ajaxQueue({
  642. url: "/play/adventure/" + userContext.setSwornSword.id + "?action_name=" + a + "&symbol=" + c,
  643. dataType: "JSON",
  644. success: function(b) {
  645. //analytics.track("Adventure Start", { adventure_region: b.location, adventure_action: a, adventure_swornsword_id: userContext.setSwornSword.id, adventure_swornsword_level: userContext.setSwornSword.ugprade_level });
  646. //analytics.wizardtrack("Adventure Start", {
  647. // adventure_region: b.location,
  648. // adventure_action: a,
  649. // adventure_swornsword_id: userContext.setSwornSword.id,
  650. // adventure_swornsword_level: userContext.setSwornSword.ugprade_level
  651. //});
  652.  
  653. if (b.symbol) {
  654. adventureProgress(userContext.setSwornSword.id, b);
  655. uiEvent("do_adventure");
  656. "1" == userContext.playerData.stat.onboarding_ftue && uiTelemetry("ss_adventure");
  657. }
  658.  
  659. // EXTENDER :: Modification
  660. if(b.reward_item != void 0 && b.duration_remaining === 0){
  661. var msg = b.attacker.full_name + " finished " + b.ability + "ing in " + b.location + ", " +
  662. "quest: " + b.title + " with " + b.attacker_result + "(" + b.attacker_result_word + ").";
  663. log(msg, "ADVENTURE", true);
  664.  
  665. msg = "Rewards: " + b.reward_item + ", prestige: " + (b.prestige_awarded ? b.prestige_awarded : 0) + ", " +
  666. "silver: " + b.reward_silver + ", experience: " + b.reward_upgrade_points;
  667. log(msg, "ADVENTURE", true);
  668. }
  669.  
  670. if (typeof callback == "function") {
  671. userContext.setSwornSword.not_on_adventure = !b.symbol;
  672.  
  673. callback(!b.symbol);
  674. }
  675. }
  676. });
  677. };
  678. log("Don't do adventure if sworn sword is about to die. Call callback when ready (bruting).", "initialize");
  679.  
  680. playSound = function playSound(a, d) {
  681. if (!1 != doSound())
  682. if ($.browser.msie || doLog("playSound [1]: " + a), !1 == soundEnabled) $.browser.msie || doLog("playSound [1]: sound disabled");
  683. else {
  684. void 0 == d && (d = 0);
  685. musicMuted = userContext.mute_music;
  686. soundMuted = userContext.mute_sound;
  687. try {
  688. if (-1 != a.indexOf("voice-") && ($.browser.msie || doLog("play voiceover"), soundMapChannel[a] = "voice"), theUrl = soundMap[a], void 0 == soundMapChannel[a] && (soundMapChannel[a] = "channel1"), isWeb()) {
  689. if ($.browser.msie || doLog("playSound[2]: " +
  690. a + " soundReady=" + soundReady), !0 == soundReady) {
  691. $.browser.msie || doLog("soundReady: " + soundMapChannel[a]);
  692. play_it = !0;
  693. if ("music" == soundMapChannel[a]) {
  694. if (0 == musicVolume || !0 == musicMuted) play_it = !1;
  695. vol = musicVolume;
  696. $.browser.msie || doLog("MUSIC vol=" + vol);
  697. } else {
  698. if (0 == soundVolume || !0 == soundMuted) play_it = !1;
  699. vol = soundVolume;
  700. $.browser.msie || doLog("SOUND vol=" + vol);
  701. }
  702. if ("channel1" == soundMapChannel[a] || "channel2" == soundMapChannel[a] || "channel3" == soundMapChannel[a] || "channel4" == soundMapChannel[a] ||
  703. "channel5" == soundMapChannel[a] || "music" == soundMapChannel[a] || "voice" == soundMapChannel[a] || "voice2" == soundMapChannel[a])
  704. if (!0 == soundChannel[soundMapChannel[a]]) $.browser.msie || doLog("Sound channel busy: " + soundMapChannel[a] + " playing=" + soundActive[a]), "music" == soundMapChannel[a] && currentMusic != a && (doLog("switch to new music"), soundCrossFade("music", vol, function() { playSound(a, d); }));
  705. else if (sound_url = assetUrl() + theUrl, $.browser.msie || doLog("SOUND: play_it=" + play_it), !0 != play_it)
  706. $.browser.msie ||
  707. doLog("SOUND: returning");
  708. else {
  709. "music" == soundMapChannel[a] && (doLog("currentMusic = " + currentMusic), currentMusic = a);
  710. $.browser.msie || doLog("SOUND: createSound");
  711. soundObject = soundManager.createSound({
  712. id: soundMapChannel[a],
  713. url: theUrl,
  714. volume: vol,
  715. onfinish: function() {
  716. $.browser.msie || doLog("soundObject.onfinish: id=" + a + " soundMapChannel=" + soundMapChannel[a]);
  717. soundChannel[soundMapChannel[a]] = !1;
  718. soundManager.destroySound(soundMapChannel[a]);
  719. "music" == soundMapChannel[a] && (0 < musicVolume && !0 !=
  720. userContext.mute_music) && playSound(a);
  721. }
  722. });
  723. if (null == soundObject || void 0 == soundObject) $.browser.msie || doLog("soundObject: invalid");
  724. !0 == play_it && (soundChannel[soundMapChannel[a]] = !0, soundActive[soundMapChannel[a]] = sound_url, soundManager.getSoundById(soundMapChannel[a]).setVolume(vol), 0 < d ? setTimeout(soundObject.play, d) : ($.browser.msie || doLog("soundObject.play: [" + soundMapChannel[a] + "] " + soundActive[soundMapChannel[a]]), soundObject.play()));
  725. }
  726. else
  727. 0 < vol && ($.browser.msie || doLog("playing [3]: [" +
  728. soundMapChannel[a] + "] vol=" + vol), soundManager.getSoundById(soundMapChannel[a]).setVolume(vol), soundManager.getSoundById(soundMapChannel[a]).volume = vol, soundManager.play(a));
  729. }
  730. } else iosSignal("playsound", soundMapChannel[a] + ":" + soundMap[a].substring(soundMap[a].lastIndexOf("/") + 1) + ":" + d);
  731. } catch (e) {
  732. $.browser.msie || doLog("playSound exception: " + e);
  733. }
  734. }
  735. };
  736. log("Cleared playSound from console logging.", "initialize");
  737.  
  738. submitWorldEventAction = function submitWorldEventAction(c, a, b) {
  739. console.debug("Logging parameters, " +
  740. "sworn sword id: " + c + ", order: " + a + ", weakness attack? " + b);
  741.  
  742. showSpinner();
  743. data = { sworn_sword_id: c, order: a };
  744. !0 == b && (data.weakness_attack = b);
  745. $.ajax({
  746. url: "/play/world_event_attack",
  747. data: data,
  748. complete: function() {
  749. hideSpinner();
  750. },
  751. success: function(a) {
  752.  
  753. hideSpinner();
  754. a.error && doAlert("Error Sending Swornsword", formatWorldEventError(a.error, a.error_code));
  755. a.swornsword && (insertInventoryFromItem(userContext.playerData.inventory, a.swornsword), doItemCooldown(a.swornsword));
  756.  
  757. // EXTENDER :: Modification
  758. // full loop implemented
  759. worldEvent.afterSubmit(a, c);
  760.  
  761. a.challenge && updateWorldEventChallenge(a.challenge);
  762. !0 == a.show_outmaneuver_alert &&
  763. dialogAlert({ style: "alert", text: "The order you just sent is guaranteed to critically hit and will have a bonus chance to find a weakness.", heading: "", button1: "Okay" });
  764. }
  765. });
  766. };
  767. log("Analyzing world event action.", "initialize");
  768.  
  769. getWorldEventAttackResults = function getWorldEventAttackResults(c, a) {
  770. console.debug("Logging parameters, " +
  771. "sworn sword id: " + c + ", refresh? " + a);
  772.  
  773. showSpinner();
  774. $.ajax({
  775. url: "/play/world_event_attack_results",
  776. data: { sworn_sword_id: c },
  777. complete: function() {
  778. hideSpinner();
  779. },
  780. success: function(b) {
  781. hideSpinner();
  782.  
  783. // EXTENDER :: Modification
  784. // full loop implemented
  785. worldEvent.afterGet(b, c);
  786.  
  787. b.error
  788. ? doAlert("Error Getting Results", formatWorldEventError(b.error, b.error_code))
  789. : (b.swornsword && (insertInventoryFromItem(userContext.playerData.inventory, b.swornsword), doItemCooldown(b.swornsword)),
  790. b.character && (userContext.playerData.stat.level_progress = b.xp_after, userContext.playerData.character = b.character,
  791. infoBar(userContext.playerData, userContext.playerData.inventory)), isWeb() ? (b = _.template('<div class="modalbg"></div><div class="contentframe1" style="top:44px; z-index:22;"><div class="contentframe2"><div class="contentframe3"><div class="contentframe4"><span class="corner tl"></span><span class="corner tr"></span><a class="closebtn" onclick="closeWorldEventAttackResults();">close</a> <h2 class="alertheader"><%= translateString(\'we_order_completed\') %></h2> <div class="alertcontents"> <div class="alertbox"> <div class="alertboxinner"> <div class="weinforow"> <%= itemMiniView(data.swornsword) %> <% if(data.wounds > 0) { %> <div class="orderwound">Wounded</div> <% } %> <div class="bossopttop"> <div class="bossoptbtn"> <span class="btnwrap btnlg"><span class="btnedge"><a class="btnbrown"> \x3c!-- Selected button is brown --\x3e <span><img src="<%= assetUrl() %>/images/content/talent/<%=data.action%>.png" /></span> <strong><%= translateString(data.action) %></strong> <em><%= data.label %></em> </a></span></span> <div class="challengebar"> <div class="challengeicon"></div> <div class="challenge-outer challengelose"> <div style="width:<%= data.cr %>%;" class="challenge-yours"></div> <div style="width:<%=100 - data.cr%>%;" class="challenge-target"></div> </div> </div> </div> </div> </div> <% if(data.outcome > 0) { %> <h3 class="challengerewardhead-success">Success!</h3> <% } else { %> <h3 class="challengerewardhead-lose">Failure!</h3> <% } %> <div class="weinforow orderresult"> <p><%= data.damage %> Damage Dealt</p> <% if(data.xp_after > data.xp_before) { %> <%= xpReward(data.xp_before, data.xp_after) %> <% } %> <div class="weinforow"> <div class="weinfo"><%= data.text %></div> </div> </div> </div> </div> </div> <div class="alertbtm"> <% if(data.can_repeat) { %> <span class="btnwrap btnlg" onclick="submitWorldEventAction(<%=data.swornsword.id%>,\'<%=data.action%>\');closeWorldEventAttackResults();"><span class="btnedge"><a class="btngold">Repeat</a></span></span> <% } %> <span class="btnwrap btnlg" onclick="closeWorldEventAttackResults();"><span class="btnedge"><a class="btngold">Close</a></span></span> </div></div></div></div></div>',
  792. { data: b }), $(".weordercomplete").html(b).show()) : iosSignal("we", "viewSSResult", b), a && refreshWorldEventChallenge());
  793. }
  794. });
  795. };
  796. log("Logging information from world event action.", "initialize");
  797.  
  798. charCharacterTab = function charCharacterTab() {
  799. $(".lineage").hide();
  800. playerData = userContext.focusData;
  801. //console.debug("Logging player data: ", playerData);
  802. markup = "";
  803. markup += '\t\t\t\t<div class="stoneridge" id="charactertop">';
  804. markup += '\t\t\t\t\t<div class="left35">';
  805. markup += '\t\t\t\t\t\t<div class="charframe">';
  806. markup += '\t\t\t\t\t\t\t<div class="portraitimage"><img src="' + playerData.portrait_pic + '" /></div>';
  807. markup += '\t\t\t\t\t\t\t<div id="character_sheet_portrait" class="charframe-lg"></div>';
  808.  
  809. // EXTENDER :: Modification
  810. markup += formatStats(playerData.got_battle, playerData.got_trade, playerData.got_intrigue, playerData.level);
  811.  
  812. 0 < playerData.id && playerData.id == userContext.playerData.character.id && (markup +=
  813. '\t\t\t\t\t\t\t<a class="lineagebtn" onclick="lineageIncarnationsPage();"></a>');
  814. markup += "\t\t\t\t\t\t</div>";
  815. markup += '\t\t\t\t\t\t<div class="charnameoverlay">';
  816. if (userContext.focusData.user_id == userContext.playerData.character.user_id) {
  817. var c = playerData.title + " ";
  818. if ("male" == userContext.playerData.strings.gender) {
  819. if (1 < userContext.playerData.strings.eligible_titles_male.length) {
  820. c = "";
  821. markup += '\t\t\t\t\t\t\t<div class="selectwrap">';
  822. markup += "\t\t\t\t\t\t\t\t<select id=\"selecttitle\" onchange=\"$('#portrait_name > em').html($('#selecttitle').val());return setTitle('selecttitle',characterModal);\">";
  823. for (var a = 0; a < userContext.playerData.strings.eligible_titles_male.length; a++) selected = "", playerData.title == userContext.playerData.strings.eligible_titles_male[a].title && (selected = "selected"), markup += "<option " + selected + ">" + userContext.playerData.strings.eligible_titles_male[a].title + "</option>";
  824. markup += "\t\t\t\t\t\t\t\t</select>";
  825. markup += "\t\t\t\t\t\t\t</div>";
  826. }
  827. } else if ("female" == userContext.playerData.strings.gender && 1 < userContext.playerData.strings.eligible_titles_female.length) {
  828. markup += '\t\t\t\t\t\t\t<div class="selectwrap">';
  829. markup += "\t\t\t\t\t\t\t\t<select id=\"selecttitle\" onchange=\"$('#portrait_name > em').html($('#selecttitle').val());return setTitle('selecttitle',characterModal);\">";
  830. c = "";
  831. for (a = 0; a < userContext.playerData.strings.eligible_titles_female.length; a++) selected = "", playerData.title == userContext.playerData.strings.eligible_titles_female[a].title && (selected = "selected"), markup += "<option " + selected + ">" + userContext.playerData.strings.eligible_titles_female[a].title + "</option>";
  832. markup += "\t\t\t\t\t\t\t\t</select>";
  833. markup += "\t\t\t\t\t\t\t</div>";
  834. }
  835. markup += "\t\t\t\t\t\t\t<h3><em>" + c + "</em>" + playerData.name + "</h3>";
  836. markup += "\t\t\t\t\t\t</div>";
  837. markup += "\t\t\t\t\t</div>";
  838. markup += '\t\t\t\t\t<div class="center30">';
  839. markup += '\t\t\t\t\t\t<div class="holdingsname">';
  840. playerData.holdings && (markup += "\t\t\t\t\t\t\t<h3>Holdings:</h3>", markup += '\t\t\t\t\t\t\t<input id="holdings_name" type="text" value="' + playerData.holdings + '" onchange="renameHoldings();"/>');
  841. } else
  842. markup += ' <span class="btnwrap btnmed" id="ptpbtn" style="position: absolute; top: -200px; width: 200px; left: -10px"><span class="btnedge"><a class="btnbrown" onclick="return pvpStartWithTarget(' +
  843. playerData.id + ');"><span></span>Player to Player</a></span></span>', markup += ' <span class="btnwrap btnmed frnd-none" id="friendbtn" style="display:none;"><span class="btnedge"><a class="btnbrown" onclick="$(\'.frnd-none\').fadeOut(\'slow\',function(){ $(\'.frnd-pending\').show(); });friendSendRequest(' + playerData.user_id + ');"><span></span>Add</a></span></span>', markup += ' <span class="btnwrap btnmed frnd-friends" id="friendbtn" style="display:none;"><span class="btnedge"><a class="btnbrown" onclick="$(\'.frnd-friends\').fadeOut(\'slow\',function(){ $(\'.frnd-none\').show(); });friendRemove(' +
  844. playerData.user_id + ');"><span></span>Remove</a></span></span>', markup += ' <span class="btnwrap btnmed frnd-pending" id="friendbtn" style="display:none;"><span class="btnedge"><a class="btnbrown"><span></span>Pending</a></span></span>', c = playerData.title_and_name, c = c.replace(playerData.title, "<em>" + playerData.title + "</em>"), c = c.replace(playerData.name, "<h3>" + playerData.name + "</h3>"), markup += c, markup += "\t\t\t\t\t\t</div>", markup += "\t\t\t\t\t</div>", markup += '\t\t\t\t\t<div class="center30">',
  845. markup += '\t\t\t\t\t\t<div class="holdingsname">', markup += "\t\t\t\t\t\t\t<h3>Holdings:</h3>", markup += "\t\t\t\t\t\t\t<h2>" + playerData.holdings + "</h2>";
  846. markup += "\t\t\t\t\t\t</div>";
  847. markup += '\t\t\t\t\t\t<div class="reviewfealty">\t';
  848. void 0 != playerData.fealty && (markup += ' <div class="reviewcircle">', markup += ' <a class="icon-book" onclick="lorePage(\'house_' + playerData.fealty.toLowerCase() + "')\"></a>", markup += ' <img style="margin: 7px" img src="' +
  849. assetUrl() + "/images/banner-" + playerData.fealty.toLowerCase() + '-lg.png?t=a66ccbf438b6"></img>', markup += " </div>");
  850. markup += "\t\t\t\t\t\t</div>";
  851. markup += '\t\t\t\t\t <div class="reviewbackground">\t';
  852. void 0 != playerData.background_option && (markup += '\t\t\t\t\t\t\t<div class="reviewcircle ' + playerData.background_option + '">', markup += '\t\t\t\t\t\t\t\t<a class="icon-book" onclick="lorePage(\'background-' + playerData.background_option + "');\"></a>", markup += "\t\t\t\t\t\t\t</div>");
  853. markup +=
  854. "\t\t\t\t\t\t</div>";
  855. userContext.focusData.user_id != userContext.playerData.character.user_id && (markup += '\t\t\t\t\t\t<div class="charequipment">', markup += "\t\t\t\t\t\t\t<h3>Equipment</h3>", markup = null == playerData.weapon ? markup + '\t\t\t\t\t\t<div class="iconview iconview-weapon" ></div>' : markup + itemIconView(playerData.weapon, "inventoryDisplayStatsWithTab", "iconview-weapon"), markup = null == playerData.armor ? markup + ' <div class="iconview iconview-armor" ></div>' : markup + itemIconView(playerData.armor,
  856. "inventoryDisplayStatsWithTab", "iconview-armor"), markup = null == playerData.companion ? markup + ' <div class="iconview iconview-companion" ></div>' : markup + itemIconView(playerData.companion, "inventoryDisplayStatsWithTab", "iconview-companion"), markup += "\t\t\t\t\t\t</div>", markup += '<span class="btnwrap btnlg" style="position: relative; left: -285px; margin-top: 230px; z-index: 1" onclick="return contactPlayer(' + playerData.id + ",'" + escape(playerData.name) + '\')"><span class="btnedge"><a class="btngold"><span></span>Send a Raven</a></span></span>');
  857. playerData.alliance_name && (markup += '\t\t\t\t\t\t\t<div style="position:relative; top:-30px; z-index: 1"><h3>Alliance:</h3>', markup += '\t\t\t\t\t\t\t<a href="#" onclick="return allianceInfo(' + playerData.alliance_id + ')">' + playerData.alliance_name + "</a></div>");
  858. markup += "\t\t\t\t\t</div>";
  859. markup += '\t\t\t\t\t<div class="right35">';
  860. markup += '\t\t\t\t\t\t<div class="charframe">';
  861. markup += '\t\t\t\t\t\t\t<div class="portraitimage"></div>';
  862. markup += '\t\t\t\t\t\t\t<div class="charframe-lg"></div>';
  863. markup += '\t\t\t\t\t\t\t<div class="charbanner-lg" style="margin-left: -7px;"><img src="' +
  864. playerData.banner + '" /></div>';
  865. markup += '\t\t\t\t\t\t\t<div class="bannerpole-lg"></div>';
  866. userContext.focusData.user_id == userContext.playerData.character.user_id && (markup += '\t\t\t\t\t\t\t<div class="editbanneroverlay">', markup += '\t\t\t\t\t\t\t\t<span class="btnwrap btnmed" id="editbtn"><span class="btnedge"><a class="btnbrown" onclick="return bannerDesigner();"><span></span>Edit</a></span></span>', markup += "\t\t\t\t\t\t\t</div>");
  867. markup += "\t\t\t\t\t\t</div>";
  868. markup += "\t\t\t\t\t</div>";
  869. markup += '\t\t\t\t\t<div class="stoneridgebtm"></div>';
  870. markup += "\t\t\t\t</div>";
  871. markup += '\t\t\t\t<div class="chargenbox" id="alignment">';
  872. markup += '\t\t\t\t\t<div class="marbletop oldways realm crafty">';
  873. markup += "\t\t\t\t\t\t<h3>Alignment</h3>";
  874. markup += '\t\t\t\t\t\t<div class="alignmenttabs">';
  875. markup += "\t\t\t\t\t\t\t<a id=\"alignmenttab-tradition\" class=\"active\" onclick=\"$(this).siblings().removeClass('active');$(this).addClass('active');$('.alignmentbar').hide();$('#alignmentbar-tradition').show();\" onmouseover=\"return doTip('tip_alignment_tradition',function(){return renderAlignmentTip('tradition')});\" onmouseout=\"return noTip('tip_alignment_tradition');\"><span></span><em></em></a>";
  876. markup += "\t\t\t\t\t\t\t<a id=\"alignmenttab-duty\" onclick=\"$(this).siblings().removeClass('active');$(this).addClass('active');$('.alignmentbar').hide();$('#alignmentbar-duty').show();\" onmouseover=\"return doTip('tip_alignment_duty',function(){return renderAlignmentTip('duty')});\" onmouseout=\"return noTip('tip_alignment_duty');\"><span></span><em></em></a>";
  877. markup += "\t\t\t\t\t\t\t<a id=\"alignmenttab-integrity\" onclick=\"$(this).siblings().removeClass('active');$(this).addClass('active');$('.alignmentbar').hide();$('#alignmentbar-integrity').show();\" onmouseover=\"return doTip('tip_alignment_integrity',function(){return renderAlignmentTip('integrity')});\" onmouseout=\"return noTip('tip_alignment_integrity');\"><span></span><em></em></a>";
  878. markup += "\t\t\t\t\t\t</div>";
  879. markup += '\t\t\t\t\t\t<div id="alignmentbar-tradition" class="alignmentbar">';
  880. markup += "\t\t\t\t\t\t\t<div class=\"alignmenticon-left\" onmouseover=\"return doTip('tip_alignment_old_ways',function(){return renderAlignmentTip('old_ways')});\" onmouseout=\"return noTip('tip_alignment_old_ways');\"></div>";
  881. markup += "\t\t\t\t\t\t\t<div class=\"alignmenticon-right\" onmouseover=\"return doTip('tip_alignment_new_ways',function(){return renderAlignmentTip('new_ways')});\" onmouseout=\"return noTip('tip_alignment_new_ways');\"></div>";
  882. markup += '\t\t\t\t\t\t\t<div class="aligncenter"></div>';
  883. markup += '\t\t\t\t\t\t\t<div class="alignbar-left" style="width:30%;"><span></span></div>';
  884. markup += '\t\t\t\t\t\t\t<div class="alignbar-right" style="width:5%;"><span></span></div>';
  885. markup += '\t\t\t\t\t\t\t<p class="aligntext-left">Old Ways</p>';
  886. markup += '\t\t\t\t\t\t\t<p class="aligntext-right">New Ways</p>';
  887. markup += "\t\t\t\t\t\t</div>";
  888. markup += '\t\t\t\t\t\t<div id="alignmentbar-duty" class="alignmentbar" style="display:none;">';
  889. markup += "\t\t\t\t\t\t\t<div class=\"alignmenticon-left\" onmouseover=\"return doTip('tip_alignment_family',function(){return renderAlignmentTip('family')});\" onmouseout=\"return noTip('tip_alignment_family');\"></div>";
  890. markup += "\t\t\t\t\t\t\t<div class=\"alignmenticon-right\" onmouseover=\"return doTip('tip_alignment_realm',function(){return renderAlignmentTip('realm')});\" onmouseout=\"return noTip('tip_alignment_realm');\"></div>";
  891. markup += '\t\t\t\t\t\t\t<div class="aligncenter"></div>';
  892. markup += '\t\t\t\t\t\t\t<div class="alignbar-left" style="width:45%"><span></span></div>';
  893. markup += '\t\t\t\t\t\t\t<div class="alignbar-right" style="width:15%"><span></span></div>';
  894. markup += '\t\t\t\t\t\t\t<p class="aligntext-left">Family</p>';
  895. markup += '\t\t\t\t\t\t\t<p class="aligntext-right">Realm</p>';
  896. markup += "\t\t\t\t\t\t</div>";
  897. markup += '\t\t\t\t\t\t<div id="alignmentbar-integrity" class="alignmentbar" style="display:none;">';
  898. markup += "\t\t\t\t\t\t\t<div class=\"alignmenticon-left\" onmouseover=\"return doTip('tip_alignment_cunning',function(){return renderAlignmentTip('cunning')});\" onmouseout=\"return noTip('tip_alignment_cunning');\"></div>";
  899. markup += "\t\t\t\t\t\t\t<div class=\"alignmenticon-right\" onmouseover=\"return doTip('tip_alignment_truthful',function(){return renderAlignmentTip('truthful')});\" onmouseout=\"return noTip('tip_alignment_truthful');\"></div>";
  900. markup += '\t\t\t\t\t\t\t<div class="aligncenter"></div>';
  901. markup += '\t\t\t\t\t\t\t<div class="alignbar-left" style="width:25%"><span></span></div>';
  902. markup += '\t\t\t\t\t\t\t<div class="alignbar-right" style="width:40%"><span></span></div>';
  903. markup += '\t\t\t\t\t\t\t<p class="aligntext-left">Cunning</p>';
  904. markup += '\t\t\t\t\t\t\t<p class="aligntext-right">Truthful</p>';
  905. markup += "\t\t\t\t\t\t</div>";
  906. markup += "\t\t\t\t\t</div>";
  907. markup += "\t\t\t\t</div>";
  908. markup += '\t\t\t\t<div id="alignment_tips">';
  909. for (x = 0; x < alignmentData.length; x++)
  910. markup +=
  911. '<div id="tip_alignment_' + alignmentData[x].symbol + '" style="top: -240px; left: -130px; position: relative"></div>';
  912. markup += " </div>";
  913. markup += '\t\t\t\t<div class="chargenbox" id="activity">';
  914. markup += '\t\t\t\t\t<div class="marbletop">';
  915. markup += "\t\t\t\t\t\t<h3>Recent Activity</h3>";
  916. if (void 0 == playerData.recent_activity) markup += " <p>No recent activity to display.</p>";
  917. else if (0 == playerData.recent_activity.length) markup += " <p>No recent activity to display.</p>";
  918. else {
  919. for (a =
  920. 0; a < playerData.recent_activity.length && 3 > a; a++) markup += '\t\t\t\t\t\t<p class="icon-' + playerData.recent_activity[a].type + '"><span style="width:27px;height:25px;"></span>' + playerData.recent_activity[a].text + "</p>";
  921. 3 < playerData.recent_activity.length && (markup += '\t\t\t\t\t\t<span class="btnwrap btnmed" id="morebtn"><span class="btnedge"><a class="btnbrown" onclick="lineageMainModal(\'activities\');"><span></span>More</a></span></span>');
  922. }
  923. markup += "\t\t\t\t\t</div>";
  924. markup += "\t\t\t\t</div>";
  925. markup += '\t\t\t\t<div id="charbtmbar">';
  926. markup += '\t\t\t\t\t<div class="househr"></div>';
  927. markup += "\t\t\t\t</div>";
  928. $("#chargenmain").removeClass("stats");
  929. $("#chargenmain").html(markup);
  930. userContext.focusData.user_id != userContext.playerData.character.user_id && $(".frnd-" + userContext.focusData.friend_status).show();
  931. alignments = ["tradition", "integrity", "duty"];
  932. tips_markup = "";
  933. for (a = 0; a < alignments.length; a++)
  934. alignment = -1 * playerData["got_" + alignments[a]], 0 < alignment ? ($("#alignmentbar-" + alignments[a] + " > .alignbar-left").css("width", alignment / 100 /
  935. 2 + "%").show(), $("#alignmentbar-" + alignments[a] + " > .aligntext-left").css("color", "white"), $("#alignmentbar-" + alignments[a] + " > .aligntext-right").css("color", "#666"), $("#alignmentbar-" + alignments[a] + " > .alignbar-right").hide()) : 0 > alignment ? ($("#alignmentbar-" + alignments[a] + " > .alignbar-right").css("width", alignment / -100 / 2 + "%").show(), $("#alignmentbar-" + alignments[a] + " > .aligntext-right").css("color", "white"), $("#alignmentbar-" + alignments[a] + " > .aligntext-left").css("color", "#666"), $("#alignmentbar-" +
  936. alignments[a] + " > .alignbar-left").hide()) : ($("#alignmentbar-" + alignments[a] + " > .aligntext-left").css("color", "white"), $("#alignmentbar-" + alignments[a] + " > .aligntext-right").css("color", "white"), $("#alignmentbar-" + alignments[a] + " > .alignbar-left").hide(), $("#alignmentbar-" + alignments[a] + " > .alignbar-right").hide());
  937. uiEvent("character");
  938. userContext.focusData.user_id == userContext.playerData.character.user_id && uiEvent("character_self");
  939. };
  940. log("Display additional info in the character tab.", "initialize");
  941.  
  942. inventoryDisplayStatsWithTab = function inventoryDisplayStatsWithTab(c, symbol) {
  943. // EXTENDER :: Modification, useless junk,
  944. // use this function as it appears to work better
  945. c = extractItemById(playerInventory, c);
  946. if (c && c.id == 0 && typeof symbol != "undefined") {
  947. statViewFromMini(symbol);
  948. return;
  949. }
  950.  
  951. "unit" == c.slot
  952. ? inventorySubTab("companion")
  953. : inventorySubTab(c.slot);
  954.  
  955. inventoryDisplayStats(void 0, void 0, c, void 0, !0);
  956. };
  957. log("Use alternative function for item popup if the initial fails.", "initialize");
  958.  
  959. inventoryTab = function inventoryTab(c) {
  960. $("#statview_container_right").html("");
  961. $("#statview_container").html("");
  962. $(".characterview").hide();
  963. $("." + c + "view").show();
  964. $("#swornswordstab_inner").removeClass("active");
  965. $("#foodtab_inner").removeClass("active");
  966. $("#charactertab_inner").removeClass("active");
  967. $("#boonstab_inner").removeClass("active");
  968. $("#resourcestab_inner").removeClass("active");
  969. $("#sealtab_inner").removeClass("active");
  970. $("#gearinvtab_inner").removeClass("active");
  971. $("#companionsinvtab_inner").removeClass("active");
  972.  
  973. //EXTENDER :: Modification
  974. $("#permanentitemstab_inner").removeClass("active");
  975.  
  976. $("#inventorybtm").removeClass("character");
  977. $("#weapontab").hide();
  978. $("#armortab").hide();
  979. $("#companiontab").hide();
  980. $("#swordcompaniontab").hide();
  981. $("#inventory-listing").hide();
  982. var a = [], b = void 0;
  983.  
  984. // EXTENDER :: Clarification
  985. if ("character" == c) {
  986. $("#inventorybtm").addClass("character");
  987. $("#weapontab").show();
  988. $("#armortab").show();
  989. $("#companiontab").show();
  990. equipContextPrefix = equipContextTarget = "character";
  991. equipContextPosition = "right";
  992. $("#inventory_toolbar_Weapon").show();
  993. } else if ("swornswords" == c) {
  994. $("#inventorybtm").addClass("character");
  995. first_sworn = extractFirstSwornSword(playerInventory);
  996. inventoryDisplayStatsRight(void 0, void 0, first_sworn);
  997. $("#weapontab").show();
  998. $("#armortab").show();
  999. $("#swordcompaniontab").show();
  1000. equipContextPrefix = "item";
  1001. $("#inventory_toolbar").show();
  1002. b = "Sworn Sword";
  1003. a.push(b);
  1004. } else if ("boons" == c) {
  1005. first_boon = extractFirstBoon(playerInventory);
  1006. inventoryDisplayStatsRight(void 0, void 0, first_boon);
  1007. $("#inventory_toolbar").hide();
  1008. b = "Boon";
  1009. a.push(b);
  1010. } else if ("food" == c) {
  1011. first_consumable = extractFirstConsumable(playerInventory);
  1012. inventoryDisplayStatsRight(void 0, void 0, first_consumable);
  1013. $("#inventory_toolbar").hide();
  1014. b = "Consumable";
  1015. a.push(b);
  1016. } else if ("seal" == c) {
  1017. first_seal = extractFirstSeal(playerInventory);
  1018. inventoryDisplayStatsRight(void 0, void 0, first_seal);
  1019. $("#inventory_toolbar").hide();
  1020. b = "Seal";
  1021. a.push(b);
  1022. } else if ("resources" == c) {
  1023. first_resource = extractFirstTreasure(playerInventory);
  1024. inventoryDisplayStatsRight(void 0, void 0, first_resource);
  1025. $("#inventory_toolbar").hide();
  1026. b = "Treasure";
  1027. a.push(b);
  1028. } else if ("gearinv" == c) {
  1029. first_gearinv = extractFirstGear(playerInventory);
  1030. inventoryDisplayStatsRight(void 0, void 0, first_gearinv);
  1031. $("#inventory_toolbar").hide();
  1032. b = "Weapon, Armor";
  1033. a.push("Weapon");
  1034. a.push("Armor");
  1035. } else if ("companionsinv" == c) {
  1036. first_companionsinv = extractFirstCompanion(playerInventory);
  1037. inventoryDisplayStatsRight(void 0, void 0, first_companionsinv);
  1038. $("#inventory_toolbar").hide();
  1039. b = "Companion, Unit";
  1040. a.push("Companion");
  1041. a.push("Unit");
  1042. } else if ("permanentitems" == c) {
  1043. b = "pass please";
  1044. }
  1045.  
  1046. doLog("inventoryTab: category=" + c + " listing_slot=" + b);
  1047.  
  1048. //console.debug("Logging pre display of storage: ", a);
  1049.  
  1050. if (void 0 != b) {
  1051. initPagination(c, 6);
  1052.  
  1053. for (var d = !1, g = [], p = "", f = 0; f < playerInventory.length; f++) {
  1054. // EXTEDNER :: Modification, clarification
  1055. if (c === "permanentitems" && playerInventory[f].permanent_item) {
  1056. g.push(playerInventory[f]);
  1057. continue;
  1058. }
  1059.  
  1060. for (var m = 0; m < a.length; m++) {
  1061. if (playerInventory[f].slot == a[m]) {
  1062. g.push(playerInventory[f]);
  1063. }
  1064. }
  1065. }
  1066.  
  1067. 0 == g.length && (d = !0);
  1068.  
  1069. //console.debug("Logging array to be displayed: ", g);
  1070.  
  1071. p += "<div id='mv_container'></div>";
  1072.  
  1073. "character" == c
  1074. ? $("#inventory-listing").html(p).hide()
  1075. : !0 == d ? "swornswords" == c
  1076. ? $("#inventory-listing").html('You have no sworn swords. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to hire one.').show()
  1077. : "food" == c
  1078. ? $("#inventory-listing").html('You have no Food. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase some.').show()
  1079. : "boons" == c
  1080. ? $("#inventory-listing").html('You have no Boons. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase one.').show()
  1081. : "seal" == c
  1082. ? $("#inventory-listing").html("You have no Seals. Earn seals from PtP.").show()
  1083. : "gearinv" == c
  1084. ? $("#inventory-listing").html('You have no Gear. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase some.').show()
  1085. : "companionsinv" == c
  1086. && $("#inventory-listing").html('You have no Companions. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase some.').show()
  1087. : $("#inventory-listing").html(p).show();
  1088.  
  1089. d || (
  1090. $.each(g, function(a, b) {
  1091. addPageItem(c);
  1092. itemMiniView(b, {
  1093. callback: inventoryDisplayStatsRight,
  1094. extra_styles: pageStyle(c),
  1095. extra_class: pageClass(c)
  1096. }, "#mv_container");
  1097. }),
  1098. $("#mv_container").append(bookPageNumbers(c))
  1099. );
  1100. }
  1101.  
  1102. $("#" + c + "tab_inner").addClass("active");
  1103. void 0 != b && pageBegin(c);
  1104. };
  1105. log("Render permanent items.", "initialize");
  1106.  
  1107. inventoryModal = function inventoryModal(c, a) {
  1108. closeUpgradePanel();
  1109. uiTelemetry("inventory");
  1110. void 0 == c ? (c = {}, c.storage = a, c.content_loading = !0, showSpinner(), $.ajaxq("gotAjaxQueue", {
  1111. url: "/play/player_data?client_seqnum=" + userContext.player_data_seqnum,
  1112. dataType: "JSON",
  1113. success: function (b) {
  1114. inventoryModal(b, a);
  1115. }
  1116. })) : (c.content_loading = !1, hideSpinner(), setupPlayerData(c, void 0), inventoryTab("character"));
  1117. c.storage = a;
  1118. c.allowseals = !0;
  1119.  
  1120. // EXTENDER :: Modification, inject permanent tab
  1121. var permanentsTab =
  1122. '<span onclick="return clickInventoryTab(\'permanentitems\');" id="permanentitemstab" class="inventorytabwrap">' +
  1123. '<span class="inventorytabedge">' +
  1124. '<a id="permanentitemstab_inner" class="inventorytab">' +
  1125. '<span></span>' +
  1126. 'Permanent' +
  1127. '<em></em>' +
  1128. '</a></span></span>';
  1129.  
  1130. var b = _.template('<div id="modalwrap" class="modal690" style="display:block"><div class="contentframe1" id="content_character_view-inventory">\t<div class="contentframe2">\t\t<div class="contentframe3">\t\t\t<div class="contentframe4">\t\t\t<div class="stonecurve" id="stonecurve-l">\t\t\t\t<span></span>\t\t\t</div>\t\t\t<div class="stonecurve" id="stonecurve-r">\t\t\t\t<span></span>\t\t\t</div>\t\t\t<div class="infobar">\t\t\t\t<div class="infobarpattern"></div>\t\t\t<%\t\t\tif(data.storage)\t\t\t%>\t\t\t\t<h2><%= translateString(\'ui_storage\') %></h2>\t\t\t<%\t\t\telse\t\t\t{\t\t\t%>\t\t\t\t<h2><%= translateString(\'your_character\') %></h2>\t\t\t<%\t\t\t}\t\t\t%>\t\t\t\t<span class="barbtmedge"></span>\t\t\t\t<span class="corner tl"></span>\t\t\t\t<span class="corner tr"></span>\t\t\t\t<a class="closebtn" onclick="return clickCloseInventory();">\t\t\t\t\t<%= translateString(\'close\') %>\t\t\t\t</a>\t\t\t</div>\t\t\t<%\t\t\tif(!data.content_loading)\t\t\t{\t\t\t%>\t\t\t\t<div class="tabbedheading">\t\t\t\t\t<div class="inventorytabs">\t\t\t\t\t\t<%\t\t\t\t\t\tif(data.storage)\t\t\t\t\t\t{\t\t\t\t\t\t%>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="resourcetab"><span class="inventorytabedge""><a id="resourcestab_inner" class="inventorytab" onclick="clickInventoryTab(\'resources\');"><span></span><%= translateString(\'resource_tab_label\') %><em></em></a></span></span>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="boonstab" onclick="return clickInventoryTab(\'boons\');"><span class="inventorytabedge"><a class="inventorytab" id="boonstab_inner"><span></span><%= translateString(\'ui_ss_boons\') %><em></em></a></span></span>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="foodtab" onclick="return clickInventoryTab(\'food\');"><span class="inventorytabedge"><a class="inventorytab" id="foodtab_inner"><span></span><%= translateString(\'ui_char_food\') %><em></em></a></span></span> <% if(data.allowseals) { %> <span class="inventorytabwrap" id="sealtab" onclick="return clickInventoryTab(\'seal\');"><span class="inventorytabedge"><a class="inventorytab" id="sealtab_inner"><span></span><%= translateString(\'ui_char_seal\') %><em></em></a></span></span> <span class="inventorytabwrap" id="gearinvtab" onclick="return clickInventoryTab(\'gearinv\');"><span class="inventorytabedge"><a class="inventorytab" id="gearinvtab_inner"><span></span><%= translateString(\'ui_char_gear\') %><em></em></a></span></span> <span class="inventorytabwrap" id="companionsinvtab" onclick="return clickInventoryTab(\'companionsinv\');"><span class="inventorytabedge"><a class="inventorytab" id="companionsinvtab_inner"><span></span><%= translateString(\'ui_char_companions\') %><em></em></a></span></span>' + permanentsTab + ' <% } %>\t\t\t\t\t\t<%\t\t\t\t\t\t}\t\t\t\t\t\telse\t\t\t\t\t\t{\t\t\t\t\t\t%>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="armortab" style="right: 0px" onclick="return clickInventoryTab(\'character\');"><span class="inventorytabedge"><a class="inventorytab active" id="charactertab_inner"><span></span><%= translateString(\'equipment\') %><em></em></a></span></span>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="charactertab" onclick="return characterModal(undefined, characterMainModal, true);"><span class="inventorytabedge"><a id="charactertab_inner" class="inventorytab"><span></span><%= translateString(\'mainmenu_character\') %><em></em></a></span></span>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="pactstab"><span class="inventorytabedge"><a class="inventorytab" id="pactstab_inner" onclick="return characterModal(undefined, pactsModal, true);"><span></span><%= translateString(\'pacts_and_influence\') %><em></em></a></span></span>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="statstab"><span class="inventorytabedge"><a class="inventorytab" id="statstab_inner" onclick="return characterModal(undefined, statsModal, true);"><span></span><%= translateString(\'stats\') %><em></em></a></span></span>\t\t\t\t\t\t\t<span class="inventorytabwrap" id="achievementstab"><span class="inventorytabedge"><a class="inventorytab" id="achievementstab_inner" onmouseover="return setTooltip(\'achievementstab_inner\',\'achievements\');" onclick="return characterModal(undefined, achievementsModal, true);"><span></span><%= translateString(\'achievements\') %><em></em></a></span></span>\t\t\t\t\t\t<%\t\t\t\t\t\t}\t\t\t\t\t\t%>\t\t\t\t\t</div>\t\t\t\t</div>\t\t\t\t<div class="inventorycontent">\t\t\t\t\t<div id="statview_container_right"></div>\t\t\t\t\t\t<div class="darkroundedbox miniviewmenu-inventory" id="inventory-listing" style="display:none">\t\t\t\t\t\t</div>\t\t\t\t\t\t<div class="characterview">\t\t\t\t\t\t\t<div class="characterviewname"><h3><%= data.strings.title_and_name%></div>\t\t\t\t\t\t\t<div class="characterviewimg">\t\t\t\t\t\t\t\t<img src="<%= userContext.playerData.strings.portrait_pic %>" width="170">\t\t\t\t\t\t\t\t<span class="characterviewframe"></span>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="characterviewstats">\t\t\t\t\t\t\t\t<span class="battlebonus"><span></span><var id="char_battlebonus" class="battle_val"><%= userContext.playerData.character.got_battle %></var></span>\t\t\t\t\t\t\t\t<span class="tradebonus"><span></span><var id="char_tradebonus" class="trade_val"><%= userContext.playerData.character.got_trade %></var></span>\t\t\t\t\t\t\t\t<span class="intriguebonus"><span></span><var id="char_intriguebonus" class="intrigue_val"><%= userContext.playerData.character.got_intrigue %></var></span>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="characterviewinfo">\t\t\t\t\t\t\t\t<span id="chartalentbtn" class="btnwrap btnxxl" onclick="talentsModal();">\t\t\t\t\t\t\t\t\t<span class="btnedge">\t\t\t\t\t\t\t\t\t\t<a class="btngold">\t\t\t\t\t\t\t\t\t\t\t<span></span><%= translateString(\'talents\') %>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<%\t\t\t\t\t\t\t\t\t\t\tif(data.character.talents_earned>0)\t\t\t\t\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t%>\t\t\t\t\t\t\t\t\t\t\t\t<strong><%= data.character.talents_earned%><%= translateString(\'ui_char_point\') %><%if(data.character.talents_earned > 1){%>s<%}%>\t\t\t\t\t\t\t\t\t\t\t\t</strong>\t\t\t\t\t\t\t\t\t\t\t<%\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t%>\t\t\t\t\t\t\t\t\t\t</a>\t\t\t\t\t\t\t\t\t</span>\t\t\t\t\t\t\t\t</span>\t\t\t\t\t\t\t\t<span id="charstoragebtn" class="btnwrap btnxxl" onclick="inventoryModal(undefined,true);">\t\t\t\t\t\t\t\t\t<span class="btnedge">\t\t\t\t\t\t\t\t\t\t<a class="btngold">\t\t\t\t\t\t\t\t\t\t\t<span></span><%= translateString(\'ui_storage\') %>\t\t\t\t\t\t\t\t\t\t</a>\t\t\t\t\t\t\t\t\t</span>\t\t\t\t\t\t\t\t</span>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="charseals">\t\t\t\t\t\t\t\t<%= characterSealMarkup() %>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="characterequipmentinfo">\t\t\t\t\t\t\t\t<%= characterEquipmentMarkup() %>\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t<div class="characterviewbtm">\t\t\t\t\t\t\t\t<% if(hand_slot == null) %>\t\t\t\t\t\t\t\t\t<div id="character_weapon_container" onclick="return modalContextEquip(\'character\',\'Weapon\')"><div class="iconview iconview-weapon"></div></div>\t\t\t\t\t\t\t\t<% else %>\t\t\t\t\t\t\t\t\t<div id="character_weapon_container" onclick="return modalContextEquip(\'character\',\'Weapon\')"><%= itemIconView(hand_slot, "inventoryDisplayStatsWithTab", \'iconview-weapon\') %></div>\t\t\t\t\t\t\t\t<% if(armor_slot == null) %>\t\t\t\t\t\t\t\t\t<div id="character_armor_container" onclick="return modalContextEquip(\'character\',\'Armor\')"><div class="iconview iconview-armor"></div></div>\t\t\t\t\t\t\t\t<% else %>\t\t\t\t\t\t\t\t\t<div id="character_armor_container" onclick="return modalContextEquip(\'character\',\'Armor\')"><%= itemIconView(armor_slot, "inventoryDisplayStatsWithTab", \'iconview-armor\') %></div>\t\t\t\t\t\t\t\t<% if(companion_slot == null) %>\t\t\t\t\t\t\t\t\t<div id="character_companion_container" onclick="return modalContextEquip(\'character\',\'Companion\')"><div class="iconview iconview-companion"></div></div>\t\t\t\t\t\t\t\t<% else %>\t\t\t\t\t\t\t\t\t<div id="character_companion_container" onclick="return modalContextEquip(\'character\',\'Companion\')"><%= itemIconView(companion_slot, "inventoryDisplayStatsWithTab", \'iconview-companion\') %></div>\t\t\t\t\t\t\t</div>\t\t\t<% \t\t\t/* end of if(!data.content_loading) */\t\t\t}\t\t\t%>\t\t\t\t</div>\t\t\t</div>\t\t</div>\t<div class="contentbtm"></div></div></div>',
  1131. {data: c});
  1132. displayModalDialog(b, "character_dialog");
  1133. uiEvent("character_dialog_open");
  1134. !c.content_loading && a && ($("#inventorybtm").hide(), clickInventoryTab("resources"));
  1135. };
  1136. log("Add permanent items tab.", "initialize");
  1137.  
  1138. shopModal = function shopModal(b, a) {
  1139. userContext.playerData.user.new_items = 0;
  1140. updateAllStatus();
  1141. doToolbar("shop");
  1142. closeAlert();
  1143. closeUpgradePanel();
  1144. clearModalDialogs("modal_dialogs_top");
  1145. doLog("shopModal");
  1146. uiTelemetry("shop");
  1147.  
  1148. // EXTENDER :: Modification, default tab: troopsequip
  1149. void 0 == a && (a = "troopsequip");
  1150.  
  1151. if (void 0 == b) {
  1152. var c;
  1153. c = "" + (shopModalHead() + shopModalFoot());
  1154. isWeb() && displayModalDialog(c, void 0, void 0, "min-height: 692px; top: 0px; margin-top: 40px");
  1155. showSpinner();
  1156. $.ajaxQueue({
  1157. url: "/play/shop/",
  1158. dataType: "JSON",
  1159. complete: hideSpinner,
  1160. success: function (c) {
  1161. shopModal(c, a);
  1162. }
  1163. })
  1164.  
  1165. // EXTENDER :: Enwrap else - readability fixes bugs
  1166. } else {
  1167. hideSpinner(),
  1168. updateSilver(b.money),
  1169. updateGold(b.perk_points),
  1170. c = sortShopItems(b.shop),
  1171. userContext.filteredShopData = distrubuteShopItemsToFilteredLists(c),
  1172.  
  1173. // EXTENDER :: Modification, extender filter by default
  1174. userContext.shopFilterIndex = userContext.shopFilterIndex || 4,
  1175. console.debug("Sorting shop and putting it in the filteredShopData.");
  1176.  
  1177. // EXTENDER :: Load extender filter with filtered data
  1178. userContext.filteredShopData[shopFilters.indexOf("extender")]
  1179. = sortShop(userContext.filteredShopData[0].slice(0));
  1180.  
  1181. userContext.shopData = userContext.filteredShopData[userContext.shopFilterIndex],
  1182. baseShopTime = parseInt((new Date).getTime() / 1E3),
  1183. b.cost_refresh_shop = 2, b.userContext = userContext,
  1184. b.open_tab = a, b.featuredTabLabel && (phraseText.featured_tab_label = b.featuredTabLabel),
  1185. b.dealsData ? (b.overrideDealsData = [], b.dealsData.map(function (a) {
  1186. b.overrideDealsData.push(a)
  1187. }), b.dealsData = [], b.overrideDealsData.map(function (a) {
  1188. b.dealsData.push(a.symbol);
  1189. a.price_perk_points && (itemFromSymbol(a.symbol).price_perk_points = a.price_perk_points)
  1190. }), userContext.defaultDeals_id = itemFromSymbol(b.dealsData[0]).id, userContext.defaultDeals_symbol = b.dealsData[0]) : b.dealsData = shopSetDealData("deals"), b.featuredItemPack ? (b.overridefeaturedItemPack = {}, b.overridefeaturedItemPack.symbol = b.featuredItemPack.symbol, b.overridefeaturedItemPack.price_perk_points =
  1191. b.featuredItemPack.price_perk_points, b.featuredItemPack = b.overridefeaturedItemPack.symbol, b.overridefeaturedItemPack.price_perk_points && (itemFromSymbol(b.overridefeaturedItemPack.symbol).price_perk_points = b.overridefeaturedItemPack.price_perk_points), userContext.defaultFeaturedPack_id = itemFromSymbol(b.featuredItemPack).id, userContext.defaultFeaturedPack_symbol = b.featuredItemPack) : b.featuredItemPack = shopSetDealData("featured_item_pack"), b.featuredItem ? (b.overridefeaturedItem = [], b.featuredItem.map(function (a) {
  1192. b.overridefeaturedItem.push(a)
  1193. }),
  1194. b.featuredItem = [], b.overridefeaturedItem.map(function (a) {
  1195. b.featuredItem.push(a.symbol);
  1196. a.price_perk_points && (itemFromSymbol(a.symbol).price_perk_points = a.price_perk_points)
  1197. })) : b.featuredItem = shopSetDealData("featured_items"), userContext.shopMetadata = b, drawShopModal(userContext.shopMetadata)
  1198. }
  1199. };
  1200. log("Sort shop.", "initialize");
  1201.  
  1202. function hasGold(b, a, c) {
  1203. // EXTENDER :: Modification, the short answer is no
  1204. if (b > 0 && extender_neverSpendGold) {
  1205. return false;
  1206. }
  1207.  
  1208. if (0 < b) {
  1209. void 0 == c && (c = !1);
  1210. doLog("hasGold: cost=" + b + " [player perk_points=" + userContext.playerData.user.perk_points + "]");
  1211. if (b > userContext.playerData.user.perk_points) return currencyModal("gold"), iosSignal("purchase", "need_gold"), !1;
  1212. if (2 == (userContext.playerData.user.options_mask & 2) && !1 == c)
  1213. return dialogAlert({
  1214. style: "confirm",
  1215. button1: "Okay",
  1216. button1_action: function() {
  1217. closeAlert();
  1218. a();
  1219. },
  1220. button2: "Cancel",
  1221. heading: jsTranslate("Spend %{val} Gold", "val", numberWithDelimiter(b)),
  1222. text: jsTranslate("Please confirm that you wish to spend %{val} gold.",
  1223. "val", numberWithDelimiter(b)),
  1224. keep_previous: !0
  1225. }), !1;
  1226. }
  1227. return !0;
  1228. };
  1229. log("Never spend gold option.", "initialize");
  1230.  
  1231. function pvpLaunch(callback) {
  1232. json = { pvp: {} };
  1233. json.pvp.target_id = pvpForm.target_id;
  1234. json.pvp.sworn_sword_id = userContext.setSwornSword.id;
  1235. json.pvp.pvp_action_symbol = userContext.currentActionLabel;
  1236. json.pvp.region_symbol = fealtySymbol[pvpForm.target_faction_id];
  1237. pvpForm.sub_region_index = Math.floor(3 * Math.random());
  1238. var b = pvpForm.target_faction_id;
  1239. void 0 == b && (b = userContext.playerData.character.faction_id);
  1240. json.pvp.sub_region_symbol = fealtySubRegions[b][pvpForm.sub_region_index].symbol;
  1241. json.pvp.attack_value = userContext.currentQuest.action_type[userContext.currentActionLabel].attacker_strength;
  1242. json.pvp.defense_value = userContext.currentQuest.action_type[userContext.currentActionLabel].defender_strength;
  1243. false || (showSpinner(),
  1244. $.ajax({
  1245. type: "get",
  1246. url: "/pvps/create",
  1247. data: json,
  1248. dataType: "JSON",
  1249. complete: hideSpinner,
  1250. success: function(a) {
  1251. void 0 == a.error ?
  1252. (pvpForm = {},
  1253. userContext.pvp = a,
  1254. pvpRenderProgress(a),
  1255. insertInventoryFromItem(playerInventory, a.attacker.sworn_sword),
  1256. analytics.track("PvP Start", { pvp_context: "attack", pvp_action: json.pvp.pvp_action_symbol }),
  1257. analytics.wizardtrack("PvP Start", {
  1258. pvp_context: "attack",
  1259. pvp_action: json.pvp.pvp_action_symbol
  1260. }))
  1261. : handleSwornSwordError(a.error);
  1262.  
  1263. // EXTENDER :: Modification, call callback
  1264. // parameter indicates successfull sending
  1265. if (typeof callback == "function") {
  1266. if(a.error && a.error === "too_many_attacks") {
  1267. //inform("Too MANY ATTACKS! StAHP STAAAHP!");
  1268. pvpFormStore = null;
  1269. return;
  1270. }
  1271.  
  1272. callback(!a.error);
  1273. }
  1274. }
  1275. }));
  1276. }
  1277. log("Player vs player enhanced. Client pvpBan, hilarious.", "initialize");
  1278.  
  1279. function questSubmit(b, a, c, d, g, k, f) {
  1280. doLog("questSubmit: stage=" + a + " choice=" + c);
  1281. uiEvent("quest_submit_" + b + "_" + a + "_choice_" + c, userContext.playerData);
  1282. userContext.postQuestEvent = "quest_post_" + b + "_" + a + "_choice_" + c;
  1283. userContext.playerData;
  1284. userContext.questActionChoice = c;
  1285. b = void 0 != f ? "/play/quest?quest_id=" + f + "&stage=" + a + "&choice=" + c + "&chosen=" + escape(d) : "/play/quest?quest_symbol=" + b + "&stage=" + a + "&choice=" + c + "&chosen=" + escape(d);
  1286. void 0 != g ? (b = isWeb() ? b + ("&chat=" + escape($("#" + g).val())) : b + ("&chat=" + escape(g)),
  1287. userContext.hideWarParty = !0) : playSound("page-turn");
  1288. void 0 != k && (userContext.dialogIndex++, userContext.dialogHistory[userContext.dialogIndex] = unescape(k));
  1289. isIpad() && showSpinner();
  1290. $.ajax({
  1291. url: b,
  1292. dataType: "JSON",
  1293. success: function(a) {
  1294. isIpad() && hideSpinner();
  1295. questSubmitCallback(a);
  1296. questById(f).action_taken = !0;
  1297.  
  1298. // EXTENDER :: Modification, auto boss challenger
  1299. bossChallenger.fight(a, c);
  1300. }
  1301. });
  1302. return !1;
  1303. }
  1304. log("Boss challenge code injected.", "initialize");
  1305.  
  1306.  
  1307. function doCampAttack(b, a, callback) {
  1308. console.debug("Logging parameters, send camp attack: ", b, a, callback);
  1309. if (!1 == checkParticipation() || !1 == allowCampAttack())
  1310. return !1;
  1311.  
  1312. if (void 0 != userContext.targetAllianceStance && void 0 == a) {
  1313. var c = !1, d = userContext.currentActionLabel;
  1314.  
  1315. if ("fight" == d || "hoodwink" == d || "steal" == d || "sabotage" == d || "hoodwink" == d || "harass" == d) c = !0;
  1316.  
  1317. if (2 == userContext.targetAllianceStance.status && !0 == c)
  1318. return doLog("show alert if you really want to attack your friendly alliance alert"), dialogAlert({
  1319. style: "confirm",
  1320. margin_top: 100,
  1321. button1: "NO",
  1322. button1_action: function() { return closeAlert(); },
  1323. button2: "YES",
  1324. button2_action: function() { doCampAttack(b, !0); },
  1325. heading: "Action Confirmation",
  1326. text: "Remember, this alliance is your friend! Are you certain you want to attack them?"
  1327. }), !1;
  1328. }
  1329.  
  1330. $.ajax({
  1331. url: "/play/camp_attack_begin?id=" + b + "&item_id=" + itemCurrentSelection.id + "&ability=" + userContext.currentActionLabel,
  1332. dataType: "JSON",
  1333. success: function(a) {
  1334.  
  1335. if (a.error) {
  1336. a.swornsword &&
  1337. insertInventoryFromItem(playerInventory, a.swornsword),
  1338. doAlert("Error Attacking Camp", a.error), !1;
  1339.  
  1340. } else {
  1341. campAttackProgress(a.camp_attack.id);
  1342. }
  1343.  
  1344. // EXTENDER :: Modification, call callback
  1345. // parameter indicates successfull sending
  1346. if (typeof callback == "function") {
  1347. callback(a);
  1348. }
  1349. }
  1350. });
  1351. }
  1352. log("Camp attack now calls callback afterwards.", "initialize");

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址