Hamer2040

Untitled

Apr 24th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 128.05 KB | None | 0 0
  1. unit gui3_shop;
  2.  
  3. // -----------------------------------------------------------------------------
  4. interface
  5.  
  6. // -----------------------------------------------------------------------------
  7. uses Forms, gui_main, sysutils, controls, cvar, toLanguage, uSoldier,
  8. uItem, tiRenderCloseUpModel, toGame, gui_Utils,
  9. vRender, toItemSession, PowerTypes, gui3_shopinv, game_ShopFilters,
  10. gui3_PrivateStore, Generics.Collections, Generics.Defaults;
  11.  
  12. // -----------------------------------------------------------------------------
  13. type
  14. // -------------------------------------------------------------
  15.  
  16. // -------------------------------------------------------------
  17. PGUIShopItem = ^TGUIShopItem;
  18.  
  19. TGUIShopItem = record
  20. LimitedTime: int64;
  21. Item: TItem;
  22. cash_type: integer;
  23. lot_id: Cardinal;
  24. discount: Byte;
  25. count: integer;
  26. inbox: word;
  27. visible: boolean;
  28. IsPremium: boolean;
  29. end;
  30.  
  31. // -------------------------------------------------------------
  32. TShopVisualMode = (svmList, svmThumbs);
  33.  
  34. TGUINewShopList = class(TGUIControl)
  35. private
  36. fSB: TGUISmartScrollBar;
  37. fItemHeight: integer;
  38. ClientBorder: Cardinal;
  39. fMouseOverItem, fMouseOverExpander, fItemIndex: integer;
  40. fMx, fMy: integer;
  41. fExpandedItemsList: TList<Cardinal>;
  42. fExpandPressed: Cardinal;
  43. fVisualMode: TShopVisualMode;
  44. UpgradeTB, PriceTB: TGUIButton;
  45.  
  46. procedure UpdateHint(const X, Y: integer);
  47. procedure SetVisualMode(const Value: TShopVisualMode);
  48. procedure DrawList(AbsLeft, AbsTop: integer);
  49. procedure DrawThumbs(AbsLeft, AbsTop: integer);
  50. public
  51. fItemList: TList<PGUIShopItem>;
  52. Loading: boolean;
  53. constructor Create(oLeft, oTop, oWidth, oHeight: integer; oParentControl: TGUIControl);
  54. procedure DoDraw; override;
  55. procedure Clear(ForceClear: boolean = false);
  56. procedure DoMouseUp(Button: TMouseButton; X, Y: integer); override;
  57. procedure DoMouseDown(Button: TMouseButton; X, Y: integer); override;
  58. procedure DoMouseMove(Button: TMouseButton; X, Y: integer); override;
  59. procedure DoMouseDoubleClick(X, Y: integer); override;
  60. procedure DoMouseWheelDown; override;
  61. procedure DoMouseWheelUp; override;
  62. procedure DoMouseEnter; override;
  63. procedure DoMouseLeave; override;
  64. procedure UpdateTrk;
  65. procedure Deselect;
  66. function GetSelectedItem: PGUIShopItem;
  67. function GetVisibleCount: Cardinal;
  68. destructor Destroy; override;
  69. property VisualMode: TShopVisualMode read fVisualMode write SetVisualMode;
  70. end;
  71.  
  72. TGUIShop = class(TGUIControl)
  73. protected
  74. fCurIndex: integer;
  75. fitemsHeight: integer;
  76. fUpPressed: boolean;
  77. fDownPressed: boolean;
  78. fScrollPressed: boolean;
  79. OldY: integer;
  80. MouseY: integer;
  81. fTrkTop: integer;
  82. fTrkHeight: integer;
  83. // fOnChanged: tcdeclproc;
  84. fCount: integer;
  85. HideScrollBar: boolean;
  86. TotalHeight: integer;
  87. fMouseInItem: integer;
  88. // scrollbar : TGUIScrollBar;
  89. fFlipScroll: integer;
  90. fCurScroll: integer;
  91. public
  92. filterindex, owner_id: integer;
  93. Loading: boolean;
  94. items: TItems;
  95. property CurIndex: integer read fCurIndex; // write SetCurIndex;
  96. property CurScroll: integer read fCurScroll write fCurScroll;
  97. property TrkTop: integer read fTrkTop write fTrkTop;
  98. property ScrollPressed: boolean write fScrollPressed;
  99.  
  100. constructor Create(oLeft, oTop, oW, oH: integer; oParentControl: TGUIControl);
  101. procedure DoDraw; override;
  102. procedure DoMouseDoubleClick(X, Y: integer); override;
  103. procedure DoMouseUp(Button: TMouseButton; X, Y: integer); override;
  104. procedure DoMouseDown(Button: TMouseButton; X, Y: integer); override;
  105. procedure DoMouseMove(Button: TMouseButton; X, Y: integer); override;
  106. procedure DoMouseWheelDown; override; // DOJ2
  107. procedure DoMouseWheelUp; override;
  108. procedure DoCancelClick; override; // DOJ1
  109. procedure UpdateTrk; virtual;
  110. procedure DoStep2(just_update: boolean);
  111. procedure DoStep; override;
  112. procedure ScrollDown;
  113. procedure Clear;
  114. procedure DeselectItem;
  115. end;
  116.  
  117. // -----------------------------------------------------------------------------
  118. procedure GUI_OpenSpecialShop(Filter: TExternalFilter);
  119. procedure GUI_ShowConsumableShop(shopId : integer);
  120. procedure GUI_AskAndOpenSpecialShop(QuestionCode: string; Filter: TExternalFilter);
  121. procedure GUI_Shop_Show;
  122. procedure Shop_ApplyFilters;
  123. procedure GUI_Shop_SendAllButtonsToReuse;
  124. procedure GUI_Shop_UpdateChar;
  125. procedure GUI_Shop_UpdateOverload(const Wei, Max: int64; const UpdatePosition: boolean = false);
  126. procedure GUI_Shop_GetCurrentWeight(var Wei: word; var Max: word);
  127. procedure GUI3_CreateShopWindow(var oInterface: TGUIInterface);
  128. procedure GUI_Shop_SetPointer(_type, owner_id: Cardinal; _items: TItems);
  129. procedure GUI_Bank_UpdateMoney;
  130. procedure window_shop_filter_Render(X, Y: integer);
  131. procedure gui_stop_click_premium; cdecl;
  132. procedure gui_stop_click_premium1; cdecl;
  133. procedure gui_stop_click_automaticauction; cdecl;
  134. procedure gui_stop_click_spectra_vendor; cdecl;
  135. procedure gui_stop_click_auction; cdecl;
  136. procedure gui_stop_click_dealers; cdecl;
  137. procedure gui_stop_click_mail; cdecl;
  138. procedure gui_stop_buy; cdecl;
  139. procedure Shop_SortNameDown; cdecl;
  140. procedure gui_shop_buy_cred; cdecl;
  141. procedure gui_shop_make_gold; cdecl;
  142. procedure process_adminbutton;
  143. procedure Shop_FilterOff; cdecl;
  144. procedure Shop_FilterSale; cdecl;
  145. procedure Shop_FilterDrops; cdecl;
  146. procedure Shop_FilterCustom; cdecl;
  147.  
  148. // -----------------------------------------------------------------------------
  149. CONST
  150. GOLD_CRED_CONVERT_RATE = 50; // 1*50
  151.  
  152. var
  153. last_shop_type: Byte = 0;
  154. last_shop_is_premium: boolean;
  155. GUI3_ShopItemList: TGUINewShopList;
  156. GUI3_ShopInventory: TShopInventory;
  157.  
  158. // GUI3_FlushFilterBtn : TGUIButton;
  159. // -----------------------------------------------------------------------------
  160. implementation
  161.  
  162. // -----------------------------------------------------------------------------
  163. uses math, Types, gui_wrapperN, Main, gs_pda, gui_window_simplequestion,
  164. netParsePacket, gui3_pdamap, net3_items, exe_wrap, titowns, menu_main,
  165. toItems, gui_hint_items, gui3_inventory, net3_assault, net3_AutomaticAuction,
  166. gui_window_sccart, g_Utils, gui3_Servers, toShowTimeNow, game_TutorialTips,
  167. net3_Checkpoint, gui_window_scshop, graph, MetacodeTemplates, game_Auction,
  168. AffiliateSystem, game_Dealers, game_Replays, game_Mail, game_Bonds, TDJXTextures,
  169. game_BuildOptions, game_Quotation, game_WeightBar, game_SquadPage, toDrop, DateUtils,
  170. game_SharedTypes, game_PlayersAuction, tiPackets, gui_SideHintButton,
  171. game_PremiumAccount, game_SCBOX, game_SpecialAuction, gui_hint, gui_ArtefactBoosters, gui_window_chat,
  172. game_TrueSkill, game_MultiShop;
  173.  
  174. // -----------------------------------------------------------------------------
  175. var
  176. // GUI3_PremiumShopMenu : TButtonMenu;
  177. GUI3_PremiumShopFilter: TGUIShopFilters;
  178. ShopItemType: TShopItemType;
  179. shop_tutorial_area: TGUITutorialTipArea = nil;
  180. shop_count_edt: TGUIEdit;
  181. ExternalFilter: TExternalFilter = nil;
  182. GoToGlobalMap: boolean = true;
  183. ShopBuyBtn: TGUIButton;
  184. TotalRenderArea: TGUIRenderArea;
  185.  
  186. // -----------------------------------------------------------------------------
  187. procedure process_adminbutton;
  188. var
  189. id, i: integer;
  190. begin
  191. id := GUIInterface.FindWindowByName('window_shop');
  192. if (id = -1) then
  193. begin
  194. Exit;
  195. end;
  196.  
  197. if (GUIInterface.Windows[id].ControlsCount > 0) then
  198. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  199. begin
  200. if (GUIInterface.Windows[id].controls[i].Name = 'shop_admin') then
  201. begin
  202. GUIInterface.Windows[id].controls[i].visible :=
  203. (character.AccessLevel >= GameserverSettings.mailAdminAccess) and (ShopItemType <> itCustom);
  204. Exit;
  205. end;
  206. end;
  207. end;
  208.  
  209. // -----------------------------------------------------------------------------
  210. procedure UpdateFiltersTop; cdecl;
  211. var
  212. id, i: integer;
  213. T: integer;
  214. begin
  215. T := 40;
  216. id := GUIInterface.FindWindowByName('window_shop_filter');
  217. if id = -1 then
  218. Exit;
  219.  
  220. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  221. begin
  222. if GUIInterface.Windows[id].controls[i] is TGUIButton then
  223. if GUIInterface.Windows[id].controls[i].visible then
  224. begin
  225. GUIInterface.Windows[id].controls[i].Top := T;
  226. Inc(T, 32);
  227. end;
  228. end;
  229. end;
  230.  
  231. // -----------------------------------------------------------------------------
  232. procedure GuiShopSenderClick(Sender: TGUIControl); cdecl;
  233. var
  234. Shop: TGUINewShopList;
  235. begin
  236. if Sender = nil then
  237. Exit;
  238. if not(Sender is TGUINewShopList) then
  239. Exit;
  240. Shop := (Sender as TGUINewShopList);
  241.  
  242. if (Shop.fItemIndex >= 0) and (Shop.fItemIndex < Shop.fItems.count) then
  243. begin
  244. GUI3_ShopInventory.SetSelectedItem(Shop.fItemList[Shop.fItemIndex].Item);
  245. GUI3_SCCartInventory.SetSelectedItem(Shop.fItemList[Shop.fItemIndex].Item);
  246. end
  247. else
  248. begin
  249. GUI3_ShopInventory.SetNoSelected;
  250. GUI3_SCCartInventory.SetNoSelected;
  251. end;
  252. end;
  253.  
  254. // -----------------------------------------------------------------------------
  255. procedure GUI_Shop_SendAllButtonsToReuse;
  256. var
  257. id, i: integer;
  258. btn: TGUIButton;
  259. begin
  260. id := GUIInterface.FindWindowByName('window_shop_filter');
  261. if id = -1 then
  262. Exit;
  263.  
  264. CharShowTimeStatistic.RECV_Time;
  265.  
  266. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  267. begin
  268. if GUIInterface.Windows[id].controls[i] is TGUIButton then
  269. begin
  270. btn := (GUIInterface.Windows[id].controls[i] as TGUIButton);
  271. btn.reuse_delay := CharShowTimeStatistic.cstTimesCount * 30 + 60;
  272. btn.GoToReuse;
  273. end;
  274. end;
  275. end;
  276.  
  277. // -----------------------------------------------------------------------------
  278. procedure GUI_Shop_GetCurrentWeight(var Wei: word; var Max: word);
  279. var
  280. id, i: integer;
  281. selected_soldier: integer;
  282. begin
  283. selected_soldier := -1;
  284. if (InMainMenu()) then
  285. begin
  286. if (CanUseRenderCloseUpModelSoldier()) then
  287. begin
  288. selected_soldier := RenderCloseUpModel_soldier_id;
  289. end;
  290. end
  291. else
  292. begin
  293. selected_soldier := GetSelectedSoldierID();
  294. end;
  295.  
  296. if (selected_soldier = -1) then
  297. begin
  298. Exit;
  299. end;
  300.  
  301. Wei := soldiers[selected_soldier].weight;
  302. Max := soldiers[selected_soldier].max_weight;
  303.  
  304. if (GUI_WindowVisible('window_exchange')) then
  305. begin
  306. id := GUIInterface.FindWindowByName('window_exchange');
  307. if id = -1 then
  308. Exit;
  309. end
  310. else
  311. begin
  312. id := GUIInterface.FindWindowByName('window_squad_page');
  313. if id = -1 then
  314. Exit;
  315. end;
  316.  
  317. if GUIInterface.Windows[id].ControlsCount > 0 then
  318. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  319. begin
  320. if (GUIInterface.Windows[id].controls[i] is TGUIWeightBar) then
  321. begin
  322. Wei := (GUIInterface.Windows[id].controls[i] as TGUIWeightBar).Position;
  323. Max := (GUIInterface.Windows[id].controls[i] as TGUIWeightBar).Max;
  324. break;
  325. end;
  326. end;
  327. end;
  328.  
  329. // -----------------------------------------------------------------------------
  330. procedure GUI_Shop_UpdateOverload(const Wei, Max: int64; const UpdatePosition: boolean = false);
  331. begin
  332. GUI3_SetOverload('window_shop', Wei, Max, UpdatePosition);
  333. GUI3_SetOverload('window_sccart', Wei, Max, UpdatePosition);
  334. GUI3_SetOverload('window_exchange', Wei, Max, UpdatePosition);
  335. GUI3_SetOverload('window_inventory', Wei, Max, UpdatePosition);
  336. GUI3_SetOverload('window_squad_page', Wei, Max, UpdatePosition);
  337. GUI3_SetOverload('window_mercenaries_selector', Wei, Max, UpdatePosition);
  338. end;
  339.  
  340. // -----------------------------------------------------------------------------
  341. procedure GUI_Shop_UpdateChar;
  342. var
  343. id, i { , k } : integer;
  344. begin
  345. id := MercenariesList_GetSelectedIndex();
  346. if (id = -1) or (not CanUseRenderCloseUpModelSoldier()) then
  347. begin
  348. MercenariesList_SelectPrevious();
  349. end
  350. else
  351. begin
  352. RenderCloseUpModel_SetSource(id);
  353. end;
  354.  
  355. GUI3_ShopInventory.UpdateCharName;
  356. GUI3_SCCartInventory.UpdateCharName;
  357.  
  358. id := GUIInterface.FindWindowByName('window_shop');
  359. if not GUIInterface.Windows[id].visible then
  360. id := GUIInterface.FindWindowByName('window_sccart');
  361. if not GUIInterface.Windows[id].visible then
  362. Exit;
  363. if id = -1 then
  364. Exit;
  365.  
  366. if GUIInterface.Windows[id].ControlsCount > 0 then
  367. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  368. begin
  369. if (GUIInterface.Windows[id].controls[i] is TGUIShop) then
  370. begin
  371. (GUIInterface.Windows[id].controls[i] as TGUIShop).owner_id :=
  372. soldiers[RenderCloseUpModel_soldier_id].obj_id;
  373. // if Assigned((GUIInterface.Windows[id].Controls[i] as TGUIShop).OnSenderClick) then (GUIInterface.Windows[id].Controls[i] as TGUIShop).OnSenderClick((GUIInterface.Windows[id].Controls[i] as TGUIShop));
  374. (GUIInterface.Windows[id].controls[i] as TGUIShop).OnClick.Call;
  375. break;
  376. end;
  377. end;
  378. end;
  379.  
  380. // -----------------------------------------------------------------------------
  381. procedure GUI_Bank_UpdateMoney;
  382. var
  383. id, i: integer;
  384. begin
  385. id := GUIInterface.FindWindowByName('window_bank');
  386. if id = -1 then
  387. Exit;
  388.  
  389. if GUIInterface.Windows[id].ControlsCount > 0 then
  390. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  391. if GUIInterface.Windows[id].controls[i] is TGUILabel then
  392. begin
  393.  
  394. if TGUILabel(GUIInterface.Windows[id].controls[i]).Name = 'cred_count' then
  395. TGUILabel(GUIInterface.Windows[id].controls[i]).caption :=
  396. Format(GetTranslation('ba01'), [inttostr(character.Credits)]);
  397.  
  398. if TGUILabel(GUIInterface.Windows[id].controls[i]).Name = 'goldcred_count' then
  399. TGUILabel(GUIInterface.Windows[id].controls[i]).caption :=
  400. Format(GetTranslation('ba03'), [inttostr(character.GoldCredits)]);
  401.  
  402. end;
  403. end;
  404.  
  405. // -----------------------------------------------------------------------------
  406. procedure GUI_Shop_SetPointer(_type, owner_id: Cardinal; _items: TItems);
  407. var
  408. id, i, j: integer;
  409. scroll_backup, trk_top_backup: integer;
  410. update_needed: boolean;
  411. begin
  412. id := GUIInterface.FindWindowByName('window_shop');
  413. if id = -1 then
  414. Exit;
  415.  
  416. update_needed := last_shop_type = _type;
  417. last_shop_type := _type;
  418.  
  419. if _type = 3 then
  420. GUIInterface.Windows[id].caption := GetTranslation('mn99') + ' - ' + GetTranslation('m117')
  421. else
  422. GUIInterface.Windows[id].caption := GetTranslation('mn99') + ' - ' + GetTranslation('m10' + inttostr(2 + _type));
  423.  
  424. if GUIInterface.Windows[id].ControlsCount > 0 then
  425. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  426. if GUIInterface.Windows[id].controls[i] is TGUIShop then
  427. begin
  428. scroll_backup := TGUIShop(GUIInterface.Windows[id].controls[i]).CurScroll;
  429. trk_top_backup := TGUIShop(GUIInterface.Windows[id].controls[i]).TrkTop;
  430.  
  431. TGUIShop(GUIInterface.Windows[id].controls[i]).Clear;
  432. // TGUIShop(GUIInterface.Windows[id].Controls[i]).
  433.  
  434. SetLength(TGUIShop(GUIInterface.Windows[id].controls[i]).items, Length(_items));
  435. TGUIShop(GUIInterface.Windows[id].controls[i]).items := _items;
  436.  
  437. for j := 0 to high(_items) do
  438. TGUIShop(GUIInterface.Windows[id].controls[i]).items[j] := _items[j];
  439.  
  440. TGUIShop(GUIInterface.Windows[id].controls[i]).UpdateTrk;
  441. TGUIShop(GUIInterface.Windows[id].controls[i]).DoStep;
  442. TGUIShop(GUIInterface.Windows[id].controls[i]).owner_id := owner_id;
  443. TGUIShop(GUIInterface.Windows[id].controls[i]).Loading := false;
  444.  
  445. if (update_needed) then
  446. begin
  447. TGUIShop(GUIInterface.Windows[id].controls[i]).CurScroll := scroll_backup;
  448. TGUIShop(GUIInterface.Windows[id].controls[i]).TrkTop := trk_top_backup;
  449. TGUIShop(GUIInterface.Windows[id].controls[i]).DoStep2(true);
  450. end;
  451. break;
  452. end;
  453. end;
  454.  
  455. // -----------------------------------------------------------------------------
  456. procedure window_shop_filter_Render(X, Y: integer);
  457. begin
  458. if not assigned(Common_Underlay.texture) then
  459. Exit;
  460.  
  461. // )
  462. // Common_Underlay.draw(x,y,$FFFFFFFF, 0,0,0,1,1,False,True);
  463. Renderer_EffectCol(Common_Underlay, X, Y, $FFFFFFFF, 0, 0);
  464. end;
  465.  
  466. // -----------------------------------------------------------------------------
  467. procedure GUI_ShopSetLoading(Loading: boolean);
  468. // var id,i : integer;
  469. begin
  470. GUI3_ShopItemList.Loading := Loading;
  471. GUI_Shop_UpdateChar();
  472. refreshInventory(soldiers[RenderCloseUpModel_soldier_id].obj_id);
  473. end;
  474.  
  475. // -----------------------------------------------------------------------------
  476. procedure gui_standartshopshow; cdecl;
  477. var
  478. id: integer;
  479. begin
  480. GoToGlobalMap := true;
  481. GUI_WindowHideShopGroup;
  482. GUI_WindowShow('window_shop');
  483. GUI_CenterWindowInsidePDA('window_shop');
  484. id := GUIInterface.FindWindowByName('window_shop');
  485. GUIInterface.Windows[id].caption := GetTranslation('mn99');
  486. if GUIInterface.Windows[id].Left < 256 + 82 then
  487. GUIInterface.Windows[id].Left := 256 + 82;
  488. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W then
  489. GUIInterface.Windows[id].Left := SCREEN_W - 80 - GUIInterface.Windows[id].Width;
  490. ShopItemType := itAll;
  491.  
  492. CharShowTimeStatistic.RECV_Time;
  493. // if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.Visible := True and not GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  494. if assigned(GUI3_PremiumShopFilter) then
  495. begin
  496. GUI3_PremiumShopFilter.visible := true;
  497. GUI3_PremiumShopFilter.MACRO_StdShopTypes;
  498. end;
  499.  
  500. SEND_RequestItemShopList(0);
  501. GUI_ShopSetLoading(true);
  502. GUI_Shop_SendAllButtonsToReuse();
  503.  
  504. // if assigned(GUI3_FlushFilterBtn) then GUI3_FlushFilterBtn.Visible := True;
  505. Shop_FilterOff();
  506. shop_tutorial_area.SetTutorialID(TIP_SHOP_SIMPLE);
  507. process_adminbutton();
  508. end;
  509.  
  510. // -----------------------------------------------------------------------------
  511. procedure GUI_OpenSpecialShop(Filter: TExternalFilter);
  512. var
  513. id: integer;
  514. begin
  515. ExternalFilter := Filter;
  516. GoToGlobalMap := false;
  517.  
  518. GUI_WindowHideShopGroup;
  519. GUI_WindowShow('window_shop');
  520. GUI_CenterWindowInsidePDA('window_shop');
  521. id := GUIInterface.FindWindowByName('window_shop');
  522. GUIInterface.Windows[id].caption := GetTranslation('mn99');
  523. if GUIInterface.Windows[id].Left < 256 + 82 then
  524. GUIInterface.Windows[id].Left := 256 + 82;
  525. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W then
  526. GUIInterface.Windows[id].Left := SCREEN_W - 80 - GUIInterface.Windows[id].Width;
  527.  
  528. GUI3_ShopItemList.Clear(true);
  529. ShopItemType := itCustom;
  530.  
  531. CharShowTimeStatistic.RECV_Time;
  532. // if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.Visible := false and not GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  533. if assigned(GUI3_PremiumShopFilter) then
  534. begin
  535. GUI3_PremiumShopFilter.visible := false;
  536. GUI3_PremiumShopFilter.ExternalFilter := Filter;
  537. GUI3_PremiumShopFilter.SelectedFilter := ShopItemType;
  538. end;
  539.  
  540. SEND_RequestItemShopList(0);
  541. SEND_RequestPremiumItemShopList(0);
  542. GUI_ShopSetLoading(true);
  543. GUI_Shop_SendAllButtonsToReuse();
  544.  
  545. // if assigned(GUI3_FlushFilterBtn) then GUI3_FlushFilterBtn.Visible := false;
  546. Shop_FilterCustom;
  547. // shop_tutorial_area.SetTutorialID(TIP_SHOP_SIMPLE);
  548. process_adminbutton();
  549. end;
  550.  
  551. procedure GUI_ShowConsumableShop(shopId : integer);
  552. var id : integer;
  553. begin
  554. GoToGlobalMap := false;
  555. GUI_WindowHideShopGroup;
  556. GUI_WindowShow('window_shop');
  557. GUI_CenterWindowInsidePDA('window_shop');
  558. id := GUIInterface.FindWindowByName('window_shop');
  559. GUIInterface.Windows[id].caption := GetTranslation('tcs_c08');
  560. if GUIInterface.Windows[id].Left < 256 + 82 then
  561. GUIInterface.Windows[id].Left := 256 + 82;
  562. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W then
  563. GUIInterface.Windows[id].Left := SCREEN_W - 80 - GUIInterface.Windows[id].Width;
  564.  
  565. GUI3_ShopItemList.Clear(true);
  566.  
  567. CharShowTimeStatistic.RECV_Time;
  568. if assigned(GUI3_PremiumShopFilter) then
  569. begin
  570. GUI3_PremiumShopFilter.visible := false;
  571. GUI3_PremiumShopFilter.SelectedFilter := itAll;
  572. end;
  573.  
  574. SEND_RequestItems(shopId);
  575.  
  576. GUI_ShopSetLoading(true);
  577. // GUI_Shop_SendAllButtonsToReuse();
  578.  
  579. end;
  580.  
  581. // -----------------------------------------------------------------------------
  582. procedure GUI_AskAndOpenSpecialShop(QuestionCode: string; Filter: TExternalFilter);
  583. begin
  584. ExternalFilter := Filter;
  585.  
  586. GUI_SimpleQuestionWindowSetText(GetTranslation(QuestionCode), '');
  587. GUI_SimpleQuestionWindowSetAnonymCallBack(
  588. procedure()
  589. begin
  590. GUI_OpenSpecialShop(ExternalFilter);
  591. end, nil);
  592. end;
  593.  
  594. // -----------------------------------------------------------------------------
  595. procedure gui_stop_click_fair; cdecl;
  596. // var id : integer;
  597. begin
  598. GUI_WindowHideShopGroup;
  599. if (GameserverSettings.FairRentEnabled) then
  600. begin
  601. GUI_WindowShow('window_fairrent');
  602. SEND_RequestPremiumItemShopList(6);
  603. end
  604. else
  605. begin
  606. GUI_WindowShow('window_fairshop');
  607. SEND_RequestPremiumItemShopList(5);
  608. end;
  609. end;
  610.  
  611. // -----------------------------------------------------------------------------
  612. procedure gui_stop_click_automaticauction; cdecl;
  613. // var id : integer;
  614. begin
  615. GUI_WindowHideShopGroup;
  616. GUI_WindowShow('window_scshop');
  617. SEND_RequestItemMallList();
  618. end;
  619.  
  620. // -----------------------------------------------------------------------------
  621. procedure gui_stop_click_rentshop; cdecl;
  622. // var id : integer;
  623. begin
  624. GUI_WindowHideShopGroup;
  625. GUI_WindowShow('window_rentshop');
  626. SEND_RequestRentalMallLots();
  627. end;
  628.  
  629. // -----------------------------------------------------------------------------
  630. procedure gui_stop_click_spectra_vendor; cdecl;
  631. // var id : integer;
  632. begin
  633. GUI_WindowHideShopGroup;
  634. GUI_WindowShow('window_spectra_vendor');
  635. SEND_RequestCrystalPriceHistory();
  636. end;
  637.  
  638. // -----------------------------------------------------------------------------
  639. procedure gui_stop_click_auction; cdecl;
  640. begin
  641. GUI_WindowHideShopGroup;
  642. ShowAuctionWindow();
  643. RequestCurrentAuctionList();
  644. end;
  645.  
  646. // -----------------------------------------------------------------------------
  647. procedure gui_stop_click_dealers; cdecl;
  648. begin
  649. GUI_WindowHideShopGroup;
  650. SEND_RequestDealersList();
  651. end;
  652.  
  653. // -----------------------------------------------------------------------------
  654. procedure gui_stop_click_mail; cdecl;
  655. begin
  656. SEND_RequestMailPackages();
  657. end;
  658.  
  659. // -----------------------------------------------------------------------------
  660. procedure gui_stop_click_quotation; cdecl;
  661. begin
  662. GUI_WindowHideShopGroup;
  663. GUI3_ShowQuotationWindow();
  664. end;
  665.  
  666. // -----------------------------------------------------------------------------
  667. procedure gui_stop_click_scbox; cdecl;
  668. begin
  669. GUI_WindowHideShopGroup;
  670.  
  671. SEND_RequestSCBOXInfo();
  672. end;
  673.  
  674. // -----------------------------------------------------------------------------
  675. procedure gui_stop_click_market; cdecl;
  676. begin
  677. if (GameserverSettings.oldMartEnabled) then
  678. begin
  679. GUI_WindowHideShopGroup;
  680. RefreshPrivateStoresList();
  681. GUI_ShopSetLoading(true);
  682. GUI_Shop_SendAllButtonsToReuse();
  683. end
  684. else
  685. begin
  686. CursorHint(GetTranslation('m1256'));
  687. end;
  688. end;
  689.  
  690. // -----------------------------------------------------------------------------
  691. procedure gui_stop_click_players_auction; cdecl;
  692. begin
  693. if (GameserverSettings.playersAuctionEnabled) then
  694. begin
  695. GUI_WindowHideShopGroup;
  696. ShowPlayersAuctionListWindow();
  697. end
  698. else
  699. begin
  700. CursorHint(GetTranslation('m714'));
  701. end;
  702. end;
  703.  
  704. // -----------------------------------------------------------------------------
  705. procedure gui_stop_click_premium_common_1; cdecl;
  706. var
  707. id: integer;
  708. begin
  709. GUI_WindowHideShopGroup;
  710. GUI_WindowShow('window_shop');
  711. GUI_CenterWindowInsidePDA('window_shop');
  712. id := GUIInterface.FindWindowByName('window_shop');
  713. GUIInterface.Windows[id].caption := GetTranslation('m117');
  714. if GUIInterface.Windows[id].Left < 256 + 82 then
  715. GUIInterface.Windows[id].Left := 256 + 82;
  716. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W then
  717. GUIInterface.Windows[id].Left := SCREEN_W - 80 - GUIInterface.Windows[id].Width;
  718. // if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.Visible := True and not GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  719. if assigned(GUI3_PremiumShopFilter) then
  720. begin
  721. GUI3_PremiumShopFilter.visible := true;
  722. GUI3_PremiumShopFilter.MACRO_PremiumTypes;
  723. end;
  724. end;
  725.  
  726. // -----------------------------------------------------------------------------
  727. procedure gui_stop_click_premium_common_2; cdecl;
  728. begin
  729. GUI_ShopSetLoading(true);
  730. GUI_Shop_SendAllButtonsToReuse();
  731. // if assigned(GUI3_FlushFilterBtn) then GUI3_FlushFilterBtn.Visible := True;
  732. Shop_FilterOff();
  733. shop_tutorial_area.SetTutorialID(TIP_SHOP_PREMIUM);
  734. end;
  735.  
  736. // -----------------------------------------------------------------------------
  737. procedure gui_stop_click_premium; cdecl;
  738. // var id : integer;
  739. begin
  740. gui_stop_click_premium_common_1;
  741. { GUI_WindowHideShopGroup;
  742. GUI_WindowShow('window_shop');
  743. GUI_CenterWindowInsidePDA ('window_shop');
  744. id := GUIInterface.FindWindowByName('window_shop');
  745. GUIInterface.Windows[id].Caption := GetTranslation('m117');
  746. if GUIInterface.Windows[id].Left < 256 + 82 then GUIInterface.Windows[id].Left := 256 + 82;
  747. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W then
  748. GUIInterface.Windows[id].Left := SCREEN_W - 80 - GUIInterface.Windows[id].Width;
  749. if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.Visible := True and not GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  750. if assigned(GUI3_PremiumShopFilter) then begin
  751. GUI3_PremiumShopFilter.Visible := true and GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  752. GUI3_PremiumShopFilter.MACRO_PremiumTypes;
  753. end; }
  754.  
  755. SEND_RequestPremiumItemShopList(0);
  756. gui_stop_click_premium_common_2;
  757. end;
  758.  
  759. // -----------------------------------------------------------------------------
  760. procedure gui_stop_click_premium1; cdecl;
  761. // var id : integer;
  762. begin
  763. { GUI_WindowHideShopGroup;
  764. GUI_WindowShow('window_shop');
  765. GUI_CenterWindowInsidePDA ('window_shop');
  766. id := GUIInterface.FindWindowByName('window_shop');
  767. GUIInterface.Windows[id].Caption := GetTranslation('m117');
  768. if GUIInterface.Windows[id].Left < 256 + 82 then GUIInterface.Windows[id].Left := 256 + 82;
  769. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W then
  770. GUIInterface.Windows[id].Left := SCREEN_W - 80 - GUIInterface.Windows[id].Width;
  771.  
  772. if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.Visible := True and not GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  773. if assigned(GUI3_PremiumShopFilter) then begin
  774. GUI3_PremiumShopFilter.Visible := true and GAME_BUILD_OPTION_NEW_SHOP_FILTER;
  775. GUI3_PremiumShopFilter.MACRO_PremiumTypes;
  776. end; }
  777. gui_stop_click_premium_common_1;
  778.  
  779. SEND_RequestPremiumItemShopList(1);
  780.  
  781. gui_stop_click_premium_common_2;
  782. { GUI_ShopSetLoading(True);
  783. GUI_Shop_SendAllButtonsToReuse();
  784. if assigned(GUI3_FlushFilterBtn) then GUI3_FlushFilterBtn.Visible := True;
  785. Shop_FilterOff();
  786. shop_tutorial_area.SetTutorialID(TIP_SHOP_PREMIUM); }
  787. end;
  788.  
  789. // -----------------------------------------------------------------------------
  790. procedure GUI_Shop_Show;
  791. var
  792. id: integer;
  793. i: Cardinal;
  794. its_gamble, its_prison,
  795. // its_base,
  796. its_training: boolean;
  797. begin
  798. GUI3_ShopInventory.SetNoSelected;
  799. GUI3_SCCartInventory.SetNoSelected;
  800. GUI_Shop_UpdateChar();
  801. process_adminbutton();
  802.  
  803. its_gamble := Towns[current_town - 1].IsMinersTown { id = 9 };
  804. its_prison := (Towns[current_town - 1].Type_ = TYPE_JAIL { id = 10 } ) or
  805. (Towns[current_town - 1].IsTraining { id = 15 } ) or (Towns[current_town - 1].Shop = false);
  806. // its_base := Towns[current_town - 1].type_ = 1;
  807. its_training := Towns[current_town - 1].IsTraining;
  808.  
  809. id := GUIInterface.FindWindowByName('window_shop_filter');
  810. if (id <> -1) then
  811. begin
  812. if (GUIInterface.Windows[id].ControlsCount > 0) then
  813. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  814. begin
  815. if (GUIInterface.Windows[id].controls[i] is TGUIButton) then
  816. with (GUIInterface.Windows[id].controls[i] as TGUIButton) do
  817. begin
  818. if (tag = 100) then
  819. begin
  820. visible := false;
  821. // if (its_prison) or (its_training) or (Towns[current_town - 1].id = 9) then
  822. // begin
  823. // visible := false;
  824. // end;
  825. end;
  826. if (tag = 104) then
  827. begin
  828. visible := GAME_BUILD_OPTION_SC_SHOP;
  829. end;
  830. if (tag = 105) then
  831. begin
  832. visible := GAME_BUILD_OPTION_RENT_SHOP;
  833. end;
  834. if (tag = 106) then
  835. begin
  836. visible := Towns[current_town - 1].Type_ in [TYPE_JAIL, TYPE_TOWN];
  837. // Super hardcode to miners town
  838. if (Towns[current_town - 1].IsMinersTown { id = 9 } ) then
  839. begin
  840. visible := false;
  841. end;
  842. if (its_prison) then
  843. begin
  844. visible := false;
  845. end;
  846. end;
  847. if (tag = 108) then
  848. begin // Auction
  849. visible := (Towns[current_town - 1].Type_ in [TYPE_JAIL, TYPE_TOWN]) and
  850. (GAME_BUILD_OPTION_AUCTION_ENABLED);
  851. end;
  852. if (tag = 109) then
  853. visible :=true;
  854. if (Towns[current_town - 1].id = 3) then
  855. begin
  856. visible := false;
  857. end;
  858. if (Towns[current_town - 1].id = 4) then
  859. begin
  860. visible := false;
  861. end;
  862. if (Towns[current_town - 1].id = 30) then
  863. begin
  864. visible := false;
  865. end;
  866. if (Towns[current_town - 1].id = 33) then
  867. begin
  868. visible := false;
  869. end;
  870. if (tag = 110) then
  871. begin
  872. visible := (its_prison = false);
  873. // and (character.AccessLevel >= GameserverSettings.mailAdminAccess);
  874. end;
  875. if (tag = 111) then
  876. begin
  877. visible := false; //GAME_BUILD_OPTION_QUOTATION_ENABLED;
  878. end;
  879. if (tag = 112) then
  880. begin
  881. visible := false; //Towns[current_town - 1].Type_ in [TYPE_JAIL, TYPE_TOWN];
  882. // Super hardcode to miners town
  883. if (Towns[current_town - 1].IsMinersTown { id = 9 } ) then
  884. // if (Towns[current_town - 1].IsMinersTown { id = 9 }) and (character.AccessLevel >=300) then
  885. begin
  886. visible := true;
  887. Enabled := visible;
  888. end;
  889. if (its_prison) then
  890. begin
  891. visible := false;
  892. end;
  893. end;
  894. if (tag = 115) then
  895. begin
  896. visible := (GameserverSettings.FairEnabled) or (GameserverSettings.FairRentEnabled);
  897. end;
  898. if (tag = 116) then
  899. begin
  900. visible := true;
  901. end;
  902. if (tag = 118) then
  903. begin
  904. visible := false;
  905. Enabled := visible;
  906. // if (Towns[current_town - 1].id = 4) then
  907. // begin
  908. // visible := false;
  909. // end;
  910. if (Towns[current_town - 1].id = 9) then
  911. begin
  912. visible := true;
  913. Enabled := visible;
  914. end;
  915. end;
  916.  
  917. if (tag = 120) then
  918. begin
  919. visible := false; //TrueSkill_InTS_Town;
  920. Enabled := visible;
  921. end;
  922. if (tag = 121) then
  923. begin
  924. visible := Towns[current_town - 1].id = 33;
  925. Enabled := visible;
  926. end;
  927. if (tag = 122) then
  928. begin
  929. visible := false;
  930. // if (Towns[current_town - 1].id = 9) then
  931. // begin
  932. // visible := true;
  933. // Enabled := visible;
  934. // end;
  935. // if (Towns[current_town - 1].id = 11) then
  936. // begin
  937. // visible := true;
  938. // Enabled := visible;
  939. // end;
  940. // if (Towns[current_town - 1].id = 33) then
  941. // begin
  942. // visible := true;
  943. // end;
  944. end;
  945. // if (tag = 123) or (tag = 124) or (tag = 125) then
  946. if (tag = 123) then
  947. begin
  948. visible := false;
  949. if (Towns[current_town - 1].id = 30) then
  950. begin
  951. visible := true;
  952. Enabled := visible;
  953. end;
  954. end;
  955.  
  956. if (tag = 127) then
  957. begin
  958. visible := false;
  959. Enabled := visible;
  960. end;
  961.  
  962. if (tag = 124) then
  963. begin
  964. visible := false;
  965. if (Towns[current_town - 1].id = 30) then
  966. begin
  967. visible := true;
  968. Enabled := visible;
  969. end;
  970. end;
  971.  
  972. if (tag = 125) then
  973. begin
  974. visible := false;
  975. if (Towns[current_town - 1].id = 3) then
  976. begin
  977. visible := true;
  978. Enabled := visible;
  979. end;
  980. end;
  981.  
  982. // if (tag = 126) or (tag = 127) or (tag = 128) then
  983. if (tag = 126) then
  984. begin
  985. visible := false;
  986. if (Towns[current_town - 1].id = 3) then
  987. begin
  988. visible := true;
  989. Enabled := visible;
  990. end;
  991. end;
  992.  
  993. if (tag = 128) then
  994. begin
  995. visible := Towns[current_town - 1].id = 33;
  996. Enabled := visible;
  997. end;
  998.  
  999. if (tag = 103) then
  1000. begin
  1001. Visible := false;
  1002. if (Towns[current_town - 1].id = 9) then
  1003. begin
  1004. visible := true;
  1005. Enabled := visible;
  1006. end;
  1007. if (Towns[current_town - 1].id = 11) then
  1008. begin
  1009. visible := true;
  1010. Enabled := visible;
  1011. end;
  1012. if (Towns[current_town - 1].id = 33) then
  1013. begin
  1014. visible := false;
  1015. Enabled := visible;
  1016. end;
  1017. // OnClick.Clear;
  1018. // if (its_gamble) then
  1019. // begin
  1020. // OnClick.Subscribe(gui_stop_click_premium1); // 1
  1021. // end
  1022. // else
  1023. // begin
  1024. // OnClick.Subscribe(gui_stop_click_premium);
  1025. // end;
  1026. end;
  1027. end;
  1028. end;
  1029. end;
  1030.  
  1031. id := GUIInterface.FindWindowByName('window_shop_filter');
  1032. GUIInterface.Windows[id].visible := true;
  1033.  
  1034. id := GUIInterface.FindWindowByName('window_shop');
  1035. GUIInterface.Windows[id].CenterOnScreen;
  1036. if GUIInterface.Windows[id].Left + GUIInterface.Windows[id].Width > SCREEN_W - 340 then
  1037. GUIInterface.Windows[id].Left := SCREEN_W - 340 - GUIInterface.Windows[id].Width;
  1038.  
  1039. if (its_prison) then
  1040. begin
  1041. Game_soldiers_actions_blocked_ := false;
  1042. // gui_stop_click_premium;
  1043. Game_soldiers_actions_blocked_ := true;
  1044. end;
  1045.  
  1046. // gui_PetShop_Refresh;
  1047. ShowShopMenu;
  1048. end;
  1049.  
  1050. // -----------------------------------------------------------------------------
  1051. procedure gui_shop_convert_cred; cdecl;
  1052. var
  1053. id, i: integer;
  1054. cred: string;
  1055. begin
  1056. id := GUIInterface.FindWindowByName('window_bank');
  1057. if id = -1 then
  1058. Exit;
  1059.  
  1060. if GUIInterface.Windows[id].ControlsCount > 0 then
  1061. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  1062. if GUIInterface.Windows[id].controls[i] is TGUIEdit then
  1063. begin
  1064.  
  1065. TGUIEdit(GUIInterface.Windows[id].controls[i]).Text :=
  1066. trim(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text);
  1067.  
  1068. if GUIInterface.Windows[id].controls[i].Name = 'edit_convert' then
  1069. cred := TGUIEdit(GUIInterface.Windows[id].controls[i]).Text;
  1070.  
  1071. end;
  1072.  
  1073. end;
  1074.  
  1075. // -----------------------------------------------------------------------------
  1076. procedure gui_shop_buy_cred; cdecl;
  1077. var
  1078. id, i: integer;
  1079. cred: string;
  1080. // const BUYLINK : 12345&login=needle&service=0&amount=20
  1081. begin
  1082. id := GUIInterface.FindWindowByName('window_bank');
  1083. if id = -1 then
  1084. Exit;
  1085.  
  1086. if GUIInterface.Windows[id].ControlsCount > 0 then
  1087. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  1088. if GUIInterface.Windows[id].controls[i] is TGUIEdit then
  1089. begin
  1090.  
  1091. TGUIEdit(GUIInterface.Windows[id].controls[i]).Text :=
  1092. trim(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text);
  1093.  
  1094. if GUIInterface.Windows[id].controls[i].Name = 'edit_buycred' then
  1095. cred := TGUIEdit(GUIInterface.Windows[id].controls[i]).Text;
  1096.  
  1097. if cred = '0' then
  1098. Exit;
  1099.  
  1100. // Application.Minimize;
  1101.  
  1102. if not ENGLISH_SERVER then
  1103. begin
  1104. if (AffiliateBankLinkOverride) then
  1105. begin
  1106. GoWebsite(AffiliateBankLinkValue + '?account=' + Cvar_VariableString('orange_login') + '&character=' +
  1107. character.Name + '&language=' + Cvar_VariableString('g_language') + '&server=' +
  1108. inttostr(GlobalSelectedServer + 1) + '&wait', true);
  1109. end
  1110. else
  1111. begin
  1112. GoWebsite('http://ti.ggeek.ru/?action=pay&account=' + Cvar_VariableString('orange_login') + '&char=' +
  1113. character.Name);
  1114. end;
  1115. end
  1116. else
  1117. begin
  1118. GoWebsite('http://billing.totalinfluenceonline.com/eng/bills/?do=create&project_id=34' + '&account=' +
  1119. Cvar_VariableString('orange_login') + '&character=' + character.Name + '&server=' +
  1120. inttostr(GlobalSelectedServer + 1) + '&wait', true);
  1121. end;
  1122. // GUI3_PDA_ShopClick;
  1123. end;
  1124.  
  1125. end;
  1126.  
  1127. // -----------------------------------------------------------------------------
  1128. procedure gui_shop_make_gold; cdecl;
  1129. begin
  1130. Application.Minimize;
  1131.  
  1132. if not ENGLISH_SERVER then
  1133. begin
  1134. GoWebsite('http://bank.tionline.ru/ftp.php?' + 'server=' + inttostr(GlobalSelectedServer + 1) + '&char_name=' +
  1135. character.Name + '');
  1136. end
  1137. else
  1138. begin
  1139.  
  1140. end;
  1141. GUI3_PDA_ShopClick;
  1142. end;
  1143.  
  1144. // -----------------------------------------------------------------------------
  1145. procedure gui_shop_convert_edit_change; cdecl;
  1146. var
  1147. id, i: integer;
  1148. cred: integer;
  1149. // const BUYLINK : 12345&login=needle&service=0&amount=20
  1150. begin
  1151. id := GUIInterface.FindWindowByName('window_bank');
  1152. if id = -1 then
  1153. Exit;
  1154.  
  1155. cred := 0;
  1156.  
  1157. if GUIInterface.Windows[id].ControlsCount > 0 then
  1158. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  1159. if GUIInterface.Windows[id].controls[i] is TGUIEdit then
  1160. begin
  1161.  
  1162. try
  1163. if GUIInterface.Windows[id].controls[i].Name = 'edit_convert' then
  1164. if Length(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text) > 0 then
  1165. cred := strtoint(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text);
  1166. except
  1167. cred := 0;
  1168. break;
  1169. end;
  1170. end;
  1171.  
  1172. if GUIInterface.Windows[id].ControlsCount > 0 then
  1173. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  1174. if GUIInterface.Windows[id].controls[i] is TGUILabel then
  1175. begin
  1176.  
  1177. if TGUILabel(GUIInterface.Windows[id].controls[i]).Name = 'convertrate' then
  1178. TGUILabel(GUIInterface.Windows[id].controls[i]).caption :=
  1179. Format(GetTranslation('ba07'), [inttostr(cred * GOLD_CRED_CONVERT_RATE)]);
  1180. end;
  1181.  
  1182. end;
  1183.  
  1184. // -----------------------------------------------------------------------------
  1185. procedure Click_shift_L; cdecl;
  1186. var
  1187. id, i, cnt: integer;
  1188. begin
  1189. id := GUIInterface.FindWindowByName('window_bank');
  1190. if id = -1 then
  1191. Exit;
  1192.  
  1193. if GUIInterface.Windows[id].ControlsCount > 0 then
  1194. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  1195. if GUIInterface.Windows[id].controls[i] is TGUIEdit then
  1196. begin
  1197. if Length(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text) = 0 then
  1198. Exit;
  1199.  
  1200. cnt := strtoint(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text);
  1201.  
  1202. if cnt > 3000 then
  1203. dec(cnt, 1000)
  1204. else if cnt > 1000 then
  1205. dec(cnt, 100)
  1206. else if cnt > 250 then
  1207. dec(cnt, 50)
  1208. else if cnt > 50 then
  1209. dec(cnt, 10)
  1210. else if cnt > 15 then
  1211. dec(cnt, 5)
  1212. else
  1213. dec(cnt);
  1214.  
  1215. if cnt < 0 then
  1216. cnt := 0;
  1217.  
  1218. TGUIEdit(GUIInterface.Windows[id].controls[i]).Text := inttostr(cnt);
  1219. Exit;
  1220. end;
  1221.  
  1222. end;
  1223.  
  1224. // -----------------------------------------------------------------------------
  1225. procedure Click_shift_R; cdecl;
  1226. var
  1227. id, i, cnt: integer;
  1228. begin
  1229. id := GUIInterface.FindWindowByName('window_bank');
  1230. if id = -1 then
  1231. Exit;
  1232.  
  1233. if GUIInterface.Windows[id].ControlsCount > 0 then
  1234. for i := 0 to GUIInterface.Windows[id].ControlsCount - 1 do
  1235. if GUIInterface.Windows[id].controls[i] is TGUIEdit then
  1236. begin
  1237. if Length(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text) = 0 then
  1238. Exit;
  1239.  
  1240. cnt := strtoint(TGUIEdit(GUIInterface.Windows[id].controls[i]).Text);
  1241.  
  1242. if cnt < 15 then
  1243. Inc(cnt)
  1244. else if cnt < 50 then
  1245. Inc(cnt, 5)
  1246. else if cnt < 250 then
  1247. Inc(cnt, 10)
  1248. else if cnt < 1000 then
  1249. Inc(cnt, 50)
  1250. else if cnt < 3000 then
  1251. Inc(cnt, 100)
  1252. else
  1253. Inc(cnt, 1000);
  1254.  
  1255. TGUIEdit(GUIInterface.Windows[id].controls[i]).Text := inttostr(cnt);
  1256. TGUIEdit(GUIInterface.Windows[id].controls[i]).CursorPos := Length(inttostr(cnt));
  1257. Exit;
  1258. end;
  1259.  
  1260. end;
  1261.  
  1262. // -----------------------------------------------------------------------------
  1263. procedure gui_stop_buy; cdecl;
  1264. var
  1265. // {id,} i : integer;
  1266. owner_id: integer;
  1267. edt_cnt: int64;
  1268.  
  1269. icount, iprice, iname: String;
  1270. begin
  1271. if (GUI3_ShopItemList.fItemIndex = -1) or (GUI3_ShopItemList.fItemIndex >= GUI3_ShopItemList.fItemList.count) then
  1272. begin
  1273. Exit;
  1274. end;
  1275.  
  1276. edt_cnt := StrToInt64Def(shop_count_edt.Text, 0);
  1277. if (edt_cnt = 0) then
  1278. begin
  1279. Exit;
  1280. end;
  1281.  
  1282. if TrueSkill_InTS_Town() and (last_shop_type = 15) then begin
  1283. with GUI3_ShopItemList do
  1284. begin
  1285. SEND_RequestItemBuy(15, fItemList[fItemIndex].Item.Item_id , fItemList[fItemIndex].count * edt_cnt, fItemList[fItemIndex].cash_type);
  1286. Exit;
  1287. end;
  1288. end;
  1289.  
  1290. if (edt_cnt > 1) then
  1291. begin
  1292. with GUI3_ShopItemList do
  1293. begin
  1294. icount := inttostr(edt_cnt) + ' (' + inttostr(fItemList[fItemIndex].Item.count * edt_cnt) + ')';
  1295. if (fItemList[fItemIndex].cash_type > 2) then
  1296. begin
  1297. iprice := inttostr(fItemList[fItemIndex].Item.price * edt_cnt) + ' ' + GameItemDatas
  1298. [GetGameItemData_byID(fItemList[fItemIndex].cash_type)].Name;
  1299. end
  1300. else if (fItemList[fItemIndex].Item.price <> 0) then
  1301. begin
  1302. iprice := inttostr(fItemList[fItemIndex].Item.price * edt_cnt) + ' cr';
  1303. end
  1304. else
  1305. begin
  1306. iprice := inttostr(fItemList[fItemIndex].Item.GoldPrice * edt_cnt) + ' gold';
  1307. end;
  1308. iname := fItemList[fItemIndex].Item.GetName;
  1309. // QuotedStr(GetItemNameByID(fItemList[fItemIndex].Item.item_id));
  1310. end;
  1311.  
  1312. GUI_SimpleQuestionWindowSetText(Format(GetTranslation('m1261'), [icount, iname, iprice]), '');
  1313. GUI_SimpleQuestionWindowSetAnonymCallBack(
  1314. procedure()
  1315. var
  1316. edt_cnt: int64;
  1317. begin
  1318. if (GUI3_ShopItemList.fItemIndex = -1) then
  1319. begin
  1320. Exit;
  1321. end;
  1322.  
  1323. edt_cnt := StrToInt64Def(shop_count_edt.Text, 0);
  1324. if (edt_cnt = 0) then
  1325. begin
  1326. Exit;
  1327. end;
  1328.  
  1329. owner_id := soldiers[RenderCloseUpModel_soldier_id].obj_id;
  1330. with GUI3_ShopItemList do
  1331. begin
  1332. if { (last_shop_is_premium) } fItemList[fItemIndex].IsPremium then
  1333. begin
  1334. SEND_RequestPremiumItemShopBuy(owner_id, fItemList[fItemIndex].Item.obj_id, edt_cnt)
  1335. end
  1336. else
  1337. begin
  1338. SEND_RequestItemShopBuy(owner_id, fItemList[fItemIndex].Item.obj_id, edt_cnt, last_shop_type);
  1339. end;
  1340. end;
  1341.  
  1342. if ShopItemType = itCustom then
  1343. with GUI3_ShopItemList do
  1344. begin
  1345. TGUIWindow(GUI3_ShopItemList.ParentWindow).Hide;
  1346. GUI3_ShopItemList.Clear(true);
  1347. end;
  1348.  
  1349. shop_count_edt.Text := '0';
  1350. end,
  1351. procedure()
  1352. begin
  1353. end);
  1354. GUI_WindowShowModal('window_simplequestion');
  1355. Exit;
  1356. end;
  1357.  
  1358. owner_id := soldiers[RenderCloseUpModel_soldier_id].obj_id;
  1359.  
  1360. with GUI3_ShopItemList do
  1361. begin
  1362. if { (last_shop_is_premium) } fItemList[fItemIndex].IsPremium then
  1363. begin
  1364. SEND_RequestPremiumItemShopBuy(owner_id, fItemList[fItemIndex].Item.obj_id, edt_cnt)
  1365. end
  1366. else
  1367. begin
  1368. SEND_RequestItemShopBuy(owner_id, fItemList[fItemIndex].Item.obj_id, edt_cnt, last_shop_type);
  1369. end;
  1370. end;
  1371.  
  1372. if ShopItemType = itCustom then
  1373. with GUI3_ShopItemList do
  1374. begin
  1375. TGUIWindow(GUI3_ShopItemList.ParentWindow).Hide;
  1376. GUI3_ShopItemList.Clear(true);
  1377. end;
  1378.  
  1379. end;
  1380.  
  1381. // -----------------------------------------------------------------------------
  1382. procedure RenderBankLogo(X, Y: integer);
  1383. begin
  1384. Renderer_RenderEffect(FindTexture('bank_logo'), X, Y, 0, 0);
  1385. end;
  1386.  
  1387. // ------------------------------------------------------------------------------
  1388. procedure SetupShopWindowControlsCommon;
  1389. begin
  1390. GUI3_ShopItemList.UpgradeTB.Left := GUI3_ShopItemList.Left + 2;
  1391. GUI3_ShopItemList.PriceTB.Left := GUI3_ShopItemList.Left + 2 + 64 + 208 + 2;
  1392. GUI3_ShopItemList.UpgradeTB.Top := GUI3_ShopItemList.Top - 18 - 10 - 3;
  1393. GUI3_ShopItemList.PriceTB.Top := GUI3_ShopItemList.Top - 18 - 10 - 3;
  1394.  
  1395. TotalRenderArea.Left := shop_count_edt.Left + shop_count_edt.Width + 5;
  1396. TotalRenderArea.Top := shop_count_edt.Top;
  1397. end;
  1398.  
  1399. // ------------------------------------------------------------------------------
  1400. procedure SetupShopWindowControlsCustom;
  1401. begin
  1402. GUI3_ShopItemList.Height := 210;
  1403. GUI3_ShopItemList.Left := 10;
  1404. GUI3_ShopItemList.Top := 60;
  1405.  
  1406. ShopBuyBtn.Left := (ShopBuyBtn.ParentWindow.Width - ShopBuyBtn.Width) div 2 + 180 div 2;
  1407. ShopBuyBtn.Top := ShopBuyBtn.ParentWindow.Height - 44;
  1408.  
  1409. { GUI3_ShopItemList.UpgradeTB.Left := GUI3_ShopItemList.Left + 2;
  1410. GUI3_ShopItemList.UpgradeTB.Top := GUI3_ShopItemList.Top - 18 - 10 - 3;
  1411. GUI3_ShopItemList.PriceTB.Top := GUI3_ShopItemList.Top - 18 - 10 - 3;
  1412. GUI3_ShopItemList.PriceTB.Left := GUI3_ShopItemList.Left + 2 + 64 + 208 + 2; }
  1413.  
  1414. with shop_count_edt do
  1415. begin
  1416. Left := ShopBuyBtn.Left - 180;
  1417. Top := ParentWindow.Height - 44;
  1418. visible := true;
  1419. end;
  1420.  
  1421. SetupShopWindowControlsCommon;
  1422. end;
  1423.  
  1424. // ------------------------------------------------------------------------------
  1425. procedure SetupShopWindowControlsRegular;
  1426. begin
  1427. GUI3_ShopItemList.Left := 165 - 10;
  1428. GUI3_ShopItemList.Height := GUI3_ShopItemList.ParentWindow.Height - 86;
  1429. GUI3_ShopItemList.Top := 50;
  1430.  
  1431. ShopBuyBtn.Left := 165;
  1432. ShopBuyBtn.Top := ShopBuyBtn.ParentWindow.Height - 34;
  1433.  
  1434. with shop_count_edt do
  1435. begin
  1436. Left := 165 + 150 + 10;
  1437. Top := ParentWindow.Height - 34;
  1438. visible := true;
  1439. end;
  1440.  
  1441. SetupShopWindowControlsCommon;
  1442. end;
  1443.  
  1444. // ------------------------------------------------------------------------------
  1445. procedure Shop_ApplyFilters;
  1446. var
  1447. P: PGUIShopItem;
  1448. id, tw, th: integer;
  1449. drops, custom: boolean;
  1450. begin
  1451. // GUI3_ShopItemList : TGUINewShopList;
  1452.  
  1453. drops := (ShopItemType in [itDrops]);
  1454. custom := (ShopItemType in [itCustom]);
  1455.  
  1456. GUI3_ShopInventory.SetVisible(not drops and not custom);
  1457.  
  1458. if drops then
  1459. begin
  1460. GUI3_ShopItemList.Width := 640;
  1461. GUI3_ShopItemList.VisualMode := svmThumbs;
  1462. end
  1463. else
  1464. begin
  1465. GUI3_ShopItemList.Width := 320 + 40;
  1466. GUI3_ShopItemList.VisualMode := svmList;
  1467. end;
  1468.  
  1469. if custom then
  1470. begin
  1471. tw := 576 - 128 - 64;
  1472. th := 320;
  1473. SetupShopWindowControlsCustom;
  1474. end
  1475. else
  1476. begin
  1477. tw := 304 * 2 + 160 + 64;
  1478. th := 512 - 128 + 32 + 32;
  1479. SetupShopWindowControlsRegular;
  1480. end;
  1481.  
  1482. // приведение типа обязательно для вызова оконного SetWidth
  1483. with GUI3_ShopItemList do
  1484. if (ParentWindow.Width <> tw) or (ParentWindow.Height <> th) then
  1485. begin
  1486. TGUIWindow(ParentWindow).Width := tw;
  1487. TGUIWindow(ParentWindow).Height := th;
  1488. TGUIWindow(ParentWindow).CenterOnScreen;
  1489. end;
  1490.  
  1491. if GUI3_ShopItemList.fItemList.count > 0 then
  1492. for P in GUI3_ShopItemList.fItemList do
  1493. begin
  1494. id := { GetGameItemData_byID(P.Item.item_id) } P.Item.GetItemIndex;
  1495. P.visible := true;
  1496.  
  1497. if assigned(GUI3_PremiumShopFilter) then
  1498. begin
  1499. P.visible := GUI3_PremiumShopFilter.IsItemMatchesCurrentFilter(P.Item);
  1500. end
  1501. else
  1502. begin
  1503. if (ShopItemType <> itAll) then
  1504. begin
  1505. case ShopItemType of
  1506. itClothing:
  1507. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_NONE) and
  1508. ((GameItemDatas[id].p_def <> 0) or (GameItemDatas[id].armortype = I_ARMORTYPE_TANK));
  1509. itClothingHead:
  1510. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_NONE) and (GameItemDatas[id].p_def <> 0)
  1511. and (GameItemDatas[id].bodypart = I_BODYPART_HEAD_);
  1512. itClothingChest:
  1513. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_NONE) and
  1514. ((GameItemDatas[id].p_def <> 0) or (GameItemDatas[id].armortype = I_ARMORTYPE_TANK)) and
  1515. ((GameItemDatas[id].bodypart = I_BODYPART_CHEST) or
  1516. (GameItemDatas[id].bodypart = I_BODYPART_FULL_ARMOR) or
  1517. (GameItemDatas[id].bodypart = I_BODYPART_COMPLEX_ARMOR));
  1518. itClothingLegs:
  1519. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_NONE) and (GameItemDatas[id].p_def <> 0)
  1520. and (GameItemDatas[id].bodypart = I_BODYPART_LEGS);
  1521. itWeapon:
  1522. P.visible := (GameItemDatas[id].weaponType <> I_WEAPONTYPE_NONE);
  1523. itWeaponMelee:
  1524. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_MELEE);
  1525. itWeaponLight:
  1526. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_LIGHT);
  1527. itWeaponAutomatic:
  1528. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_AUTOMATIC);
  1529. itWeaponDistance:
  1530. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_DISTANCE);
  1531. itWeaponHeavy:
  1532. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_HEAVY);
  1533. itWeaponThrowing:
  1534. P.visible := (GameItemDatas[id].weaponType = I_WEAPONTYPE_THROWING);
  1535. // itRare : P.visible := P.Item.IsRareItem();
  1536. itSale:
  1537. P.visible := (P.Item.SaleTag <> '') and not P.Item.IsDrop;
  1538. itDrops:
  1539. P.visible := (P.Item.IsDrop);
  1540. itCustom:
  1541. if not assigned(ExternalFilter) then
  1542. P.visible := false
  1543. else
  1544. P.visible := ExternalFilter(P.Item);
  1545. itSteroids:
  1546. P.visible := P.Item.IsSteroid();
  1547. itBlueprint:
  1548. P.visible := P.Item.IsBlueprint();
  1549. itAmmo:
  1550. P.visible := (P.Item.IsConsumable());
  1551. itMines:
  1552. P.visible := P.Item.IsMine or P.Item.IsMineFinder or P.Item.IsMineDefuser;
  1553. end;
  1554.  
  1555. if P.Item.IsGoldOrCredits and not(ShopItemType in [itDrops, itCustom]) then
  1556. P.visible := true;
  1557. end;
  1558. if (ShopItemType = itAll) and P.Item.IsDrop then
  1559. P.visible := false;
  1560. end;
  1561.  
  1562. end;
  1563. GUI3_ShopItemList.UpdateTrk;
  1564. end;
  1565.  
  1566. // ------------------------------------------------------------------------------
  1567. procedure Shop_FilterOff; cdecl;
  1568. begin
  1569. ShopItemType := itAll;
  1570. { if assigned(GUI3_PremiumShopMenu) then begin
  1571. GUI3_PremiumShopMenu.FlushColor;
  1572. GUI3_PremiumShopMenu.UpdateColor( Integer(ShopItemType) );
  1573. end; }
  1574. if assigned(GUI3_PremiumShopFilter) then
  1575. GUI3_PremiumShopFilter.SelectedFilter := ShopItemType;
  1576.  
  1577. Shop_ApplyFilters();
  1578. end;
  1579.  
  1580. // ------------------------------------------------------------------------------
  1581. procedure Shop_FilterSale; cdecl;
  1582. begin
  1583. ShopItemType := itSale;
  1584. { if assigned(GUI3_PremiumShopMenu) then begin
  1585. GUI3_PremiumShopMenu.FlushColor;
  1586. GUI3_PremiumShopMenu.UpdateColor( Integer(ShopItemType) );
  1587. end; }
  1588. if assigned(GUI3_PremiumShopFilter) then
  1589. GUI3_PremiumShopFilter.SelectedFilter := ShopItemType;
  1590. Shop_ApplyFilters();
  1591. end;
  1592.  
  1593. // ------------------------------------------------------------------------------
  1594. procedure Shop_FilterDrops; cdecl;
  1595. begin
  1596. ShopItemType := itDrops;
  1597. { if assigned(GUI3_PremiumShopMenu) then begin
  1598. GUI3_PremiumShopMenu.FlushColor;
  1599. GUI3_PremiumShopMenu.UpdateColor( Integer(ShopItemType) );
  1600. end; }
  1601. if assigned(GUI3_PremiumShopFilter) then
  1602. GUI3_PremiumShopFilter.SelectedFilter := ShopItemType;
  1603. Shop_ApplyFilters();
  1604. end;
  1605.  
  1606. // ------------------------------------------------------------------------------
  1607. procedure Shop_FilterCustom; cdecl;
  1608. begin
  1609. ShopItemType := itCustom;
  1610. { if assigned(GUI3_PremiumShopMenu) then begin
  1611. GUI3_PremiumShopMenu.FlushColor;
  1612. GUI3_PremiumShopMenu.UpdateColor( Integer(ShopItemType) );
  1613. end; }
  1614. if assigned(GUI3_PremiumShopFilter) then
  1615. GUI3_PremiumShopFilter.SelectedFilter := ShopItemType;
  1616. Shop_ApplyFilters();
  1617. end;
  1618.  
  1619. // ------------------------------------------------------------------------------
  1620. procedure Shop_FilterOn(Sender: TGUIControl); cdecl;
  1621. begin
  1622.  
  1623. if Sender is TGUIShopFilters then
  1624. begin
  1625. ShopItemType := TGUIShopFilters(Sender).SelectedFilter;
  1626. Shop_ApplyFilters();
  1627. Exit;
  1628. end;
  1629.  
  1630. if (Sender as TGUIButton).CaptionColor <> SC_SELECTED_BUTTON_COLOR then
  1631. begin
  1632. // if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.FlushColor;
  1633. (Sender as TGUIButton).CaptionColor := SC_SELECTED_BUTTON_COLOR;
  1634. ShopItemType := TShopItemType((Sender as TGUIButton).tag);
  1635. end
  1636. else
  1637. begin
  1638. // if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.FlushColor;
  1639. ShopItemType := itAll;
  1640. end;
  1641. Shop_ApplyFilters();
  1642. // if assigned(GUI3_PremiumShopMenu) then GUI3_PremiumShopMenu.UpdateColor( Integer(ShopItemType) );
  1643. end;
  1644.  
  1645. // -----------------------------------------------------------------------------
  1646. procedure DoShopHide; cdecl;
  1647. begin
  1648. if GoToGlobalMap then
  1649. GS_SetGlobalPage_Shops
  1650. else
  1651. GUI_WindowHide('window_shop');
  1652. end;
  1653.  
  1654. // -----------------------------------------------------------------------------
  1655. procedure GUI3_CreateShopWindow(var oInterface: TGUIInterface);
  1656. var
  1657. btn: TGUIButton;
  1658. shbtn: TGUISideHintButton;
  1659. label1: TGUILabel;
  1660. wnd: TGUIWindow;
  1661. edit: TGUIEdit;
  1662. ra: TGUIRenderArea;
  1663. L: Cardinal;
  1664. begin
  1665. // -------------------
  1666. // test sign in window
  1667. wnd := TGUIWindow.Create(oInterface);
  1668. wnd.Name := 'window_shop';
  1669. wnd.texture := Common_Window2;
  1670. wnd.SetSize(10, 10, 304 * 2 + 160 + 64, 512 - 128 + 32 + 32);
  1671. wnd.MinWidth := 1;
  1672. wnd.MinHeight := 1;
  1673. wnd.AllowDocking := true;
  1674. wnd.AllowResizing := false;
  1675. wnd.caption := GetTranslation('mn99');
  1676. wnd.visible := true;
  1677. wnd.CenterOnScreen;
  1678. wnd.CloseBtn.ModalResult := mrCancel;
  1679. wnd.CloseBtn.visible := true;
  1680. wnd.CloseBtn.OnClick.Subscribe(DoShopHide);
  1681. (*
  1682. if not GAME_BUILD_OPTION_NEW_SHOP_FILTER then begin
  1683. GUI3_PremiumShopMenu := TButtonMenu.Create(0, 30, 150, wnd);
  1684. {with GUI3_PremiumShopMenu do begin
  1685. Add(GetTranslation('m696'), 0, Byte(itSale), Shop_FilterOn);
  1686. Add(GetTranslation('box_filter'), 0, Byte(itDrops), Shop_FilterOn);
  1687. //Add(GetTranslation('m696'), 0, Byte(itRare), Shop_FilterOn);
  1688. Add(GetTranslation('m699'), 0, Byte(itSteroids), Shop_FilterOn);
  1689. Add(GetTranslation('m695'), 0, Byte(itBlueprint), Shop_FilterOn);
  1690. Add(GetTranslation('m103'), 0, Byte(itClothing), Shop_FilterOn);
  1691. Add(GetTranslation('m512'), 10, Byte(itClothingHead), Shop_FilterOn);
  1692. Add(GetTranslation('m513'), 10, Byte(itClothingChest), Shop_FilterOn);
  1693. Add(GetTranslation('m514'), 10, Byte(itClothingLegs), Shop_FilterOn);
  1694. Add(GetTranslation('m403'), 0, Byte(itWeapon), Shop_FilterOn);
  1695. Add(GetTranslation('m515'), 10, Byte(itWeaponMelee), Shop_FilterOn);
  1696. Add(GetTranslation('m516'), 10, Byte(itWeaponLight), Shop_FilterOn);
  1697. Add(GetTranslation('m517'), 10, Byte(itWeaponAutomatic), Shop_FilterOn);
  1698. Add(GetTranslation('m518'), 10, Byte(itWeaponDistance), Shop_FilterOn);
  1699. Add(GetTranslation('m519'), 10, Byte(itWeaponHeavy), Shop_FilterOn);
  1700. Add(GetTranslation('m520'), 10, Byte(itWeaponThrowing), Shop_FilterOn);
  1701. Add(GetTranslation('mine_category'), 10, Byte(itMines), Shop_FilterOn);
  1702. Add(GetTranslation('m104'), 0, Byte(itAmmo), Shop_FilterOn);
  1703. end;}
  1704.  
  1705. GUI3_FlushFilterBtn := TGUIButton.Create(Common_Buttons3, wnd);
  1706. with GUI3_FlushFilterBtn do begin
  1707. Caption := GetTranslation('m369');
  1708. Left := 0;
  1709. Top := wnd.Height - 34;
  1710. Width := 150;
  1711. CaptionColor := $FF00FFFF;
  1712. OnClick.Subscribe(Shop_FilterOff);
  1713. end;
  1714.  
  1715. GUI3_PremiumShopFilter := nil;
  1716. end else begin
  1717. GUI3_PremiumShopMenu := nil; *)
  1718. // GUI3_FlushFilterBtn := nil;
  1719. GUI3_PremiumShopFilter := TGUIShopFilters.Create(wnd);
  1720. with GUI3_PremiumShopFilter do
  1721. begin
  1722. Left := 0;
  1723. Top := 30;
  1724. Width := 150;
  1725. Height := ParentControl.Height - Top - 5;
  1726. OnFilterChange.Subscribe(Shop_FilterOn);
  1727. // OnFilterChange := Shop_FilterOn;
  1728. end;
  1729. // end;
  1730.  
  1731. GUI3_ShopItemList := TGUINewShopList.Create(165 - 10, 50, 320 + 40, wnd.Height - 86, wnd);
  1732. GUI3_ShopItemList.OnClick.Subscribe(GuiShopSenderClick);
  1733.  
  1734. // Buy button
  1735. btn := TGUIButton.Create(Common_Buttons3, wnd);
  1736. btn.caption := GetTranslation('m107');
  1737. btn.Left := 165 - 15;
  1738. btn.Width := 150;
  1739. btn.Top := wnd.Height - 34;
  1740. btn.Align := guiInUpperCorner;
  1741. btn.OnClick.Subscribe(gui_stop_buy);
  1742. btn.reuse_delay := 36;
  1743. btn.MouseTracerEnabled := true;
  1744. ShopBuyBtn := btn;
  1745.  
  1746. // Edit count
  1747. shop_count_edt := TGUIEdit.Create(wnd);
  1748. with shop_count_edt do
  1749. begin
  1750. Text := '0';
  1751. Left := 165 + 150 + 10;
  1752. Width := 50;
  1753. Top := wnd.Height - 34;
  1754. WorkMode := wmInteger;
  1755. MaxLength := 5;
  1756. end;
  1757.  
  1758. TotalRenderArea := TGUIRenderArea.Create(shop_count_edt.Left + shop_count_edt.Width + 5, shop_count_edt.Top,
  1759. 0, 0, wnd);
  1760. with TotalRenderArea do
  1761. begin
  1762. RenderCallBackAnonymous := procedure(X, Y: integer)
  1763. var
  1764. cnt, edt_cnt, price: int64;
  1765. buf: String;
  1766. W: integer;
  1767. P: PGUIShopItem;
  1768. pt: Byte;
  1769. begin
  1770.  
  1771. edt_cnt := StrToInt64Def(shop_count_edt.Text, 0);
  1772. if (GUI3_ShopItemList.fItemIndex <> -1) and (GUI3_ShopItemList.fItemList.count > GUI3_ShopItemList.fItemIndex)
  1773. then
  1774. begin
  1775. P := GUI3_ShopItemList.fItemList[GUI3_ShopItemList.fItemIndex];
  1776. cnt := P.Item.count;
  1777. if (P.Item.price <> 0) then
  1778. begin
  1779. price := edt_cnt * P.Item.price;
  1780. pt := 0;
  1781. end
  1782. else
  1783. begin
  1784. price := edt_cnt * P.Item.GoldPrice;
  1785. pt := 1;
  1786. end;
  1787. end
  1788. else
  1789. begin
  1790. cnt := 0;
  1791. price := 0;
  1792. pt := 0;
  1793. end;
  1794.  
  1795. buf := 'x' + inttostr(cnt) + ' = ';
  1796. W := Visual.TextWidth(buf, PIXEL);
  1797. Visual.Text(buf, X, Y);
  1798. Visual.Text(inttostr(edt_cnt * cnt), X + W, Y);
  1799.  
  1800. buf := inttostr(price);
  1801. Visual.Text(buf, X + W, Y + 14);
  1802. W := W + Visual.TextWidth(buf, PIXEL);
  1803. end;
  1804. end;
  1805.  
  1806. // Admin button
  1807. btn := TGUIButton.Create(Common_Buttons3, wnd);
  1808. btn.caption := GetTranslation('m755');
  1809. btn.Left := wnd.Width - 150 - 20;
  1810. btn.Width := 150;
  1811. btn.Top := 15;
  1812. btn.Name := 'shop_admin';
  1813. btn.OnClick.Subscribe(
  1814. procedure
  1815. begin
  1816. SEND_RequestActiveBondConfig(true)
  1817. end);
  1818. btn.visible := false; // process_adminbutton
  1819.  
  1820. shop_tutorial_area := TGUITutorialTipArea.Create(TIP_SHOP_PREMIUM, 0, 0, 0, 0, wnd);
  1821.  
  1822. GUI3_ShopInventory := TShopInventory.Create(256 + 195 + 64, 0, wnd);
  1823. // -------------------
  1824. // FILTER SWITCH
  1825. wnd := TGUIWindow.Create(oInterface);
  1826. wnd.Name := 'window_shop_filter';
  1827. wnd.SetSize(600, 10, 128 + 32, 256 + 128);
  1828. wnd.AllowDocking := true;
  1829. wnd.AllowResizing := false;
  1830. wnd.visible := true;
  1831. wnd.Left := 168;
  1832. wnd.Top := 64 + 16;
  1833. wnd.OnShow.Subscribe(UpdateFiltersTop);
  1834. wnd.ShowBorder := false;
  1835. wnd.CanBeActivated := false;
  1836.  
  1837. ra := TGUIRenderArea.Create(0, 0, wnd.Width, wnd.Height, wnd);
  1838. ra.RenderCallBack := window_shop_filter_Render;
  1839. ra.center := false;
  1840.  
  1841. L := 0;
  1842. // FairShop
  1843. btn := TGUIButton.Create(Common_Buttons3, wnd);
  1844. btn.caption := GetTranslation('m1272');
  1845. btn.Left := 8;
  1846. btn.Top := 40 + 32 * L;
  1847. btn.Width := 150;
  1848. btn.Align := guiInUpperCorner;
  1849. btn.OnClick.Subscribe(gui_stop_click_fair);
  1850. btn.tag := 115;
  1851. btn.reuse_delay := 60;
  1852. btn.MouseTracerEnabled := true;
  1853. btn.visible := true;
  1854. Inc(L);
  1855.  
  1856. // AutomaticAuction
  1857. // Товары SC
  1858. {shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1859. shbtn.caption := GetTranslation('m402');
  1860. shbtn.sidehint := GetTranslation('shop_hint_01');
  1861. shbtn.Left := 8;
  1862. shbtn.Top := 40 + 32 * L;
  1863. shbtn.Width := 150;
  1864. shbtn.Align := guiInUpperCorner;
  1865. shbtn.OnClick.Subscribe(gui_stop_click_automaticauction);
  1866. shbtn.tag := 104;
  1867. shbtn.reuse_delay := 60;
  1868. shbtn.MouseTracerEnabled := true;
  1869. shbtn.visible := true;
  1870. Inc(L);
  1871. }
  1872. // Premium
  1873. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1874. shbtn.caption := GetTranslation('m117');
  1875. shbtn.sidehint := GetTranslation('shop_hint_02');
  1876. shbtn.Left := 8;
  1877. shbtn.Top := 40 + 32 * L;
  1878. shbtn.Width := 150;
  1879. shbtn.Align := guiInUpperCorner;
  1880. shbtn.OnClick.Subscribe(gui_stop_click_premium);
  1881. shbtn.tag := 103;
  1882. shbtn.reuse_delay := 60;
  1883. shbtn.MouseTracerEnabled := true;
  1884. Inc(L);
  1885.  
  1886. // Weapons
  1887. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1888. shbtn.caption := GetTranslation('h17c');
  1889. shbtn.sidehint := GetTranslation('shop_hint_03');
  1890. shbtn.Left := 8;
  1891. shbtn.Width := 150;
  1892. shbtn.Top := 40 + 32 * L;
  1893. shbtn.Align := guiInUpperCorner;
  1894. shbtn.OnClick.Subscribe(gui_standartshopshow);
  1895. shbtn.tag := 100;
  1896. shbtn.reuse_delay := 60;
  1897. shbtn.MouseTracerEnabled := true;
  1898. Inc(L);
  1899.  
  1900. // Armor
  1901. // btn := TGUIButton.Create(Common_Buttons3, wnd);
  1902. // btn.caption := GetTranslation('m103');
  1903. // btn.Left := 8;
  1904. // btn.Width := 150;
  1905. // btn.Top := 40 + 32* L;
  1906. // btn.Align := guiInUpperCorner;
  1907. // btn.OnClick.Subscribe( gui_stop_click_armors;
  1908. // btn.tag := 101;
  1909. // btn.reuse_delay := 60;
  1910. // Inc(L);
  1911.  
  1912. // Acc
  1913. // btn := TGUIButton.Create(Common_Buttons3, wnd);
  1914. // btn.caption := GetTranslation('m104');
  1915. // btn.Left := 8;
  1916. // btn.Top := 40 + 32* L;
  1917. // btn.Width := 150;
  1918. // btn.Align := guiInUpperCorner;
  1919. // btn.OnClick.Subscribe( gui_stop_click_accesories;
  1920. // btn.tag := 102;
  1921. // btn.reuse_delay := 60;
  1922. // Inc(L);
  1923.  
  1924. // Market
  1925. { отключен в связи с хронической закрытостью рынка 29 мая 2014
  1926. btn := TGUIButton.Create(Common_Buttons3, wnd);
  1927. btn.MouseTracerEnabled := True;
  1928. with btn do begin
  1929. caption := GetTranslation('mn118');
  1930. Left := 8;
  1931. Top := 40 + 32* L;
  1932. Width := 150;
  1933. Align := guiInUpperCorner;
  1934. OnClick.Subscribe( gui_stop_click_market;
  1935. tag := 106;
  1936. reuse_delay := 60;
  1937. end;
  1938. Inc(L);
  1939. }
  1940.  
  1941. // Rent
  1942. {
  1943. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1944. shbtn.caption := GetTranslation('mn117');
  1945. shbtn.sidehint := GetTranslation('shop_hint_04');
  1946. shbtn.Left := 8;
  1947. shbtn.Top := 40 + 32 * L;
  1948. shbtn.Width := 150;
  1949. shbtn.Align := guiInUpperCorner;
  1950. shbtn.OnClick.Subscribe(gui_stop_click_rentshop);
  1951. shbtn.tag := 105;
  1952. shbtn.reuse_delay := 60;
  1953. shbtn.visible := true;
  1954. Inc(L);
  1955. }
  1956. // Auction
  1957. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1958. shbtn.caption := GetTranslation('m1255'); // GetTranslation('m712');
  1959. shbtn.sidehint := GetTranslation('shop_hint_05');
  1960. shbtn.Left := 8;
  1961. shbtn.Top := 40 + 32 * L;
  1962. shbtn.Width := 150;
  1963. shbtn.Align := guiInUpperCorner;
  1964. shbtn.OnClick.Subscribe(gui_stop_click_players_auction);
  1965. shbtn.tag := 112;
  1966. shbtn.reuse_delay := 60;
  1967. shbtn.visible := true;
  1968. Inc(L);
  1969.  
  1970. // Dealers
  1971. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1972. shbtn.caption := GetTranslation('m790');
  1973. shbtn.sidehint := GetTranslation('shop_hint_06');
  1974. shbtn.Left := 8;
  1975. shbtn.Top := 40 + 32 * L;
  1976. shbtn.Width := 150;
  1977. shbtn.Align := guiInUpperCorner;
  1978. shbtn.OnClick.Subscribe(gui_stop_click_dealers);
  1979. shbtn.tag := 109;
  1980. shbtn.reuse_delay := 60;
  1981. shbtn.visible := true;
  1982. Inc(L);
  1983.  
  1984. // Mail
  1985. // btn := TGUIButton.Create(Common_Buttons3, wnd);
  1986. // btn.caption := GetTranslation('m817');
  1987. // btn.Left := 8;
  1988. // btn.Top := 40 + 32* L;
  1989. // btn.Width := 150;
  1990. // btn.Align := guiInUpperCorner;
  1991. // btn.OnClick.Subscribe( gui_stop_click_mail;
  1992. // btn.tag := 110;
  1993. // btn.reuse_delay := 60;
  1994. // btn.Visible := true;
  1995. // Inc(L);
  1996.  
  1997. // Quotation
  1998. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  1999. shbtn.caption := GetTranslation('m854');
  2000. shbtn.sidehint := GetTranslation('shop_hint_07');
  2001. shbtn.Left := 8;
  2002. shbtn.Top := 40 + 32 * L;
  2003. shbtn.Width := 150;
  2004. shbtn.Align := guiInUpperCorner;
  2005. shbtn.OnClick.Subscribe(gui_stop_click_quotation);
  2006. shbtn.tag := 111;
  2007. shbtn.reuse_delay := 60;
  2008. shbtn.visible := true;
  2009. Inc(L);
  2010.  
  2011. // SCBOX
  2012. {shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2013. shbtn.caption := GetTranslation('m1328');
  2014. shbtn.sidehint := GetTranslation('shop_hint_08');
  2015. shbtn.Left := 8;
  2016. shbtn.Top := 40 + 32 * L;
  2017. shbtn.Width := 150;
  2018. shbtn.Align := guiInUpperCorner;
  2019. shbtn.OnClick.Subscribe(gui_stop_click_scbox);
  2020. shbtn.tag := 116;
  2021. shbtn.reuse_delay := 60;
  2022. shbtn.visible := true;
  2023. Inc(L); }
  2024.  
  2025. // Special Auction
  2026. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2027. shbtn.caption := GetTranslation('spa016'); // GetTranslation('m712');
  2028. shbtn.sidehint := GetTranslation('spa_hint');
  2029. shbtn.Left := 8;
  2030. shbtn.Top := 40 + 32 * L;
  2031. shbtn.Width := 150;
  2032. shbtn.Align := guiInUpperCorner;
  2033. shbtn.OnClick.Subscribe(ShowSpAuctionWindow);
  2034. shbtn.tag := 118;
  2035. shbtn.reuse_delay := 60;
  2036. shbtn.visible := true;
  2037. Inc(L);
  2038.  
  2039. // Gold Rush
  2040. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2041. shbtn.caption := GetTranslation('art_boost_caption');
  2042. shbtn.sidehint := GetTranslation('art_boost_hint');
  2043. shbtn.Left := 8;
  2044. shbtn.Top := 40 + 32 * L;
  2045. shbtn.Width := 150;
  2046. shbtn.Align := guiInUpperCorner;
  2047. shbtn.OnClick.Subscribe(ShowArtBoostWindow);
  2048. shbtn.tag := 120;
  2049. shbtn.reuse_delay := 60;
  2050. shbtn.visible := true;
  2051. Inc(L);
  2052.  
  2053. // Магазин ТС
  2054. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2055. shbtn.caption := GetTranslation('trueskill_shop');
  2056. shbtn.sidehint := GetTranslation('trueskill_shop_hint');
  2057. shbtn.Left := 8;
  2058. shbtn.Top := 40 + 32 * L;
  2059. shbtn.Width := 150;
  2060. shbtn.Align := guiInUpperCorner;
  2061. shbtn.OnClick.Subscribe(
  2062. procedure
  2063. begin
  2064. ShowMultiShop(7);
  2065. end);
  2066. shbtn.tag := 121;
  2067. shbtn.reuse_delay := 60;
  2068. shbtn.visible := true;
  2069. Inc(L);
  2070.  
  2071. // Расходка
  2072. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2073. shbtn.caption := GetTranslation('tcs_c08');
  2074. shbtn.sidehint := GetTranslation('tcs_c08_hint');
  2075. shbtn.Left := 8;
  2076. shbtn.Top := 40 + 32 * L;
  2077. shbtn.Width := 150;
  2078. shbtn.Align := guiInUpperCorner;
  2079. shbtn.OnClick.Subscribe(
  2080. procedure
  2081. begin
  2082. GUI_ShowConsumableShop(15);
  2083. end);
  2084. shbtn.tag := 122;
  2085. shbtn.reuse_delay := 60;
  2086. shbtn.visible := true;
  2087. Inc(L);
  2088.  
  2089. // Самир Рафи
  2090. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2091. shbtn.caption := GetTranslation('coshop_1');
  2092. shbtn.sidehint := GetTranslation('coshop_1_hint');
  2093. shbtn.Left := 8;
  2094. shbtn.Top := 40 + 32 * L;
  2095. shbtn.Width := 150;
  2096. shbtn.Align := guiInUpperCorner;
  2097. shbtn.OnClick.Subscribe(
  2098. procedure
  2099. begin
  2100. ShowMultiShop(1);
  2101. end);
  2102. shbtn.tag := 123;
  2103. shbtn.reuse_delay := 60;
  2104. shbtn.visible := true;
  2105. Inc(L);
  2106.  
  2107. // Чаоксианг Ли
  2108. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2109. shbtn.caption := GetTranslation('coshop_2');
  2110. shbtn.sidehint := GetTranslation('coshop_2_hint');
  2111. shbtn.Left := 8;
  2112. shbtn.Top := 40 + 32 * L;
  2113. shbtn.Width := 150;
  2114. shbtn.Align := guiInUpperCorner;
  2115. shbtn.OnClick.Subscribe(
  2116. procedure
  2117. begin
  2118. ShowMultiShop(2);
  2119. end);
  2120. shbtn.tag := 124;
  2121. shbtn.reuse_delay := 60;
  2122. shbtn.visible := true;
  2123. Inc(L);
  2124.  
  2125. // Иван Романов
  2126. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2127. shbtn.caption := GetTranslation('coshop_3');
  2128. shbtn.sidehint := GetTranslation('coshop_3_hint');
  2129. shbtn.Left := 8;
  2130. shbtn.Top := 40 + 32 * L;
  2131. shbtn.Width := 150;
  2132. shbtn.Align := guiInUpperCorner;
  2133. shbtn.OnClick.Subscribe(
  2134. procedure
  2135. begin
  2136. ShowMultiShop(3);
  2137. end);
  2138. shbtn.tag := 125;
  2139. shbtn.reuse_delay := 60;
  2140. shbtn.visible := true;
  2141. Inc(L);
  2142.  
  2143. // Гордый Фримен
  2144. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2145. shbtn.caption := GetTranslation('coshop_4');
  2146. shbtn.sidehint := GetTranslation('coshop_4_hint');
  2147. shbtn.Left := 8;
  2148. shbtn.Top := 40 + 32 * L;
  2149. shbtn.Width := 150;
  2150. shbtn.Align := guiInUpperCorner;
  2151. shbtn.OnClick.Subscribe(
  2152. procedure
  2153. begin
  2154. ShowMultiShop(4);
  2155. end);
  2156. shbtn.tag := 126;
  2157. shbtn.reuse_delay := 60;
  2158. shbtn.visible := true;
  2159. Inc(L);
  2160.  
  2161. // Лаборатория
  2162. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2163. shbtn.caption := GetTranslation('coshop_5');
  2164. shbtn.sidehint := GetTranslation('coshop_5_hint');
  2165. shbtn.Left := 8;
  2166. shbtn.Top := 40 + 32 * L;
  2167. shbtn.Width := 150;
  2168. shbtn.Align := guiInUpperCorner;
  2169. shbtn.OnClick.Subscribe(
  2170. procedure
  2171. begin
  2172. ShowMultiShop(5);
  2173. end);
  2174. shbtn.tag := 127;
  2175. shbtn.reuse_delay := 60;
  2176. shbtn.visible := true;
  2177. Inc(L);
  2178.  
  2179. // Нужные вещи
  2180. shbtn := TGUISideHintButton.Create(Common_Buttons3, wnd);
  2181. shbtn.caption := GetTranslation('coshop_6');
  2182. shbtn.sidehint := GetTranslation('coshop_6_hint');
  2183. shbtn.Left := 8;
  2184. shbtn.Top := 40 + 32 * L;
  2185. shbtn.Width := 150;
  2186. shbtn.Align := guiInUpperCorner;
  2187. shbtn.OnClick.Subscribe(
  2188. procedure
  2189. begin
  2190. ShowMultiShop(6);
  2191. end);
  2192. shbtn.tag := 128;
  2193. shbtn.reuse_delay := 60;
  2194. shbtn.visible := true;
  2195.  
  2196. // Inc(L); // <-- don't forget to uncomment
  2197.  
  2198. TGUITutorialTipArea.Create(TIP_LOC_SHOP_BUTTONS, 0, 0, 0, 0, wnd);
  2199.  
  2200. // Обработка видимости в gui_Shop_Show
  2201.  
  2202. // ---------------------------------------------------------------------
  2203. // BANK WINDOW
  2204. wnd := TGUIWindow.Create(oInterface);
  2205. wnd.Name := 'window_bank';
  2206. wnd.SetSize(10, 10, 530, 240);
  2207. wnd.MinWidth := 1;
  2208. wnd.MinHeight := 1;
  2209. wnd.AllowDocking := true;
  2210. wnd.AllowResizing := false;
  2211. wnd.caption := GetTranslation('m106');
  2212. wnd.visible := false;
  2213. wnd.CenterOnScreen;
  2214. wnd.CloseBtn.ModalResult := mrCancel;
  2215. wnd.CloseBtn.visible := true;
  2216. wnd.CloseBtn.OnClick.Subscribe(GS_SetGlobalPage_Map);
  2217.  
  2218. with TGUIRenderArea.Create(260, 15, wnd.Width, wnd.Height, wnd) do
  2219. begin
  2220. RenderCallBack := RenderBankLogo;
  2221. center := false;
  2222. end;
  2223.  
  2224. label1 := TGUILabel.Create(wnd);
  2225. label1.Left := 16;
  2226. label1.caption := Format(GetTranslation('ba01'), [inttostr(character.Credits)]);
  2227. label1.Top := 29 + 16 * 9;
  2228. label1.Name := 'cred_count';
  2229. // label1.right_align := true;
  2230.  
  2231. // goldcred_count
  2232. label1 := TGUILabel.Create(wnd);
  2233. label1.Left := 16;
  2234. label1.caption := Format(GetTranslation('ba03'), [inttostr(character.GoldCredits)]);
  2235. label1.Top := 29 + 16 * 10;
  2236. label1.Name := 'goldcred_count';
  2237. // label1.right_align := true;
  2238.  
  2239. // BUYING
  2240. label1 := TGUILabel.Create(wnd);
  2241. label1.Left := 16;
  2242. label1.caption := GetTranslation('ba04');
  2243. label1.Top := 29;
  2244. label1.Name := 'c';
  2245. label1.Font := PIXELB;
  2246. label1.color := TI_BOLD_COLOR;
  2247.  
  2248. // Открывается в новом окне браузера
  2249. label1 := TGUILabel.Create(wnd);
  2250. label1.Left := 16;
  2251. label1.caption := GetTranslation('ba08');
  2252. label1.Top := 29 + 16 * 1;
  2253. label1.Name := 'c';
  2254.  
  2255. // Курс продажи
  2256. label1 := TGUILabel.Create(wnd);
  2257. label1.Left := 16;
  2258. label1.caption := GetTranslation('ba02');
  2259. label1.Top := 29 + 16 * 2;
  2260. label1.Name := 'c2';
  2261. label1.color := TI_COLOR;
  2262.  
  2263. // Количество
  2264. edit := TGUIEdit.Create(wnd);
  2265. edit.Name := 'edit_buycred';
  2266. edit.Left := 100;
  2267. edit.Top := 32 + 16 * 5;
  2268. edit.Width := 40;
  2269. edit.Text := '30';
  2270. edit.CursorPos := Length(edit.Text);
  2271. edit.MaxLength := 6;
  2272. edit.WorkMode := wmInteger;
  2273. edit.visible := false;
  2274.  
  2275. // BUY
  2276. btn := TGUIButton.Create(Common_Buttons3, wnd);
  2277. btn.caption := GetTranslation('m107');
  2278. btn.Left := 6;
  2279. btn.Top := wnd.Height - 39;
  2280. btn.Width := 175;
  2281. btn.Align := guiInUpperCorner;
  2282. btn.OnClick.Subscribe(gui_shop_buy_cred);
  2283.  
  2284. // CLOSE
  2285. btn := TGUIButton.Create(Common_Buttons3, wnd);
  2286. btn.caption := GetTranslation('mn19');
  2287. btn.Top := wnd.Height - 39;
  2288. btn.Width := 175;
  2289. btn.Left := wnd.Width - btn.Width - 6;
  2290. btn.Align := guiInUpperCorner;
  2291. btn.OnClick.Subscribe(GS_SetGlobalPage_Map);
  2292.  
  2293. // MAKE MONEY
  2294. btn := TGUIButton.Create(Common_Buttons3, wnd);
  2295. btn.caption := GetTranslation('m782');
  2296. btn.Left := 6 + 175 + 3;
  2297. btn.Top := wnd.Height - 39;
  2298. btn.Width := 175;
  2299. btn.Align := guiInUpperCorner;
  2300. btn.OnClick.Subscribe(gui_shop_make_gold);
  2301. btn.visible := AffiliateEarningGoldButtonEnabled;
  2302. btn.visible := false;
  2303.  
  2304. // ---------------------------------------------------------------------
  2305. // BUY CONFIRM WINDOW
  2306. end;
  2307.  
  2308. // -----------------------------------------------------------------------------
  2309. // -------------------------TGUIShop--------------------------------------------
  2310. // -----------------------------------------------------------------------------
  2311. constructor TGUIShop.Create(oLeft, oTop, oW, oH: integer; oParentControl: TGUIControl);
  2312. begin
  2313. inherited Create(oParentControl, oParentControl.fRootInterface);
  2314. fWidth := oW;
  2315. fHeight := oH;
  2316. fBaseWidth := fWidth;
  2317. fBaseHeight := fHeight;
  2318. fLeft := oLeft;
  2319. fTop := oTop;
  2320. visible := true;
  2321. Enabled := true;
  2322. items := nil;
  2323. SetLength(items, 0);
  2324. fitemsHeight := 60;
  2325. fCurIndex := -1;
  2326. Loading := true;
  2327.  
  2328. // fCurScroll:=0;
  2329. // AllowSelect:=True;
  2330. // Parse:=False;
  2331.  
  2332. fCount := 1;
  2333. filterindex := 0;
  2334. TotalHeight := fBaseHeight;
  2335. fTrkHeight := fHeight - 32;
  2336. SetLength(items, 0);
  2337. // scrollbar := TGUIScrollBar.Create(Oleft, oTop, 200, self);
  2338. // fItemsHeight := 20;
  2339. end;
  2340.  
  2341. // -----------------------------------------------------------------------------
  2342. procedure TGUIShop.DoDraw;
  2343. var
  2344. i, _x, _y, AbsLeft, AbsTop: integer;
  2345. ClientRect: TRect;
  2346. Name: string;
  2347. too_low_money: boolean;
  2348. // alpha_dec : byte;
  2349.  
  2350. procedure ScrollBar;
  2351. begin
  2352.  
  2353. DrawControlBorder(AbsLeft + Width - 16, AbsTop, 17, Height, TI_LINE_COLOR);
  2354. DrawControlScrollBar(AbsLeft + Width - 14, AbsTop + 17 + fTrkTop, 12, fTrkHeight, Height - 36 = fTrkHeight);
  2355. if not fUpPressed then
  2356. Renderer_EffectCol(Common_Buttons, AbsLeft + Width - 16, AbsTop, AColor, 0, 0)
  2357. else
  2358. Renderer_EffectCol(Common_Buttons, AbsLeft + Width - 16, AbsTop, AColor, 1, 0);
  2359. if not fDownPressed then
  2360. Renderer_EffectCol(Common_Buttons, AbsLeft + Width - 16, AbsTop + Height - 16, AColor, 2, 0)
  2361. else
  2362. Renderer_EffectCol(Common_Buttons, AbsLeft + Width - 16, AbsTop + Height - 16, AColor, 3, 0);
  2363.  
  2364. end;
  2365.  
  2366. begin
  2367.  
  2368. // Отрисовываем основную область
  2369. AbsLeft := ParentControl.GetLeft + Left;
  2370. AbsTop := ParentControl.GetTop + Top;
  2371. ScrollBar;
  2372.  
  2373. _x := 8;
  2374. _y := -fCurScroll;
  2375.  
  2376. ClientRect := Rect(AbsLeft, AbsTop + 2, AbsLeft + Width - 16, AbsTop + Height + 2);
  2377. SetClipRect(ClientRect);
  2378.  
  2379. for i := 0 to high(items) do
  2380. begin
  2381.  
  2382. if (_y >= -fitemsHeight) and (_y < Height) then
  2383. begin
  2384. if assigned(Common_TradeLot.texture) then
  2385. begin
  2386. if fCurIndex = i then
  2387. Renderer_EffectCol(Common_TradeLot, AbsLeft + _x, AbsTop + _y, $77FFFFFF, 1, 0);
  2388. Renderer_EffectCol(Common_TradeLot, AbsLeft + _x, AbsTop + _y, $FFFFFFFF, 0, 0);
  2389. end;
  2390.  
  2391. if assigned(Common_ItemSlot.texture) then
  2392. Renderer_EffectCol(Common_ItemSlot, AbsLeft + _x + 10, AbsTop + _y + 14, $77FFFFFF, 0, 0);
  2393.  
  2394. // if items[i].Equipped=1 then I_ICONS_MINI.Draw(AbsLeft + _x + IW - 11, AbsTop + _y + IH - 9, $FFFFFFFF, 0, I_ICONS_MINI.PatternWidth, I_ICONS_MINI.PatternHeight);
  2395. // Renderer_Rectangle(AbsLeft + _x, AbsTop + _y, IW,IH, $0, $4400FF00, 2 or $100);
  2396. // DrawControlBorder(AbsLeft + _x, AbsTop + _y , IW, IH, $FF00FFFF);
  2397. // Font_TextOut(PIXEL, inttostr( items[i].item_id ), AbsLeft+_x, AbsTop+_y, $FFFFFFFF );
  2398.  
  2399. too_low_money := false;
  2400. if (items[i].price > 0) then
  2401. begin
  2402. too_low_money := character.Credits < items[i].price;
  2403. end;
  2404. if (items[i].GoldPrice > 0) then
  2405. begin
  2406. too_low_money := character.GoldCredits < items[i].GoldPrice;
  2407. end;
  2408.  
  2409. GameItem_Render(AbsLeft + _x + IW div 2 + 10, AbsTop + _y + IH div 2 + 14, items[i], tag = 0, false,
  2410. ((tag = 23) or (items[i].count > 1)), false, true);
  2411.  
  2412. if (items[i].available = 0) then
  2413. begin
  2414. Renderer_EffectCol(Common_TradeLot, AbsLeft + _x, AbsTop + _y, $FF222222, 1, 0);
  2415. end;
  2416.  
  2417. // hack for cash
  2418. name := GetItemNameByID(items[i].item_id);
  2419. if items[i].item_id <= 2 then
  2420. name := inttostr(items[i].count) + ' ' + name;
  2421.  
  2422. if (items[i].EnhanceLevel > 0) then
  2423. begin
  2424. Font_TextOut(PIXELB, '+' + inttostr(items[i].EnhanceLevel) + ' ', AbsLeft + _x + IW + 14,
  2425. AbsTop + _y + 10, $FFFFFFFF - min(($1A1A00 * items[i].EnhanceLevel), $FFFF00) -
  2426. (integer(too_low_money) * $B0000000));
  2427. Font_TextOut(PIXELB, name, AbsLeft + _x + IW + 14 + Font_TextWidth(PIXELB,
  2428. '+' + inttostr(items[i].EnhanceLevel) + ' '), AbsTop + _y + 10,
  2429. TI_BOLD_COLOR - (integer(too_low_money) * $B0000000));
  2430. end
  2431. else
  2432. begin
  2433. Font_TextOut(PIXELB, name, AbsLeft + _x + IW + 14, AbsTop + _y + 10,
  2434. TI_BOLD_COLOR - (integer(too_low_money) * $B0000000));
  2435. end;
  2436.  
  2437. if items[i].price > 0 then
  2438. Font_TextOut(PIXEL, Format(GetTranslation('m105'), [IntThousandSeparation(inttostr(items[i].price))]),
  2439. AbsLeft + _x + IW + 14, AbsTop + _y + 22, $FFFFFFFF - (integer(too_low_money) * $B0000000));
  2440. if items[i].GoldPrice > 0 then
  2441. Font_TextOut(PIXEL, Format(GetTranslation('m116'), [IntThousandSeparation(inttostr(items[i].GoldPrice))]),
  2442. AbsLeft + _x + IW + 14, AbsTop + _y + 22, $FFFFFFFF - (integer(too_low_money) * $B0000000));
  2443.  
  2444. if (items[i].available > 0) then
  2445. begin
  2446. Font_TextOut(PIXEL, Format(GetTranslation('m656'), [IntThousandSeparation(inttostr(items[i].available))]),
  2447. AbsLeft + _x + IW + 14, AbsTop + _y + 36, $FFFFFFFF);
  2448. end;
  2449.  
  2450. end;
  2451.  
  2452. Inc(_y, fitemsHeight);
  2453. end;
  2454.  
  2455. if Loading then
  2456. begin
  2457. Renderer_FillRect(Rect(AbsLeft + 10, AbsTop, Width - 26, Height + 6), $44000000, 0);
  2458. Renderer_EffectCol(FindTexture('loading'), AbsLeft + Width div 2 - 16, AbsTop + Height div 2 - 16, $FFFFFFFF,
  2459. (GTIME div 80) mod 16, 0);
  2460. end;
  2461. // DJXTextureList1.find('loading').Draw(AbsLeft + Width div 2 - 16, AbsTop + Height div 2 - 16, $FFFFFFFF, (GTIME div 80) mod 16, 32, 32 );
  2462.  
  2463. ResetClipRect();
  2464.  
  2465. end;
  2466.  
  2467. // -----------------------------------------------------------------------------
  2468. procedure TGUIShop.DoMouseDown(Button: TMouseButton; X, Y: integer);
  2469. var { id, }
  2470. i, _x, _y: integer;
  2471. begin
  2472. _x := 8;
  2473. _y := -fCurScroll;
  2474.  
  2475. if not Loading then
  2476. for i := 0 to high(items) do
  2477. begin
  2478. if ((X - Left >= _x) and (X - Left <= _x + 266) and (Y - Top >= _y) and (Y - Top <= _y + fitemsHeight)) then
  2479. begin
  2480. if (items[i].available <> 0) then
  2481. begin
  2482. fCurIndex := i;
  2483. end;
  2484. end;
  2485. Inc(_y, fitemsHeight);
  2486. end;
  2487.  
  2488. // if Assigned(OnSenderClick) then OnSenderClick(self);
  2489. OnClick.Call;
  2490.  
  2491. if (X > Left + Width - 16) and (X < Left + Width) and (Y < Top + 16) then
  2492. fUpPressed := true;
  2493. if (X > Left + Width - 16) and (X < Left + Width) and (Y > Top + Height - 16) then
  2494. fDownPressed := true;
  2495.  
  2496. if Length(items) > 0 then
  2497. begin
  2498. if (X > Left + Width - 16) and (X < Left + Width) and (Y > Top + 16 + fTrkTop) and
  2499. (Y < Top + 16 + fTrkTop + fTrkHeight) then
  2500. begin
  2501. fScrollPressed := true;
  2502. OldY := fTrkTop;
  2503. MouseY := MainCursorY;
  2504. end;
  2505. end;
  2506. end;
  2507.  
  2508. // -----------------------------------------------------------------------------
  2509. procedure TGUIShop.DoMouseDoubleClick(X, Y: integer);
  2510. var
  2511. i, _x, _y: integer;
  2512. begin
  2513.  
  2514. _x := 8;
  2515. _y := -fCurScroll;
  2516.  
  2517. if not Loading then
  2518. for i := 0 to high(items) do
  2519. begin
  2520. if ((X - Left >= _x) and (X - Left <= _x + 256) and (Y - Top >= _y) and (Y - Top <= _y + fitemsHeight)) then
  2521. begin
  2522. if (items[i].available = 0) then
  2523. begin
  2524. Inc(_y, fitemsHeight);
  2525. Continue;
  2526. end;
  2527.  
  2528. if (tag = 23) then
  2529. begin
  2530. SEND_RequestAssaultTeamItemManipulate(0, items[i].obj_id, 1);
  2531. end
  2532. else
  2533. begin
  2534. { if last_shop_type = 3 then
  2535. SEND_RequestPremiumItemShopBuy( owner_id, items[i].obj_id, items[i].count) else
  2536. SEND_RequestItemShopBuy( owner_id, items[i].obj_id, items[i].count, last_shop_type );
  2537. cprint('sds ' + IntToStr(owner_id)); }
  2538. gui_stop_buy();
  2539. end;
  2540. // SEND_RequestPremiumItemShopBuy( RenderCloseUpModel_soldier_id, items[i].obj_id, items[i].count) else
  2541. // SEND_RequestItemShopBuy( RenderCloseUpModel_soldier_id, items[i].obj_id, items[i].count, last_shop_type );
  2542. // cprint(IntTostr(owner_id) + ' vs. ' + IntTostr(RenderCloseUpModel_soldier_id));
  2543. end;
  2544. Inc(_y, fitemsHeight);
  2545. end;
  2546.  
  2547. end;
  2548.  
  2549. // -----------------------------------------------------------------------------
  2550. procedure TGUIShop.DoMouseWheelDown;
  2551. begin
  2552. fDownPressed := true;
  2553. DoStep();
  2554. fDownPressed := false;
  2555. end;
  2556.  
  2557. // -----------------------------------------------------------------------------
  2558. procedure TGUIShop.DoMouseWheelUp;
  2559. begin
  2560. fUpPressed := true;
  2561. DoStep();
  2562. fUpPressed := false;
  2563. end;
  2564.  
  2565. // -----------------------------------------------------------------------------
  2566. procedure TGUIShop.DoStep2(just_update: boolean);
  2567. var
  2568. fNewPos: integer;
  2569. begin
  2570. if (just_update) then
  2571. begin
  2572. fNewPos := fTrkTop;
  2573. if fNewPos < 0 then
  2574. fNewPos := 0;
  2575. if fNewPos > (Height - 36 - fTrkHeight) then
  2576. begin
  2577. fNewPos := Height - 36 - fTrkHeight;
  2578. fNewPos := Trunc((TotalHeight - (fHeight)) * (fNewPos / (Height - 36 - fTrkHeight)));
  2579. fCurScroll := fNewPos;
  2580. UpdateTrk;
  2581. end;
  2582. Exit;
  2583. end;
  2584.  
  2585. // if AllowFlip(fFlipScroll,5) then
  2586. begin
  2587. if fUpPressed then
  2588. begin
  2589. dec(fCurScroll, 25);
  2590. if fCurScroll < 0 then
  2591. fCurScroll := 0;
  2592. UpdateTrk;
  2593. end;
  2594. if fDownPressed then
  2595. begin
  2596.  
  2597. if TotalHeight > fHeight then
  2598. begin
  2599. Inc(fCurScroll, 25);
  2600. if fCurScroll > TotalHeight - (fHeight) then
  2601. fCurScroll := TotalHeight - (fHeight);
  2602. end;
  2603.  
  2604. UpdateTrk;
  2605. end;
  2606. if fScrollPressed then
  2607. begin
  2608. fNewPos := OldY + (MainCursorY - MouseY);
  2609. if fNewPos < 0 then
  2610. fNewPos := 0;
  2611. if fNewPos > (Height - 36 - fTrkHeight) then
  2612. fNewPos := Height - 36 - fTrkHeight;
  2613. fNewPos := Trunc((TotalHeight - (fHeight)) * (fNewPos / (Height - 36 - fTrkHeight)));
  2614. fCurScroll := fNewPos;
  2615. UpdateTrk;
  2616. end;
  2617. end;
  2618. end;
  2619.  
  2620. procedure TGUIShop.DoStep;
  2621. begin
  2622. DoStep2(false);
  2623. end;
  2624.  
  2625. // -----------------------------------------------------------------------------
  2626. procedure TGUIShop.DoMouseUp(Button: TMouseButton; X, Y: integer);
  2627. begin
  2628. if Button = mbLeft then
  2629. GUIN_DragItemExecute(self);
  2630. fUpPressed := false;
  2631. fDownPressed := false;
  2632. fScrollPressed := false;
  2633. end;
  2634.  
  2635. // -----------------------------------------------------------------------------
  2636. procedure TGUIShop.DeselectItem;
  2637. begin
  2638. fCurIndex := -1;
  2639. end;
  2640.  
  2641. // -----------------------------------------------------------------------------
  2642. procedure TGUIShop.DoCancelClick;
  2643. begin
  2644. fUpPressed := false;
  2645. fDownPressed := false;
  2646. fScrollPressed := false;
  2647. // cprint('TGUIShop.DoCancelClick');
  2648. end;
  2649.  
  2650. // -----------------------------------------------------------------------------
  2651. procedure TGUIShop.UpdateTrk;
  2652. begin
  2653. TotalHeight := high(items) * fitemsHeight + fitemsHeight;
  2654.  
  2655. if TotalHeight <= Height then
  2656. begin
  2657. fTrkHeight := fHeight - 36;
  2658. fTrkTop := 0;
  2659. end
  2660. else
  2661. begin
  2662. fTrkHeight := Round(Int((fHeight - 36) * ((fHeight) / (TotalHeight))));
  2663. fTrkTop := Round((fHeight - 36 - fTrkHeight) * (fCurScroll / (TotalHeight - (fHeight))));
  2664. end;
  2665. end;
  2666.  
  2667. // -----------------------------------------------------------------------------
  2668. procedure TGUIShop.ScrollDown;
  2669. begin
  2670. // if fTextHeight<=fHeight-4 then fCurScroll:=0 else
  2671. // fCurScroll:=fTextHeight-(fHeight-4);
  2672. end;
  2673.  
  2674. // -----------------------------------------------------------------------------
  2675. procedure TGUIShop.Clear;
  2676. begin
  2677. fCurScroll := 0;
  2678. fCurIndex := -1;
  2679. // if Assigned(OnSenderClick) then OnSenderClick(self);
  2680. OnClick.Call;
  2681. SetLength(items, 0);
  2682. end;
  2683.  
  2684. // -----------------------------------------------------------------------------
  2685. procedure TGUIShop.DoMouseMove(Button: TMouseButton; X, Y: integer);
  2686. var
  2687. i, _x, _y: integer;
  2688. begin
  2689. _x := 8;
  2690. _y := -fCurScroll;
  2691.  
  2692. // Common_ItemSlot.draw(AbsLeft + _x + 10, AbsTop + _y + 14, $77FFFFFF);
  2693.  
  2694. for i := 0 to high(items) do
  2695. begin
  2696. if ((X - Left >= _x + 10) and (X - Left <= _x + IW + 5) and (Y - Top >= _y + 14 { - ih div 2 } ) and
  2697. (Y - Top <= _y + IH + 14)) then
  2698. begin
  2699. Hint_WeaponHint_POP(items[i]);
  2700. if (CurIndex <> -1) and (CurIndex = i) then
  2701. begin
  2702. if mbPressed[0] = 1 then
  2703. if GUIInterface.guiDragMove = 1 then
  2704. GUIN_DragItem(items[i], self);
  2705. end;
  2706. Exit;
  2707. end;
  2708.  
  2709. Inc(_y, fitemsHeight);
  2710. end;
  2711. end;
  2712.  
  2713. // -----------------------------------------------------------------------------
  2714. // TGUINewShopList
  2715. // -----------------------------------------------------------------------------
  2716. procedure TGUINewShopList.Clear(ForceClear: boolean = false);
  2717. begin
  2718. if (ShopItemType = itCustom) and not ForceClear then
  2719. Exit;
  2720.  
  2721. while fItemList.count > 0 do
  2722. begin
  2723. Dispose(fItemList[0]);
  2724. fItemList.Delete(0);
  2725. end;
  2726.  
  2727. fItemIndex := -1;
  2728. fMouseOverItem := -1;
  2729. fMouseOverExpander := -1;
  2730. end;
  2731.  
  2732. // ------------------------------------------------------------------------------
  2733. procedure Shop_SortNameUp; cdecl;
  2734. begin
  2735. GUI3_ShopItemList.fItemList.Sort(TComparer<PGUIShopItem>.Construct(
  2736. function(const Left, Right: PGUIShopItem): integer
  2737. var
  2738. nLeft, nRight: string;
  2739. begin
  2740. if (Left.Item.item_id <> 1) and (Right.Item.item_id = 1) then
  2741. begin
  2742. Exit(1);
  2743. end;
  2744.  
  2745. if (Left.Item.item_id = 1) then
  2746. begin
  2747. if (Right.Item.item_id = 1) then
  2748. begin
  2749. if (Left.Item.count > Right.Item.count) then
  2750. Exit(1);
  2751. if (Left.Item.count < Right.Item.count) then
  2752. Exit(-1);
  2753. Exit(0);
  2754. end;
  2755. Exit(-1);
  2756. end;
  2757.  
  2758. nLeft := GameItemDatas[Left.Item.GetItemIndex].Name;
  2759. nRight := GameItemDatas[Right.Item.GetItemIndex].Name;
  2760. Exit(-AnsiCompareStr(nLeft, nRight));
  2761. end));
  2762. end;
  2763.  
  2764. // ------------------------------------------------------------------------------
  2765. procedure Shop_SortNameDown; cdecl;
  2766. begin
  2767. GUI3_ShopItemList.fItemList.Sort(TComparer<PGUIShopItem>.Construct(
  2768. function(const Left, Right: PGUIShopItem): integer
  2769. var
  2770. nLeft, nRight: string;
  2771. begin
  2772. if (Left.Item.item_id <> 1) and (Right.Item.item_id = 1) then
  2773. begin
  2774. Exit(1);
  2775. end;
  2776.  
  2777. if (Left.Item.item_id = 1) then
  2778. begin
  2779. if (Right.Item.item_id = 1) then
  2780. begin
  2781. if (Left.Item.count > Right.Item.count) then
  2782. Exit(1);
  2783. if (Left.Item.count < Right.Item.count) then
  2784. Exit(-1);
  2785. Exit(0);
  2786. end;
  2787. Exit(-1);
  2788. end;
  2789.  
  2790. nLeft := GameItemDatas[Left.Item.GetItemIndex].Name;
  2791. nRight := GameItemDatas[Right.Item.GetItemIndex].Name;
  2792. Exit(AnsiCompareStr(nLeft, nRight));
  2793. end));
  2794. end;
  2795.  
  2796. // ------------------------------------------------------------------------------
  2797. procedure Shop_SortSenderClick(Sender: TGUIControl); cdecl;
  2798. var
  2799. i: integer;
  2800. ctrl: TGUIControl;
  2801. begin
  2802. if ((Sender as TTitleButton).ButtonState = tbsNone) or ((Sender as TTitleButton).ButtonState = tbsUp) then
  2803. begin
  2804. (Sender as TTitleButton).ButtonState := tbsDown;
  2805. (Sender as TTitleButton).OnDown.Call; // CallBackDown();
  2806. end
  2807. else if (Sender as TTitleButton).ButtonState = tbsDown then
  2808. begin
  2809. (Sender as TTitleButton).ButtonState := tbsUp;
  2810. (Sender as TTitleButton).OnUp.Call; // CallBackUp();
  2811. end;
  2812.  
  2813. ctrl := Sender.ParentControl;
  2814. for i := 0 to ctrl.ControlsCount - 1 do
  2815. if ctrl.controls[i] <> Sender then
  2816. if ctrl.controls[i] is TTitleButton then
  2817. (ctrl.controls[i] as TTitleButton).ButtonState := tbsNone;
  2818. end;
  2819.  
  2820. // ------------------------------------------------------------------------------
  2821. procedure Shop_SortPriceUp; cdecl;
  2822. begin
  2823. GUI3_ShopItemList.fItemList.Sort(TComparer<PGUIShopItem>.Construct(
  2824. function(const Left, Right: PGUIShopItem): integer
  2825. begin
  2826. if (Left.Item.item_id <> 1) and (Right.Item.item_id = 1) then
  2827. begin
  2828. Exit(1);
  2829. end;
  2830.  
  2831. if (Left.Item.item_id = 1) then
  2832. begin
  2833. if (Right.Item.item_id = 1) then
  2834. begin
  2835. if (Left.Item.count > Right.Item.count) then
  2836. Exit(1);
  2837. if (Left.Item.count < Right.Item.count) then
  2838. Exit(-1);
  2839. Exit(0);
  2840. end;
  2841. Exit(-1);
  2842. end;
  2843.  
  2844. if (Left.Item.price <> 0) then
  2845. begin
  2846. if (Left.Item.price = Right.Item.price) then
  2847. Exit(0)
  2848. else if (Left.Item.price > Right.Item.price) then
  2849. Exit(-1)
  2850. else
  2851. Exit(1);
  2852. end
  2853. else
  2854. begin
  2855. if (Left.Item.GoldPrice = Right.Item.GoldPrice) then
  2856. Exit(0)
  2857. else if (Left.Item.GoldPrice > Right.Item.GoldPrice) then
  2858. Exit(-1)
  2859. else
  2860. Exit(1);
  2861. end;
  2862. end));
  2863. end;
  2864.  
  2865. // ------------------------------------------------------------------------------
  2866. procedure Shop_SortPriceDown; cdecl;
  2867. begin
  2868. GUI3_ShopItemList.fItemList.Sort(TComparer<PGUIShopItem>.Construct(
  2869. function(const Left, Right: PGUIShopItem): integer
  2870. begin
  2871. if (Left.Item.item_id <> 1) and (Right.Item.item_id = 1) then
  2872. begin
  2873. Exit(1);
  2874. end;
  2875.  
  2876. if (Left.Item.item_id = 1) then
  2877. begin
  2878. if (Right.Item.item_id = 1) then
  2879. begin
  2880. if (Left.Item.count > Right.Item.count) then
  2881. Exit(1);
  2882. if (Left.Item.count < Right.Item.count) then
  2883. Exit(-1);
  2884. Exit(0);
  2885. end;
  2886. Exit(-1);
  2887. end;
  2888.  
  2889. if (Left.Item.price <> 0) then
  2890. begin
  2891. if (Left.Item.price = Right.Item.price) then
  2892. Exit(0)
  2893. else if (Left.Item.price > Right.Item.price) then
  2894. Exit(1)
  2895. else
  2896. Exit(-1);
  2897. end
  2898. else
  2899. begin
  2900. if (Left.Item.GoldPrice = Right.Item.GoldPrice) then
  2901. Exit(0)
  2902. else if (Left.Item.GoldPrice > Right.Item.GoldPrice) then
  2903. Exit(1)
  2904. else
  2905. Exit(-1);
  2906. end;
  2907. end));
  2908. end;
  2909.  
  2910. // -----------------------------------------------------------------------------
  2911. constructor TGUINewShopList.Create(oLeft, oTop, oWidth, oHeight: integer; oParentControl: TGUIControl);
  2912. begin
  2913. inherited Create(oParentControl, oParentControl.fRootInterface);
  2914.  
  2915. fVisualMode := svmList;
  2916. fLeft := oLeft;
  2917. fTop := oTop;
  2918. fWidth := oWidth;
  2919. fHeight := oHeight;
  2920. Loading := false;
  2921.  
  2922. fItemHeight := 38;
  2923. fItemIndex := -1;
  2924. ClientBorder := TI_LINE_COLOR;
  2925.  
  2926. fSB := TGUISmartScrollBar.Create(self, nil, nil, nil);
  2927. fSB.Position := 0;
  2928. fSB.WorkMode := wmDynamic;
  2929. fSB.Left := fWidth - 16;
  2930.  
  2931. // upgrade
  2932. UpgradeTB := TTitleButton.Create(I_SC_TITLE, oParentControl);
  2933. with TTitleButton(UpgradeTB) do
  2934. begin
  2935. Left := oLeft + 2;
  2936. Top := oTop - 18 - 10 - 3;
  2937. Width := 64 + 209;
  2938. Height := 31;
  2939. caption := GetTranslation('m537');
  2940. OnUp.Subscribe(Shop_SortNameUp);
  2941. OnDown.Subscribe(Shop_SortNameDown);
  2942. OnClick.Subscribe(Shop_SortSenderClick);
  2943. end;
  2944.  
  2945. // price
  2946. PriceTB := TTitleButton.Create(I_SC_TITLE, oParentControl);
  2947. with TTitleButton(PriceTB) do
  2948. begin
  2949. Left := oLeft + 2 + 64 + 208 + 2;
  2950. Top := oTop - 18 - 10 - 3;
  2951. Width := 84;
  2952. Height := 31;
  2953. caption := GetTranslation('m248');
  2954. OnUp.Subscribe(Shop_SortPriceUp);
  2955. OnDown.Subscribe(Shop_SortPriceDown);
  2956. OnClick.Subscribe(Shop_SortSenderClick);
  2957. end;
  2958.  
  2959. fItemList := TList<PGUIShopItem>.Create;
  2960. fExpandedItemsList := TList<Cardinal>.Create;
  2961. fAreaManager := TAreaEventManager.Create;
  2962. fExpandPressed := 0;
  2963.  
  2964. end;
  2965.  
  2966. // -----------------------------------------------------------------------------
  2967. procedure TGUINewShopList.Deselect;
  2968. begin
  2969. fItemIndex := -1;
  2970. end;
  2971.  
  2972. // -----------------------------------------------------------------------------
  2973. destructor TGUINewShopList.Destroy;
  2974. begin
  2975. while fItemList.count > 0 do
  2976. begin
  2977. Dispose(fItemList[0]);
  2978. fItemList.Delete(0);
  2979. end;
  2980. fItemList.Free;
  2981. fExpandedItemsList.Free;
  2982. inherited;
  2983. end;
  2984.  
  2985. // -----------------------------------------------------------------------------
  2986. procedure TGUINewShopList.DrawList(AbsLeft, AbsTop: integer);
  2987. var
  2988. i, _x, _y, W, h: integer;
  2989. ratio: double;
  2990. P: PGUIShopItem;
  2991. ScrollWidth: integer;
  2992. ClientRect: TRect;
  2993. txt: string;
  2994. color: Cardinal;
  2995. shift: shortint;
  2996. ItemHeight: integer;
  2997. img: TDJXTexture;
  2998.  
  2999. procedure DrawRegularItem;
  3000. begin
  3001. ItemHeight := fItemHeight;
  3002. if (_y + ItemHeight < 0) or (_y > Height + 15) then
  3003. begin
  3004. Inc(_y, ItemHeight);
  3005. Exit;
  3006. end;
  3007.  
  3008. _x := 3;
  3009.  
  3010. if (fItemList.IndexOf(P) = fItemIndex) then
  3011. begin
  3012. Visual.Rect(AbsLeft + _x, AbsTop + _y, fWidth, ItemHeight, $77A7A7A7, $77A7A7A7, 0);
  3013. end;
  3014.  
  3015. if (P.count = 0) then
  3016. begin
  3017. Visual.Rect(AbsLeft + _x, AbsTop + _y, fWidth, ItemHeight, $220000FF, $220000FF, 0);
  3018. end;
  3019.  
  3020. Inc(_x, 3);
  3021.  
  3022. // item icon
  3023. if assigned(Common_ItemSlot.texture) then
  3024. begin
  3025. Renderer_EffectCol(Common_ItemSlot, AbsLeft + _x, AbsTop + _y + 2, $77FFFFFF, 0, 0);
  3026. end;
  3027. GameItem_Render(AbsLeft + _x + IW div 2, AbsTop + _y + 4 + IH div 2, P.Item, tag = 0, false,
  3028. (tag = 23) or (P.Item.count > 1), true, true);
  3029.  
  3030. fAreaManager.Add(AbsLeft + _x + IW div 2 - 32, AbsTop + _y + 4 + IH div 2 - 16, 64, 32, [i],
  3031. procedure(params: array of variant)
  3032. begin
  3033. if fMouseOverItem >= 0 then
  3034. Hint_WeaponHint_POP(fItemList[fMouseOverItem].Item);
  3035. end);
  3036.  
  3037. Inc(_x, 64 + 3);
  3038.  
  3039. // item count
  3040. shift := 0;
  3041. if (P.Item.available > 0) then
  3042. begin
  3043. shift := 8;
  3044. Visual.Text(Format(GetTranslation('m656'), [IntThousandSeparation(inttostr(P.Item.available))]), AbsLeft + _x,
  3045. AbsTop + _y + 12 + shift, TI_COLOR, PIXEL, false);
  3046. end;
  3047. // item name
  3048. Visual.Text(GameItemDatas[P.Item.GetItemIndex].Name, AbsLeft + _x, AbsTop + _y + 12 - shift, TI_COLOR,
  3049. PIXEL, false);
  3050. Inc(_x, 208);
  3051.  
  3052. // item prices
  3053. if (P.Item.price <> 0) or (P.Item.GoldPrice = High(Cardinal)) then
  3054. begin
  3055. if P.Item.price <> 0 then txt := IntThousandSeparation(inttostr(P.Item.price))
  3056. else txt := 'FREE';
  3057. // if (P.Item.EnhanceLevel < 20) then begin
  3058. Visual.Text(txt, AbsLeft + _x, AbsTop + _y + 12, TI_COLOR, PIXEL, false);
  3059. if(P.Item.price > 0) then begin
  3060. if (P.cash_type > 2) then
  3061. begin
  3062. // Gui_window_Chat_ReceiveMessage(CHAT_ANY, 'DEBUG', '1. Item Id: ' + IntToStr(P.Item.Item_id) + ' cash type: ' + IntToStr(P.cash_type));
  3063. img := GameItem_GetImage(P.cash_type);
  3064. ratio := img.Width / img.Height;
  3065. W := 32;
  3066. H := Round(W / ratio);
  3067. Visual.Draw(AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, W, H, img);
  3068. end
  3069. else
  3070. begin
  3071. // Gui_window_Chat_ReceiveMessage(CHAT_ANY, 'DEBUG', '2. Item Id: ' + IntToStr(P.Item.Item_id) + ' cash type: ' + IntToStr(P.cash_type));
  3072. Visual.Draw(Common_Credits, AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, P.cash_type - 1);
  3073. end;
  3074. // end;
  3075. end;
  3076.  
  3077. fAreaManager.Add(AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, W, H, [P.cash_type],
  3078. procedure(params: array of variant)
  3079. begin
  3080. CursorHint(GetItemNameByID(params[0]));
  3081. end);
  3082.  
  3083. end
  3084. else
  3085. begin
  3086. txt := IntThousandSeparation(inttostr(P.Item.GoldPrice));
  3087. Visual.Text(txt, AbsLeft + _x, AbsTop + _y + 12, TI_COLOR, PIXEL, false);
  3088. Visual.Draw(Common_Credits, AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, 1);
  3089. end;
  3090. Inc(_x, 80 + 3);
  3091.  
  3092. fAreaManager.Add(AbsLeft, AbsTop + _y, _x, ItemHeight, [i],
  3093. procedure(params: array of variant)
  3094. begin
  3095. fMouseOverItem := params[0];
  3096. end);
  3097.  
  3098. Inc(_y, ItemHeight);
  3099. Renderer_Line(AbsLeft, AbsTop + _y, AbsLeft + _x + 64, AbsTop + _y, DecAlphaEx2(TI_LINE_COLOR, $A0));
  3100. end;
  3101. // -----------------------------------------------------------------------
  3102.  
  3103. var
  3104. _y0: integer;
  3105. begin
  3106. inherited;
  3107. // Отрисовываем основную область
  3108. ScrollWidth := 15;
  3109.  
  3110. // Draw grid
  3111. Renderer_Rectangle(AbsLeft + 2, AbsTop, Width, Height, DisplaceRB(TI_LINE_COLOR), $00FFFFFF);
  3112. Renderer_Rectangle(AbsLeft + 2, AbsTop - 32, Width, 33, DisplaceRB(TI_LINE_COLOR), $00FFFFFF);
  3113. color := DecAlphaEx2(TI_LINE_COLOR, $A0);
  3114. _x := 64 + 208 + 3;
  3115. Renderer_Line(AbsLeft + _x, AbsTop - 32, AbsLeft + _x, AbsTop + Height - 2, color);
  3116.  
  3117. // Рисуем фон
  3118. ClientRect := Rect(AbsLeft, AbsTop + 2, AbsLeft + Width - ScrollWidth - 1, AbsTop + Height - 2);
  3119. SetClipRect(ClientRect);
  3120.  
  3121. _y := 3 - Trunc(fSB.Value);
  3122. _y0 := _y;
  3123.  
  3124. for i := 0 to fItemList.count - 1 do
  3125. begin
  3126. P := fItemList[i];
  3127. if (not P.visible) then
  3128. Continue;
  3129. DrawRegularItem;
  3130. end;
  3131.  
  3132. if Loading then
  3133. begin
  3134. Renderer_FillRect(Rect(AbsLeft, AbsTop, Width - 18, Height + 6), $44000000, 0);
  3135. Renderer_EffectCol(FindTexture('loading'), AbsLeft + Width div 2 - 16, AbsTop + Height div 2 - 16, $FFFFFFFF,
  3136. (GTIME div 80) mod 16, 0);
  3137. end;
  3138.  
  3139. ResetClipRect();
  3140. fSB.MaxValue := _y - _y0 - fHeight + 4;
  3141. end;
  3142.  
  3143. // -----------------------------------------------------------------------------
  3144. procedure TGUINewShopList.DrawThumbs(AbsLeft, AbsTop: integer);
  3145. const
  3146. THUMB_WIDTH = 260;
  3147. THUMB_HEIGHT = 250;
  3148. MARGIN_X = 30;
  3149. MARGIN_Y = 16;
  3150.  
  3151. var
  3152. i, _x, _y, _y0: integer;
  3153. P: PGUIShopItem;
  3154. ScrollWidth: integer;
  3155. ClientRect: TRect;
  3156. // color : Cardinal;
  3157. cols, col: integer;
  3158.  
  3159. procedure DrawItem;
  3160. var
  3161. c: Cardinal;
  3162. DropIndex, j: integer;
  3163. _xt, _yt { , _xl1, _xl2, _yl1, _yl2 } : integer;
  3164. Premium: TPremiumDBItem;
  3165. Hr: integer;
  3166. SalePrice, price: integer;
  3167. Percent: string;
  3168. Opt: TRenderMoneyOptions;
  3169. R: TRect;
  3170. Time: integer;
  3171. TimeText: string;
  3172. // TotalDrops : integer;
  3173. begin
  3174.  
  3175. if i = fMouseOverItem then
  3176. c := DecAlphaEx(TI_COLOR, $A0)
  3177. else
  3178. c := $80000000;
  3179. if i = fItemIndex then
  3180. c := DecAlphaEx(TI_COLOR, $60);
  3181. c := DisplaceRB(c);
  3182.  
  3183. Visual.Rect(AbsLeft + _x, AbsTop + _y, THUMB_WIDTH, THUMB_HEIGHT, $40000000, c, 0);
  3184.  
  3185. // item icon
  3186. if assigned(Common_ItemSlot.texture) then
  3187. begin
  3188. Renderer_EffectCol(Common_ItemSlot, AbsLeft + _x + 2, AbsTop + _y + 2, $77FFFFFF, 0, 0);
  3189. end;
  3190. fAreaManager.Add(AbsLeft + _x, AbsTop + _y, THUMB_WIDTH, THUMB_HEIGHT, [i],
  3191. procedure(params: array of variant)
  3192. begin
  3193. fMouseOverItem := params[0];
  3194. end);
  3195.  
  3196. GameItem_Render(AbsLeft + _x + IW div 2 + 2, AbsTop + _y + 4 + IH div 2, P.Item, tag = 0, false, tag = 23,
  3197. true, true);
  3198. Visual.Text(P.Item.GetItemName, AbsLeft + _x + 70, AbsTop + _y + 32 - 14, TI_COLOR, NICE);
  3199. fAreaManager.Add(AbsLeft + _x + IW div 2 - 32 + 2, AbsTop + _y + 4 + IH div 2 - 16, 64, 32, [i],
  3200. procedure(params: array of variant)
  3201. begin
  3202. if { fMouseOverItem } params[0] > 0 then
  3203. begin
  3204. Hint_WeaponHint_POP(fItemList[params[0] { fMouseOverItem } ].Item);
  3205. end;
  3206. end);
  3207.  
  3208. _yt := _y + 40;
  3209.  
  3210. DropIndex := FindDropByName(GameItemDatas[P.Item.GetItemIndex].DropName);
  3211. { if (DropIndex >= 0) then begin
  3212. TotalDrops := length(DropLibrary[DropIndex].Items);
  3213. if DropLibrary[DropIndex].PremiumID > 0 then inc(TotalDrops);
  3214. end else begin
  3215. TotalDrops := 0;
  3216. end; }
  3217.  
  3218. if (DropIndex >= 0) then
  3219. begin
  3220. for j := low(DropLibrary[DropIndex].items) to high(DropLibrary[DropIndex].items) do
  3221. begin
  3222. _xt := _x + 40;
  3223. Visual.Text(DropLibrary[DropIndex].items[j].NameEnch, AbsLeft + _xt, AbsTop + _yt, TI_COLOR, PIXEL);
  3224. _xt := _xt - 10 - Visual.TextWidth(inttostr(DropLibrary[DropIndex].items[j].count), PIXEL);
  3225. Visual.Text(inttostr(DropLibrary[DropIndex].items[j].count) + 'x', AbsLeft + _xt, AbsTop + _yt,
  3226. TI_COLOR, PIXEL);
  3227.  
  3228. fAreaManager.Add(AbsLeft + _x, AbsTop + _yt, 40 + Visual.TextWidth(DropLibrary[DropIndex].items[j].NameEnch,
  3229. PIXEL), 14, [DropLibrary[DropIndex].items[j].ItemID, DropLibrary[DropIndex].items[j].Enchance,
  3230. DropLibrary[DropIndex].items[j].count],
  3231. procedure(params: array of variant)
  3232. var
  3233. tmp: TItem;
  3234. begin
  3235. DefaultItem(tmp, params[0]);
  3236. tmp.item_id := params[0];
  3237. tmp.EnhanceLevel := params[1];
  3238. tmp.count := params[2];
  3239. Hint_WeaponHint_POP(tmp);
  3240. end
  3241.  
  3242. );
  3243.  
  3244. Inc(_yt, 16);
  3245. // if j >= 2 then break; {$MESSAGE WARN 'DO NOT FORGET TO REMOVE'}
  3246.  
  3247. end;
  3248. if DropLibrary[DropIndex].PremiumID > 0 then
  3249. begin
  3250. Premium := PremiumDataByID(DropLibrary[DropIndex].PremiumID);
  3251.  
  3252. Hr := Premium.Hours; // ServicesGetValue(DropLibrary[DropIndex].PremiumID, 1);
  3253. _xt := _x + 40;
  3254. Visual.Text(GetTranslation('box_prem_text') + ' ' + Premium.Name, AbsLeft + _xt, AbsTop + _yt,
  3255. TI_COLOR, PIXEL);
  3256. _xt := _xt - 10 - Visual.TextWidth(inttostr(Hr), PIXEL);
  3257. Visual.Text(inttostr(Hr) + GetTranslation('box_prem_unit'), AbsLeft + _xt, AbsTop + _yt, TI_COLOR, PIXEL);
  3258.  
  3259. fAreaManager.Add(AbsLeft + _x, AbsTop + _yt, 40 + Visual.TextWidth(GetTranslation('box_prem_unit'), PIXEL),
  3260. 14, [Premium.id],
  3261. procedure(params: array of variant)
  3262. var
  3263. P: TPremiumAccount;
  3264. pData: TPremiumDBItem;
  3265. L: integer;
  3266. begin
  3267. P.id := params[0];
  3268. P.EndTime := 0;
  3269. P.EstimatedTime := 0;
  3270. pData := PremiumDataByID(params[0]);
  3271. L := 0;
  3272. Hint_Clear;
  3273. FillPremiumHint(P, pData, L);
  3274. Hint_Pop;
  3275. end
  3276.  
  3277. );
  3278. end;
  3279. end;
  3280.  
  3281. // item prices
  3282. if (P.Item.price <> 0) then
  3283. begin
  3284. price := P.Item.NoDiscountPrice;
  3285. SalePrice := P.Item.price;
  3286. Opt := Opt + [rmoCredits];
  3287. end
  3288. else
  3289. begin
  3290. price := P.Item.NoDiscountPrice;
  3291. SalePrice := P.Item.GoldPrice;
  3292. Opt := Opt + [rmoGold];
  3293. end;
  3294.  
  3295. if SalePrice > price then
  3296. begin
  3297. Percent := '';
  3298. end
  3299. else if (price = 0) or (price = SalePrice) then
  3300. begin
  3301. Percent := '-0%'
  3302. end
  3303. else
  3304. begin
  3305. Percent := inttostr(Round(100 * SalePrice / price - 100)) + '%';
  3306. end;
  3307.  
  3308. if P.LimitedTime > 0 then
  3309. begin
  3310. Time := SecondsBetween(Date + sysutils.Time, UnixTimeToDateTime(P.LimitedTime));
  3311. end
  3312. else
  3313. begin
  3314. Time := -1;
  3315. end;
  3316. if Time > 0 then
  3317. begin
  3318.  
  3319. if Time <= 120 { s } then
  3320. begin
  3321. TimeText := inttostr(Time) + GetTranslation('time_unit_s')
  3322. end
  3323. else if Time <= 120 * 60 { min } then
  3324. begin
  3325. TimeText := inttostr(Time div 60) + GetTranslation('time_unit_m')
  3326. end
  3327. else if Time <= 48 * 60 * 60 { hr } then
  3328. begin
  3329. TimeText := inttostr(Time div 60 div 60) + GetTranslation('time_unit_h')
  3330. end
  3331. else
  3332. begin
  3333. TimeText := inttostr(Time div 60 div 60 div 24) + GetTranslation('time_unit_d')
  3334. end;
  3335. end;
  3336.  
  3337. if { (TimeText > '') and (SalePrice < Price) } true then
  3338. begin
  3339. Visual.Rect(AbsLeft + _x + THUMB_WIDTH - 150,
  3340. AbsTop + _y,
  3341. { AbsLeft + _x + THUMB_WIDTH } 150,
  3342. { AbsTop + _y + } THUMB_HEIGHT,
  3343. $00000000,
  3344. $4000FF00,
  3345. $4000FF00,
  3346. $0800FF00);
  3347. end;
  3348.  
  3349. _yt := _y + THUMB_HEIGHT - 16 * 2 - 8;
  3350. // if TimeText > '' then _xt := _x + THUMB_WIDTH - 40 else _xt := _x + THUMB_WIDTH - 10;
  3351. _xt := _x + THUMB_WIDTH - 10;
  3352. if SalePrice < price then
  3353. begin
  3354. R := RenderMoney(AbsLeft + _xt, AbsTop + _yt, price, Opt + [rmoAlignRight], NICE, DecAlphaEx(TI_COLOR, $40));
  3355. // Visual.Line( R.Left - 2, (R.Top + R.Bottom) div 2 - 3, R.Right + 2, (R.Top + R.Bottom) div 2 - 3, $FFFF0000 );
  3356. Visual.Rect(R.Left - 2, (R.Top + R.Bottom) div 2 - 3, R.Right - R.Left + 4, 2, $FF0000FF, 0);
  3357. end;
  3358. Inc(_yt, 16);
  3359. RenderMoney(AbsLeft + _xt, AbsTop + _yt, SalePrice, Opt + [rmoAlignRight], NICE, TI_COLOR);
  3360.  
  3361. if (TimeText > '') then
  3362. begin
  3363. { _xt := _x + THUMB_WIDTH - 32 - 5;
  3364. _yt := _y + THUMB_HEIGHT - 32 - 20; }
  3365. if Percent = '' then
  3366. begin
  3367. _xt := _x + THUMB_WIDTH - 32 - 5;
  3368. end
  3369. else
  3370. begin
  3371. _xt := _x + THUMB_WIDTH - 10 - (32 + Visual.TextWidth(Percent, NICE)) div 2;
  3372. end;
  3373. _yt := _y + 25;
  3374. Visual.Draw('icon_clock2', AbsLeft + _xt, AbsTop + _yt);
  3375. _xt := _xt + 32 div 2;
  3376. _yt := _yt + 32 + 6;
  3377. Visual.Text(TimeText, AbsLeft + _xt, AbsTop + _yt, $FFFFFFFF, PIXEL, true);
  3378. end;
  3379.  
  3380. if SalePrice < price then
  3381. begin
  3382. _yt := _y + 5;
  3383. _xt := _x + THUMB_WIDTH - 10 - Visual.TextWidth(Percent, NICE);
  3384. Visual.Text(Percent, AbsLeft + _xt, AbsTop + _yt, TI_COLOR, NICE);
  3385. end;
  3386.  
  3387. end;
  3388. // ---------------------------------------------------------------------
  3389.  
  3390. begin
  3391. inherited;
  3392.  
  3393. // Отрисовываем основную область
  3394. ScrollWidth := 15;
  3395.  
  3396. // Draw grid
  3397. Renderer_Rectangle(AbsLeft + 2, AbsTop, Width, Height, DisplaceRB(TI_LINE_COLOR), $00FFFFFF);
  3398. // Renderer_Rectangle(AbsLeft + 2, AbsTop - 32, Width, 33, DisplaceRB(TI_LINE_COLOR), $00FFFFFF);
  3399. // color := DecAlphaEx2(TI_LINE_COLOR, $A0);
  3400. _x := 64 + 208 + 3;
  3401. // Renderer_Line(AbsLeft + _x, AbsTop - 32, AbsLeft + _x, AbsTop + Height - 2, color);
  3402.  
  3403. // Рисуем фон
  3404. ClientRect := Rect(AbsLeft, AbsTop + 2, AbsLeft + Width - ScrollWidth - 1, AbsTop + Height - 2);
  3405. SetClipRect(ClientRect);
  3406.  
  3407. cols := (Width - ScrollWidth) div (THUMB_WIDTH + MARGIN_X);
  3408. if cols < 1 then
  3409. cols := 1;
  3410.  
  3411. _y := 3 - Trunc(fSB.Value);
  3412. _y0 := _y;
  3413.  
  3414. col := cols + 1;
  3415. _y := _y - THUMB_HEIGHT { - MARGIN_Y };
  3416. for i := 0 to fItemList.count - 1 do
  3417. begin
  3418. if col > cols then
  3419. begin
  3420. _x := ((Width - ScrollWidth) - THUMB_WIDTH * cols - MARGIN_X * (cols - 1)) div 2;
  3421. _y := _y + THUMB_HEIGHT + MARGIN_Y;
  3422. col := 1;
  3423. end;
  3424.  
  3425. P := fItemList[i];
  3426. if (not P.visible) then
  3427. Continue;
  3428. DrawItem;
  3429. Inc(_x, THUMB_WIDTH + MARGIN_X);
  3430. Inc(col);
  3431. end;
  3432.  
  3433. _y := _y + THUMB_HEIGHT + MARGIN_Y;
  3434.  
  3435. if Loading then
  3436. begin
  3437. Renderer_FillRect(Rect(AbsLeft, AbsTop, Width - 18, Height + 6), $44000000, 0);
  3438. Renderer_EffectCol(FindTexture('loading'), AbsLeft + Width div 2 - 16, AbsTop + Height div 2 - 16, $FFFFFFFF,
  3439. (GTIME div 80) mod 16, 0);
  3440. end;
  3441.  
  3442. ResetClipRect();
  3443. fSB.MaxValue := _y - _y0 - fHeight + 4;
  3444. end;
  3445.  
  3446. // -----------------------------------------------------------------------------
  3447. procedure TGUINewShopList.DoDraw;
  3448. var
  3449. { i, _x, _y, } AbsLeft, AbsTop: integer;
  3450. { P : PGUIShopItem;
  3451. ScrollWidth: integer;
  3452. ClientRect: TRect;
  3453. txt : string;
  3454. color : Cardinal;
  3455. shift : shortint;
  3456. ItemHeight : integer;
  3457.  
  3458. Opt : TRenderMoneyOptions;
  3459. Price, SalePrice : integer;
  3460. Percent : string;
  3461. Tex : TDJXTexture;
  3462. Premium : TPremiumDBItem;
  3463.  
  3464. procedure DrawDropItem;
  3465. var
  3466. j, DropIndex : integer;
  3467. _y0, _yt, _xt, dx, dy : integer;
  3468. pt : integer;
  3469. Hr : integer;
  3470. begin
  3471. DropIndex := FindDropByName( GameItemDatas[P.Item.GetItemIndex].DropName );
  3472. ItemHeight := fItemHeight + 25;
  3473.  
  3474. if fExpandedItemsList.Contains(P.Item.Item_id) then
  3475. if DropIndex >= 0 then begin
  3476. ItemHeight := ItemHeight + length(DropLibrary[DropIndex].Items) * 16 + 4;
  3477. if DropLibrary[DropIndex].PremiumID >= 0 then ItemHeight := ItemHeight + 16;
  3478.  
  3479. end;
  3480.  
  3481. if (_y + ItemHeight < 0) or (_y > Height + 15) then begin
  3482. inc(_y, ItemHeight);
  3483. Exit;
  3484. end;
  3485. _y0 := _y;
  3486. _x := 3;
  3487.  
  3488. if (fItemList.IndexOf(P) = fItemIndex) then begin
  3489. Visual.Rect(AbsLeft + _x, AbsTop + _y, fWidth, ItemHeight, $77A7A7A7, $77A7A7A7, 0);
  3490. end;
  3491.  
  3492. inc(_x, 3);
  3493.  
  3494. _yt := _y + 40;
  3495.  
  3496. if fExpandedItemsList.Contains(P.Item.Item_id) then
  3497. if (DropIndex >= 0) then begin
  3498. for j := low(DropLibrary[DropIndex].Items) to high(DropLibrary[DropIndex].Items) do begin
  3499. _xt := 70;
  3500. Visual.Text(DropLibrary[DropIndex].Items[j].NameEnch, AbsLeft + _xt, AbsTop + _yt, TI_COLOR, PIXEL);
  3501. _xt := 40 - Visual.TextWidth(IntToStr(DropLibrary[DropIndex].Items[j].Count), PIXEL);
  3502. Visual.Text(IntToStr(DropLibrary[DropIndex].Items[j].Count) + 'x', AbsLeft + _xt, AbsTop + _yt, TI_COLOR, PIXEL);
  3503. Inc(_yt, 16);
  3504. end;
  3505. if DropLibrary[DropIndex].PremiumID > 0 then begin
  3506. Premium := PremiumDataByID(DropLibrary[DropIndex].PremiumID);
  3507.  
  3508. Hr := Premium.Hours; //ServicesGetValue(DropLibrary[DropIndex].PremiumID, 1);
  3509. _xt := 70;
  3510. Visual.Text(GetTranslation('box_prem_text') + ' ' + Premium.Name, AbsLeft + _xt, AbsTop + _yt, TI_COLOR, PIXEL);
  3511. _xt := 40 - Visual.TextWidth(IntToStr(Hr), PIXEL);
  3512. Visual.Text(IntToStr(Hr) + GetTranslation('box_prem_unit'), AbsLeft + _xt, AbsTop + _yt, TI_COLOR, PIXEL);
  3513. // Inc(_yt, 16);
  3514. end;
  3515. end;
  3516.  
  3517. //item icon
  3518. if assigned(Common_ItemSlot.texture) then begin
  3519. Renderer_EffectCol(Common_ItemSlot, AbsLeft + _x, AbsTop + _y + 2, $77FFFFFF, 0, 0);
  3520. end;
  3521. GameItem_Render(AbsLeft + _x + IW div 2, AbsTop + _y + 4 + IH div 2, P.Item, tag = 0, false, tag = 23, true, true);
  3522.  
  3523. fAreaManager.Add(AbsLeft + _x + IW div 2 - 32, AbsTop + _y + 4 + IH div 2 - 16, 64, 32, [i],
  3524. procedure(params : array of variant)
  3525. begin
  3526. if fMouseOverItem >= 0 then Hint_WeaponHint_POP( fItemList[fMouseOverItem].Item );
  3527. end);
  3528.  
  3529. //item name
  3530. Inc(_x, 64 + 3);
  3531. Visual.Text( P.Item.GetItemName, AbsLeft + _x, AbsTop + _y + 12 - shift, TI_COLOR, PIXEL, false);
  3532. Renderer_Line(AbsLeft, AbsTop + _y + 38, AbsLeft + _x + 203, AbsTop + _y + 38, DecAlphaEx2(TI_LINE_COLOR, $A0));
  3533.  
  3534. Tex := FindTexture('sc_sort_btn');
  3535. if fExpandedItemsList.Contains(P.Item.Item_id) then begin
  3536. //Tex := FindTexture('btn_shift_u');
  3537. if fMouseOverExpander = i then pt := 0 else pt := 1;
  3538. end else begin
  3539. //Tex := FindTexture('btn_shift_d');
  3540. if fMouseOverExpander = i then pt := 2 else pt := 3;
  3541. end;
  3542. dx := 0; dy := 0;
  3543.  
  3544. fAreaManager.DrawAndAdd(AbsLeft + 260 + dx, AbsTop + _y0 + 3 + dy, Tex, pt, [i],
  3545. procedure(params : array of variant)
  3546. begin
  3547. fMouseOverExpander := params[0];
  3548. end);
  3549.  
  3550.  
  3551. _yt := _y0 + ItemHeight - 20;
  3552. Renderer_Line(AbsLeft, AbsTop + _yt - 5, AbsLeft + _x + 203, AbsTop + _yt - 5, DecAlphaEx2(TI_LINE_COLOR, $A0));
  3553. Inc(_x, 208);
  3554.  
  3555. Opt := [];
  3556.  
  3557. //item prices
  3558. if (P.Item.Price <> 0) then begin
  3559. Price := P.Item.NoDiscountPrice;
  3560. SalePrice := P.Item.Price;
  3561. Opt := Opt + [rmoCredits];
  3562. end else begin
  3563. Price := P.Item.NoDiscountPrice;
  3564. SalePrice := P.Item.GoldPrice;
  3565. Opt := Opt + [rmoGold];
  3566. end;
  3567.  
  3568. if (Price = 0) or (Price = SalePrice) then begin
  3569. Percent := '-0%'
  3570. end else begin
  3571. Percent := IntToStr(100 * SalePrice div Price - 100) + '%';
  3572. end;
  3573.  
  3574. RenderMoney(AbsLeft + 30, AbsTop + _yt, Price, Opt, PIXEL, TI_COLOR);
  3575. Visual.Text(Percent, AbsLeft + width div 2 - 20, AbsTop + _yt, TI_COLOR, PIXEL);
  3576. RenderMoney(AbsLeft + _x, AbsTop + _yt, SalePrice, Opt, PIXEL, TI_COLOR);
  3577. Visual.Line(AbsLeft + 100, AbsTop + _y0 + ItemHeight, AbsLeft + 100, AbsTop + _y0 + ItemHeight - 25, DecAlphaEx2(TI_LINE_COLOR, $A0));
  3578. Inc(_x, 80 + 3);
  3579.  
  3580. fAreaManager.Add(GetLeft, AbsTop + _y, _x, ItemHeight, [i],
  3581. procedure(params : array of variant)
  3582. begin
  3583. fMouseOverItem := params[0];
  3584. end);
  3585.  
  3586. _y := _y0 + ItemHeight;
  3587. Renderer_Line(AbsLeft, AbsTop + _y, AbsLeft + _x+64, AbsTop + _y, DecAlphaEx2(TI_LINE_COLOR, $A0));
  3588.  
  3589.  
  3590. end;
  3591.  
  3592. procedure DrawRegularItem;
  3593. begin
  3594. ItemHeight := fItemHeight;
  3595. if (_y + ItemHeight < 0) or (_y > Height + 15) then begin
  3596. inc(_y, ItemHeight);
  3597. Exit;
  3598. end;
  3599.  
  3600. _x := 3;
  3601.  
  3602. if (fItemList.IndexOf(P) = fItemIndex) then begin
  3603. Visual.Rect(AbsLeft + _x, AbsTop + _y, fWidth, ItemHeight, $77A7A7A7, $77A7A7A7, 0);
  3604. end;
  3605.  
  3606. if (P.count = 0) then begin
  3607. Visual.Rect(AbsLeft + _x, AbsTop + _y, fWidth, ItemHeight, $220000FF, $220000FF, 0);
  3608. end;
  3609.  
  3610. inc(_x, 3);
  3611.  
  3612. //item icon
  3613. if assigned(Common_ItemSlot.texture) then begin
  3614. Renderer_EffectCol(Common_ItemSlot, AbsLeft + _x, AbsTop + _y + 2, $77FFFFFF, 0, 0);
  3615. end;
  3616. GameItem_Render(AbsLeft + _x + IW div 2, AbsTop + _y + 4 + IH div 2, P.Item, tag = 0, false, tag = 23, true, true);
  3617.  
  3618. fAreaManager.Add(AbsLeft + _x + IW div 2 - 32, AbsTop + _y + 4 + IH div 2 - 16, 64, 32, [i],
  3619. procedure(params : array of variant)
  3620. begin
  3621. if fMouseOverItem > 0 then Hint_WeaponHint_POP( fItemList[fMouseOverItem].Item );
  3622. end);
  3623.  
  3624. Inc(_x, 64 + 3);
  3625.  
  3626. //item count
  3627. shift := 0;
  3628. if (P.Item.available > 0) then begin
  3629. shift := 8;
  3630. Visual.Text( Format(GetTranslation('m656'), [IntThousandSeparation(inttostr(P.Item.available))]), AbsLeft + _x, AbsTop + _y + 12 + shift, TI_COLOR, PIXEL, false);
  3631. end;
  3632. //item name
  3633. Visual.Text( GameItemDatas[P.Item.GetItemIndex].name, AbsLeft + _x, AbsTop + _y + 12 - shift, TI_COLOR, PIXEL, false);
  3634. Inc(_x, 208);
  3635.  
  3636. //item prices
  3637. if (P.Item.Price <> 0) then begin
  3638. txt := IntThousandSeparation(IntToStr(P.Item.Price));
  3639. if (not (P.Item.EnhanceLevel >= 20)) then begin
  3640. Visual.Text( txt, AbsLeft + _x, AbsTop + _y + 12, TI_COLOR, PIXEL, false);
  3641. Visual.Draw(Common_Credits, AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, 0);
  3642. end;
  3643. end else begin
  3644. txt := IntThousandSeparation(IntToStr(P.Item.GoldPrice));
  3645. if (P.Item.EnhanceLevel >= 20) then begin
  3646. Visual.Text( txt, AbsLeft + _x, AbsTop + _y + 12, TI_COLOR, PIXEL, false);
  3647. Visual.Draw(Common_Credits, AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, 1);
  3648. end else begin
  3649. Visual.Text( txt, AbsLeft + _x, AbsTop + _y + 12, TI_COLOR, PIXEL, false);
  3650. Visual.Draw(Common_Credits, AbsLeft + _x + Visual.TextWidth(txt, PIXEL), AbsTop + _y + 12, 1);
  3651. end;
  3652. end;
  3653. Inc(_x, 80 + 3);
  3654.  
  3655. fAreaManager.Add(GetLeft, AbsTop + _y, _x, ItemHeight, [i],
  3656. procedure(params : array of variant)
  3657. begin
  3658. fMouseOverItem := params[0];
  3659. end);
  3660.  
  3661. inc(_y, ItemHeight);
  3662. Renderer_Line(AbsLeft, AbsTop + _y, AbsLeft + _x+64, AbsTop + _y, DecAlphaEx2(TI_LINE_COLOR, $A0));
  3663. end;
  3664.  
  3665. var
  3666. _y0 : integer; }
  3667. begin
  3668. inherited;
  3669. // Отрисовываем основную область
  3670. AbsLeft := ParentControl.GetLeft + Left;
  3671. AbsTop := ParentControl.GetTop + Top;
  3672. case fVisualMode of
  3673. svmList:
  3674. DrawList(AbsLeft, AbsTop);
  3675. svmThumbs:
  3676. DrawThumbs(AbsLeft, AbsTop);
  3677. end;
  3678. end;
  3679.  
  3680. // -----------------------------------------------------------------------------
  3681. procedure TGUINewShopList.DoMouseDoubleClick(X, Y: integer);
  3682. begin
  3683. if GTIME < fExpandPressed + 1000 then
  3684. Exit;
  3685. if (OnDoubleClick.Call) then
  3686. begin
  3687. Exit;
  3688. end;
  3689. gui_stop_buy;
  3690. end;
  3691.  
  3692. // -----------------------------------------------------------------------------
  3693. procedure TGUINewShopList.DoMouseDown(Button: TMouseButton; X, Y: integer);
  3694. // var
  3695. // _y : Integer;
  3696. // P : PGUIShopItem;
  3697. // OldIndex : Integer;
  3698. begin
  3699. // _y := 3 - Trunc(fSB.Value);
  3700. // OldIndex := fItemIndex;
  3701.  
  3702. {
  3703. fItemIndex := -1;
  3704. if not Loading then
  3705. for P in fItemList do begin
  3706. if (not P.visible) then Continue;
  3707. if (_y + fItemHeight < 0)or (_y > fHeight + 15) then begin
  3708. inc(_y, fItemHeight);
  3709. Continue;
  3710. end;
  3711.  
  3712. if (X > fLeft)and(X < fLeft + fWidth)and (Y >= fTop + _y)and(Y < fTop + _y + fItemHeight) then begin
  3713. fItemIndex := fItemList.IndexOf(P);
  3714. if (OldIndex <> fItemIndex) then begin
  3715. shop_count_edt.Text := '1';
  3716. shop_count_edt.CursorPos := Length(shop_count_edt.Text);
  3717. shop_count_edt.SelectAll();
  3718. end;
  3719. break;
  3720. end;
  3721. inc(_y, fItemHeight);
  3722. end;
  3723. }
  3724. if fMouseOverExpander >= 0 then
  3725. begin
  3726. if fExpandedItemsList.Contains(fItemList[fMouseOverExpander].Item.item_id) then
  3727. begin
  3728. fExpandedItemsList.Remove(fItemList[fMouseOverExpander].Item.item_id);
  3729. end
  3730. else
  3731. begin
  3732. fExpandedItemsList.Add(fItemList[fMouseOverExpander].Item.item_id);
  3733. end;
  3734. fExpandPressed := GTIME;
  3735. end;
  3736.  
  3737. if not Loading then
  3738. begin
  3739. if (fMouseOverItem > 0) and (fMouseOverItem <> fItemIndex) then
  3740. begin
  3741. shop_count_edt.Text := '1';
  3742. shop_count_edt.CursorPos := Length(shop_count_edt.Text);
  3743. shop_count_edt.SelectAll();
  3744. end;
  3745. fItemIndex := fMouseOverItem;
  3746. end;
  3747.  
  3748. end;
  3749.  
  3750. procedure TGUINewShopList.DoMouseEnter;
  3751. begin
  3752. inherited;
  3753. fMouseOverItem := -1;
  3754. fMouseOverExpander := -1;
  3755. end;
  3756.  
  3757. procedure TGUINewShopList.DoMouseLeave;
  3758. begin
  3759. inherited;
  3760. fMouseOverItem := -1;
  3761. fMouseOverExpander := -1;
  3762. end;
  3763.  
  3764. // -----------------------------------------------------------------------------
  3765. procedure TGUINewShopList.DoMouseMove(Button: TMouseButton; X, Y: integer);
  3766. // var
  3767. // _y : Integer;
  3768. // P : PGUIShopItem;
  3769. begin
  3770. fMouseOverItem := -1;
  3771. fMouseOverExpander := -1;
  3772. fAreaManager.Process(MainCursorX, MainCursorY);
  3773.  
  3774. fMx := X;
  3775. fMy := Y;
  3776. UpdateHint(fMx, fMy);
  3777.  
  3778. // _y := 3 - Trunc(fSB.Value);
  3779.  
  3780. if not Loading then
  3781. { for P in fItemList do begin
  3782. if (not P.visible) then Continue;
  3783. if (_y + fItemHeight < 0)or (_y > fHeight + 15) then begin
  3784. inc(_y, fItemHeight);
  3785. Continue;
  3786. end;
  3787.  
  3788. if (X > fLeft)and(X < fLeft + fWidth)and (Y >= fTop + _y)and(Y < fTop + _y + fItemHeight) then begin
  3789. if mbPressed[0]=1 then
  3790. if GUIInterface.guiDragMove = 1 then
  3791. GUIN_DragItem(fItemList.Items[fItemList.IndexOf(P)].Item, self );
  3792. break;
  3793. end;
  3794. inc(_y, fItemHeight);
  3795. end; }
  3796. if (fMouseOverItem >= 0) and (fVisualMode <> svmThumbs) and (ShopItemType <> itCustom) then
  3797. begin
  3798. if mbPressed[0] = 1 then
  3799. if GUIInterface.guiDragMove = 1 then
  3800. GUIN_DragItem(fItemList.items[fMouseOverItem].Item, self);
  3801. end;
  3802.  
  3803. end;
  3804.  
  3805. // -----------------------------------------------------------------------------
  3806. procedure TGUINewShopList.DoMouseUp(Button: TMouseButton; X, Y: integer);
  3807. begin
  3808. if Button = mbLeft then
  3809. GUIN_DragItemExecute(self);
  3810. end;
  3811.  
  3812. // -----------------------------------------------------------------------------
  3813. procedure TGUINewShopList.DoMouseWheelDown;
  3814. begin
  3815. fMouseOverItem := -1;
  3816. fMouseOverExpander := -1;
  3817.  
  3818. fSB.Value := fSB.Value + 20;
  3819. DoStep();
  3820. UpdateHint(fMx, fMy);
  3821. fAreaManager.Process(MainCursorX, MainCursorY);
  3822. end;
  3823.  
  3824. // -----------------------------------------------------------------------------
  3825. procedure TGUINewShopList.DoMouseWheelUp;
  3826. begin
  3827. fMouseOverItem := -1;
  3828. fMouseOverExpander := -1;
  3829.  
  3830. fSB.Value := fSB.Value - 20;
  3831. DoStep();
  3832. UpdateHint(fMx, fMy);
  3833. fAreaManager.Process(MainCursorX, MainCursorY);
  3834. end;
  3835.  
  3836. function TGUINewShopList.GetSelectedItem: PGUIShopItem;
  3837. begin
  3838. if (fItemIndex >= 0) and (fItemIndex < fItemList.count) then
  3839. Exit(fItemList.items[fItemIndex]);
  3840. result := nil;
  3841. end;
  3842.  
  3843. // -----------------------------------------------------------------------------
  3844. function TGUINewShopList.GetVisibleCount: Cardinal;
  3845. var
  3846. P: PGUIShopItem;
  3847. begin
  3848. if (fItemList.count = 0) then
  3849. begin
  3850. Exit(0);
  3851. end;
  3852.  
  3853. result := 0;
  3854.  
  3855. for P in fItemList do
  3856. if (P.visible) then
  3857. begin
  3858. Inc(result);
  3859. end;
  3860. end;
  3861.  
  3862. procedure TGUINewShopList.SetVisualMode(const Value: TShopVisualMode);
  3863. begin
  3864. fVisualMode := Value;
  3865. UpgradeTB.visible := Value = svmList;
  3866. PriceTB.visible := Value = svmList;
  3867. end;
  3868.  
  3869. // -----------------------------------------------------------------------------
  3870. procedure TGUINewShopList.UpdateHint(const X, Y: integer);
  3871. { var
  3872. _y: Integer;
  3873. P : PGUIShopItem; }
  3874. begin
  3875. Exit;
  3876.  
  3877. { _y := 3 - Trunc(fSB.Value);
  3878. if not Loading then
  3879. for P in fItemList do begin
  3880. if (not P.visible) then Continue;
  3881. if (_y + fItemHeight < 0)or (_y > fHeight + 15) then begin
  3882. inc(_y, fItemHeight);
  3883. Continue;
  3884. end;
  3885.  
  3886. if (X > fLeft)and(X < fLeft + fWidth)and
  3887. (Y >= fTop + _y)and(Y < fTop + _y + fItemHeight) then begin
  3888. if (X > fLeft)and(X < fLeft + 64 + 1) then begin
  3889. Hint_WeaponHint_POP( P.Item );
  3890. Exit;
  3891. end;
  3892. end;
  3893. inc(_y, fItemHeight);
  3894. end; }
  3895. end;
  3896.  
  3897. // -----------------------------------------------------------------------------
  3898. procedure TGUINewShopList.UpdateTrk;
  3899. begin
  3900. // fSB.MaxValue := GetVisibleCount * fItemHeight - fHeight + 4;
  3901. end;
  3902.  
  3903. initialization
  3904.  
  3905. finalization
  3906.  
  3907. GUI3_ShopInventory.Free;
  3908.  
  3909. end.
Add Comment
Please, Sign In to add comment