GOTA_Extender_Custom

Custom page functions rewritten.

目前為 2014-12-22 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/5426/29116/GOTA_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. }
  170.  
  171. // EXTENDER :: Modification
  172. if (typeof callback == "function") {
  173. callback();
  174. }
  175. }
  176. }));
  177. };
  178. log("Finish production and call callback if any. Fix bug.", "initialize");
  179.  
  180. doProduction = function(c, a, b, d, g, callback) {
  181. userContext.lastFinish = null;
  182. null == b && (b = 1);
  183. doLog("doProduction: symbol=" + c + " producer=" + a + " quantity=" + b);
  184. var p = null, f = "", m = null, q = "", k = null, D = null;
  185. uiEvent("start_production");
  186. null == userContext.playerData.stat.num_shop_items_started && (userContext.playerData.stat.num_shop_items_started = 0);
  187. userContext.playerData.stat.num_shop_items_started += 1;
  188. for (var u = 0; u < userContext.recipeData.length; u++)
  189. if (console.log("DEBUG: n=" + userContext.recipeData[u].category + ", symbol: " +
  190. 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) {
  191. p = userContext.recipeData[u];
  192. p.output == c ? (k = itemFromSymbol(c), q = k.full_name) : (p.output_loot == c && (m = c), q = p.name);
  193. D = u;
  194. components = userContext.recipeData[u].input.split(",");
  195. quantity_components = userContext.recipeData[u].input_quantity.split(",");
  196. var s = itemFromSymbol(userContext.recipeData[u].category);
  197. if (true ==
  198. userContext.recipeData[u].unlocked) {
  199. if (1 < userContext.recipeData[u].input.length)
  200. for (s = 0; s < components.length; s++) {
  201. var y = itemFromSymbol(components[s]), w = false;
  202. 0 == s && true == userContext.recipeData[u].evolution && (w = true);
  203. w = sumInventoryQuantity(y.symbol, w);
  204. if (parseInt(quantity_components[s]) * b > w) {
  205. "" == f && (f = "You need more of the following:<p/>");
  206. f += "<div>";
  207. if (4 <= userContext.playerData.character.level)
  208. switch (components[s]) {
  209. case "stone":
  210. case "iron":
  211. case "fur":
  212. case "ore":
  213. case "horse":
  214. case "riverways_fish_consumable":
  215. case "smallfolk":
  216. case "wood":
  217. case "cloth":
  218. case "grains":
  219. w =
  220. parseInt(quantity_components[s]) * b - w;
  221. if (cost_item = itemFromSymbol("pennyroyal")) var z = cost_item.price_perk_points * w;
  222. f += '<div id="basic_resource_' + components[s] + '">';
  223. f += itemMiniView(y, { extra_styles: "left:-70px", quantity_override: w });
  224. 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>";
  225. f += "</div>";
  226. break;
  227. default:
  228. f += itemMiniView(y);
  229. }
  230. f += "</div>";
  231. f += "<p>" + y.howto + "</p>";
  232. }
  233. }
  234. } else f = "You need <em>" + s.full_name + "</em> to produce that.";
  235. break;
  236. }
  237. if ("" != f) doAlert("Requirements: " + q, f), analytics.track("Production Blocked-Resources", { item_symbol: c }), analytics.wizardtrack("Production Blocked-Resources", { item_symbol: c });
  238. else if (p && hasMoney(p.craft_cost * b, function() { doProduction(c, a, b, d, g); })) {
  239. f = JSON.parse(JSON.stringify(userContext.playerData.inventory));
  240. u = [];
  241. p.output == c ? (k = itemFromSymbol(c), q = k.full_name) : (p.output_loot ==
  242. c && (m = c), q = p.name);
  243. components = p.input.split(",");
  244. quantity_components = p.input_quantity.split(",");
  245. s = itemFromSymbol(p.category);
  246. 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);
  247. q = "";
  248. D = null;
  249. for (s = 0; s < u.length; s++)
  250. if (y = itemFromSymbol(u[s].symbol), u[s].full_name != y.full_name)
  251. D = JSON.parse(JSON.stringify(u[s])),
  252. q += "[" + u[s].full_name + "]";
  253. 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 + "]";
  254.  
  255. // EXTENDER :: Modification
  256. if (true != d && null != D && !extender_confirmSuperiorMaterials) {
  257. return playerInventory = JSON.parse(JSON.stringify(f)), userContext.playerData.inventory = playerInventory, dialogAlert({
  258. style: "confirm",
  259. margin_top: 100,
  260. items: [D],
  261. button2: "Not Now",
  262. button2_action: function() { closeAlert(); },
  263. button1: "Confirm",
  264. button1_action: function() {
  265. closeAlert();
  266. return doProduction(c, a, b, true, g);
  267. },
  268. heading: "Confirm Superior Materials",
  269. 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?"
  270. }), false;
  271. }
  272.  
  273. var I = buildingBySymbol(userContext.activeBuildingPanel);
  274. I.build_remaining = p.craft_duration * b;
  275. I.original_build_seconds = p.craft_duration * b;
  276. I.build_progress = 0;
  277. "" != p.output && (I.producing_archetype_id = itemFromSymbol(p.output).id);
  278. I.recipe_symbol = p.symbol;
  279. I.action_sub_id = b;
  280. f = renderBuildingConstruction(I);
  281. isWeb() && $("#bc_" + I.id).html(f);
  282. displayBuildingCooldown(I);
  283. "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)));
  284. p = "/play/set_production";
  285. p = (m ? p + ("?loot_symbol=" + m + "&producer_symbol=" + a) : k ? p + ("/" + c + "?producer_symbol=" + a) : p + ("?producer_symbol=" + a)) + ("&quantity=" + b);
  286. g && (p += "&recipe_symbol=" + g);
  287. //console.debug("Tampering with the url: ", p);
  288.  
  289. $.ajax({
  290. url: p,
  291. dataType: "JSON",
  292. success: function(a) {
  293. // EXTENDER :: Modification
  294. if (!a.num_shop_items_started && a.status) {
  295. //console.debug("Server responded with: ", a);
  296. return;
  297. }
  298.  
  299. userContext.prodProgressShow = null;
  300. userContext.playerData.stat.num_shop_items_started = a.num_shop_items_started;
  301. updateAllStatus();
  302. uiEvent("do_production");
  303. isWeb() || iosSignal("building", "cooldown", mobileCooldownData({ mode: "building", symbol: I.symbol, flag: "production_started" }));
  304.  
  305. // EXTENDER :: Modification
  306. if (typeof callback == "function") {
  307. callback();
  308. }
  309. }
  310. });
  311. }
  312. };
  313. log("Do production and call callback if any. Inject superior materials condition.", "initialize");
  314.  
  315. buildTimerUpdate = function(c, a, b) {
  316. $("#timer-" + c).html(renderBuildTime(a));
  317. $("#timer-panel-" + c).html(renderBuildTime(a));
  318.  
  319. percent = 100 - 100 * (a / b);
  320. $("#progress-" + c).html('<span style="width:' + percent + '%;"></span>');
  321.  
  322. var d = buildingById(c);
  323. d.build_remaining = a;
  324. markup = renderBuildPanelAction(d);
  325.  
  326. $("#speed_button_" + c).show();
  327. $("#build_panel_action_" + c).html(markup);
  328. $("#production_timer_" + c).html(renderBuildTime(d.build_remaining, true));
  329. $("#production_timer_upper_" +
  330. c).html(renderBuildTime(d.build_remaining));
  331. $("#production_progress_" + c).css({ width: percent + "%" });
  332. $("#duration_long_" + c).html(durationLong(buildTimerDescription(d), a, b));
  333. a--;
  334. userContext.doBuildId == c && (300 >= a ?
  335. ($("#speed_up_skip_block").hide(),
  336. $("#speed_up_skip_use").show()) :
  337. ($("#speed_up_skip_use").hide(),
  338. $("#speed_up_skip_block").show()),
  339. $(".speed_building_" + c).html() != renderSpeedUpButton(c) && $(".speed_building_" + c).html(renderSpeedUpButton(c)));
  340.  
  341. d.cooldown = a;
  342. d.original_cooldown_seconds = b;
  343. displayBuildingCooldown(d);
  344. 0 < a || (closeSpeedUp(), finalizeBuildingConstruction(d), clearBuildingTimer(d.symbol));
  345.  
  346. // EXTENDER :: Modification REVISE
  347. if (a == 300 - 1) {
  348. doInstantSpeedUp(c, false, function() {
  349. setTimeout(function() {
  350. doFinishProduction(d.item_id);
  351. }, (extender_queueDelay / 2) * 1000);
  352.  
  353. setTimeout(function() {
  354. var el = getElement(d.symbol);
  355. if (el) {
  356. executeElement(el);
  357. }
  358. }, extender_queueDelay * 1000);
  359. });
  360. } else if (a < 300 - 10) {
  361. doInstantSpeedUp(c, false, function() {
  362. doFinishProduction(d.item_id);
  363. });
  364. }
  365. };
  366. log("Build custom timer update. Speed up and finish automatically, grab production item if any and execute.", "initialize");
  367.  
  368. doCollect = function(c) {
  369. lock_name = "collect-" + c;
  370. if (userLock(lock_name)) {
  371. var a = buildingByItemId(c);
  372. 0 < predictCollect(a) && (playSound("coins"), isWeb() && animatedCoins.init($("#collectbtn"), $("#silver"), [-10, -40], [-72, -44]));
  373. uiEvent("collect_" + buildingSymbolFromItemId(c), userContext.PlayerData);
  374. the_url = "/play/collect_building/" + c + "?client_seqnum=" + userContext.player_data_seqnum;
  375.  
  376. isWeb() || showSpinner();
  377. $.ajax({
  378. url: the_url,
  379. dataType: "JSON",
  380. success: function(b) {
  381. freeLock(lock_name);
  382. doLog("doCollect: building_id=" +
  383. c + " data.money=" + b.money);
  384. updateSilver(b.money);
  385. updateBaseTime(b.base_time);
  386. a.last_collected_at = b.last_collected_at;
  387. userContext.playerData.stat.buildings_collected = b.buildings_collected;
  388. userContext.playerData.stat.onboarding = b.onboarding;
  389. isWeb() || (iosSignal("building_collected"), hideSpinner());
  390. isWeb() && $("#collect_" + a.symbol).html(renderUpgradeCollect(a));
  391. buildingUpgradePanel(a.symbol);
  392. b = renderBuildingOwned(a);
  393. isWeb() && $("#bc_" + a.id).html(b);
  394. updateAllStatus();
  395. questListings();
  396.  
  397. // EXTENDER :: Modification
  398. closeModalLarge('modal_dialogs_top');
  399. }
  400. });
  401. }
  402. };
  403. log("Close dialog when silver is collected.", "initialize");
  404.  
  405. claimDaily = function() {
  406. showSpinner();
  407. $.ajax({
  408. url: "/play/advice_claim_daily",
  409. dataType: "JSON",
  410. success: function(c) {
  411. console.debug("Logging response from the server: ", c);
  412. hideSpinner();
  413.  
  414. // EXTENDER :: Modification
  415. // bugfix: undefined silver and gold
  416. if (c.status && c.status == "OK") {
  417. return;
  418. }
  419.  
  420. $("#claimed_holder").html("<h5>Claimed</h5>");
  421. updateSilver(c.total_silver);
  422. updateGold(c.total_gold);
  423. $(".claimrewardchest").hide();
  424. $("#daily_reward_statview").html(itemStatViewFromSymbol(c.item, { produce: "Continue", produce_callback: "welcomeClaimed" }));
  425. $("#dailynewsbtn").removeClass("btnglow");
  426.  
  427. var a = buildingBySymbol("keep");
  428. userContext.playerData.stat.daily_streak_claimed = userContext.playerData.stat.daily_streak;
  429. a && $("#bc_" + a.id).html(renderBuildingOwned(a));
  430. isWeb() || iosSignal("daily_reward_claimed", null, c.item);
  431.  
  432. // EXTENDER :: Modification
  433. $(".welcomemodal").hide();
  434. }
  435. });
  436.  
  437. return false;
  438. };
  439. log("Claim daily updates money only if claimed. Close when ready.", "initialize");
  440.  
  441. finishAll = function() {
  442. log("Checking buildings...");
  443.  
  444. var btn = $("#extender_finishBtn a");
  445. if (btn && btn.length > 0) btn.text("Finishing...");
  446.  
  447. for (var i = 0; i < userContext.buildingsData.length; i++) {
  448. var b = userContext.buildingsData[i];
  449. if(b.symbol === "keep"){
  450. continue;
  451. }
  452.  
  453. if (buildingFinished(b)) {
  454. log("Attempt to finish production on " + b.symbol);
  455. doFinishProduction(b.item_id, finishAll);
  456. return;
  457. }
  458. }
  459.  
  460. if (btn && btn.length > 0) btn.text("Finished");
  461. log("All buildings are now finished.");
  462. inform('Done');
  463. };
  464. log("Finish all buildings whole different way, make use of doFinish callback.", "initialize");
  465.  
  466. applySelectedUpgrade = function(c, a, callback) {
  467. lock_name = "upgrade-" + c.id;
  468. userContext.lastFinish = null;
  469.  
  470. var b;
  471.  
  472. if (0 < c.gold && null == a)
  473. doGoldUnlock(c.id, function() {
  474. applySelectedUpgrade(c, true, callback);
  475. });
  476. else if (hasMoney(c.silver, function() {
  477. applySelectedUpgrade(c, a, c.silver);
  478. }) && userLock(lock_name)) {
  479. var d = buildingUpgradeResourceCheck(c.building_id, c.id);
  480. if (isWeb()) {
  481. if (null != d.markup && "" != d.markup) {
  482. doAlert("Resources Required", "You need additional resources to construct that upgrade:<p/>" + d.markup);
  483. return false;
  484. }
  485. } else if (null !=
  486. d.strMissingComponentText) {
  487. if (isAndroid()) {
  488. iosSignal("building", "upgrade_fail", d);
  489. return false;
  490. }
  491. return d;
  492. }
  493. b = d.item;
  494. playSound("build");
  495. var g = buildingById(c.building_id);
  496. itemFromSymbol(g.symbol);
  497. d = extractItemBySymbol(userContext.playerData.inventory, g.symbol).upgrade_level - 1;
  498. 0 > d && (d = 0);
  499. userContext.buildIndex++;
  500. g.build_progress = 0;
  501. g.producing_archetype_id = b.id;
  502. $.ajax({
  503. url: "/play/apply_upgrade/" + c.id,
  504. dataType: "JSON",
  505. success: function(result) {
  506. freeLock(lock_name);
  507. if (result.resource_list)
  508. for (var i = 0; i < result.resource_list.length; i++) {
  509. var m =
  510. extractItemBySymbol(playerInventory, result.resource_list[i]);
  511. m && (m.quantity -= parseInt(result.resource_quantities[i]));
  512. }
  513. updateSilver(result.money);
  514. updateBaseTime(result.base_time);
  515. userContext.playerData.stat.onboarding = result.onboarding;
  516. userContext.playerData.stat.building_upgrades_added = result.building_upgrades_added;
  517. g.build_remaining = result.build_remaining;
  518. g.original_build_seconds = result.original_build_seconds;
  519. displayBuildingCooldown(g);
  520. isWeb() && buildingUpgradePanel(g.symbol);
  521. result = renderBuildingConstruction(g);
  522. $("#bc_" + g.id).html(result);
  523. uiEvent("add_" +
  524. userContext.activeBuildingPanel, userContext.PlayerData);
  525. selectedUpgrade = extractItemBySymbol(playerInventory, b.symbol);
  526. q_upgrade = 1;
  527. selectedUpgrade && (q_upgrade = selectedUpgrade.quantity + 1);
  528. $("#addbtn_container").html(addButtonUpgrade(b, false, q_upgrade));
  529. isWeb() ? selectUpgrade(userContext.activeUpgrade) : iosSignal("building", "cooldown", mobileCooldownData({ mode: "building", symbol: g.symbol, flag: "production_started" }));
  530. questListings();
  531. analytics.track("Building Apply-Upgrade", {
  532. building: userContext.activeBuildingPanel,
  533. upgrade: itemData[itemById[c.id]].symbol,
  534. cost: itemData[itemById[c.id]].cost
  535. });
  536. analytics.wizardtrack("Building Apply-Upgrade", { building: userContext.activeBuildingPanel, upgrade: itemData[itemById[c.id]].symbol, cost: itemData[itemById[c.id]].cost }); // EXTENDER :: Modification
  537.  
  538. // EXTENDER :: Modification
  539. if (typeof callback == "function") {
  540. callback();
  541. }
  542. }
  543. });
  544. }
  545.  
  546. return false;
  547. };
  548. log("Do upgrade and call callback function.", "initialize");
  549.  
  550. speedBuild = function speedBuild(c, a, callback) {
  551. $("#modal_dialogs_top2").hide();
  552. doLog("speedBuild: speed_item=" + c + " item_id=" + a);
  553. $.ajax({
  554. url: "/play/build_now/" + a + "?complete=" + c,
  555. dataType: "JSON",
  556. success: function(b) {
  557. //console.debug("Logging server response for speedBuild: ", b);
  558.  
  559. userContext.playerData.user.money = b.user.money;
  560. userContext.playerData.stat.onboarding = b.stat.onboarding;
  561. userContext.playerData.chapter = b.chapter;
  562. var d = buildingById(a, b.building);
  563. doLog("speedBuild: speed_item:");
  564. doLog(b.speed_item);
  565. b.speed_item && insertInventoryFromItem(userContext.playerData.inventory,
  566. b.speed_item);
  567. insertInventoryFromItem(userContext.playerData.inventory, b.produced_item);
  568. logLastItem("speedBuild:A");
  569. userContext.buildingsData && (userContext.playerData.buildings = userContext.buildingsData);
  570. playerInventory && (userContext.playerData.inventory = playerInventory);
  571. userContext.chapterData = b.chapter;
  572. d && (analytics.track("SpeedUp-Building", { building: d.symbol, speed_item: c }), analytics.wizardtrack("SpeedUp-Building", { building: d.symbol, speed_item: c }));
  573. userContext.buildIndex++;
  574. logLastItem("speedBuild:B");
  575. finalizeBuildingConstruction(d);
  576. 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)),
  577. $("#build_panel_action_" + d.id).html(renderBuildPanelAction(d)), $("#speed_button_" + d.id).hide());
  578. renderBuildingsOnScreen(userContext.playerData);
  579. d && uiEvent("building_panel_" + d.symbol);
  580.  
  581. // EXTENDER :: Modification
  582. if (typeof (callback) == "function") {
  583. callback();
  584. }
  585. }
  586. });
  587. };
  588. log("Speed build is what actually calls the callback (not doInstantSpeedUp).", "initialize");
  589.  
  590. doAdventure = function doAdventure(c, a, b, callback) {
  591. //console.debug("First passed parameter: ", c);
  592. // EXTENDER : Modfification
  593. if (userContext.setSwornSword && userContext.setSwornSword.damage && userContext.setSwornSword.damage == 4) {
  594. warn("Sworn sword has 4 wounds. Adventure will not continue.");
  595. return;
  596. }
  597.  
  598. //console.debug("Logging parameters of doAdventure: ", c, a, b);
  599.  
  600. if (void 0 != userContext.setSwornSword && void 0 != userContext.setSwornSword.batch_type && 0 != userContext.setSwornSword.batch_type)
  601. return 1 == userContext.setSwornSword.batch_type && (!1 == b && prepareAdvPartyTimeout(), $.ajax({
  602. url: "/play/batch_set_sworn_sword_target?batch_type=1&ss_id=" + userContext.setSwornSword.id + "&batch_action=" + a + "&target_symbol=" + c,
  603. dataType: "JSON",
  604. success: function(a) {
  605. questClose();
  606. showAdvPartyResponse(a);
  607. uiEvent("ss_adventure_party");
  608. return !0;
  609. },
  610. error: function(b) {
  611. 400 ==
  612. b.status ? advPartyFail() : 409 == b.status ? setTimeout(function() { doAdventure(c, a, !0); }, 5E3) : spinTimeout();
  613. }
  614. })), !1;
  615. $.ajaxQueue({
  616. url: "/play/adventure/" + userContext.setSwornSword.id + "?action_name=" + a + "&symbol=" + c,
  617. dataType: "JSON",
  618. success: function(b) {
  619. //analytics.track("Adventure Start", { adventure_region: b.location, adventure_action: a, adventure_swornsword_id: userContext.setSwornSword.id, adventure_swornsword_level: userContext.setSwornSword.ugprade_level });
  620. //analytics.wizardtrack("Adventure Start", {
  621. // adventure_region: b.location,
  622. // adventure_action: a,
  623. // adventure_swornsword_id: userContext.setSwornSword.id,
  624. // adventure_swornsword_level: userContext.setSwornSword.ugprade_level
  625. //});
  626.  
  627. if (b.symbol) {
  628. adventureProgress(userContext.setSwornSword.id, b);
  629. uiEvent("do_adventure");
  630. "1" == userContext.playerData.stat.onboarding_ftue && uiTelemetry("ss_adventure");
  631. }
  632.  
  633. // EXTENDER :: Modification
  634. if (typeof callback == "function") {
  635. userContext.setSwornSword.not_on_adventure = !b.symbol;
  636.  
  637. callback(!b.symbol);
  638. }
  639. }
  640. });
  641. };
  642. log("Don't do adventure if sworn sword is about to die. Call callback when ready (bruting).", "initialize");
  643.  
  644. playSound = function playSound(a, d) {
  645. if (!1 != doSound())
  646. if ($.browser.msie || doLog("playSound [1]: " + a), !1 == soundEnabled) $.browser.msie || doLog("playSound [1]: sound disabled");
  647. else {
  648. void 0 == d && (d = 0);
  649. musicMuted = userContext.mute_music;
  650. soundMuted = userContext.mute_sound;
  651. try {
  652. if (-1 != a.indexOf("voice-") && ($.browser.msie || doLog("play voiceover"), soundMapChannel[a] = "voice"), theUrl = soundMap[a], void 0 == soundMapChannel[a] && (soundMapChannel[a] = "channel1"), isWeb()) {
  653. if ($.browser.msie || doLog("playSound[2]: " +
  654. a + " soundReady=" + soundReady), !0 == soundReady) {
  655. $.browser.msie || doLog("soundReady: " + soundMapChannel[a]);
  656. play_it = !0;
  657. if ("music" == soundMapChannel[a]) {
  658. if (0 == musicVolume || !0 == musicMuted) play_it = !1;
  659. vol = musicVolume;
  660. $.browser.msie || doLog("MUSIC vol=" + vol);
  661. } else {
  662. if (0 == soundVolume || !0 == soundMuted) play_it = !1;
  663. vol = soundVolume;
  664. $.browser.msie || doLog("SOUND vol=" + vol);
  665. }
  666. if ("channel1" == soundMapChannel[a] || "channel2" == soundMapChannel[a] || "channel3" == soundMapChannel[a] || "channel4" == soundMapChannel[a] ||
  667. "channel5" == soundMapChannel[a] || "music" == soundMapChannel[a] || "voice" == soundMapChannel[a] || "voice2" == soundMapChannel[a])
  668. 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); }));
  669. else if (sound_url = assetUrl() + theUrl, $.browser.msie || doLog("SOUND: play_it=" + play_it), !0 != play_it)
  670. $.browser.msie ||
  671. doLog("SOUND: returning");
  672. else {
  673. "music" == soundMapChannel[a] && (doLog("currentMusic = " + currentMusic), currentMusic = a);
  674. $.browser.msie || doLog("SOUND: createSound");
  675. soundObject = soundManager.createSound({
  676. id: soundMapChannel[a],
  677. url: theUrl,
  678. volume: vol,
  679. onfinish: function() {
  680. $.browser.msie || doLog("soundObject.onfinish: id=" + a + " soundMapChannel=" + soundMapChannel[a]);
  681. soundChannel[soundMapChannel[a]] = !1;
  682. soundManager.destroySound(soundMapChannel[a]);
  683. "music" == soundMapChannel[a] && (0 < musicVolume && !0 !=
  684. userContext.mute_music) && playSound(a);
  685. }
  686. });
  687. if (null == soundObject || void 0 == soundObject) $.browser.msie || doLog("soundObject: invalid");
  688. !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()));
  689. }
  690. else
  691. 0 < vol && ($.browser.msie || doLog("playing [3]: [" +
  692. soundMapChannel[a] + "] vol=" + vol), soundManager.getSoundById(soundMapChannel[a]).setVolume(vol), soundManager.getSoundById(soundMapChannel[a]).volume = vol, soundManager.play(a));
  693. }
  694. } else iosSignal("playsound", soundMapChannel[a] + ":" + soundMap[a].substring(soundMap[a].lastIndexOf("/") + 1) + ":" + d);
  695. } catch (e) {
  696. $.browser.msie || doLog("playSound exception: " + e);
  697. }
  698. }
  699. };
  700. log("Cleared playSound from console logging.", "initialize");
  701.  
  702. submitWorldEventAction = function submitWorldEventAction(c, a, b) {
  703. console.debug("Submitting world event action, " +
  704. "sworn sword id: " + c + ", order: " + a + ", weakness attack? " + b);
  705.  
  706. showSpinner();
  707. data = { sworn_sword_id: c, order: a };
  708. !0 == b && (data.weakness_attack = b);
  709. $.ajax({
  710. url: "/play/world_event_attack",
  711. data: data,
  712. complete: function() {
  713. hideSpinner();
  714. },
  715. success: function(a) {
  716. console.debug("Logging response from the server for sending the sworn sword: ", b);
  717.  
  718. hideSpinner();
  719. a.error && doAlert("Error Sending Swornsword", formatWorldEventError(a.error, a.error_code));
  720. a.swornsword && (insertInventoryFromItem(userContext.playerData.inventory, a.swornsword), doItemCooldown(a.swornsword));
  721. a.challenge && updateWorldEventChallenge(a.challenge);
  722. !0 == a.show_outmaneuver_alert &&
  723. 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" });
  724. }
  725. });
  726. };
  727. log("Analyzing world event action.", "initialize");
  728.  
  729. getWorldEventAttackResults = function getWorldEventAttackResults(c, a, loop) {
  730. console.debug("Getting world event attack result, " +
  731. "sworn sword id: " + c + ", refresh? " + a + " and then loop? " + loop);
  732.  
  733. showSpinner();
  734. $.ajax({
  735. url: "/play/world_event_attack_results",
  736. data: { sworn_sword_id: c },
  737. complete: function() {
  738. hideSpinner();
  739. },
  740. success: function(b) {
  741. hideSpinner();
  742.  
  743. console.debug("Logging response from the server from world event attack: ", b);
  744. console.debug("Got response, repeat event condition: " +
  745. "loop? " + loop + ", response contains sworn sword? " + (b.swornsword) + ", response contains an action parameter? " + (b.action));
  746.  
  747. if (loop && b.swornsword && b.action) {
  748. submitWorldEventAction(b.swornsword.id, b.action, false);
  749. console.debug("Submit a new world event action with parameters: ", b.swornsword.id, b.action, false);
  750. }
  751.  
  752. b.error
  753. ? doAlert("Error Getting Results", formatWorldEventError(b.error, b.error_code))
  754. : (b.swornsword && (insertInventoryFromItem(userContext.playerData.inventory, b.swornsword), doItemCooldown(b.swornsword)),
  755. b.character && (userContext.playerData.stat.level_progress = b.xp_after, userContext.playerData.character = b.character,
  756. 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>',
  757. { data: b }), $(".weordercomplete").html(b).show()) : iosSignal("we", "viewSSResult", b), a && refreshWorldEventChallenge());
  758. }
  759. });
  760. };
  761. log("Logging information from world event action.", "initialize");
  762.  
  763. charCharacterTab = function charCharacterTab() {
  764. $(".lineage").hide();
  765. playerData = userContext.focusData;
  766. //console.debug("Logging player data: ", playerData);
  767. markup = "";
  768. markup += '\t\t\t\t<div class="stoneridge" id="charactertop">';
  769. markup += '\t\t\t\t\t<div class="left35">';
  770. markup += '\t\t\t\t\t\t<div class="charframe">';
  771. markup += '\t\t\t\t\t\t\t<div class="portraitimage"><img src="' + playerData.portrait_pic + '" /></div>';
  772. markup += '\t\t\t\t\t\t\t<div id="character_sheet_portrait" class="charframe-lg"></div>';
  773.  
  774. // EXTENDER :: Modification
  775. markup += formatStats(playerData.got_battle, playerData.got_trade, playerData.got_intrigue, playerData.level);
  776.  
  777. 0 < playerData.id && playerData.id == userContext.playerData.character.id && (markup +=
  778. '\t\t\t\t\t\t\t<a class="lineagebtn" onclick="lineageIncarnationsPage();"></a>');
  779. markup += "\t\t\t\t\t\t</div>";
  780. markup += '\t\t\t\t\t\t<div class="charnameoverlay">';
  781. if (userContext.focusData.user_id == userContext.playerData.character.user_id) {
  782. var c = playerData.title + " ";
  783. if ("male" == userContext.playerData.strings.gender) {
  784. if (1 < userContext.playerData.strings.eligible_titles_male.length) {
  785. c = "";
  786. markup += '\t\t\t\t\t\t\t<div class="selectwrap">';
  787. markup += "\t\t\t\t\t\t\t\t<select id=\"selecttitle\" onchange=\"$('#portrait_name > em').html($('#selecttitle').val());return setTitle('selecttitle',characterModal);\">";
  788. 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>";
  789. markup += "\t\t\t\t\t\t\t\t</select>";
  790. markup += "\t\t\t\t\t\t\t</div>";
  791. }
  792. } else if ("female" == userContext.playerData.strings.gender && 1 < userContext.playerData.strings.eligible_titles_female.length) {
  793. markup += '\t\t\t\t\t\t\t<div class="selectwrap">';
  794. markup += "\t\t\t\t\t\t\t\t<select id=\"selecttitle\" onchange=\"$('#portrait_name > em').html($('#selecttitle').val());return setTitle('selecttitle',characterModal);\">";
  795. c = "";
  796. 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>";
  797. markup += "\t\t\t\t\t\t\t\t</select>";
  798. markup += "\t\t\t\t\t\t\t</div>";
  799. }
  800. markup += "\t\t\t\t\t\t\t<h3><em>" + c + "</em>" + playerData.name + "</h3>";
  801. markup += "\t\t\t\t\t\t</div>";
  802. markup += "\t\t\t\t\t</div>";
  803. markup += '\t\t\t\t\t<div class="center30">';
  804. markup += '\t\t\t\t\t\t<div class="holdingsname">';
  805. 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();"/>');
  806. } else
  807. 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(' +
  808. 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(' +
  809. 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">',
  810. 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>";
  811. markup += "\t\t\t\t\t\t</div>";
  812. markup += '\t\t\t\t\t\t<div class="reviewfealty">\t';
  813. 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="' +
  814. assetUrl() + "/images/banner-" + playerData.fealty.toLowerCase() + '-lg.png?t=fe526f65c954"></img>', markup += " </div>");
  815. markup += "\t\t\t\t\t\t</div>";
  816. markup += '\t\t\t\t\t <div class="reviewbackground">\t';
  817. 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>");
  818. markup +=
  819. "\t\t\t\t\t\t</div>";
  820. 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,
  821. "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>');
  822. 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>");
  823. markup += "\t\t\t\t\t</div>";
  824. markup += '\t\t\t\t\t<div class="right35">';
  825. markup += '\t\t\t\t\t\t<div class="charframe">';
  826. markup += '\t\t\t\t\t\t\t<div class="portraitimage"></div>';
  827. markup += '\t\t\t\t\t\t\t<div class="charframe-lg"></div>';
  828. markup += '\t\t\t\t\t\t\t<div class="charbanner-lg" style="margin-left: -7px;"><img src="' +
  829. playerData.banner + '" /></div>';
  830. markup += '\t\t\t\t\t\t\t<div class="bannerpole-lg"></div>';
  831. 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>");
  832. markup += "\t\t\t\t\t\t</div>";
  833. markup += "\t\t\t\t\t</div>";
  834. markup += '\t\t\t\t\t<div class="stoneridgebtm"></div>';
  835. markup += "\t\t\t\t</div>";
  836. markup += '\t\t\t\t<div class="chargenbox" id="alignment">';
  837. markup += '\t\t\t\t\t<div class="marbletop oldways realm crafty">';
  838. markup += "\t\t\t\t\t\t<h3>Alignment</h3>";
  839. markup += '\t\t\t\t\t\t<div class="alignmenttabs">';
  840. 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>";
  841. 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>";
  842. 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>";
  843. markup += "\t\t\t\t\t\t</div>";
  844. markup += '\t\t\t\t\t\t<div id="alignmentbar-tradition" class="alignmentbar">';
  845. 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>";
  846. 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>";
  847. markup += '\t\t\t\t\t\t\t<div class="aligncenter"></div>';
  848. markup += '\t\t\t\t\t\t\t<div class="alignbar-left" style="width:30%;"><span></span></div>';
  849. markup += '\t\t\t\t\t\t\t<div class="alignbar-right" style="width:5%;"><span></span></div>';
  850. markup += '\t\t\t\t\t\t\t<p class="aligntext-left">Old Ways</p>';
  851. markup += '\t\t\t\t\t\t\t<p class="aligntext-right">New Ways</p>';
  852. markup += "\t\t\t\t\t\t</div>";
  853. markup += '\t\t\t\t\t\t<div id="alignmentbar-duty" class="alignmentbar" style="display:none;">';
  854. 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>";
  855. 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>";
  856. markup += '\t\t\t\t\t\t\t<div class="aligncenter"></div>';
  857. markup += '\t\t\t\t\t\t\t<div class="alignbar-left" style="width:45%"><span></span></div>';
  858. markup += '\t\t\t\t\t\t\t<div class="alignbar-right" style="width:15%"><span></span></div>';
  859. markup += '\t\t\t\t\t\t\t<p class="aligntext-left">Family</p>';
  860. markup += '\t\t\t\t\t\t\t<p class="aligntext-right">Realm</p>';
  861. markup += "\t\t\t\t\t\t</div>";
  862. markup += '\t\t\t\t\t\t<div id="alignmentbar-integrity" class="alignmentbar" style="display:none;">';
  863. 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>";
  864. 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>";
  865. markup += '\t\t\t\t\t\t\t<div class="aligncenter"></div>';
  866. markup += '\t\t\t\t\t\t\t<div class="alignbar-left" style="width:25%"><span></span></div>';
  867. markup += '\t\t\t\t\t\t\t<div class="alignbar-right" style="width:40%"><span></span></div>';
  868. markup += '\t\t\t\t\t\t\t<p class="aligntext-left">Cunning</p>';
  869. markup += '\t\t\t\t\t\t\t<p class="aligntext-right">Truthful</p>';
  870. markup += "\t\t\t\t\t\t</div>";
  871. markup += "\t\t\t\t\t</div>";
  872. markup += "\t\t\t\t</div>";
  873. markup += '\t\t\t\t<div id="alignment_tips">';
  874. for (x = 0; x < alignmentData.length; x++)
  875. markup +=
  876. '<div id="tip_alignment_' + alignmentData[x].symbol + '" style="top: -240px; left: -130px; position: relative"></div>';
  877. markup += " </div>";
  878. markup += '\t\t\t\t<div class="chargenbox" id="activity">';
  879. markup += '\t\t\t\t\t<div class="marbletop">';
  880. markup += "\t\t\t\t\t\t<h3>Recent Activity</h3>";
  881. if (void 0 == playerData.recent_activity) markup += " <p>No recent activity to display.</p>";
  882. else if (0 == playerData.recent_activity.length) markup += " <p>No recent activity to display.</p>";
  883. else {
  884. for (a =
  885. 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>";
  886. 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>');
  887. }
  888. markup += "\t\t\t\t\t</div>";
  889. markup += "\t\t\t\t</div>";
  890. markup += '\t\t\t\t<div id="charbtmbar">';
  891. markup += '\t\t\t\t\t<div class="househr"></div>';
  892. markup += "\t\t\t\t</div>";
  893. $("#chargenmain").removeClass("stats");
  894. $("#chargenmain").html(markup);
  895. userContext.focusData.user_id != userContext.playerData.character.user_id && $(".frnd-" + userContext.focusData.friend_status).show();
  896. alignments = ["tradition", "integrity", "duty"];
  897. tips_markup = "";
  898. for (a = 0; a < alignments.length; a++)
  899. alignment = -1 * playerData["got_" + alignments[a]], 0 < alignment ? ($("#alignmentbar-" + alignments[a] + " > .alignbar-left").css("width", alignment / 100 /
  900. 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-" +
  901. 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());
  902. uiEvent("character");
  903. userContext.focusData.user_id == userContext.playerData.character.user_id && uiEvent("character_self");
  904. };
  905. log("Display additional info in the character tab.", "initialize");
  906.  
  907. inventoryDisplayStatsWithTab = function inventoryDisplayStatsWithTab(c, symbol) {
  908. // EXTENDER :: Modification, useless junk,
  909. // use this function as it appears to work better
  910. c = extractItemById(playerInventory, c);
  911. if (c && c.id == 0 && typeof symbol != "undefined") {
  912. statViewFromMini(symbol);
  913. return;
  914. }
  915.  
  916. "unit" == c.slot
  917. ? inventorySubTab("companion")
  918. : inventorySubTab(c.slot);
  919.  
  920. inventoryDisplayStats(void 0, void 0, c, void 0, !0);
  921. };
  922. log("Use alternative function for item popup if the initial fails.", "initialize");
  923.  
  924. inventoryTab = function inventoryTab(c) {
  925. $("#statview_container_right").html("");
  926. $("#statview_container").html("");
  927. $(".characterview").hide();
  928. $("." + c + "view").show();
  929. $("#swornswordstab_inner").removeClass("active");
  930. $("#foodtab_inner").removeClass("active");
  931. $("#charactertab_inner").removeClass("active");
  932. $("#boonstab_inner").removeClass("active");
  933. $("#resourcestab_inner").removeClass("active");
  934. $("#sealtab_inner").removeClass("active");
  935. $("#gearinvtab_inner").removeClass("active");
  936. $("#companionsinvtab_inner").removeClass("active");
  937.  
  938. //EXTENDER :: Modification
  939. $("#permanentitemstab_inner").removeClass("active");
  940.  
  941. $("#inventorybtm").removeClass("character");
  942. $("#weapontab").hide();
  943. $("#armortab").hide();
  944. $("#companiontab").hide();
  945. $("#swordcompaniontab").hide();
  946. $("#inventory-listing").hide();
  947. var a = [], b = void 0;
  948.  
  949. // EXTENDER :: Clarification
  950. if ("character" == c) {
  951. $("#inventorybtm").addClass("character");
  952. $("#weapontab").show();
  953. $("#armortab").show();
  954. $("#companiontab").show();
  955. equipContextPrefix = equipContextTarget = "character";
  956. equipContextPosition = "right";
  957. $("#inventory_toolbar_Weapon").show();
  958. } else if ("swornswords" == c) {
  959. $("#inventorybtm").addClass("character");
  960. first_sworn = extractFirstSwornSword(playerInventory);
  961. inventoryDisplayStatsRight(void 0, void 0, first_sworn);
  962. $("#weapontab").show();
  963. $("#armortab").show();
  964. $("#swordcompaniontab").show();
  965. equipContextPrefix = "item";
  966. $("#inventory_toolbar").show();
  967. b = "Sworn Sword";
  968. a.push(b);
  969. } else if ("boons" == c) {
  970. first_boon = extractFirstBoon(playerInventory);
  971. inventoryDisplayStatsRight(void 0, void 0, first_boon);
  972. $("#inventory_toolbar").hide();
  973. b = "Boon";
  974. a.push(b);
  975. } else if ("food" == c) {
  976. first_consumable = extractFirstConsumable(playerInventory);
  977. inventoryDisplayStatsRight(void 0, void 0, first_consumable);
  978. $("#inventory_toolbar").hide();
  979. b = "Consumable";
  980. a.push(b);
  981. } else if ("seal" == c) {
  982. first_seal = extractFirstSeal(playerInventory);
  983. inventoryDisplayStatsRight(void 0, void 0, first_seal);
  984. $("#inventory_toolbar").hide();
  985. b = "Seal";
  986. a.push(b);
  987. } else if ("resources" == c) {
  988. first_resource = extractFirstTreasure(playerInventory);
  989. inventoryDisplayStatsRight(void 0, void 0, first_resource);
  990. $("#inventory_toolbar").hide();
  991. b = "Treasure";
  992. a.push(b);
  993. } else if ("gearinv" == c) {
  994. first_gearinv = extractFirstGear(playerInventory);
  995. inventoryDisplayStatsRight(void 0, void 0, first_gearinv);
  996. $("#inventory_toolbar").hide();
  997. b = "Weapon, Armor";
  998. a.push("Weapon");
  999. a.push("Armor");
  1000. } else if ("companionsinv" == c) {
  1001. first_companionsinv = extractFirstCompanion(playerInventory);
  1002. inventoryDisplayStatsRight(void 0, void 0, first_companionsinv);
  1003. $("#inventory_toolbar").hide();
  1004. b = "Companion, Unit";
  1005. a.push("Companion");
  1006. a.push("Unit");
  1007. } else if ("permanentitems" == c) {
  1008. b = "pass please";
  1009. }
  1010.  
  1011. doLog("inventoryTab: category=" + c + " listing_slot=" + b);
  1012.  
  1013. //console.debug("Logging pre display of storage: ", a);
  1014.  
  1015. if (void 0 != b) {
  1016. initPagination(c, 6);
  1017.  
  1018. for (var d = !1, g = [], p = "", f = 0; f < playerInventory.length; f++) {
  1019. // EXTEDNER :: Modification, clarification
  1020. if (c === "permanentitems" && playerInventory[f].permanent_item) {
  1021. g.push(playerInventory[f]);
  1022. continue;
  1023. }
  1024.  
  1025. for (var m = 0; m < a.length; m++) {
  1026. if (playerInventory[f].slot == a[m]) {
  1027. g.push(playerInventory[f]);
  1028. }
  1029. }
  1030. }
  1031.  
  1032. 0 == g.length && (d = !0);
  1033.  
  1034. //console.debug("Logging array to be displayed: ", g);
  1035.  
  1036. p += "<div id='mv_container'></div>";
  1037.  
  1038. "character" == c
  1039. ? $("#inventory-listing").html(p).hide()
  1040. : !0 == d ? "swornswords" == c
  1041. ? $("#inventory-listing").html('You have no sworn swords. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to hire one.').show()
  1042. : "food" == c
  1043. ? $("#inventory-listing").html('You have no Food. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase some.').show()
  1044. : "boons" == c
  1045. ? $("#inventory-listing").html('You have no Boons. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase one.').show()
  1046. : "seal" == c
  1047. ? $("#inventory-listing").html("You have no Seals. Earn seals from PtP.").show()
  1048. : "gearinv" == c
  1049. ? $("#inventory-listing").html('You have no Gear. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase some.').show()
  1050. : "companionsinv" == c
  1051. && $("#inventory-listing").html('You have no Companions. Visit the <a class="shop_link" href="#" onclick="return shopModal();">shop</a> to purchase some.').show()
  1052. : $("#inventory-listing").html(p).show();
  1053.  
  1054. d || (
  1055. $.each(g, function(a, b) {
  1056. addPageItem(c);
  1057. itemMiniView(b, {
  1058. callback: inventoryDisplayStatsRight,
  1059. extra_styles: pageStyle(c),
  1060. extra_class: pageClass(c)
  1061. }, "#mv_container");
  1062. }),
  1063. $("#mv_container").append(bookPageNumbers(c))
  1064. );
  1065. }
  1066.  
  1067. $("#" + c + "tab_inner").addClass("active");
  1068. void 0 != b && pageBegin(c);
  1069. };
  1070. log("Render permanent items.", "initialize");
  1071.  
  1072. inventoryModal = function inventoryModal(c, a) {
  1073. closeUpgradePanel();
  1074. uiTelemetry("inventory");
  1075. void 0 == c ? (c = {}, c.storage = a, c.content_loading = !0, showSpinner(), $.ajaxq("gotAjaxQueue", {
  1076. url: "/play/player_data?client_seqnum=" + userContext.player_data_seqnum,
  1077. dataType: "JSON",
  1078. success: function (b) {
  1079. inventoryModal(b, a);
  1080. }
  1081. })) : (c.content_loading = !1, hideSpinner(), setupPlayerData(c, void 0), inventoryTab("character"));
  1082. c.storage = a;
  1083. c.allowseals = !0;
  1084.  
  1085. // EXTENDER :: Modification, inject permanent tab
  1086. var permanentsTab =
  1087. '<span onclick="return clickInventoryTab(\'permanentitems\');" id="permanentitemstab" class="inventorytabwrap">' +
  1088. '<span class="inventorytabedge">' +
  1089. '<a id="permanentitemstab_inner" class="inventorytab">' +
  1090. '<span></span>' +
  1091. 'Permanent' +
  1092. '<em></em>' +
  1093. '</a></span></span>';
  1094.  
  1095. 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>',
  1096. {data: c});
  1097. displayModalDialog(b, "character_dialog");
  1098. uiEvent("character_dialog_open");
  1099. !c.content_loading && a && ($("#inventorybtm").hide(), clickInventoryTab("resources"));
  1100. };
  1101. log("Add permanent items tab.", "initialize");
  1102.  
  1103. shopModal = function shopModal(b, a) {
  1104. userContext.playerData.user.new_items = 0;
  1105. updateAllStatus();
  1106. doToolbar("shop");
  1107. closeAlert();
  1108. closeUpgradePanel();
  1109. clearModalDialogs("modal_dialogs_top");
  1110. doLog("shopModal");
  1111. uiTelemetry("shop");
  1112.  
  1113. // EXTENDER :: Modification, default tab: troopsequip
  1114. void 0 == a && (a = "troopsequip");
  1115.  
  1116. if (void 0 == b) {
  1117. var c;
  1118. c = "" + (shopModalHead() + shopModalFoot());
  1119. isWeb() && displayModalDialog(c, void 0, void 0, "min-height: 692px; top: 0px; margin-top: 40px");
  1120. showSpinner();
  1121. $.ajaxQueue({
  1122. url: "/play/shop/",
  1123. dataType: "JSON",
  1124. complete: hideSpinner,
  1125. success: function (c) {
  1126. shopModal(c, a);
  1127. }
  1128. })
  1129. } else
  1130. hideSpinner(),
  1131. updateSilver(b.money),
  1132. updateGold(b.perk_points),
  1133. c = sortShopItems(b.shop),
  1134. userContext.filteredShopData = distrubuteShopItemsToFilteredLists(c),
  1135. userContext.shopFilterIndex = userContext.shopFilterIndex || 0,
  1136. userContext.shopData = userContext.filteredShopData[userContext.shopFilterIndex],
  1137. baseShopTime = parseInt((new Date).getTime() / 1E3),
  1138. b.cost_refresh_shop = 2, b.userContext = userContext,
  1139. b.open_tab = a, b.featuredTabLabel && (phraseText.featured_tab_label = b.featuredTabLabel),
  1140. b.dealsData ? (b.overrideDealsData =[], b.dealsData.map(function (a) {
  1141. b.overrideDealsData.push(a)
  1142. }), b.dealsData = [], b.overrideDealsData.map(function (a) {
  1143. b.dealsData.push(a.symbol);
  1144. a.price_perk_points && (itemFromSymbol(a.symbol).price_perk_points = a.price_perk_points)
  1145. }), 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 =
  1146. 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) {
  1147. b.overridefeaturedItem.push(a)
  1148. }),
  1149. b.featuredItem = [], b.overridefeaturedItem.map(function (a) {
  1150. b.featuredItem.push(a.symbol);
  1151. a.price_perk_points && (itemFromSymbol(a.symbol).price_perk_points = a.price_perk_points)
  1152. })) : b.featuredItem = shopSetDealData("featured_items"), userContext.shopMetadata = b, drawShopModal(userContext.shopMetadata)
  1153.  
  1154. // EXTENDER :: Modification - add custom filter
  1155. if(shopFilters.indexOf("extender") == -1)
  1156. shopFilters.push("extender");
  1157.  
  1158. if(userContext.filteredShopData)
  1159. userContext.filteredShopData[shopFilters.indexOf("extender")]
  1160. = sortShop(userContext.filteredShopData[0].slice(0));
  1161.  
  1162. phraseText["shop_filter_extender"] = "Extender";
  1163. // End of modification
  1164. };
  1165. log("Sort shop.", "initialize");
  1166.  
  1167. function hasGold(b, a, c) {
  1168. // EXTENDER :: Modification, the short answer is no
  1169. if (b > 0 && extender_neverSpendGold) {
  1170. return false;
  1171. }
  1172.  
  1173. if (0 < b) {
  1174. void 0 == c && (c = !1);
  1175. doLog("hasGold: cost=" + b + " [player perk_points=" + userContext.playerData.user.perk_points + "]");
  1176. if (b > userContext.playerData.user.perk_points) return currencyModal("gold"), iosSignal("purchase", "need_gold"), !1;
  1177. if (2 == (userContext.playerData.user.options_mask & 2) && !1 == c)
  1178. return dialogAlert({
  1179. style: "confirm",
  1180. button1: "Okay",
  1181. button1_action: function() {
  1182. closeAlert();
  1183. a();
  1184. },
  1185. button2: "Cancel",
  1186. heading: jsTranslate("Spend %{val} Gold", "val", numberWithDelimiter(b)),
  1187. text: jsTranslate("Please confirm that you wish to spend %{val} gold.",
  1188. "val", numberWithDelimiter(b)),
  1189. keep_previous: !0
  1190. }), !1;
  1191. }
  1192. return !0;
  1193. };
  1194. log("Never spend gold option.", "initialize");
  1195.  
  1196. function pvpLaunch(callback) {
  1197. json = { pvp: {} };
  1198. json.pvp.target_id = pvpForm.target_id;
  1199. json.pvp.sworn_sword_id = userContext.setSwornSword.id;
  1200. json.pvp.pvp_action_symbol = userContext.currentActionLabel;
  1201. json.pvp.region_symbol = fealtySymbol[pvpForm.target_faction_id];
  1202. pvpForm.sub_region_index = Math.floor(3 * Math.random());
  1203. var b = pvpForm.target_faction_id;
  1204. void 0 == b && (b = userContext.playerData.character.faction_id);
  1205. json.pvp.sub_region_symbol = fealtySubRegions[b][pvpForm.sub_region_index].symbol;
  1206. json.pvp.attack_value = userContext.currentQuest.action_type[userContext.currentActionLabel].attacker_strength;
  1207. json.pvp.defense_value = userContext.currentQuest.action_type[userContext.currentActionLabel].defender_strength;
  1208. false || (showSpinner(),
  1209. $.ajax({
  1210. type: "get",
  1211. url: "/pvps/create",
  1212. data: json,
  1213. dataType: "JSON",
  1214. complete: hideSpinner,
  1215. success: function(a) {
  1216. void 0 == a.error ?
  1217. (pvpForm = {},
  1218. userContext.pvp = a,
  1219. pvpRenderProgress(a),
  1220. insertInventoryFromItem(playerInventory, a.attacker.sworn_sword),
  1221. analytics.track("PvP Start", { pvp_context: "attack", pvp_action: json.pvp.pvp_action_symbol }),
  1222. analytics.wizardtrack("PvP Start", {
  1223. pvp_context: "attack",
  1224. pvp_action: json.pvp.pvp_action_symbol
  1225. }))
  1226. : handleSwornSwordError(a.error);
  1227.  
  1228. // EXTENDER :: Modification, call callback
  1229. // parameter indicates successfull sending
  1230. if (typeof callback == "function") {
  1231. callback(!a.error);
  1232. }
  1233. }
  1234. }));
  1235. }
  1236. log("Player vs player enhanced. Client pvpBan, hilarious.", "initialize");
  1237.  
  1238. var bossChallengeTimout;
  1239. function questSubmit(b, a, c, d, g, k, f) {
  1240. doLog("questSubmit: stage=" + a + " choice=" + c);
  1241. uiEvent("quest_submit_" + b + "_" + a + "_choice_" + c, userContext.playerData);
  1242. userContext.postQuestEvent = "quest_post_" + b + "_" + a + "_choice_" + c;
  1243. userContext.playerData;
  1244. userContext.questActionChoice = c;
  1245. 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);
  1246. void 0 != g ? (b = isWeb() ? b + ("&chat=" + escape($("#" + g).val())) : b + ("&chat=" + escape(g)),
  1247. userContext.hideWarParty = !0) : playSound("page-turn");
  1248. void 0 != k && (userContext.dialogIndex++, userContext.dialogHistory[userContext.dialogIndex] = unescape(k));
  1249. isIpad() && showSpinner();
  1250. $.ajax({
  1251. url: b,
  1252. dataType: "JSON",
  1253. success: function(a) {
  1254. isIpad() && hideSpinner();
  1255. questSubmitCallback(a);
  1256. questById(f).action_taken = !0
  1257.  
  1258. // EXTENDER :: Modification, auto boss challenger
  1259. if (typeof a.actions_remaining == "undefined" || isNaN(a.actions_remaining)){
  1260. log("Not on boss challenge, or the boss challenge is completed", "BOSS");
  1261. return;
  1262. }
  1263. if(!extender_autoBossChallenge){
  1264. log("Boss challenge is not automated. Exiting...", "EXTENDER");
  1265. return;
  1266. }
  1267. log("Boss challenge automated. Actions remaining: " + a.actions_remaining + "," +
  1268. "stage: " + a.stage, "BOSS");
  1269.  
  1270. if(a.stage && a.stage === 1000){
  1271. log("Boss challenge complete. Exiting...", "BOSS");
  1272. return;
  1273. }
  1274.  
  1275. if (a.actions_remaining > 0) {
  1276. questSubmit(a.symbol, a.stage, c, a.chosen, null, null, a.id);
  1277. } else {
  1278. log("No actions remaining! Adjusting...", "BOSS");
  1279.  
  1280. bossChallengeTimout =
  1281. setTimeout(function() {
  1282. questSubmit(a.symbol, a.stage, c, a.chosen, null, null, a.id);
  1283. }, 3 * 5 * 60 * 1000);
  1284.  
  1285. log("Timer running. Fire again in 15 minutes.", "BOSS");
  1286.  
  1287. }
  1288. }
  1289. });
  1290. return !1;
  1291. }
  1292. log("Boss challenge code injected.", "initialize");
  1293.  
  1294.  
  1295. function doCampAttack(b, a, callback) {
  1296. console.debug("Logging parameters, send camp attack: ", b, a, callback);
  1297. if (!1 == checkParticipation() || !1 == allowCampAttack())
  1298. return !1;
  1299.  
  1300. if (void 0 != userContext.targetAllianceStance && void 0 == a) {
  1301. var c = !1, d = userContext.currentActionLabel;
  1302.  
  1303. if ("fight" == d || "hoodwink" == d || "steal" == d || "sabotage" == d || "hoodwink" == d || "harass" == d) c = !0;
  1304.  
  1305. if (2 == userContext.targetAllianceStance.status && !0 == c)
  1306. return doLog("show alert if you really want to attack your friendly alliance alert"), dialogAlert({
  1307. style: "confirm",
  1308. margin_top: 100,
  1309. button1: "NO",
  1310. button1_action: function() { return closeAlert(); },
  1311. button2: "YES",
  1312. button2_action: function() { doCampAttack(b, !0); },
  1313. heading: "Action Confirmation",
  1314. text: "Remember, this alliance is your friend! Are you certain you want to attack them?"
  1315. }), !1;
  1316. }
  1317.  
  1318. $.ajax({
  1319. url: "/play/camp_attack_begin?id=" + b + "&item_id=" + itemCurrentSelection.id + "&ability=" + userContext.currentActionLabel,
  1320. dataType: "JSON",
  1321. success: function(a) {
  1322.  
  1323. if (a.error) {
  1324. a.swornsword &&
  1325. insertInventoryFromItem(playerInventory, a.swornsword),
  1326. doAlert("Error Attacking Camp", a.error), !1;
  1327.  
  1328. } else {
  1329. campAttackProgress(a.camp_attack.id);
  1330. }
  1331.  
  1332. // EXTENDER :: Modification, call callback
  1333. // parameter indicates successfull sending
  1334. if (typeof callback == "function") {
  1335. callback(a);
  1336. }
  1337. }
  1338. });
  1339. }
  1340. log("Camp attack now calls callback afterwards.", "initialize");

QingJ © 2025

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