Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 349.61 KB | None | 0 0
  1. ;========================================================
  2. ;* COME E' ORGANIZZATO LO SCRIPT
  3. ;*
  4. ;* Siccome questo è uno script piuttosto complesso, è necessario un minimo di progettazione delle varie sub.
  5. ;* Lo script si muove su vari livelli. I livelli superiori conoscono ed utilizzano quelli inferiori, ma non vice-versa.
  6. ;* Ciascuna funzione è identificata da un PREFISSO, che ne indica il livello di appartenenza.
  7. ;* Si può far finta che siano come dei package in Java.
  8. ;*
  9. ;* LIVELLI:
  10. ;* 1 - FUNZIONI ELEMENTARI (prefisso: Std)
  11. ;* Sono sub che assolvono a compiti semplici e basilari, senza avere dipendenze da altre sub.
  12. ;* Esso sono generalmente: "di basso livello", "riusabili", "rientranti" (non dipendono da variabili globali)
  13. ;* 2 - FUNZIONI LOGICHE (prefisso: Model)
  14. ;* Implementano la logica dello script, senza curarsi di problemi di configurazione o simili.
  15. ;* Obbediscono ad una logica "design by contract": pretendono delle pre-condizioni e garantiscono delle post-condizioni.
  16. ;* Generalmente DIPENDONO da alcune variabili globali.
  17. ;* Costituiscono la parte "model" di un'architettura Model-View-Controller.
  18. ;* 3 - FUNZIONI GRAFICHE (prefisso: View)
  19. ;* Creano i menu e ne eseguono il loop.
  20. ;* [...]
  21. ;* 4 - FUNZIONI ESECUTIVE (prefisso: Ctrl)
  22. ;* Costituiscono il collegamento fra l'interfaccia grafica e le funzioni del livello logico.
  23. ;* Spesso hanno nomi simili alle corrispondenti funzioni del livello logico, ma si collocano ad un livello più alto.
  24. ;* Infatti, esse richiedono all'utente determinati parametri se ce n'è bisogno, e si occupano di avviare i loop.
  25. ;* Si può pensare ad esse come a "TUTTO ciò che accade quando si preme un pulsante".
  26. ;* Costituiscono la parte "controller" di un'architettura Model-View-Controller.
  27. ;*
  28. ;* Ci sono poi le FUNZIONI DI LIBRERIA, ovvero funzioni "importate" da altri script. Queste possono avere un qualsiasi
  29. ;* prefisso, ma generalmente si consiglia di assegnare loro un prefisso che ricordi la libreria da cui provengono.
  30. ;*
  31. ;*
  32. ;* IMPORTANTE!!! CONVENZIONE "SAFECALL" (chiamate sicure)
  33. ;* Tutto lo script segue la "convenzione safecall". "Safecall" è una sub che incapsula altre sub dentro dei namespace univoci.
  34. ;* Lo scopo di questa sub è quello di avvicinare lo scripting di easyuo ai tradizionali linguaggi di programmazione,
  35. ;* che prevedono uno scope distinto per ciascuna sub.
  36. ;*
  37. ;* Esempio: gosub safecall miaSub arg1 arg2 arg3
  38. ;* Questo tipo di chiamata si assicura che "miaSub" abbia uno spazio dei nomi riservato.
  39. ;* Di conseguenza, miaSub è sollevata dal noioso compito di dover dichiarare esplicitamente il suo namespace.
  40. ;*
  41. ;*
  42. ;* @version 2.0.3 final
  43. ;*
  44. ;* @todo Sostituire tutti i display/halt delle librerie di Boydon con diverso sistema di segnalazione errore.
  45.  
  46.  
  47.  
  48. ;===========================================================================================
  49. ;* @name Intestazione standard di inizio script.
  50. ;* @purpose Si assicura che lo script possa essere richiamato anche dall'esterno,
  51. ;* e che configuri correttamente i namespaces.
  52. ;*
  53. ;* @example call NomeScript.txt ; richiama lo script in modalità "standalone"
  54. ;* call NomeScript.txt main ; richiama la procedura principale dello script
  55. ;* call NomeScript.txt nomesub ; richiama una particolare sub dello script
  56. ;* ; (per finalità di testing o di libreria)
  57. ;*
  58. ;* @warning E' importante terminare lo script con gosub quit, anzichè con halt o exit!
  59. ;*
  60.  
  61. set %charnum 4
  62. set %bodprendi 0
  63. set %bodriprendi 0
  64. set %wait #False
  65. set %sharddowntime 065000 ;le 6:50
  66. set %sharduptime 071500 ;le 7:10
  67. ;set %lag 0
  68. set %BODRitirati 0
  69. set %BODRitiro 0
  70. ;set *RazielBodTime #time
  71. ;set *RazielBodDate #date
  72. set %Bod #false
  73. set %secondo #false
  74. set %umano #false
  75. if %0 = !null
  76. {
  77. namespace push
  78. namespace local ScriptName_standalone
  79. set !lpc #lpc
  80. set #lpc 500
  81. gosub _indirectInvokeEx 0 main
  82. }
  83. else
  84. {
  85. namespace push
  86. namespace local ScriptName_reentrant
  87. set !lpc #lpc
  88. set #lpc 500
  89. if %0 = 0
  90. {
  91. gosub _indirectInvokeEx 0 main
  92. }
  93. else
  94. {
  95. set %0 ( %0 - 1 )
  96. gosub _indirectInvokeEx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
  97. }
  98. }
  99. gosub quit
  100.  
  101. sub quit
  102. while ( #nsname <> ScriptName_standalone ) && ( #nsname <> ScriptName_reentrant )
  103. {
  104. namespace clear
  105. namespace pop
  106. }
  107. if #nsname = ScriptName_standalone
  108. {
  109. halt
  110. }
  111. set #lpc !lpc
  112. namespace clear
  113. namespace pop
  114. exit #result
  115.  
  116. ;===============================================================================
  117. ;* @name _indirectInvokeEx
  118. ;* @ver 1.0 (09/04/2009)
  119. ;* @author AG
  120. ;* @purpose Indirectly calls a specified sub, creating a namespace for it.
  121. ;*
  122. ;* @params %1 req number of arguments passed to the given sub
  123. ;* %2 req name of the sub to call
  124. ;* %3...%12 opt arguments to pass to the given sub (maximum of 10)
  125. ;* @returns #result of the sub
  126. ;*
  127. ;* @example gosub _indirectInvokeEx 3 mysub arg1 arg2 arg3
  128. ;* @status Tested and working.
  129. ;*
  130.  
  131. sub _indirectInvokeEx ; %argc(of given sub) %subname %args[10]
  132. namespace push
  133. namespace local indirectInvoke_ , #systime , #random
  134.  
  135. goto _indirectInvokeEx_ , %1
  136.  
  137. ; si arriva qui solo se la label non è riconosciuta (numero args errato)
  138. event exmsg #charid 3 0 ATTENZIONE! Il numero degli argomenti di _indirectInvokeEx è errato ( %1 )! Lo script andrà in pausa.
  139. pause
  140. goto _indirectInvokeEx_out
  141.  
  142. _indirectInvokeEx_0:
  143. gosub %2
  144. goto _indirectInvokeEx_out
  145. _indirectInvokeEx_1:
  146. gosub %2 %3
  147. goto _indirectInvokeEx_out
  148. _indirectInvokeEx_2:
  149. gosub %2 %3 %4
  150. goto _indirectInvokeEx_out
  151. _indirectInvokeEx_3:
  152. gosub %2 %3 %4 %5
  153. goto _indirectInvokeEx_out
  154. _indirectInvokeEx_4:
  155. gosub %2 %3 %4 %5 %6
  156. goto _indirectInvokeEx_out
  157. _indirectInvokeEx_5:
  158. gosub %2 %3 %4 %5 %6 %7
  159. goto _indirectInvokeEx_out
  160. _indirectInvokeEx_6:
  161. gosub %2 %3 %4 %5 %6 %7 %8
  162. goto _indirectInvokeEx_out
  163. _indirectInvokeEx_7:
  164. gosub %2 %3 %4 %5 %6 %7 %8 %9
  165. goto _indirectInvokeEx_out
  166. _indirectInvokeEx_8:
  167. gosub %2 %3 %4 %5 %6 %7 %8 %9 %10
  168. goto _indirectInvokeEx_out
  169. _indirectInvokeEx_9:
  170. gosub %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
  171. goto _indirectInvokeEx_out
  172. _indirectInvokeEx_10:
  173. gosub %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12
  174. goto _indirectInvokeEx_out
  175. _indirectInvokeEx_out:
  176.  
  177. namespace clear
  178. namespace pop
  179. return #result
  180.  
  181. ;===============================================================================
  182. ;* @name _indirectCallEx
  183. ;* @ver 1.0 (05/04/2009)
  184. ;* @author AG
  185. ;* @purpose Indirectly calls a specified sub into the specified library, creating a namespace for it.
  186. ;*
  187. ;* @params %1 req number of arguments passed to the given sub
  188. ;* %2 req name of the library
  189. ;* %3 req name of the sub to call
  190. ;* %4...%13 opt arguments to pass to the given sub (maximum of 10)
  191. ;* @returns #result of the sub
  192. ;*
  193. ;* @example gosub _indirectCallEx 3 mylib mysub arg1 arg2 arg3
  194. ;* @status Under testing.
  195. ;*
  196.  
  197. sub _indirectCallEx
  198. namespace push
  199. namespace local indirectCall_ , #systime , #random
  200.  
  201. goto _indirectCallEx_ , %1
  202.  
  203. ; si arriva qui solo se la label non è riconosciuta (numero args errato)
  204. event exmsg #charid 3 0 ATTENZIONE! Il numero degli argomenti di _indirectCallEx è errato! Lo script andrà in pausa.
  205. pause
  206. goto _indirectCallEx_out
  207.  
  208. _indirectCallEx_0:
  209. call %2 %3
  210. goto _indirectCallEx_out
  211. _indirectCallEx_1:
  212. call %2 %3 %4
  213. goto _indirectCallEx_out
  214. _indirectCallEx_2:
  215. call %2 %3 %4 %5
  216. goto _indirectCallEx_out
  217. _indirectCallEx_3:
  218. call %2 %3 %4 %5 %6
  219. goto _indirectCallEx_out
  220. _indirectCallEx_4:
  221. call %2 %3 %4 %5 %6 %7
  222. goto _indirectCallEx_out
  223. _indirectCallEx_5:
  224. call %2 %3 %4 %5 %6 %7 %8
  225. goto _indirectCallEx_out
  226. _indirectCallEx_6:
  227. call %2 %3 %4 %5 %6 %7 %8 %9
  228. goto _indirectCallEx_out
  229. _indirectCallEx_7:
  230. call %2 %3 %4 %5 %6 %7 %8 %9 %10
  231. goto _indirectCallEx_out
  232. _indirectCallEx_8:
  233. call %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
  234. goto _indirectCallEx_out
  235. _indirectCallEx_9:
  236. call %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12
  237. goto _indirectCallEx_out
  238. _indirectCallEx_10:
  239. call %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13
  240. goto _indirectCallEx_out
  241. _indirectCallEx_out:
  242.  
  243. namespace clear
  244. namespace pop
  245. return #result
  246.  
  247. ;==================================================================================
  248. ;* @name safecall
  249. ;* @author AG
  250. ;* @purpose Simplified version of _indirectInvokeEx, for internal use by the script.
  251. ;* Wraps a namespace around the given sub.
  252. ;*
  253. ;* @params %1 req name of the sub to call
  254. ;* %2...%11 opt arguments to pass to the given sub (maximum of 10)
  255. ;*
  256. ;* @returns #result of the sub
  257. ;*
  258. ;* @example gosub safecall mysub arg1 arg2 arg3
  259. ;* @status Under testing.
  260. ;*
  261.  
  262. sub safecall
  263. set %0 %0 - 1
  264. gosub _indirectInvokeEx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
  265. return #result
  266.  
  267. ;==================================================================================
  268. ;* @name libcall
  269. ;* @author AG
  270. ;* @purpose Indirectly invokes a library function.
  271. ;* Can be modified to convert between statically and dynamically linked libraries,
  272. ;* and also to convert symbolic library names into physical library names.
  273. ;* @params %1 req name of the library to call
  274. ;* %2 req name of the sub to call
  275. ;* %3...%12 opt arguments to pass to the given sub (maximum of 10)
  276. ;*
  277. ;* @returns #result of the sub
  278. ;*
  279. ;* @example gosub libcall mylib mysub arg1 arg2 arg3
  280. ;* @status Tested and working.
  281.  
  282. sub libcall
  283. if %1 in BodFunctions.euo_CraftMenuFunctions.euo ; specify statically linked libraries
  284. {
  285. set %0 %0 - 2
  286. gosub _indirectInvokeEx %0 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
  287. return #result
  288. }
  289. set %0 %0 - 2
  290. gosub _indirectCallEx %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12
  291. return #result
  292.  
  293.  
  294.  
  295. ;==========================================================
  296. ;=
  297. ;=
  298. ;= FUNZIONI ELEMENTARI (prefisso "Std")
  299. ;=
  300. ;=
  301. ;==========================================================
  302.  
  303. ;===================================================================================
  304. ;* @name DebugMessage
  305. ;* @author AG
  306. ;* @purpose Displays a debug message if %debug = #true.
  307. ;* @params The message to display (arguments will be concatenated, with a space between each couple).
  308. ;* @example gosub DebugMessage This is my message.
  309. ;* DO NOT USE "SAFECALL" FOR THIS!!!
  310. ;* @status Under testing.
  311.  
  312. sub DebugMessage
  313. namespace push
  314. namespace local DebugMessage , #systime , #random
  315. set %debug #true
  316.  
  317. if %debug = #true
  318. {
  319. set !msg
  320. if %0 > 1
  321. {
  322. for !i 1 %0
  323. {
  324. set !arg % . !i
  325. set !msg !msg , !arg , #spc
  326. }
  327. }
  328. event exmsg #charid 3 1152 !msg
  329. }
  330.  
  331. namespace clear
  332. namespace pop
  333. return
  334.  
  335. ;===================================================================================
  336. ;* @name Std_OpenPaperdoll
  337. ;* @author AG
  338. ;* @purpose Opens the paperdoll.
  339. ;* @example gosub safecall OpenPaperdoll
  340. ;* @status Tested.
  341.  
  342. sub Std_OpenPaperdoll
  343. event Macro 8 1 ; Open Paperdoll
  344. set !timeout #systime + 5000
  345. while #systime < !timeout && #contname <> paperdoll_gump
  346. {
  347. }
  348. return #contname = paperdoll_gump
  349.  
  350. ;===========================================================================
  351. ;* @name Std_ReadProperty
  352. ;* @author AG
  353. ;* @purpose Legge in maniera sicura le proprietà di un item.
  354. ;* Timeout di 1s.
  355. ;* @params %1 req ID dell'oggetto di cui leggere le proprietà.
  356. ;* @returns Le proprietà dell'oggetto, oppure #false in caso di errore.
  357. ;* @example gosub safecall Std_ReadProperty %item
  358.  
  359. sub Std_ReadProperty
  360. set !object %1
  361. set !timeout ( #systime + 1000 )
  362.  
  363. set #property 0
  364. event property !object
  365. while #property = 0
  366. {
  367. if #systime > !timeout
  368. return #false
  369. }
  370. return #property
  371.  
  372. ;===========================================================================
  373. ;* @name Std_MoveObject
  374. ;* @author AG
  375. ;* @purpose Sposta un oggetto da un contenitore ad un altro.
  376. ;* Timeout di 2.5s.
  377. ;* @params %1 req ID dell'oggetto da spostare.
  378. ;* %2 req Contenitore di destinazione.
  379. ;* %3 opt Quantità da spostare. Se non specificato, sposta tutto.
  380. ;* %4 opt Coordinata x del punto in cui lasciare l'oggetto.
  381. ;* %5 opt Coordinata y del punto in cui lasciare l'oggetto.
  382. ;* @returns
  383. ;* @example gosub safecall Std_MoveObject %object %destination %quantity %x %y
  384.  
  385. sub Std_MoveObject ; %id %dest %qty %x %y
  386. set !object %1
  387. set !dest %2
  388. if %0 < 3 || %3 = !null
  389. set !quantity all
  390. else
  391. set !quantity %3
  392. if %0 < 4 || !x = !null
  393. set !x random
  394. else
  395. set !x %4
  396. if %0 < 5 || !y = !null
  397. set !y random
  398. else
  399. set !y %5
  400.  
  401. gosub safecall Std_ReadProperty !dest
  402. set !oldProperty #result
  403.  
  404. if !quantity = all
  405. exEvent drag !object
  406. else
  407. exEvent drag !object !quantity
  408.  
  409. if !x = random || !y = random
  410. exEvent dropc !dest
  411. else
  412. exEvent dropc !dest !x !y
  413. wait 10 ; minimum timeout
  414.  
  415. set !timeout #systime + 2000
  416. while #systime < !timeout
  417. {
  418. gosub safecall Std_ReadProperty !dest
  419. if #result <> !oldProperty
  420. break
  421. }
  422. return
  423.  
  424. ;===========================================================================
  425. ;* @name Std_UseObject
  426. ;* @author AG
  427. ;* @purpose Utilizza un oggetto, ed eventualmente seleziona un bersaglio per l'utilizzo.
  428. ;* Timeout di 5s.
  429. ;* @params %1 req ID dell'oggetto da utilizzare.
  430. ;* %2 opt ID del bersaglio, oppure coordinata x del bersaglio.
  431. ;* %3 opt Coordinata y del bersaglio.
  432. ;* %4 opt Coordinata z del bersaglio.
  433. ;* @returns #true se l'operazione va a buon fine, #false altrimenti.
  434. ;* @example gosub safecall Std_UseObject %objectId %target_id
  435. ;* gosub safecall Std_UseObject %objectId %target_x %target_y %target_z
  436.  
  437. sub Std_UseObject
  438. set !object %1
  439. if %0 < 2
  440. set !targetX !null
  441. else
  442. set !targetX %2
  443. if %0 < 3
  444. set !targetY !null
  445. else
  446. set !targetY %3
  447. if %0 < 4
  448. set !targetZ !null
  449. else
  450. set !targetZ %4
  451.  
  452. set #lobjectid !object
  453. event macro 17 ; LastObject
  454. if !targetId <> !null || !targetX <> !null
  455. {
  456. gosub safecall Std_SelectTarget !targetX !targetY !targetZ
  457. }
  458. return #result
  459.  
  460. ;===========================================================================
  461. ;* @name Std_SelectTarget
  462. ;* @author AG
  463. ;* @purpose Seleziona in modo rapido un bersaglio.
  464. ;* Timeout di 5s.
  465. ;* @params %1 req ID del bersaglio, oppure coordinata x del bersaglio.
  466. ;* %2 opt Coordinata y del bersaglio (obbligatoria se %1 specifica la coordinata x).
  467. ;* %3 opt Coordinata z del bersaglio.
  468. ;* %4 opt Override esplicito per #ltargetkind. @todo
  469. ;* @returns #true se la selezione è riuscita correttamente. #false in caso di errore.
  470. ;* @example gosub safecall Std_SelectTarget %target_id
  471. ;* gosub safecall Std_SelectTarget %target_x %target_y %target_z
  472.  
  473. sub Std_SelectTarget ; %id_or_x %y %z
  474. set !type %0
  475. if !type >= 1 && %1 <> !null
  476. {
  477. if !type >= 2 && %2 <> !null
  478. {
  479. set #ltargetkind 2
  480. set #ltargetx %1
  481. set #ltargety %2
  482. if !type >= 3 && %3 <> !null
  483. set #ltargetz %3
  484. }
  485. else
  486. {
  487. set #ltargetkind 1
  488. set #ltargetid %1
  489. }
  490. set !timeout #systime + 5000
  491. while #systime < !timeout && #targcurs <> 1
  492. {
  493. }
  494. if #targcurs <> 1
  495. return #false
  496. event macro 22 ; LastTarget
  497. return #true
  498. }
  499. return #false
  500.  
  501. ;=======================================
  502. ;* @name Std_UseRunebook
  503. ;* @author AG
  504. ;* @purpose Apre un runebook e lo utilizza.
  505. ;* @params %1 req ID del runebook.
  506. ;* %2 req Pulsante (recall, gate_travel, sacred_journey, drop_rune, set_default, use_scroll, rename_book, close)
  507. ;* %3 req Indice della runa (da 1 a 16)
  508. ;*
  509. ;* @example gosub safecall Std_UseRunebook %runebook recall 1
  510. ;* gosub safecall Std_UseRunebook %runebook drop_rune 2
  511. ;* gosub safecall Std_UseRunebook %runebook rename_book Casa
  512.  
  513. sub Std_UseRunebook ; %idRunebook, %pulsante, %indiceRuna
  514. set !timeout ( #systime + 5000 )
  515. set !idRunebook %1
  516. set !pulsante %2
  517. set !runa %3
  518.  
  519. ; interpreta elasticamente il parametro pulsante
  520. if gate in !pulsante || travel in !pulsante
  521. set !pulsante gate_travel
  522. if journey in !pulsante || sacred in !pulsante
  523. set !pulsante sacred_journey
  524. if rename in !pulsante
  525. set !pulsante rename_book
  526. if drop in !pulsante || rune in !pulsante
  527. set !pulsante drop_rune
  528. if scroll in !pulsante || use in !pulsante
  529. set !pulsante use_scroll
  530. if default in !pulsante || set in !pulsante
  531. set !pulsante set_default
  532.  
  533. ; chiudi runebook precedente se aperto
  534. while #contsize = 452_236
  535. {
  536. set !x #contposx + 200
  537. set !y #contposy + 50
  538. click !x !y r
  539. wait 2
  540. }
  541.  
  542. ; apri il runebook
  543. set #lobjectid !idRunebook
  544. event macro 17 ; LastObject
  545.  
  546. ; attendi apertura runebook
  547. while #systime < !timeout && #contsize <> 452_236
  548. {
  549. }
  550. if #contsize <> 452_236
  551. return #false
  552.  
  553. ; gestisci ridenominazione runebook
  554. if !pulsante = rename_book
  555. {
  556. msg !runa , $
  557. return #true
  558. }
  559.  
  560. ; cambia pagina
  561. set !page ( ( !runa - 1 ) / 2 ) + ( ( !runa - 1 ) / 8 )
  562. set !x ( #contposx + 140 + !page * 35 ) )
  563. set !y ( #contposy + 195 )
  564. click !x !y
  565. wait 1s ; sul mio pc va bene anche "wait 10"
  566.  
  567. ; gestisci secondo click
  568. if ( !runa % 2 ) = 1 ; se la pagina è dispari
  569. set !x ( #contposx + 140 ) ; setta x di conseguenza
  570. else ; altrimenti
  571. set !x ( #contposx + 300 ) ; setta x di conseguenza
  572. if !pulsante = recall
  573. set !y ( #contposy + 145 )
  574. if !pulsante = gate_travel
  575. set !y ( #contposy + 162 )
  576. if !pulsante = sacred_journey
  577. set !y ( #contposy + 180 )
  578. if !pulsante = drop_rune
  579. set !y ( #contposy + 118 )
  580. if !pulsante = use_scroll
  581. {
  582. set !y ( #contposy + 70 )
  583. set !x ( !x - 5 )
  584. }
  585. if !pulsante = set_default
  586. {
  587. set !y ( #contposy + 25 )
  588. if ( !runa % 2 ) = 1
  589. set !x ( #contposx + 165 )
  590. else
  591. set !x ( #contposx + 305 )
  592. }
  593. click !x !y
  594.  
  595. ; attendi eventuale spell
  596. if ( !pulsante = recall ) || ( !pulsante = gate_travel ) || ( !pulsante = sacred_journey ) || ( !pulsante = use_scroll ) || ( !pulsante = sacred_journey )
  597. {
  598. wait 2s
  599. wait 20
  600. }
  601.  
  602. ; chiudi book se ancora aperto
  603. while #contsize = 452_236
  604. {
  605. set !x #contposx + 200
  606. set !y #contposy + 50
  607. click !x !y r
  608. wait 2
  609. }
  610. return #true
  611.  
  612. ;=======================================
  613. ;* @name Std_SafeUseRunebook
  614. ;* @author AG
  615. ;* @purpose Apre un runebook e lo utilizza. Se la posizione del PG non cambia, ripete il tentativo.
  616. ;* @params %1 req ID del runebook.
  617. ;* %2 req Pulsante (recall, gate_travel, sacred_journey, drop_rune, set_default, use_scroll, rename_book, close)
  618. ;* %3 req Indice della runa (da 1 a 16)
  619. ;*
  620. ;* @example gosub safecall Std_SafeUseRunebook %runebook recall 1
  621.  
  622. sub Std_SafeUseRunebook ; %idRunebook, %pulsante, %indiceRuna
  623. set !runebook %1
  624. set !mode %2
  625. set !index %3
  626. set !x #charposx
  627. set !y #charposy
  628. set !z #charposz
  629. set !timeout #systime + 10000
  630. gosub safecall Std_UseRunebook !runebook !mode !index ; per sicurezza, fai sempre almeno il primo
  631. while #systime < !timeout && !x = #charposx && !y = #charposy && !z = #charposz
  632. {
  633. gosub safecall Std_UseRunebook !runebook !mode !index
  634. }
  635. return !x <> #charposx || !y <> #charposy || !z <> #charposz
  636.  
  637. ;===========================================================================
  638. ;* @name Std_CheckOverweight
  639. ;* @author AG, fixed by Smjert
  640. ;* @purpose Verifica se il pg trasporta troppo peso (o troppi oggetti).
  641. ;* @params %1 opt Margine di sicurezza peso (default = 0)
  642. ;* La sub terrà conto di un margine di sicurezza ulteriore per determinare se il pg trasporta troppo peso.
  643. ;* %2 opt Margine di sicurezza numero di oggetti (default = 0)
  644. ;* La sub terrà conto di un margine di sicurezza ulteriore per determinare se il pg trasporta troppi oggetti.
  645. ;* @returns #true se il pg trasporta troppo peso o troppi oggetti. #false altrimenti.
  646. ;* @example gosub safecall Std_CheckOverweight 50 10
  647.  
  648. sub Std_CheckOverweight
  649. if %0 > 0 && %1 <> !null
  650. set !weightMargin %1
  651. else
  652. set !weightMargin 0
  653. if %0 > 1 && %2 <> !null
  654. set !itemsMargin %2
  655. else
  656. set !itemsMargin 0
  657.  
  658. ; @todo aggiungere modificatore al peso per umani
  659. if #maxweight - #weight < !weightMargin
  660. return #true
  661.  
  662. gosub safecall Std_ReadProperty #backpackid
  663. set !property #result
  664. str pos !property contents:
  665. set !index #strres + 9
  666. str del !property 1 !index
  667. set !property #strres
  668. str pos !property /
  669. set !index #strres - 1
  670. str left !property !index
  671. set !itemCount #strres
  672. if 125 - !itemCount < !itemsMargin
  673. return #true
  674. return #false
  675.  
  676. ;===========================================================================
  677. ;* @name Std_GetObjectCount
  678. ;* @author AG
  679. ;* @purpose Conta il numero totale di oggetti rispetto ad un'istruzione finditem.
  680. ;* @params %1 req Istruzione finditem (esempi: "G_20" oppure "C_ , #backpackid").
  681. ;* %2 req Id dell'oggetto da cercare.
  682. ;* %3 opt Colore dell'oggetto da cercare.
  683. ;* @returns Il numero totale di oggetti trovati.
  684. ;* @example gosub safecall Std_GetObjectCount G_20 %objectType
  685. ;* gosub safecall Std_GetObjectCount C_ , #backpackid %objectType %objectColor
  686.  
  687. sub Std_GetObjectCount
  688. set !findString %1
  689. set !id %2
  690. if %0 < 3 || %3 = !null
  691. set !color any
  692. else
  693. set !color %3
  694.  
  695. set !count 0
  696. finditem !id !findString
  697. if #findkind <> -1
  698. {
  699. for #findindex 1 #findcnt
  700. {
  701. if !color <> any && !color <> #findcol
  702. continue
  703. set !count !count + #findstack
  704. }
  705. }
  706. return !count
  707.  
  708. ;===========================================================================
  709. ;* @name Std_AskForTarget
  710. ;* @author AG
  711. ;* @purpose Richiede la selezione di un bersaglio all'utente.
  712. ;* Timeout di 10s.
  713. ;* @params
  714. ;* @returns ID del bersaglio selezionato, oppure #false se l'operazione fallisce.
  715. ;* Le variabili #ltarget* restano riempite con informazioni sul bersaglio scelto.
  716. ;* @example gosub safecall Std_AskForTarget
  717. ;*
  718. sub Std_AskForTarget
  719. set !timeout #systime + 10000
  720.  
  721. set #ltargetid 0
  722. set #targcurs 1
  723. while ( #systime < !timeout ) && ( #targcurs = 1 )
  724. {
  725. }
  726. if #systime >= !timeout
  727. return #false
  728.  
  729. if ( #ltargetid <> YC ) && ( #ltargetid <> 0 ) && ( #ltargetid <> !null )
  730. return #ltargetid
  731. return #false
  732.  
  733. ;===========================================================================
  734. ;* @name Std_ResetJournal
  735. ;* @author AG
  736. ;* @purpose Cancella il contenuto di un'istanza del journal.
  737. ;* In termini pratici, determina l'istante di partenza da cui cominciare a monitorare il journal.
  738. ;* @params %1 opt Nome dell'istanza del journal da cancellare. Ciascuna istanza è indipendente dalle altre.
  739. ;* @example Vedere la documentazione di Std_ScanJournal per un esempio di come usare congiuntamente le due sub.
  740.  
  741. sub Std_ResetJournal ; %instanceName
  742. namespace push
  743. namespace local Std_ScanJournal_Persistent
  744. if %0 < 1 || %1 = !null
  745. set !instance default
  746. else
  747. set !instance %1
  748. set !instances_ . !instance ( #jindex + 1 )
  749. namespace pop
  750. return
  751.  
  752. sub Std_ClearJournal ; sinonimo
  753. if %0 < 1
  754. set %1 !null
  755. gosub Std_ResetJournal %1
  756. return
  757.  
  758. ;===========================================================================
  759. ;* @name Std_ScanJournal
  760. ;* @author AG
  761. ;* @purpose Cerca un'insieme di stringhe in un'istanza del journal.
  762. ;* @params %1 req Nome dell'istanza del journal da cancellare. Ciascuna istanza è indipendente dalle altre.
  763. ;* %2 req Stringa da ricercare all'interno dell'istanza.
  764. ;* %3...%n opt Stringhe addizionali da ricercare all'interno dell'istanza.
  765. ;* @returns La prima stringa che viene trovata nell'istanza, oppure #false se non ne viene trovata nessuna.
  766. ;*
  767. ;* @example {
  768. ;* gosub safecall Std_ResetJournal operation1
  769. ;* <esegui l'operazione>
  770. ;* gosub safecall Std_ScanJournal operation1 the_spell_fizzles
  771. ;* if #result = the_spell_fizzles
  772. ;* <nel journal è comparsa la stringa the_spell_fizzles durante l'esecuzione dell'operazione>
  773. ;* }
  774.  
  775. sub Std_ScanJournal ; %instanceName %string1 %string2 %string...
  776. namespace push
  777. namespace local Std_ScanJournal_Persistent
  778. if %0 < 1 || %1 = !null
  779. set !instance default
  780. else
  781. set !instance %1
  782. set !start !instances_ . !instance
  783.  
  784. if !start <= #jindex
  785. {
  786. for !i !start #jindex
  787. {
  788. scanjournal !i
  789. for !j 2 %0
  790. {
  791. set !string % . !j
  792. if !string in #journal
  793. {
  794. set #result !string
  795. namespace pop
  796. return #result
  797. }
  798. }
  799. }
  800. }
  801. namespace pop
  802. return #false
  803.  
  804. ;==================================================================================
  805. ;* @name Std_GetWorldStatus
  806. ;* @author AG
  807. ;* @purpose Verifica se c'è un save o un cleaning in corso.
  808. ;* @returns Uno dei seguenti valori:
  809. ;* - cleaning: Cleaning resources in corso.
  810. ;* - saving: Save in corso.
  811. ;* - savewarning: Sta per avvenire un save.
  812. ;* - running: Nessun save o clean in corso.
  813. ;* @example gosub safecall Std_GetWorldStatus
  814. ;* @status Tested and working.
  815.  
  816. sub Std_GetWorldStatus
  817. namespace push
  818. namespace local Std_GetWorldStatus_Persistent
  819. if !status = !null
  820. {
  821. set !jstart #jindex + 1
  822. set !status running
  823. }
  824. if !status = running
  825. set !restoreTime #systime + 60000
  826.  
  827. set !jend #jindex
  828. if !jend >= !jstart
  829. {
  830. for !j !jend !jstart ; reverse scanning
  831. {
  832. scanjournal !j
  833. set !journal #journal
  834. set !newstate !null
  835. if world_will_save in !journal
  836. set !newstate savewarning
  837. if world_is_saving in !journal
  838. set !newstate saving
  839. if cleaning_resources in !journal
  840. set !newstate cleaning
  841. if world_save_complete in !journal
  842. set !newstate running
  843. if resources_cleaned in !journal
  844. set !newstate running
  845. if #systime > !restoreTime
  846. {
  847. event exmsg #charid 3 0 Il save sta durando troppo!
  848. set !newstate running
  849. }
  850. if !newstate <> !null
  851. {
  852. set !status !newstate
  853. break
  854. }
  855. }
  856. set !jstart !jend + 1
  857. }
  858.  
  859. set #result !status
  860. namespace pop
  861. return #result
  862.  
  863. ;===========================================================================
  864. ;* @name Std_OpenBankBox
  865. ;* @author AG
  866. ;* @purpose Semplice sub di utilità per aprire la bank-box.
  867. ;* Timeout di 10s.
  868. ;* @params %1 opt ID di un banker nelle vicinanze.
  869. ;* Se viene specificato, si aprirà la bank usando "exevent popup" anzichè "msg bank$".
  870. ;* @returns #true se l'operazione è andata a buon fine. #false altrimenti.
  871. ;* @example gosub safecall Std_OpenBankBox
  872.  
  873. sub Std_OpenBankBox ; %banker
  874. if %0 < 1 || %1 = !null
  875. set !banker !null
  876. else
  877. set !banker %1
  878.  
  879. if !banker = !null
  880. msg bank$
  881. else
  882. exevent popup !banker 2
  883.  
  884. set !timeout #systime + 5000
  885. while #systime < !timeout && #contsize <> 180_240
  886. {
  887. }
  888. return #contsize = 180_240
  889.  
  890. ;===========================================================================
  891. ;* @name Std_ClickGumpButton
  892. ;* @author AG
  893. ;* @purpose Clicca in maniera rapida e sicura sul bottone di un gump.
  894. ;* Funziona con tutti quei gump che scompaiono brevemente quando si clicca su un pulsante
  895. ;* (esempi: gump di crafting, gump di un bodbook).
  896. ;* @params %1 req Coordinata x del bottone rispetto al gump.
  897. ;* %2 req Coordinata y del bottone rispetto al gump.
  898. ;* %3 opt #contsize del gump. Se non specificata, si assume che sia la #contsize del gump corrente.
  899. ;* @returns #true se l'operazione ha successo. #false altrimenti.
  900. ;* @example gosub safecall Std_ClickGumpButton 10 20
  901. ;* gosub safecall Std_ClickGumpButton 10 20 640_480
  902. ;* @status Tested and working.
  903.  
  904. sub Std_ClickGumpButton ; %x %y %gump_size
  905. set !relX %1
  906. set !relY %2
  907. if %0 < 3 || %3 = !null
  908. set !contsize #contsize ; currently opened gump
  909. else
  910. set !contsize %3
  911.  
  912. ; attendi comparsa del gump
  913. set !timeout #systime + 2000
  914. while #systime < !timeout && #contsize <> !contsize
  915. {
  916. }
  917. if #contsize <> !contsize
  918. return #false
  919.  
  920. ; clicca
  921. set !x ( #contposx + !relX )
  922. set !y ( #contposy + !relY )
  923. click !x !y
  924.  
  925. ; attendi scomparsa del gump
  926. set !timeout #systime + 1000 ; il gump sparisce anche in caso di lag
  927. while #systime < !timeout && #contsize = !contsize
  928. {
  929. }
  930. if #contsize = !contsize
  931. return #false
  932. return #true
  933.  
  934. ;===========================================================================
  935. ;* @name Std_ExtractBod
  936. ;* @version 2.0
  937. ;* @author AG
  938. ;* @purpose Estrae in maniera sicura uno o più bod da un bodbook.
  939. ;* @params %1 req Bodbook da cui estrarre il bod.
  940. ;* %2 opt Numero di bod da estrarre. Disponibile dalla versione 2.0.
  941. ;* Si può specificare "all" per estrarli tutti. Il valore predefinito è 1.
  942. ;* @returns Numero di bod estratti. Questo implica #false in caso di 0 bod estratti.
  943. ;* La versione 1.0 restituiva l'id del singolo bod estratto.
  944. ;* @example gosub safecall Std_ExtractBod %bodbookid
  945. ;* gosub safecall Std_ExtractBod %bodbookid all
  946.  
  947. sub Std_ExtractBod
  948. set !clsBod EYM
  949. set !book %1
  950. if %0 < 2 || %2 = !null
  951. set !count 1
  952. else
  953. set !count %2
  954. if !count = all
  955. set !count 100000
  956. if !count <= 0
  957. return #false
  958.  
  959. ; Apri il bodbook
  960. gosub safecall Std_UseObject !book
  961. set !timeout #systime + 3000
  962. while #contsize <> 615_454 && #systime < !timeout
  963. {
  964. }
  965. if #contsize <> 615_454 ; prova ancora
  966. {
  967. gosub safecall Std_UseObject !book
  968. set !timeout #systime + 3000
  969. while #contsize <> 615_454 && #systime < !timeout
  970. {
  971. }
  972. if #contsize <> 615_454
  973. return #false
  974. }
  975.  
  976. ; Estrai per più volte il primo BOD della pagina
  977. for !i 1 !count
  978. {
  979. gosub safecall Std_ClickGumpButton 42 104 615_454
  980. if #result = #false ; try again
  981. {
  982. gosub safecall Std_ClickGumpButton 42 104 615_454
  983. if #result = #false
  984. break
  985. }
  986. }
  987.  
  988. ; Chiudi il gump
  989. gosub safecall Std_ClickGumpButton 385 425 615_454
  990. return !i - 1
  991.  
  992. ;===========================================================================
  993. ;* @name Std_AskNewBod
  994. ;* @author AG
  995. ;* @purpose Richiede un bod ad un vendor.
  996. ;* Timeout di 5s.
  997. ;* @params %1 req Vendor a cui chiedere il bod.
  998. ;* @returns ID del bod chiesto al vendor, oppure #false se l'operazione non va a buon fine.
  999. ;* @example gosub safecall Std_AskNewBod %vendorId
  1000.  
  1001. sub Std_AskNewBod ; %vendor
  1002. set !vendor %1
  1003. set !timeout ( #systime + 5000 )
  1004. set !clsBod EYM
  1005.  
  1006. gosub safecall Std_ResetJournal Std_AskNewBod
  1007. exevent popup !vendor 4
  1008. while #contkind <> UEJB
  1009. wait 5
  1010. set !x #contposx + 15
  1011. set !y #contposy + ( 17 * 4 ) + 8
  1012. click !x !y
  1013. gosub safecall Std_CheckForBodRequestGump
  1014. while ( #systime < !timeout ) && ( #result = #false )
  1015. {
  1016. ; fail-fast su "An offer may be available in..."
  1017. gosub safecall Std_ScanJournal Std_AskNewBod offer_may_be_available
  1018. if #result <> #false
  1019. return #false
  1020.  
  1021. gosub safecall Std_CheckForBodRequestGump
  1022. }
  1023. if #result = #false
  1024. return #false
  1025.  
  1026. set !x ( #contposx + 110 )
  1027. str mid #contsize 5 3
  1028. set !y ( #contposy + #strres - 25 )
  1029.  
  1030. ignoreitem reset
  1031. finditem !clsBod C_ , #backpackid
  1032. if #findkind <> -1
  1033. {
  1034. for #findindex 1 #findcnt
  1035. {
  1036. ignoreitem #findid
  1037. }
  1038. }
  1039. click !x !y
  1040.  
  1041. set #result #false
  1042. set !timeout #systime + 3000
  1043. while #systime < !timeout
  1044. {
  1045. finditem !clsBod C_ , #backpackid
  1046. if #findkind <> -1
  1047. {
  1048. set #result #findid
  1049. break
  1050. }
  1051. }
  1052. ignoreitem reset
  1053. return #result
  1054.  
  1055. ;===========================================================================
  1056. ;* @name Std_RestockItem
  1057. ;* @author AG
  1058. ;* @purpose Cerca oggetti del tipo specificato nel container sorgente, e li sposta nel container di destinazione.
  1059. ;* Si ferma non appena nel container di destinazione si raggiunge una quantità di oggetti compresa fra min e max.
  1060. ;* @params %1 req ID del tipo di oggetto da restockare.
  1061. ;* %2 req Container sorgente (è possibile indicare anche containers multipli).
  1062. ;* %3 req Container di destinazione.
  1063. ;* %4 req Quantità minima da restockare.
  1064. ;* %5 opt Quantità massima da restockare. Pari a %4 se non specificato.
  1065. ;* %6 opt Colore dell'oggetto da cercare. Può essere "any" per indicare "qualsiasi colore".
  1066. ;* %7 opt Settare a #true se si desidera lasciare sempre almeno 2 unità di un oggetto stackabile dentro il
  1067. ;* container sorgente (così da non alterare eventuali posizionamenti definiti dall'utente).
  1068. ;* @returns #true se si riesce a restockare almeno la quantità minima (quindi anche se non si è riusciti a raggiungere
  1069. ;* la quantità massima).
  1070. ;* #false se l'operazione fallisce.
  1071. ;* @example gosub safecall Std_RestockItem %id %source %dest %reqQuantity %optQuantity %color
  1072. ;* @depends Std_MoveObject
  1073.  
  1074. sub Std_RestockItem ; %id %source %dest %reqQuantity %optQuantity %color %leave2
  1075. set !id %1
  1076. set !sources %2
  1077. set !destination %3
  1078. set !minQuantity %4
  1079. if %0 < 5 || %5 = !null || %5 < !minQuantity
  1080. set !maxQuantity !minQuantity
  1081. else
  1082. set !maxQuantity %5
  1083. if %0 < 6 || %6 = !null
  1084. set !color any
  1085. else
  1086. set !color %6
  1087. set !preserveStack %0 >= 7 && %7 = #true
  1088.  
  1089. ; conta items già a destinazione
  1090. set !quantity 0
  1091. finditem !id C_ , !destination
  1092. if #findkind <> -1
  1093. {
  1094. for #findindex 1 #findcnt
  1095. {
  1096. if !color = any || !color = #findcol
  1097. {
  1098. set !quantity !quantity + #findstack
  1099. }
  1100. }
  1101. }
  1102. if !quantity >= !minQuantity
  1103. return #true
  1104.  
  1105. gosub safecall AG_Tokenize !sources _ Std_RestockItem_Array_
  1106. if ! ( #result > 0 )
  1107. return #false
  1108. set !source_count #result
  1109.  
  1110. for !i 1 !source_count
  1111. {
  1112. set !source %Std_RestockItem_Array_ . !i
  1113. finditem !id C_ , !source
  1114. if #findkind = -1
  1115. continue
  1116.  
  1117. for #findindex 1 #findcnt
  1118. {
  1119. if !quantity >= !maxQuantity
  1120. return #true
  1121. if !color <> any && !color <> #findcol
  1122. continue
  1123.  
  1124. set !item #findid
  1125. set !stack #findstack
  1126. if !preserveStack
  1127. {
  1128. if !stack >= 2
  1129. set !stack !stack - 2
  1130. if !stack = 0
  1131. continue
  1132. }
  1133. if !stack > ( !maxQuantity - !quantity )
  1134. set !stack ( !maxQuantity - !quantity )
  1135. gosub safecall Std_MoveObject !item !destination !stack
  1136. set !quantity !quantity + !stack
  1137. }
  1138. if !quantity >= !minQuantity
  1139. return #true
  1140. }
  1141. return !quantity >= !minQuantity
  1142.  
  1143. ;=========================================================================
  1144. ;* @name Std_LoadPersistentVariables
  1145. ;* @author AG
  1146. ;* @purpose Carica delle variabili rese persistenti in precedenza mediante Std_SavePersistentVariables.
  1147. ;* Le variabili vengono lette da CEO Filesystem, ed importate fra le variabili globali (%variabile).
  1148. ;* @params %1 req Lista variabili
  1149. ;* %2 opt Nome configurazione (default: current)
  1150. ;* %3 opt Separatore (default: |)
  1151. ;* @example gosub safecall Std_LoadPersistentVariables variabile1|variabile2|variabile3
  1152. ;* gosub safecall Std_LoadPersistentVariables variabile1#variabile2#variabile3 #
  1153. ;* @depends CEO_getGlobalVar, AG_Tokenize
  1154. ;*
  1155. sub Std_LoadPersistentVariables
  1156. set !list %1
  1157. set !scriptId Boscags7
  1158.  
  1159. if %0 < 2 || %2 = !null
  1160. set !config Current
  1161. else
  1162. set !config %2
  1163.  
  1164. if %0 < 3 || %3 = !null
  1165. set !sep |
  1166. else
  1167. set !sep %3
  1168.  
  1169. gosub safecall AG_Tokenize !list !sep Temp_Array_
  1170. set !count #result
  1171. for !i 1 !count
  1172. {
  1173. set !localName %Temp_Array_ . !i
  1174. set !outerName _ , #charid , _ , !config , _ , !localName
  1175. gosub CEO_getGlobalVar !scriptId !outerName
  1176. set % . !localName ( % . !outerName )
  1177. }
  1178. return
  1179.  
  1180. ;=========================================================
  1181. ;* @name Std_SavePersistentVariables
  1182. ;* @author AG
  1183. ;* @purpose Rende persistenti una serie di variabili, di cui si forniscono i nomi.
  1184. ;* Le variabili vengono ricercate fra le variabili globali (%variabile) e salvate mediante CEO Filesystem.
  1185. ;* @params %1 req Lista variabili
  1186. ;* %2 opt Nome configurazione (default: current)
  1187. ;* %3 opt Separatore (default: |)
  1188. ;* @example gosub safecall Std_SavePersistentVariables variabile1|variabile2|variabile3
  1189. ;* gosub safecall Std_SavePersistentVariables variabile1#variabile2#variabile3 #
  1190. ;* @depends CEO_putGlobalVar, AG_Tokenize
  1191. ;*
  1192. sub Std_SavePersistentVariables ; %list %configName %separator
  1193. set !list %1
  1194. set !scriptId Boscags7
  1195.  
  1196. if %0 < 2 || %2 = !null
  1197. set !config Current
  1198. else
  1199. set !config %2
  1200.  
  1201. if %0 < 3 || %3 = !null
  1202. set !sep |
  1203. else
  1204. set !sep %3
  1205.  
  1206. gosub safecall AG_Tokenize !list !sep Temp_Array_
  1207. set !count #result
  1208. for !i 1 !count
  1209. {
  1210. set !localName %Temp_Array_ . !i
  1211. set !outerName _ , #charid , _ , !config , _ , !localName
  1212. set % . !outerName ( % . !localName )
  1213. gosub CEO_putGlobalVar !scriptId !outerName
  1214. }
  1215. return
  1216.  
  1217. ;=======================================
  1218. ;* @name Std_Pathfind
  1219. ;* @author AG (original code by Scorna)
  1220. ;* @purpose Raggiunge la posizione specificata.
  1221. ;* Timeout di 10s. Comportamento fail-fast in caso di punto non raggiungibile.
  1222. ;* @params %1 req Coordinata x del punto da raggiungere.
  1223. ;* %2 req Coordinata y del punto da raggiungere.
  1224. ;* %3 opt Coordinata z del punto da raggiungere. Se non indicata, il check avverrà solo su #charposx e #charposy.
  1225. ;* %4 opt Tolleranza rispetto al punto da raggiungere.
  1226. ;* @returns #true se il punto è stato raggiunto. #false altrimenti.
  1227. ;*
  1228. ;* @example gosub safecall Std_Pathfind !x !y !z 2
  1229.  
  1230. sub Std_Pathfind
  1231. set !x %1
  1232. set !y %2
  1233. if %0 < 3 || %3 = !null
  1234. set !z !null
  1235. else
  1236. set !z %3
  1237. if %0 < 4 || %4 = !null
  1238. set !tolerance 0
  1239. else
  1240. set !tolerance %4
  1241. set !timeout ( #systime + 10000 )
  1242.  
  1243. set !xmin !x - !tolerance
  1244. set !xmax !x + !tolerance
  1245. set !ymin !y - !tolerance
  1246. set !ymax !y + !tolerance
  1247. set !zmin !z - !tolerance
  1248. set !zmax !z + !tolerance
  1249.  
  1250. while #systime < !timeout
  1251. {
  1252. if ( #charposx >= !xmin && #charposx <= !xmax ) &&
  1253. + ( #charposy >= !ymin && #charposy <= !ymax ) &&
  1254. + ( !z = !null || ( #charposz >= !zmin && #charposz <= !zmax ) )
  1255. return #true
  1256.  
  1257. set !inizioj #jindex + 1
  1258. if !z = !null
  1259. event PathFind !x !y
  1260. else
  1261. event PathFind !x !y !z
  1262. for !j !inizioj #jindex
  1263. {
  1264. scanjournal !j
  1265. if Can't_get_there in #journal || That_location_is_blocked in #journal
  1266. {
  1267. deletejournal
  1268. return #false
  1269. }
  1270. }
  1271. wait 1s
  1272. }
  1273. return #false
  1274.  
  1275. ;=======================================
  1276. ;* @name Std_SmartPathfind
  1277. ;* @author AG (original code by Scorna)
  1278. ;* @purpose Raggiunge la posizione specificata, eseguendo anche operazioni "intelligenti" (tipo aprire le porte).
  1279. ;* @params %1 req Coordinata x del punto da raggiungere.
  1280. ;* %2 req Coordinata y del punto da raggiungere.
  1281. ;* %3 opt Coordinata z del punto da raggiungere. Se non indicata, il check avverrà solo su #charposx e #charposy.
  1282. ;* %4 opt Tolleranza rispetto al punto da raggiungere.
  1283. ;* @returns #true se il punto è stato raggiunto. #false altrimenti.
  1284. ;*
  1285. ;* @example gosub safecall Std_SmartPathfind !x !y !z 2
  1286.  
  1287. sub Std_SmartPathfind
  1288. ; vecchi id, correttamente funzionanti
  1289. ; set !clsDoor XG_ZG_TG_VG_FH_HH_BH_DH_AY_ZX_CY_BY_
  1290. ; +XGB_ZGB_JHB_LHB_FHB_HHB_RHB_THB_NHB_PHB_ZHB_BIB_VHB_XHB_HIB_JIB_DIB_FIB_PIB_RIB_LIB_NIB_ZDB_BEB_VDB_XDB_HEB_
  1291. ; +JEB_DEB_FEB_PEB_REB_LEB_NEB_XEB_ZEB_TEB_VEB_FFB_HFB_FJC_IJC_HJC_SJC_RJC_UJC_TJC_OJC_NJC_QJC_PJC_YOC_XOC_APC_
  1292. ; +ZOC_UOC_TOC_WOC_VOC_GPC_FPC_IPC_HPC_CPC_BPC_EPC_DPC_OPC_NPC_QPC_PPC_KPC_JPC_MPC_LPC_WPC_VPC_YPC_XPC_SPC_RPC_
  1293. ; +UPC_TPC_EQC_DQC_GQC_FQC_AQC_ZPC_CQC_BQC_MQC_LQC_OQC_NQC_IQC_HQC_KQC_JQC_UQC_TQC_WQC_VQC_QQC_PQC_SQC_RQC_CRC_
  1294. ; +BRC_ERC_DRC_YQC_XQC_ARC_ZQC_MMC_LMC_OMC_NMC_IMC_HMC_KMC_JMC_UMC_TMC_WMC_VMC_QMC_PMC_SMC_RMC_CNC_BNC_ENC_DNC_
  1295. ; +YMC_XMC_ANC_ZMC_KNC_JNC_MNC_LNC_GNC_FNC_INC_HNC_SNC_RNC_UNC_TNC_ONC_NNC_QNC_PNC_AOC_ZNC_COC_BOC_WNC_VNC_YNC_
  1296. ; +XNC_IOC_HOC_KOC_JOC_EOC_IPJ_HPJ_RPL_UPL_TPL_OPL_NPL_QPL_PPL_AQL_ZPL_CQL_BQL_WPL_VPL_YPL_XPL_IQL_HQL_KQL_JQL_
  1297. ; +EQL_DQL_GQL_FQL_QQL_PQL_SQL_RQL_MQL_LQL_OQL_NQL_YQL_XQL_ARL_ZQL_UQL_ZZL_CAM_BAM_MAM_LAM_OAM_NAM_IAM_HAM_KAM_
  1298. ; +JAM_UAM_TAM_WAM_VAM_QAM_FUN_QUN_PUN_SUN_RUN_MUN_GRO_IRO_EWP_DWP_KWP_JWP_HAQ_KAQ_JAQ_UAQ_TAQ_WAQ_VAQ_QAQ_PAQ_
  1299. ; +SAQ_RAQ_CBQ_BBQ_EBQ_DBQ_YAQ_XAQ_ABQ_ZAQ_KBQ_JBQ_MBQ_LBQ_GBQ_SCR_PCR_NXS_OXS_VCR_QCR_PXS_QXS_
  1300.  
  1301. ; nuovi id, non ancora testati
  1302. set !clsDoor _
  1303. +XG_ZG_TG_VG_FH_HH_BH_DH_AY_ZX_CY_BY_XGB_ZGB_JHB_LHB_FHB_HHB_RHB_
  1304. +THB_NHB_PHB_ZHB_BIB_VHB_XHB_HIB_JIB_DIB_FIB_PIB_RIB_LIB_NIB_ZDB_
  1305. +BEB_VDB_XDB_HEB_JEB_DEB_FEB_PEB_REB_LEB_NEB_XEB_ZEB_TEB_VEB_FFB_
  1306. +HFB_FJC_IJC_HJC_SJC_RJC_UJC_TJC_OJC_NJC_QJC_PJC_YOC_XOC_APC_ZOC_
  1307. +UOC_TOC_WOC_VOC_GPC_FPC_IPC_HPC_CPC_BPC_EPC_DPC_OPC_NPC_QPC_PPC_
  1308. +KPC_JPC_MPC_LPC_WPC_VPC_YPC_XPC_SPC_RPC_UPC_TPC_EQC_DQC_GQC_FQC_
  1309. +AQC_ZPC_CQC_BQC_MQC_LQC_OQC_NQC_IQC_HQC_KQC_JQC_UQC_TQC_WQC_VQC_
  1310. +QQC_PQC_SQC_RQC_CRC_BRC_ERC_DRC_YQC_XQC_ARC_ZQC_MMC_LMC_OMC_NMC_
  1311. +IMC_HMC_KMC_JMC_UMC_TMC_WMC_VMC_QMC_PMC_SMC_RMC_CNC_BNC_ENC_DNC_
  1312. +YMC_XMC_ANC_ZMC_KNC_JNC_MNC_LNC_GNC_FNC_INC_HNC_SNC_RNC_UNC_TNC_
  1313. +ONC_NNC_QNC_PNC_AOC_ZNC_COC_BOC_WNC_VNC_YNC_XNC_IOC_HOC_KOC_JOC_
  1314. +EOC_IPJ_HPJ_RPL_UPL_TPL_OPL_NPL_QPL_PPL_AQL_ZPL_CQL_BQL_WPL_VPL_
  1315. +YPL_XPL_IQL_HQL_KQL_JQL_EQL_DQL_GQL_FQL_QQL_PQL_SQL_RQL_MQL_LQL_
  1316. +OQL_NQL_YQL_XQL_ARL_ZQL_UQL_ZZL_CAM_BAM_MAM_LAM_OAM_NAM_IAM_HAM_
  1317. +KAM_JAM_UAM_TAM_WAM_VAM_QAM_FUN_QUN_PUN_SUN_RUN_MUN_GRO_IRO_EWP_
  1318. +DWP_KWP_JWP_HAQ_KAQ_JAQ_UAQ_TAQ_WAQ_VAQ_QAQ_PAQ_SAQ_RAQ_CBQ_BBQ_
  1319. +EBQ_DBQ_YAQ_XAQ_ABQ_ZAQ_KBQ_JBQ_MBQ_LBQ_GBQ_SCR_PCR_NXS_OXS_VCR_
  1320. +QCR_PXS_QXS_WBD_YBD_KBD_MBD_SBD_UBD_ECD_GCD_RFD_TFD_VFD_XFD_FBD_
  1321. +HBD_BBD_DBD_GFD_IFD_UED_WED_CFD_EFD_OFD_QFD_GBS_CXS_MBS_EXS_XCR_
  1322. +YXS_DDR_WXS_RCR_MXS_BDR_KXS_UXS_SXS_WBR_MBR_YEB_AFB_MEB_OEB_UEB_
  1323. +WEB_GFB_IFB_IEB_KEB_WDB_YDB_EEB_GEB_QEB_SEB_QIB_SIB_EIB_GIB_MIB_
  1324. +OIB_AEB_CEB_AIB_CIB_OHB_QHB_WHB_YHB_IIB_KIB_WCD_QCD_KCD_UCD_SCD_
  1325. +CDD_EDD_YCD_TTU_DUU_XTU_RTU_FUU_ZTU_BUU_LUU_VTU_LTU_JTU_PTU_DOU_
  1326. +JOU_NTU_FOU_
  1327.  
  1328. set !x %1
  1329. set !y %2
  1330. if %0 < 3 || %3 = !null
  1331. set !z !null
  1332. else
  1333. set !z %3
  1334. if %0 < 4 || %4 = !null
  1335. set !tolerance 0
  1336. else
  1337. set !tolerance %4
  1338. set !timeout ( #systime + 20000 )
  1339.  
  1340. ignoreitem reset
  1341. while #systime < !timeout
  1342. {
  1343. gosub safecall Std_Pathfind !x !y !z !tolerance
  1344. if #result = #true
  1345. {
  1346. ignoreitem reset
  1347. return #true
  1348. }
  1349.  
  1350. ; fallimento: tenta operazioni intelligenti
  1351. finditem !clsDoor G_15
  1352. if #findkind = -1
  1353. break ; fallimento completo
  1354.  
  1355. set !door_dist 1000
  1356. for #findindex 1 #findcnt
  1357. {
  1358. if #finddist >= !door_dist
  1359. continue
  1360. set !door_dist #finddist
  1361. set !door_id #findid
  1362. set !door_x #findx
  1363. set !door_y #findy
  1364. set !door_z #findz
  1365. }
  1366.  
  1367. gosub safecall Std_Pathfind !door_x !door_y !door_z 1
  1368. if #result = #false
  1369. break
  1370.  
  1371. gosub safecall Std_UseObject !door_id
  1372. wait 1s
  1373.  
  1374. finditem !clsDoor G_2 ; escludi le door nelle vicinanze (presumibilmente aperte)
  1375. for #findindex 1 #findcnt
  1376. {
  1377. ignoreitem #findid
  1378. }
  1379. }
  1380.  
  1381. ignoreitem reset
  1382. return #false
  1383.  
  1384. ;====================================================================
  1385. ;* @name Std_RecycleItems
  1386. ;* @author AG
  1387. ;* @purpose Ricicla un gruppo di oggetti. Gli oggetti vengono riciclati tutti secondo UNO STESSO METODO.
  1388. ;* La sub ignora tutti gli oggetti insured o blessed.
  1389. ;* La sub ignora gli oggetti di tipo cloth nel caso in cui il metodo sia cut (si produrrebbero bandages).
  1390. ;*
  1391. ;* @params %1 req Specifica gli oggetti da riciclare.
  1392. ;* Nella stessa lista, si possono specificare sia ID di oggetti che ID di tipi di oggetto.
  1393. ;* %2 req Metodo di riciclaggio (smelt|cut|combine).
  1394. ;* Se si specifica un metodo non valido, non verrà effettuato nessun riciclaggio, e verrà semplicemente
  1395. ;* restituita la lista di tutti gli item, filtrata in base ai criteri di sicurezza (esclusione di oggetti
  1396. ;* blessed e insured, eccetera).
  1397. ;* %3 opt Restringe la ricerca di item da riciclare al solo container specificato.
  1398. ;* @returns Elenco degli oggetti che NON si è riusciti a riciclare.
  1399. ;* Se l'elenco è vuoto, il risultato è pari a "_".
  1400. ;*
  1401. ;* @example gosub safecall Std_RecycleItems !items smelt
  1402. ;* @depends CraftMenuFunctions.euo
  1403.  
  1404. sub Std_RecycleItems ; %list %method %container
  1405. set !list %1
  1406. set !method %2
  1407. if %0 < 3 || %3 = !null
  1408. set !searchString C
  1409. else
  1410. set !searchString C_ , %3
  1411. set !cloth BUI
  1412. set !cutUpCloth CUI
  1413. set !craftContSize 530_457 ;530_457
  1414. set !result _
  1415.  
  1416. gosub safecall AG_Tokenize !list _ Std_RecycleItems_Array_
  1417. set !count #result
  1418. if !count < 1
  1419. return !result
  1420.  
  1421. set !itemCount 0
  1422. set !items _
  1423. for !i 1 !count
  1424. {
  1425. set !item_or_type %Std_RecycleItems_Array_ . !i
  1426. finditem !item_or_type !searchString
  1427. if #findkind = -1
  1428. continue
  1429.  
  1430. for #findindex 1 #findcnt
  1431. {
  1432. set !item #findid
  1433.  
  1434. ; check di sicurezza
  1435. gosub safecall Std_ReadProperty !item
  1436. set !property #result
  1437. if blessed in !property || insured in !property
  1438. continue
  1439. if ( !method = cut ) && ( #findtype = !cloth || #findtype = !cutUpCloth )
  1440. continue
  1441.  
  1442. set !itemCount !itemCount + 1
  1443. set !item . !itemCount !item
  1444. set !items !items , !item , _
  1445. }
  1446. }
  1447. if !itemCount < 1
  1448. return !result
  1449. ; le liste vengono riempite correttamente (già testate)
  1450.  
  1451. if !method = cut
  1452. {
  1453. finditem KAG C_ , #backpackid
  1454. if #findkind = -1
  1455. {
  1456. finditem KTL C_ , #backpackid
  1457. if #findkind = -1
  1458. return !items
  1459. set !tinkersTools #findid
  1460.  
  1461. gosub safecall Std_CraftItem !tinkersTools iron 2 1
  1462. finditem KAG C_ , #backpackid
  1463. if #findkind = -1
  1464. return !items
  1465. }
  1466. set !scissors #findid
  1467.  
  1468. for !i 1 !itemCount
  1469. {
  1470. set !item !item . !i
  1471. gosub safecall Std_UseObject !scissors !item
  1472. wait 10
  1473. }
  1474. }
  1475. if !method = smelt
  1476. {
  1477. ; Lo smeltaggio non consuma cariche del tool! Basta un tool solo!
  1478. if #contsize = !craftContSize
  1479. gosub safecall Std_ClickGumpButton 25 435 !craftContSize ; exit
  1480. gosub libcall CraftMenuFunctions.euo BringUpCraftMenu smith #false
  1481. if #result = x
  1482. return !items
  1483.  
  1484. for !i 1 !itemCount
  1485. {
  1486. set !item !item . !i
  1487. gosub safecall Std_ClickGumpButton 25 355 !craftContSize ; smelt
  1488. gosub safecall Std_SelectTarget !item
  1489. }
  1490. set !closeCraftGump #true
  1491. }
  1492. if !method = combine ; cut-up cloth (@todo includere check per colori multipli?)
  1493. {
  1494. if #contsize = !craftContSize
  1495. gosub safecall Std_ClickGumpButton 25 435 !craftContSize ; exit
  1496. gosub libcall CraftMenuFunctions.euo BringUpCraftMenu tailor #false
  1497. if #result = x
  1498. return !items
  1499. gosub libcall CraftMenuFunctions.euo CraftAnything 1 2
  1500. set !closeCraftGump #true
  1501. }
  1502.  
  1503. if !closeCraftGump = #true
  1504. gosub safecall Std_ClickGumpButton 25 435 !craftContSize ; exit
  1505.  
  1506. ; verifica quali elementi NON sono stati riciclati
  1507. for !i 1 !itemCount
  1508. {
  1509. set !item !item . !i
  1510. finditem !item !searchString
  1511. if #findkind <> -1
  1512. set !result !result , !item , _
  1513. }
  1514. return !result
  1515.  
  1516. ;=======================================
  1517. ;* @name Std_CraftItem
  1518. ;* @author AG
  1519. ;* @purpose Crafta un oggetto a partire da un tool, un materiale, e due pulsanti da premere.
  1520. ;* Per ogni parametro è possibile specificare il valore "last" (che è il predefinito).
  1521. ;* In quel caso, le operazioni collegate a quel parametro verranno saltate.
  1522. ;* @params %1 opt ID del tool da usare.
  1523. ;* @todo: Si può specificare un tool in particolare, oppure solo il tipo di tool.
  1524. ;* @todo: E' anche possibile specificare soltanto il nome della skill correlata (smith, tailoring, etc)
  1525. ;* Se si specifica "last", si assume che il menu di crafting sia già attivo e si procede solo a premere i pulsanti.
  1526. ;* %2 opt Materiale da utilizzare. E' possibile specificare un valore di colore, oppure un nome di materiale a scelta tra:
  1527. ;* iron, dull, shadow, copper, bronze, gold, agapite, verite, valorite, leather, spined, horned, barbed.
  1528. ;* Se si specifica "last", si assume che il materiale corretto sia già selezionato.
  1529. ;* %3 opt Primo pulsante da premere per craftare l'oggetto. E' il pulsante che indica la "categoria" dell'oggetto
  1530. ;* (in pratica, uno dei pulsanti sulla sinistra).
  1531. ;* Se si specifica "last", lo script premerà semplicemente "Make Last".
  1532. ;* %4 opt Secondo pulsante da premere per craftare l'oggetto. E' il pulsante che indica l'oggetto all'interno della
  1533. ;* sua categoria (in pratica, uno dei pulsanti sulla destra).
  1534. ;* Se si specificano valori maggiori di 10, lo script premerà automaticamente "Next Page" tutte le volte necessarie.
  1535. ;* @returns #true se l'operazione va a buon fine (non indica necessariamente un craft riuscito).
  1536. ;* #false se si verificano malfunzionamenti.
  1537. ;*
  1538. ;* @example gosub safecall Std_CraftItem !smithTool !materialColor 2 3 ; apre il gump, seleziona il materiale e crafta l'oggetto
  1539. ;* gosub safecall Std_CraftItem !sewingKit last last last ; preme "Make Last" dopo aver aperto il gump
  1540. ;* gosub safecall Std_CraftItem last last last last ; preme semplicemente "Make Last" su un gump già aperto
  1541. ;*
  1542. ;* @depends CraftMenuFunctions.euo
  1543. ;* @status Incompleta. Ciò che è già implementato funziona correttamente.
  1544.  
  1545. sub Std_CraftItem ; %tool %material %button1 %button2 (valori predefiniti: last)
  1546. if %0 < 1 || %1 = !null || %1 = current
  1547. set !tool last
  1548. else
  1549. set !tool %1
  1550.  
  1551. if %0 < 2 || %2 = !null || %2 = current
  1552. set !material last
  1553. else
  1554. set !material %2
  1555.  
  1556. if %0 < 3 || %3 = !null || %3 = current
  1557. set !button1 last
  1558. else
  1559. set !button1 %3
  1560.  
  1561. if %0 < 4 || %4 = !null || %4 = current
  1562. set !button2 last
  1563. else
  1564. set !button2 %4
  1565.  
  1566. if %0 < 5 || %5 <> #true
  1567. set !checked #false
  1568. else
  1569. set !checked #true
  1570.  
  1571. if !tool <> last
  1572. {
  1573. finditem !tool C
  1574. if #findkind = -1
  1575. return #false
  1576. set !tool #findid
  1577.  
  1578. gosub safecall Std_OpenPaperdoll
  1579. wait 10
  1580. set !timeout #systime + 5000
  1581. gosub safecall Std_UseObject !tool
  1582. while #systime < !timeout && #contsize <> 530_457 ; 530_457 attendi il nuovo gump
  1583. {
  1584. }
  1585. }
  1586.  
  1587. if #contsize <> 530_457 ; 530_457
  1588. return #false
  1589.  
  1590. if !material <> last
  1591. {
  1592. gosub libcall CraftMenuFunctions.euo ChooseMaterial !material
  1593. }
  1594.  
  1595. set !jStart #jIndex + 1
  1596. if !button1 <> last && !button2 <> last
  1597. gosub libcall CraftMenuFunctions.euo CraftAnything !button1 !button2
  1598. else
  1599. gosub libcall CraftMenuFunctions.euo ClickMakeLast
  1600.  
  1601. ; attendi il ritorno del gump dopo il craft
  1602. set !timeout #systime + 5000
  1603. while #systime < !timeout && #contsize <> 530_457 ; 530_457
  1604. {
  1605. if !jStart <= #jindex
  1606. {
  1607. scanjournal !jStart
  1608. if you_have_worn_out_your_tool in #journal
  1609. break
  1610. set !jStart !jStart + 1
  1611. }
  1612. }
  1613. return #true
  1614.  
  1615. ;====================================================================
  1616. ;* @name Std_SearchForCraftedItems
  1617. ;* @author AG
  1618. ;* @purpose Routine di supporto per Std_FillSmallBod
  1619.  
  1620. sub Std_SearchForCraftedItems ; %type %color %exceptional %listName
  1621. set !type %1
  1622. if %0 < 2 || %2 = !null
  1623. set !color any
  1624. else
  1625. set !color %2
  1626. if %0 < 3 || %3 = !null
  1627. set !exceptional #false
  1628. else
  1629. set !exceptional %3
  1630. if %0 < 4 || %4 = !null
  1631. set !listName !null
  1632. else
  1633. set !listName %4
  1634.  
  1635. set !count 0
  1636. finditem !type C_ , #backpackid
  1637. if #findkind <> -1
  1638. {
  1639. for #findindex 1 #findcnt
  1640. {
  1641. gosub safecall Std_ReadProperty #findid
  1642. set !property #property
  1643. if Blessed in !property || Insured in !property || Arcane in !property
  1644. continue
  1645. if !exceptional && Exceptional notin !property
  1646. continue
  1647.  
  1648. if !color <> any
  1649. {
  1650. if !type in PPH_WPH_QPH_BQH_AQH_VPH_ZPH_YPH_CQH
  1651. {
  1652. if !color = 0 && ( Spined in !property || Horned in !property || Barbed in !property )
  1653. continue
  1654. if !color = 2220 && Spined notin !property
  1655. continue
  1656. if !color = 2117 && Horned notin !property
  1657. continue
  1658. if !color = 2129 && Barbed notin !property
  1659. continue
  1660. }
  1661. else
  1662. {
  1663. if !color <> #findcol
  1664. continue
  1665. }
  1666. }
  1667.  
  1668. set !count !count + 1
  1669. if !listName <> !null
  1670. {
  1671. set !temp !listName , !count
  1672. set % . !temp #findid
  1673. }
  1674. }
  1675. }
  1676. return !count
  1677.  
  1678. ;====================================================================
  1679. ;* @name Std_FillSmallBod
  1680. ;* @author AG, fixed by Smjert
  1681. ;* @purpose Tenta di riempire uno small bod, utilizzando SOLO le risorse all'interno del backpack.
  1682. ;* Se alcuni item sono già disponibili, evita di craftarne in eccesso.
  1683. ;* Se non si può proseguire, inserisce gli item craftati dentro il bod e ritorna un codice di errore.
  1684. ;*
  1685. ;* @params %1 req ID del bod per il quale craftare oggetti.
  1686. ;* %2 opt ID di un dying tub nelle vicinanze, o nel backpack, in caso di cloth colorati.
  1687. ;*
  1688. ;* @returns #true se TUTTI gli oggetti vengono craftati ed inseriti con successo.
  1689. ;* Un codice di errore tra i seguenti se il riempimento fallisce:
  1690. ;* - bod_is_large se il bod è large
  1691. ;* - not_enough_material se non ci sono abbastanza risorse
  1692. ;* - not_enough_bones se non ci sono abbastanza ossa
  1693. ;* - not_enough_tools se sono stati consumati tutti i tool per craftare
  1694. ;* - unexpected_error se avviene un errore non previsto
  1695. ;*
  1696. ;* @example gosub safecall Std_FillSmallBod !bod
  1697. ;* @depends Numerosissime dipendenze...
  1698. ;* @status Partially tested
  1699.  
  1700. sub Std_FillSmallBod
  1701. set !bod %1
  1702. set !tub %2
  1703. set !bones_id GUF
  1704. set !tailorTools HAG
  1705. set !smithTools TLH_FBG_GBG_OLH_OBG_TBG_
  1706.  
  1707. ;--------------------------------------
  1708. ; Fase 1: analisi e configurazione
  1709. ;--------------------------------------
  1710.  
  1711. gosub libcall BodFunctions.euo analyzeBod !bod Std_FillSmallBod_Bod_ obmqc
  1712. if #result <> #true
  1713. return unexpected_error
  1714.  
  1715. set !large %Std_FillSmallBod_Bod_Large
  1716. if !large
  1717. return bod_is_large
  1718.  
  1719. set !tailor %Std_FillSmallBod_Bod_Tailor
  1720. set !exceptional %Std_FillSmallBod_Bod_Exceptional
  1721. set !material_name %Std_FillSmallBod_Bod_MaterialName
  1722. set !material_id %Std_FillSmallBod_Bod_MaterialId
  1723. set !material_color %Std_FillSmallBod_Bod_MaterialColor
  1724. set !items_id %Std_FillSmallBod_Bod_ItemId
  1725. set !items_color !material_color
  1726. set !items_required %Std_FillSmallBod_Bod_Quantity - %Std_FillSmallBod_Bod_FillCount
  1727. set !craftButton1 %Std_FillSmallBod_Bod_CraftButton1
  1728. set !craftButton2 %Std_FillSmallBod_Bod_CraftButton2
  1729.  
  1730. if !tailor
  1731. {
  1732. if !material_name = cloth
  1733. {
  1734. set !material_required %Std_FillSmallBod_Bod_Cloth
  1735. set !material_id !material_id , _CUI ; aggiungi cut cloth
  1736. }
  1737. else
  1738. {
  1739. set !material_required %Std_FillSmallBod_Bod_Hides
  1740. }
  1741. set !bones_required %Std_FillSmallBod_Bod_Bones
  1742. set !tools_id !tailorTools
  1743. }
  1744. else
  1745. {
  1746. set !material_required %Std_FillSmallBod_Bod_Ingots
  1747. set !tools_id !smithTools
  1748. }
  1749.  
  1750. ;--------------------------------------
  1751. ; Fase 2: Creazione degli items
  1752. ;--------------------------------------
  1753.  
  1754. while #true
  1755. {
  1756. ; cerca items già pronti
  1757. gosub safecall Std_SearchForCraftedItems !items_id !material_color !exceptional
  1758. set !items_available #result
  1759. if !items_available >= !items_required
  1760. {
  1761. set !result #true
  1762. break
  1763. }
  1764.  
  1765. ; procedura di sicurezza contro colored cloths
  1766. if !material_name = cloth
  1767. {
  1768. finditem !material_id C_ , #backpackid
  1769. if #findkind <> -1
  1770. {
  1771. for #findindex 1 #findcnt
  1772. {
  1773. if #findcol <> 0
  1774. {
  1775. gosub safecall Yeld ; @note: teoricamente non si dovrebbe fare da dentro il livello Std
  1776. if !tub <> !null
  1777. gosub Std_UseObject !tub #findid
  1778. else
  1779. set !result cannot_dye_cloth
  1780. }
  1781. }
  1782. }
  1783. if !result = cannot_dye_cloth
  1784. break
  1785. }
  1786.  
  1787. ; cerca materiale
  1788. gosub safecall Std_GetObjectCount C_ , #backpackid !material_id !material_color
  1789. set !material_available #result
  1790. if !material_available < !material_required
  1791. {
  1792. set !result not_enough_material
  1793. break
  1794. }
  1795.  
  1796. ; cerca ossa
  1797. if !bones_required <> 0
  1798. {
  1799. gosub safecall Std_GetObjectCount C_ , #backpackid !bones_id
  1800. set !bones_available #result
  1801. if !bones_available < !bones_required
  1802. {
  1803. set !result not_enough_bones
  1804. break
  1805. }
  1806. }
  1807.  
  1808. ; cerca tool
  1809. set !currentTool !null
  1810. finditem !tools_id C_ , #backpackid
  1811. if #findkind <> -1
  1812. {
  1813. for #findindex 1 #findcnt
  1814. {
  1815. if #findcol <> 0 ; ignora kit runici
  1816. continue
  1817. set !currentTool #findid
  1818. break
  1819. }
  1820. }
  1821. if !currentTool = !null
  1822. {
  1823. set !result not_enough_tools
  1824. break
  1825. }
  1826.  
  1827. ; Crafting degli items
  1828. gosub safecall Yeld ; @note: teoricamente non si dovrebbe fare da dentro il livello Std
  1829. gosub safecall Std_CraftItem !currentTool !material_color !craftButton1 !craftButton2
  1830. set !loopCount ( !items_required - !items_available - 1 )
  1831. if !loopCount < 1
  1832. continue
  1833.  
  1834. for !i 1 !loopCount
  1835. {
  1836. gosub safecall Yeld ; @note: teoricamente non si dovrebbe fare da dentro il livello Std
  1837. gosub safecall Std_CraftItem last last last last
  1838. }
  1839. }
  1840.  
  1841. ; dismiss gump
  1842. set !timeout #systime + 2000
  1843. while #systime < !timeout && #contsize = 530_457 ; 530_457
  1844. {
  1845. gosub safecall Std_ClickGumpButton 25 435 530_457 ; 530_457
  1846. }
  1847.  
  1848. ;--------------------------------------
  1849. ; Fase 3: Inserimento items nel bod
  1850. ;--------------------------------------
  1851.  
  1852. gosub safecall Std_SearchForCraftedItems !items_id !items_color !exceptional Temp_Array_
  1853. set !items_available #result
  1854. if !items_available > !items_required
  1855. set !items_available !items_required
  1856. if !items_available > 0
  1857. {
  1858. gosub safecall Yeld ; @note: teoricamente non si dovrebbe fare da dentro il livello Std
  1859. gosub safecall Std_UseObject !bod
  1860. gosub safecall Std_WaitForBodGump
  1861. if #result = #false
  1862. return #false
  1863. gosub safecall Std_ClickBodGumpButton fill ; 135 205
  1864.  
  1865. ; insert all the items
  1866. gosub safecall Yeld ; @note: teoricamente non si dovrebbe fare da dentro il livello Std
  1867. for !i 1 !items_available
  1868. {
  1869. set %error #scnt + 2
  1870. while #targcurs <> 1 && %error > #scnt
  1871. {
  1872. }
  1873.  
  1874. if #targcurs <> 1
  1875. {
  1876. event ExMsg #charid 3 33 Target non fuori
  1877. gosub safecall Std_ClickBodGumpButton fill ; 135 205
  1878. }
  1879.  
  1880. set !item %Temp_Array_ . !i
  1881. gosub safecall Std_SelectTarget !item
  1882. }
  1883.  
  1884. ; dismiss gump
  1885. set !timeout #systime + 2000
  1886. gosub safecall Std_CheckForBodGump
  1887. while #systime < !timeout && #result = #true
  1888. {
  1889. gosub safecall Std_ClickBodGumpButton exit
  1890. gosub safecall Std_CheckForBodGump
  1891. }
  1892. if #targcurs = 1
  1893. set #targcurs 0
  1894. }
  1895. return !result
  1896.  
  1897. ;=======================================
  1898. ;* @name Bod Gump functions
  1899. ;* @author AG
  1900. ;* @purpose Varie sub per gestire i gump dei BOD.
  1901. ;* @todo Descrizioni individuali.
  1902.  
  1903. sub Std_CheckForBodGump
  1904. return 510_ in #contsize || 524_ in #contsize || 499_ in #contsize || 467_ in #contsize
  1905.  
  1906. sub Std_CheckForBodRequestGump
  1907. return 460_ in #contsize || 524_ in #contsize || 499_ in #contsize || 467_ in #contsize
  1908.  
  1909. sub Std_WaitForBodGump
  1910. set !timeout #systime + 5000
  1911. gosub safecall Std_CheckForBodGump
  1912. while #systime < !timeout && #result = #false
  1913. {
  1914. gosub safecall Std_CheckForBodGump
  1915. }
  1916. return #result
  1917.  
  1918. sub Std_ClickBodGumpButton ; %button
  1919. set !offsetY -20
  1920. if %0 >= 1 && %1 = fill
  1921. set !offsetY 0
  1922. if %0 >= 1 && %1 = exit
  1923. set !offsetY 20
  1924.  
  1925. gosub safecall Std_WaitForBodGump
  1926. if #result = #false
  1927. return #false
  1928.  
  1929. str right #contsize 3
  1930. set !height #strres
  1931. set !y !height - 70 + !offsetY
  1932. gosub safecall Std_ClickGumpButton 140 !y
  1933. return #result
  1934.  
  1935. ;=======================================
  1936. ;* @name Std_SetBodbookFilter
  1937. ;* @author AG
  1938. ;* @purpose Imposta il filtro di un bodbook.
  1939. ;* Questa implementazione richiama semplicemente la sub SetBodbookFilter di BodFunctions.euo.
  1940. ;* @params %1 opt Identificatore del bodbook.
  1941. ;* %2 opt Filtro per dimensione (all, small, large, last).
  1942. ;* %3 opt Filtro per qualità (all, normal, exceptional, last).
  1943. ;* %4 opt Filtro per materiale (all, clear, tailor, smithy, iron, dull, ..., cloth, leather, ..., last).
  1944. ;* %5 opt Filtro per quantità (all, 10, 15, 20).
  1945. ;* @returns #true se tutte le operazioni vanno a buon fine, #false altrimenti.
  1946. ;* @example gosub safecall Std_SetBodbookFilter %bodbook %size %quality %material %quantity
  1947. ;* @see SetBodBookFilter in BodFunctions.euo
  1948.  
  1949. sub Std_SetBodbookFilter ; %bodbook %size %quality %material %quantity
  1950. set !nullArg %0 + 1
  1951. for !i !nullArg 6
  1952. {
  1953. set % . !i !null
  1954. }
  1955. gosub libcall BodFunctions.euo SetBodbookFilter %1 %2 %3 %4 %5
  1956. return #result
  1957.  
  1958. ;=======================================
  1959. ;* @name Std_IdentifyObject
  1960. ;* @author AG
  1961. ;* @purpose Assegna un identificatore univoco ad un determinato oggetto.
  1962. ;* Si preoccupa di distinguere fra loro oggetti molto rilevanti ai fini dello script.
  1963. ;* @params %1 req Oggetto da analizzare.
  1964. ;* @returns Identificatore univoco dell'oggetto. Il risultato è imprevedibile se l'oggetto non è un premio o una risorsa.
  1965. ;* @example gosub safecall Std_IdentifyObject !object
  1966. ;* @status Partially tested
  1967.  
  1968. sub Std_IdentifyObject ; %object
  1969. set !object %1
  1970. set !clsDeed EWH_TVH ; t5, t10, t15, t20, s5, s10, s15, s20, b, msh, lsh, lft, dft, bbh, pbh
  1971. set !clsAncient OLH ; a10, a15, a30, a60
  1972. set !clsPickaxe QPF ; 2419, g
  1973. set !clsAnvil ZAG_KBG
  1974. set !clsGloves KKH_XKH_BMH ; m1, m3, m5
  1975.  
  1976. finditem !object C
  1977. if #findkind = -1
  1978. return #false
  1979. set !type #findtype
  1980. set !color #findcol
  1981.  
  1982. if !type in !clsDeed ; sop, bless deeds, furniture
  1983. {
  1984. gosub safecall Std_ReadProperty !object
  1985. set !property #result
  1986. if bear , #spc , rug , #spc , deed in !property
  1987. {
  1988. if brown in !property
  1989. return EWH:bbr
  1990. if polar in !property
  1991. return EWH:pbr
  1992. }
  1993. if flower , #spc , tapestry , #spc , deed in !property
  1994. {
  1995. if dark in !property
  1996. return EWH:dft
  1997. return EWH:lft
  1998. }
  1999. if stretched , #spc , hide , #spc , deed in !property
  2000. {
  2001. if large in !property
  2002. return EWH:lsh
  2003. return EWH:msh
  2004. }
  2005. if Clothing , #spc , Bless , #spc , Deed in !property
  2006. {
  2007. return EWH:b
  2008. }
  2009. if 105 in !property
  2010. set !skill 5
  2011. if 110 in !property
  2012. set !skill 10
  2013. if 115 in !property
  2014. set !skill 15
  2015. if 120 in !property
  2016. set !skill 20
  2017. if Scroll , #spc , of , #spc , Tailoring in !property
  2018. return !type , :t , !skill
  2019. if Scroll , #spc , of , #spc , Blacksmith in !property ; include sia "blacksmithy" che "blacksmithing"
  2020. return !type , :s , !skill
  2021. return #false
  2022. }
  2023. if !type in !clsGloves
  2024. {
  2025. gosub safecall Std_ReadProperty !object
  2026. set !property #result
  2027. if Blacksmith , #spc , Gloves , #spc , of , #spc , Mining notin !property
  2028. return #false
  2029. str right !property 2
  2030. str left #strres 1
  2031. set !bonus #strres
  2032. if !bonus <> 1 && !bonus <> 3 && !bonus <> 5
  2033. return #false
  2034. return !type , :m , !bonus
  2035. }
  2036. if !type in !clsAncient ; ancient hammers
  2037. {
  2038. gosub safecall Std_ReadProperty !object
  2039. set !property #result
  2040. if Ancient , #spc , Smithy , #spc , Hammer notin !property
  2041. return #false
  2042. str right !property 3
  2043. str left #strres 2
  2044. set !bonus #strres
  2045. if !bonus <> 10 && !bonus <> 15 && !bonus <> 30 && !bonus <> 60
  2046. return #false
  2047. return !type , :a , !bonus
  2048. }
  2049. if !type in !clsPickaxe ; gargoyle's pickaxe
  2050. {
  2051. gosub safecall Std_ReadProperty !object
  2052. set !property #result
  2053. if Gargoyle's in !property
  2054. return !type , :g
  2055. }
  2056. if !type in !clsAnvil ; Colored Anvils
  2057. {
  2058. set !type ZAG
  2059. }
  2060. return !type , : , !color
  2061.  
  2062. ;=======================================
  2063. ;* @name Std_GetContainerAffinity
  2064. ;* @author AG
  2065. ;* @purpose Calcola l'affinità di un contenitore rispetto ad un premio o ad una risorsa.
  2066. ;* @params %1 req Contenitore di cui calcolare l'affinità.
  2067. ;* %2 req Codice dell'oggetto rispetto al quale calcolare l'affinità (oppure id dell'oggetto stesso).
  2068. ;* @returns Un livello di affinità fra i seguenti:
  2069. ;* 0 - Nessuna affinità
  2070. ;* 5 - Oggetti dello stesso tipo
  2071. ;* 10 - Affinità completa
  2072. ;* Restituisce unknown_object in caso l'oggetto indicato in %2 non sia un premio valido.
  2073. ;* @example gosub safecall Model_GetContainerAffinity %container %code
  2074. ;* @status Under development
  2075. ;* @deprecated
  2076.  
  2077. sub Std_GetContainerAffinity ; %container %code
  2078. set !container %1
  2079. set !code %2
  2080.  
  2081. if : notin !code
  2082. {
  2083. gosub safecall Std_IdentifyObject !code
  2084. if #result = #false
  2085. return unknown_object
  2086. set !code #result
  2087. }
  2088. str pos !code :
  2089. set !len #strres
  2090. str del !code 1 !len
  2091. set !postfix #strres
  2092. set !len !len - 1
  2093. str left !code !len
  2094. set !prefix #strres
  2095.  
  2096. set !type !prefix
  2097. set !result 0
  2098. ignoreitem reset StdGetContainerAffinity
  2099. while #true
  2100. {
  2101. finditem !type C_ , !container StdGetContainerAffinity
  2102. if #findkind = -1
  2103. break
  2104. set !result 5
  2105.  
  2106. gosub safecall Std_IdentifyObject #findid
  2107. if #result = !code
  2108. {
  2109. set !result 10
  2110. break
  2111. }
  2112. ignoreitem #findid StdGetContainerAffinity
  2113. }
  2114. ignoreitem reset StdGetContainerAffinity
  2115. return !result
  2116.  
  2117. ;=======================================
  2118. ;* @name Std_GetMostAffineContainer
  2119. ;* @author AG, fixed by Smjert
  2120. ;* @purpose Valuta una lista di contenitori per determinare qual'è il più idoneo ad ospitare un determinato oggetto.
  2121. ;* L'idoneità, anche detta "affinità", viene calcolata in base a quanto l'oggetto dato è simile ad eventuali
  2122. ;* altri oggetti già contenuti in ciascun contenitore.
  2123. ;* In particolare, si valutano i seguenti parametri:
  2124. ;* - Affinità 0: Nulla
  2125. ;* - Affinità 1: Stesso tipo di oggetto
  2126. ;* - Affinità 2: Stesso tipo di oggetto + Stesso colore dell'oggetto
  2127. ;* - Affinità 3: Stesso tipo di oggetto + Stesso colore dell'oggetto + Stesso nome dell'oggetto
  2128. ;* A parità di affinità fra più contenitori, la sub restituisce il contenitore che, fra questi, è stato
  2129. ;* specificato per primo nella lista.
  2130. ;* @params %1 req Lista di contenitori fra i quali scegliere il più affine.
  2131. ;* %2 req Oggetto o tipo di oggetto rispetto al quale calcolare l'affinità.
  2132. ;* Se questo parametro è un oggetto, i parametri %3 e %4 vengono ignorati.
  2133. ;* Se questo parametro è un tipo, i parametri %3 e %4 sono obbligatori.
  2134. ;* %3 opt Colore dell'oggetto rispetto al quale calcolare l'affinità.
  2135. ;* %4 opt #property dell'oggetto rispetto al quale calcolare l'affinità.
  2136. ;* @returns Il contenitore più affine fra tutti quelli trovati.
  2137. ;* @example gosub safecall Std_GetMostAffineContainer !iron ABCDEFG_HIJKLMN_OPQRSTU
  2138. ;* @status Tested and working
  2139.  
  2140. sub Std_GetMostAffineContainer ; %containers %object_or_type %color %header
  2141. set !containers %1
  2142. set !object %2
  2143.  
  2144. str len !object
  2145. if #strres <= 3
  2146. {
  2147. set !type !object
  2148. set !color %3
  2149. set !property %4
  2150. }
  2151. else
  2152. {
  2153. finditem !object C
  2154. if #findkind = -1
  2155. {
  2156. finditem !object G
  2157. if #findkind = -1
  2158. return #false
  2159. }
  2160. set !type #findtype
  2161. set !color #findcol
  2162. gosub safecall Std_ReadProperty !object
  2163. set !property #result
  2164. }
  2165.  
  2166. str pos !property $
  2167. if #strres > 0
  2168. {
  2169. str left !property #strres
  2170. set !header #strres
  2171. }
  2172. else
  2173. {
  2174. set !header !null
  2175. }
  2176.  
  2177. gosub safecall AG_Tokenize !containers _ Std_PlaceObject_Array_
  2178. set !count #result
  2179. if ! ( !count > 0 )
  2180. return #false
  2181.  
  2182. set !bestContainer !null
  2183. set !bestAffinity -1
  2184. for !i 1 !count
  2185. {
  2186. set !container %Std_PlaceObject_Array_ . !i
  2187. set !affinity 0
  2188.  
  2189. gosub safecall Std_ReadProperty !container
  2190. set !property #result
  2191. str pos !property contents:
  2192. set !index #strres + 9
  2193. str del !property 1 !index
  2194. set !property #strres
  2195. str pos !property /
  2196. set !index #strres - 1
  2197. str left !property !index
  2198. set !itemCount #strres
  2199.  
  2200. if !itemCount = 125 ; la bag è piena, skippiamo
  2201. continue
  2202.  
  2203. finditem !type C_ , !container
  2204. if #findkind <> -1
  2205. {
  2206. set !affinity 1 ; stesso tipo
  2207. for #findindex 1 #findcnt
  2208. {
  2209. if #findcol = !color
  2210. {
  2211. set !affinity 2 ; stesso colore
  2212. if !header = !null
  2213. {
  2214. set !affinity 3 ; ignora il confronto sull'header
  2215. break
  2216. }
  2217.  
  2218. gosub safecall Std_ReadProperty #findid
  2219. str pos #result $
  2220. str left #result #strres
  2221. if #strres = !header
  2222. {
  2223. set !affinity 3 ; stessa intestazione
  2224. break
  2225. }
  2226. }
  2227. }
  2228. }
  2229. if !affinity > !bestAffinity
  2230. {
  2231. set !bestAffinity !affinity
  2232. set !bestContainer !container
  2233. }
  2234. if !bestAffinity >= 3
  2235. break
  2236. }
  2237. return !bestContainer
  2238.  
  2239. ;=======================================
  2240. ;* @name Std_GetObjectWeight
  2241. ;* @author AG
  2242. ;* @purpose Restituisce il peso di UN SINGOLO elemento di un certo tipo.
  2243. ;* E' necessario che il tipo di oggetto in questione sia visibile dal giocatore.
  2244. ;* @params %1 req Tipo di oggetto del quale calcolare il peso.
  2245. ;* E' anche possibile specificare un oggetto, anziché un tipo. Ricordarsi, in questo caso, che la funzione
  2246. ;* calcola il peso di UN SINGOLO elemento, anche se l'oggetto è di tipo stackable.
  2247. ;* @returns Il peso di UN SINGOLO elemento del tipo specificato, in MILLESIMI di Stones (un #result di 1000 indica 1 Stone).
  2248. ;* La stima è esatta se:
  2249. ;* - L'oggetto pesa più di 1 stone.
  2250. ;* - L'oggetto pesa meno di 1 stone (quindi è stackable) ma è stackato in quantità sufficientemente elevata.
  2251. ;* Negli altri casi, la stima soffre di una leggera approssimazione per eccesso.
  2252. ;* @example gosub safecall Std_GetObjectWeight !goldType
  2253. ;* @status Tested and working
  2254.  
  2255. sub Std_GetObjectWeight ; %id
  2256. set !type %1
  2257. finditem !type C
  2258. if #findkind = -1
  2259. {
  2260. finditem !type G
  2261. if #findkind = -1
  2262. return 0
  2263. }
  2264. set !object #findid
  2265. set !count #findstack
  2266.  
  2267. gosub safecall Std_ReadProperty !object
  2268. set !property #result
  2269. str pos !property weight:
  2270. set !index #strres + 7
  2271. str del !property 1 !index
  2272. set !property #strres
  2273. str pos !property #spc
  2274. set !index #strres - 1
  2275. str left !property !index
  2276. set !fullWeight #strres
  2277. if ! ( !fullWeight > 0 )
  2278. return 0
  2279. return !fullWeight * 1000 / !count
  2280.  
  2281. ;==============================================================================================================================
  2282. ;* @name Std_RunMenu
  2283. ;* @author AG
  2284. ;* @purpose Esegue un menu in maniera "guidata dagli eventi".
  2285. ;* Questa sub implementa un semplice framework per l'esecuzione di menu secondo una filosofia event-driven.
  2286. ;* Occorre specificare un prefisso comune per tutte le variabili e le sub collegate al menu in esecuzione.
  2287. ;*
  2288. ;* Ogni volta che si agirà su un determinato componente (premendolo se si tratta di un pulsante, oppure alterandone
  2289. ;* il valore se si tratta di un altro componente), Std_RunMenu provvederà a:
  2290. ;* - Aggiornare la variabile %[prefisso]_[nomeComponente] con il valore corrente del componente
  2291. ;* (se si tratta di un pulsante, verrà aggiornata la variabile %[prefisso]_MenuButton)
  2292. ;* - Notificare l'evento alla sub [prefisso]_[nomeComponente], se esiste.
  2293. ;*
  2294. ;* Se invece si vuole modificare il valore di un componente direttamente da script, si può procedere in due modi:
  2295. ;* - Procedere in maniera "classica", cioè usare il comando "menu set".
  2296. ;* Questo ha lo stesso effetto di quando un utente altera il valore del componente, e quindi fa scattare le notifiche.
  2297. ;* - Settare il valore della variabile %[prefisso]_[nomeComponente].
  2298. ;* In questo caso, sarà Std_RunMenu ad aggiornare "silenziosamente" il componente, evitando di far scattare notifiche.
  2299. ;*
  2300. ;* Inoltre, Std_RunMenu richiama anche le seguenti sub:
  2301. ;* - [prefisso]_Init: Prima esecuzione del menu. Utile per creare il menu stesso.
  2302. ;* - [prefisso]_Idle: Il menu non presenta eventi da eseguire. Utile per aggiornare menu dinamici.
  2303. ;* - [prefisso]_Over: Il ciclo del menu è terminato.
  2304. ;*
  2305. ;* Il ciclo del menu continua fintanto che la variabile [prefisso]_Result = !null.
  2306. ;* Un modo veloce per impostare tale variabile è richiamare la sub Std_CloseMenu [menu_name] [menu_result].
  2307. ;*
  2308. ;* @params %1 req Nome del menu. Esso costituirà il prefisso comune a tutte le variabili e sub collegate a questo menu.
  2309. ;* %2 opt Lista di componenti "passivi" (non pulsanti) di cui notificare i cambiamenti.
  2310. ;* Necessario anche per quei componenti che si desidera aggiornare tramite modifica della relativa variabile.
  2311. ;* Il separatore per questa lista è il carattere | (pipe).
  2312. ;* NOTA: Questa lista può essere fornita anche come valore di ritorno della sub [prefisso]_Init.
  2313. ;* %3 opt Modalità di esecuzione del ciclo (@todo). Può essere:
  2314. ;* - cycle (predefinito): La sub esegue l'intero ciclo del menu, e ritorna solo quando il menu viene dismesso.
  2315. ;* - step: Viene eseguito un singolo passo del ciclo di menu. Utile per simulare il multithreading.
  2316. ;* @returns Il valore della variabile [prefisso]_Result.
  2317. ;* @example gosub safecall Std_RunMenu MioMenu |CheckBox1|ListBox1|EditBox3|
  2318. ;* @depends AG_Tokenize, safecall
  2319.  
  2320. sub Std_RunMenu
  2321. if %0 >= 3 && %3 = step
  2322. {
  2323. namespace push
  2324. namespace local Std_RunMenu_Persistent_ , %1
  2325. gosub Std_RunMenu_Core %1 %2 #true
  2326. namespace pop
  2327. }
  2328. else
  2329. {
  2330. if %0 >= 2
  2331. gosub Std_RunMenu_Core %1 %2
  2332. else
  2333. gosub Std_RunMenu_Core %1
  2334. }
  2335. return #result
  2336.  
  2337. sub Std_RunMenu_Core ; %menuName %observableComponents %singleStep
  2338. set !menuName %1
  2339. set !singleStep %0 >= 3 && %3 = #true
  2340.  
  2341. ; initialization
  2342. if !initSub = !null
  2343. {
  2344. if %0 >= 2 && %2 <> !null
  2345. set !observableComponents %2
  2346. else
  2347. set !observableComponents |
  2348.  
  2349. set !initSub !menuName , _Init
  2350. set !idleSub !menuName , _Idle
  2351. set !clearSub !menuName , _Over
  2352. set !quitVar !menuName , _Result
  2353. set !buttonVar !menuName , _MenuButton
  2354.  
  2355. gosub safecall !initSub
  2356. if #result <> !null
  2357. set !observableComponents !observableComponents , | , #result
  2358.  
  2359. gosub safecall AG_Tokenize !observableComponents | Std_RunMenu_Components_
  2360. set !Components_Count #result
  2361. if !Components_Count > 0
  2362. {
  2363. set !insertedComponents |
  2364. set !j 0
  2365. for !i 1 !Components_Count
  2366. {
  2367. set !component %Std_RunMenu_Components_ . !i
  2368. if | , !component , | in !insertedComponents
  2369. continue
  2370. set !j !j + 1
  2371. set !Components_ . !j !component
  2372. set !insertedComponents !insertedComponents , !component , |
  2373. }
  2374. set !Components_Count !j
  2375. }
  2376.  
  2377. set % . !quitVar !null
  2378. set % . !buttonVar !null
  2379. set #menubutton !null
  2380. }
  2381.  
  2382. ; loop
  2383. while #true
  2384. {
  2385. set !button #menubutton
  2386. if !button <> !null
  2387. {
  2388. set % . !buttonVar !button
  2389. set #menubutton !null
  2390. gosub safecall !menuName , _ , !button
  2391. }
  2392.  
  2393. if % . !quitVar <> !null
  2394. {
  2395. set !result % . !quitVar
  2396. break
  2397. }
  2398.  
  2399. if ! ( !Components_Count < 1 )
  2400. {
  2401. for !i 1 !Components_Count
  2402. {
  2403. set !component !Components_ . !i
  2404. set !varname !menuName , _ , !component
  2405.  
  2406. if ( % . !varname ) <> ( ! . !varname ) ; global <> local
  2407. {
  2408. set !value % . !varname
  2409. set ! . !varname !value ; set local global
  2410. menu set !component !value ; update menu
  2411. menu list select !component !value
  2412. menu combo select !component !value
  2413. }
  2414.  
  2415. menu get !component ; pesante!!! @todo: esiste altro metodo?
  2416. if #menures <> ( ! . !varname ) ; menu <> local
  2417. {
  2418. set ! . !varname #menures ; set local menu
  2419. set % . !varname #menures ; set global menu
  2420. gosub safecall !varName ; notify
  2421. }
  2422. }
  2423. }
  2424.  
  2425. gosub safecall !idleSub
  2426.  
  2427. if !singleStep = #true
  2428. return ; @todo return what value?
  2429. }
  2430.  
  2431. ; destruction
  2432. gosub safecall !clearSub
  2433. set #result !result
  2434. namespace clear
  2435. return #result
  2436.  
  2437. ;=======================================
  2438. ;* @name Std_CloseMenu
  2439. ;* @author AG
  2440. ;* @purpose Funzione helper per chiudere correttamente un menu avviato con Std_RunMenu.
  2441. ;* @params %1 req Nome del menu. Esso costituisce il prefisso comune a tutte le variabili e sub collegate a questo menu.
  2442. ;* %2 opt Valore di ritorno. Valore da restituire alla fine della sub Std_RunMenu.
  2443. ;* @example gosub safecall Std_CloseMenu MioMenu #false
  2444. ;* @status Tested and working
  2445.  
  2446. sub Std_CloseMenu ; %menuName %menuReturnVal
  2447. set !menuName %1
  2448. if %0 < 2 || %2 = !null
  2449. set !result 0
  2450. else
  2451. set !result %2
  2452.  
  2453. set !quitVar !menuName , _Result
  2454. set % . !quitVar !result
  2455. return
  2456.  
  2457. ;=======================================
  2458. ;* @name Std_FillLargeBods
  2459. ;* @author AG
  2460. ;* @purpose Tenta di riempire un gruppo di bod large, utilizzando tutti i bod che si trovano in un bodbook.
  2461. ;* @params %1 req Lista di large bods da riempire. Devono trovarsi già nel backpack.
  2462. ;* %2 req Bodbook da cui estrarre i bod small. Si suppone che eventuali filtri siano già impostati correttamente.
  2463. ;* @returns Numero di bod inseriti con successo.
  2464. ;* Implicitamente, questo significa che la sub restituisce #false (cioè 0) se non inserisce nessun bod.
  2465. ;* @example gosub safecall Std_FillLargeBods !largebod !bodbook
  2466. ;* gosub safecall Std_FillLargeBods ABCDEFG_HIJKLMN !bodbook
  2467. ;* @status Under development (incompleto poiché deprecato)
  2468. ;* @depends AG_Tokenize, altre
  2469. ;* @deprecated
  2470.  
  2471. sub Std_FillLargeBods ; %bodlist %bodbook
  2472. set !bodlist %1
  2473. set !bodbook %2
  2474. set !clsBod EYM
  2475.  
  2476. gosub safecall AG_Tokenize Std_FillLargeBods_ _ !bodlist
  2477. if #result = 0
  2478. return #false
  2479.  
  2480. ignoreitem reset
  2481. for !i 1 %Std_FillLargeBods_Count
  2482. {
  2483. set !bod %Std_FillLargeBods_ . !i
  2484. ignoreitem !bod
  2485. }
  2486.  
  2487. while #true
  2488. {
  2489. gosub safecall Std_ExtractBod !bodbook
  2490. if #result = #false
  2491. break
  2492. finditem !clsBod C_ , #backpackid
  2493. if #findkind = -1 ; should never happen
  2494. break
  2495. set !bod #findid
  2496.  
  2497. for !i 1 %Std_FillLargeBods_Count
  2498. {
  2499. set !largebod %Std_FillLargeBods_ . !i
  2500. if _ignore in !largebod
  2501. continue
  2502.  
  2503. gosub safecall Std_UseObject !largebod
  2504. gosub safecall Std_WaitForBodGump
  2505. if #result = #false
  2506. continue
  2507.  
  2508. gosub safecall Std_ClickBodGumpButton fill
  2509. gosub safecall Std_SelectTarget !bod
  2510.  
  2511. if #result = #false ; mirino non visualizzato: probabilmente il large bod è pieno - @todo Ottimizzare
  2512. {
  2513. set !largebod !largebod , _ignore
  2514. set %Std_FillLargeBods_ . !i !largebod
  2515. continue
  2516. }
  2517.  
  2518. finditem !bod C_ , #backpackid
  2519. if #findkind = -1 ; bod inserito. passa al successivo.
  2520. break
  2521. }
  2522.  
  2523. finditem !bod C_ , #backpackid
  2524. if #findkind <> -1 ; bod non inserito. inserisci in lista ignore, e poi in bodbook.
  2525. {
  2526. ; @todo ?
  2527. }
  2528. }
  2529.  
  2530. gosub safecall Std_CheckForBodGump
  2531. while #result = #true
  2532. {
  2533. gosub safecall Std_ClickBodGumpButton exit
  2534. }
  2535.  
  2536. finditem !clsBod C_ , #backpackid
  2537. set !newcount #findcnt
  2538. return !oldcount - !newcount
  2539.  
  2540.  
  2541.  
  2542.  
  2543. ;==========================================================
  2544. ;=
  2545. ;=
  2546. ;= FUNZIONI LOGICHE (prefisso "Model")
  2547. ;=
  2548. ;=
  2549. ;==========================================================
  2550.  
  2551. ;==========================================================
  2552. ;= SEZIONE 1: Funzioni di configurazione
  2553. ;==========================================================
  2554.  
  2555. ;=======================================
  2556. ;* @name Model_Init
  2557. ;* @author AG
  2558. ;* @purpose Inizializza tutte le variabili dello script.
  2559. ;* Si occupa di richiamare Model_InitConstants, nonché la funzione di tipo "Model_LoadConfig" più appropriata.
  2560. ;* @example gosub safecall Model_Init
  2561.  
  2562. sub Model_Init
  2563. gosub safecall Model_InitConstants
  2564. gosub safecall Model_LoadConfig
  2565. gosub safecall Model_AutoConfig
  2566. return
  2567.  
  2568. ;=======================================
  2569. ;* @name Model_InitConstants
  2570. ;* @author AG, fixed by Smjert
  2571. ;* @purpose Inizializza tutte le costanti dello script.
  2572. ;* Tutte le costanti hanno prefisso "Constants_", per evitare conflitti di nomi con altre variabili globali.
  2573. ;* @example gosub safecall Model_InitConstants
  2574.  
  2575. sub Model_InitConstants
  2576. ; Colors
  2577. ;set %Constants_Color_Normal 0
  2578. ;set %Constants_Color_Regular 0
  2579. ;set %Constants_Color_Leather 0
  2580. ;set %Constants_Color_Spined 2220
  2581. ;set %Constants_Color_Horned 2117
  2582. ;set %Constants_Color_Barbed 2129
  2583. ;set %Constants_Color_Iron 0
  2584. ;set %Constants_Color_Dull 2419
  2585. ;set %Constants_Color_Shadow 2406
  2586. ;set %Constants_Color_Copper 2413
  2587. ;set %Constants_Color_Bronze 2418
  2588. ;set %Constants_Color_Gold 2213
  2589. ;set %Constants_Color_Agapite 2425
  2590. ;set %Constants_Color_Verite 2207
  2591. ;set %Constants_Color_Valorite 2219
  2592. ;set %Constants_Color_Green 1155
  2593. ;set %Constants_Color_GreenBlue 1164
  2594. ;set %Constants_Color_DarkTurquoise 1160
  2595. ;set %Constants_Color_AquaGreen 1162
  2596. ;set %Constants_Color_Torquoise 1173
  2597. ;set %Constants_Color_Purple 1163
  2598. ;set %Constants_Color_DarkPurple 1158
  2599. ;set %Constants_Color_BloodRed 1157
  2600. ;set %Constants_Color_NeonBlue 1165
  2601. ;set %Constants_Color_NeonPurple 1168
  2602. ;set %Constants_Color_NeonPink 1166
  2603. ;set %Constants_Color_NeonYellow 1169
  2604. ;set %Constants_Color_NeonGreen 1167 ; anche sandals
  2605. ;set %Constants_Color_RedBlue 1172 ; anche sandals
  2606. ;set %Constants_Color_DarkBlue 1156 ; anche sandals
  2607. ;set %Constants_Color_Charcoal 1175 ; anche sandals
  2608. ;set %Constants_Color_Fire 1161 ; anche sandals
  2609. ;set %Constants_Color_IceGreen 1151 ; anche sandals
  2610. ;set %Constants_Color_IceBlue 1154 ; anche sandals
  2611. ;set %Constants_Color_IceWhite 1150 ; anche sandals
  2612. ;set %Constants_Color_SopWhite 1153
  2613.  
  2614. ; tipi di oggetto
  2615. set %Constants_TinkersTools KTL
  2616. set %Constants_SewingKit HAG ; normal/runic
  2617. set %Constants_Tongs OBG
  2618. set %Constants_Hammer TLH ; normal/runic
  2619. set %Constants_Scissors KAG
  2620. set %Constants_SmithTools TLH_FBG_GBG_OLH_OBG_TBG
  2621. set %Constants_Ingots ENK
  2622. set %Constants_Cloth BUI ; normal/colored
  2623. set %Constants_CutUpCloth CUI
  2624. set %Constants_Leather JJG
  2625. set %Constants_Bones GUF
  2626. set %Constants_Sandals NVI ; normal/colored
  2627. set %Constants_Deed EWH ; SOP, Bless Deed, other
  2628. set %Constants_AncientHammer OLH
  2629. set %Constants_POF KEG
  2630. set %Constants_Pickaxe QPF ; normal/sturdy/gargoyle
  2631. set %Constants_Shovel TWF ; normal/sturdy
  2632. set %Constants_ProspectorsTools GBG
  2633. set %Constants_Gloves KKH_XKH_BMH
  2634. set %Constants_Vendor IS_HS
  2635. set %Constants_Bod EYM
  2636. set %Constants_Bodbook DYM
  2637. set %Constants_TrashBarrel BKF
  2638. set %Constants_Runebook ZBN
  2639. set %Constants_Forges JBG_SOJ_ROJ_AUJ_ZTJ_CUJ_BUJ_WTJ_VTJ_KUJ_JUJ_EUJ_DUJ_
  2640. +GUJ_FUJ_QUJ_PUJ_OUJ_NUJ_YUJ_XUJ_AVJ_ZUJ_UUJ_TUJ_IVJ_
  2641. +HVJ_CVJ_BVJ_EVJ_DVJ_OVJ_NVJ_KHR
  2642. set %Constants_Anvils ZAG_KBG_AHR
  2643. set %Constants_DyingTub DBG
  2644. set %Constants_BoneItems CQH_VPH_PPH_ZPH_BQH
  2645.  
  2646. set %Constants_Resources_Types _ENK_JJG_BUI_GUF_
  2647. set %Constants_Resources_Tailor _JJG:0_JJG:2220_JJG:2117_JJG:2129_BUI:0_GUF:0_
  2648. set %Constants_Resources_Smith _ENK:0_ENK:2419_ENK:2406_ENK:2413_ENK:2418_ENK:2213_ENK:2425_ENK:2207_ENK:2219_
  2649. set %Constants_Resources_All %Constants_Resources_Smith , %Constants_Resources_Tailor
  2650. set %Constants_Resources_Light _BUI_ENK_
  2651. set %Constants_Resources_Heavy _JJG_GUF_
  2652.  
  2653. ; Categorie di Rewards (per interfaccia grafica)
  2654. set %Constants_Rewards_Types BUI_NVI_EWH_HAG_ZAG_KBG_TLH_OLH_TWF_QPF_GBG_BMH_KKH_XKH_TVH_KEG
  2655. set %Constants_Rewards_Cloth _BUI:1155_BUI:1164_BUI:1160_BUI:1162_BUI:1173_BUI:1163_BUI:1158_BUI:1157_BUI:1165_BUI:1168_
  2656. +BUI:1166_BUI:1169_BUI:1167_BUI:1172_BUI:1156_BUI:1175_BUI:1161_BUI:1151_BUI:1154_BUI:1150_
  2657. set %Constants_Rewards_Sandals _NVI:1167_NVI:1172_NVI:1156_NVI:1175_NVI:1161_NVI:1151_NVI:1154_NVI:1150_
  2658. set %Constants_Rewards_Tailor _EWH:msh_EWH:lsh_EWH:lft_EWH:dft_EWH:bbr_EWH:pbr_EWH:t5_EWH:t10_EWH:t15_EWH:t20_EWH:b_HAG:2220_HAG:2117_HAG:2129_
  2659. set %Constants_Rewards_Anvils _ZAG:2419_ZAG:2406_ZAG:2413_ZAG:2418_ZAG:2213_ZAG:2425_ZAG:2207_ZAG:2219_
  2660. set %Constants_Rewards_Hammers _TLH:2419_TLH:2406_TLH:2413_TLH:2418_TLH:2213_TLH:2425_TLH:2207_TLH:2219_OLH:a10_OLH:a15_OLH:a30_OLH:a60_
  2661. set %Constants_Rewards_Smith _TWF:2419_QPF:2419_GBG:2419_QPF:g_KEG:2419_KKH:m1_XKH:m3_BMH:m5_EWH:s5_EWH:s10_EWH:s15_EWH:s20_
  2662. set %Constants_Rewards_All %Constants_Rewards_Cloth , %Constants_Rewards_Sandals , %Constants_Rewards_Tailor ,
  2663. + %Constants_Rewards_Anvils , %Constants_Rewards_Hammers , %Constants_Rewards_Smith
  2664.  
  2665. set %Constants_LargeRewards_Tailor _MediumStretchedHide_LargeStretchedHide_LightTapestry_DarkTapestry_BrownBearRug_PolarBearRug_
  2666. +Tailoring5_Tailoring10_Tailoring15_Tailoring20_BlessDeed_SpinedKit_HornedKit_BarbedKit_
  2667. set %Constants_LargeRewards_Smith _MiningGloves1_MiningGloves3_MiningGloves5_ProspectorsTools_GargoylesPickaxe_POF_ColoredAnvil_
  2668. +Blacksmithy5_Blacksmithy10_Blacksmithy15_Blacksmithy20_
  2669. +DullHammer_ShadowHammer_CopperHammer_BronzeHammer_GoldHammer_AgapiteHammer_VeriteHammer_ValoriteHammer_
  2670. +AncientHammer10_AncientHammer15_AncientHammer30_AncientHammer60_
  2671.  
  2672. set %Constants_Tools |FillSmallBod|FillLargeBod|DeliverBod|PlaceObject|BankRestock|AnalyzeObject|MoveObject|
  2673.  
  2674. ; tutte le variabili indicate in questa lista verranno rese persistenti. utilizzare un segno di "|" come separatore
  2675. set %Constants_PersistentVars |
  2676. +Config_Runebooks_Tailor|Config_Runebooks_Smith|Config_Runebooks_Home|Config_Runebooks_Bank|
  2677. +Config_Chests_Work|Config_Chests_Bank|Config_Chests_Rewards|
  2678. +Config_BodFilter_Rewards|Config_BodFilter_TrashBoneBods|Config_RewardFilter_Rewards|
  2679. +Config_Home_PosX|Config_Home_PosY|Config_Home_PosZ|
  2680. +Config_Home_DyingTub|Config_Home_Forge|Config_Home_Anvil|Config_Home_Trash|
  2681. return
  2682.  
  2683. sub Model_GetHumanName ; %varname
  2684. set !name %1
  2685. while : in !name ; elimina i ":" dai nomi di variabile
  2686. {
  2687. str pos !name :
  2688. str del !name #strres 1
  2689. set !name #strres
  2690. }
  2691.  
  2692. goto Boscags7_HumanNamesDb_ , !name
  2693. return !null
  2694.  
  2695. ; Premi tailoring (large reward id)
  2696. Boscags7_HumanNamesDb_MediumStretchedHide:
  2697. return Medium , #spc , Stretched , #spc , Hide
  2698. Boscags7_HumanNamesDb_LargeStretchedHide:
  2699. return Large , #spc , Stretched , #spc , Hide
  2700. Boscags7_HumanNamesDb_LightTapestry:
  2701. return Light , #spc , Wall , #spc , Tapestry
  2702. Boscags7_HumanNamesDb_DarkTapestry:
  2703. return Dark , #spc , Wall , #spc , Tapestry
  2704. Boscags7_HumanNamesDb_BrownBearRug:
  2705. return Brown , #spc , Bear , #spc , Rug
  2706. Boscags7_HumanNamesDb_PolarBearRug:
  2707. return Polar , #spc , Bear , #spc , Rug
  2708. Boscags7_HumanNamesDb_Tailoring5:
  2709. return SOP , #spc , +5 , #spc , Tailoring
  2710. Boscags7_HumanNamesDb_Tailoring10:
  2711. return SOP , #spc , +10 , #spc , Tailoring
  2712. Boscags7_HumanNamesDb_Tailoring15:
  2713. return SOP , #spc , +15 , #spc , Tailoring
  2714. Boscags7_HumanNamesDb_Tailoring20:
  2715. return SOP , #spc , +20 , #spc , Tailoring
  2716. Boscags7_HumanNamesDb_BlessDeed:
  2717. return Bless , #spc , Deed
  2718. Boscags7_HumanNamesDb_SpinedKit:
  2719. return Spined , #spc , Kit
  2720. Boscags7_HumanNamesDb_HornedKit:
  2721. return Horned , #spc , Kit
  2722. Boscags7_HumanNamesDb_BarbedKit:
  2723. return Barbed , #spc , Kit
  2724.  
  2725. ; Premi blacksmith (large reward id)
  2726. Boscags7_HumanNamesDb_MiningGloves1:
  2727. return Gloves , #spc , of , #spc , Mining , #spc , +1
  2728. Boscags7_HumanNamesDb_MiningGloves3:
  2729. return Gloves , #spc , of , #spc , Mining , #spc , +3
  2730. Boscags7_HumanNamesDb_MiningGloves5:
  2731. return Gloves , #spc , of , #spc , Mining , #spc , +5
  2732. Boscags7_HumanNamesDb_ProspectorsTools:
  2733. return Prospector's , #spc , Tools
  2734. Boscags7_HumanNamesDb_GargoylesPickaxe:
  2735. return Gargoyle's , #spc , Pickaxe
  2736. Boscags7_HumanNamesDb_POF:
  2737. return Powder , #spc , of , #spc , Fortifying
  2738. Boscags7_HumanNamesDb_ColoredAnvil:
  2739. return Colored , #spc , Anvil
  2740. Boscags7_HumanNamesDb_Blacksmithy5:
  2741. return SOP , #spc , +5 , #spc , Blacksmithy
  2742. Boscags7_HumanNamesDb_Blacksmithy10:
  2743. return SOP , #spc , +10 , #spc , Blacksmithy
  2744. Boscags7_HumanNamesDb_Blacksmithy15:
  2745. return SOP , #spc , +15 , #spc , Blacksmithy
  2746. Boscags7_HumanNamesDb_Blacksmithy20:
  2747. return SOP , #spc , +20 , #spc , Blacksmithy
  2748. Boscags7_HumanNamesDb_DullHammer:
  2749. return Dull , #spc , Copper , #spc , Hammer
  2750. Boscags7_HumanNamesDb_ShadowHammer:
  2751. return Shadow , #spc , Hammer
  2752. Boscags7_HumanNamesDb_CopperHammer:
  2753. return Copper , #spc , Hammer
  2754. Boscags7_HumanNamesDb_BronzeHammer:
  2755. return Bronze , #spc , Hammer
  2756. Boscags7_HumanNamesDb_GoldHammer:
  2757. return Gold , #spc , Hammer
  2758. Boscags7_HumanNamesDb_AgapiteHammer:
  2759. return Agapite , #spc , Hammer
  2760. Boscags7_HumanNamesDb_VeriteHammer:
  2761. return Verite , #spc , Hammer
  2762. Boscags7_HumanNamesDb_ValoriteHammer:
  2763. return Valorite , #spc , Hammer
  2764. Boscags7_HumanNamesDb_AncientHammer10:
  2765. return Ancient , #spc , Hammer , #spc , +10
  2766. Boscags7_HumanNamesDb_AncientHammer15:
  2767. return Ancient , #spc , Hammer , #spc , +15
  2768. Boscags7_HumanNamesDb_AncientHammer30:
  2769. return Ancient , #spc , Hammer , #spc , +30
  2770. Boscags7_HumanNamesDb_AncientHammer60:
  2771. return Ancient , #spc , Hammer , #spc , +60
  2772.  
  2773. ; Stoffe
  2774. Boscags7_HumanNamesDb_BUI1155:
  2775. return 1: , #spc , Green , #spc , Cloth
  2776. Boscags7_HumanNamesDb_BUI1164:
  2777. return 1: , #spc , Green/Blue , #spc , Cloth
  2778. Boscags7_HumanNamesDb_BUI1160:
  2779. return 1: , #spc , Dark , #spc , Turquoise , #spc , Cloth
  2780. Boscags7_HumanNamesDb_BUI1162:
  2781. return 1: , #spc , Aqua , #spc , Green , #spc , Cloth
  2782. Boscags7_HumanNamesDb_BUI1173:
  2783. return 2: , #spc , Torquoise , #spc , Cloth
  2784. Boscags7_HumanNamesDb_BUI1163:
  2785. return 2: , #spc , Purple , #spc , Cloth
  2786. Boscags7_HumanNamesDb_BUI1158:
  2787. return 2: , #spc , Dark , #spc , Purple , #spc , Cloth
  2788. Boscags7_HumanNamesDb_BUI1157:
  2789. return 2: , #spc , Blood , #spc , Red , #spc , Cloth
  2790. Boscags7_HumanNamesDb_BUI1165:
  2791. return 3: , #spc , Neon , #spc , Blue , #spc , Cloth
  2792. Boscags7_HumanNamesDb_BUI1168:
  2793. return 3: , #spc , Neon , #spc , Purple , #spc , Cloth
  2794. Boscags7_HumanNamesDb_BUI1166:
  2795. return 3: , #spc , Neon , #spc , Pink , #spc , Cloth
  2796. Boscags7_HumanNamesDb_BUI1169:
  2797. return 3: , #spc , Neon , #spc , Yellow , #spc , Cloth
  2798. Boscags7_HumanNamesDb_BUI1167:
  2799. return 4: , #spc , Neon , #spc , Green , #spc , Cloth
  2800. Boscags7_HumanNamesDb_BUI1172:
  2801. return 4: , #spc , Red/Blue , #spc , Cloth
  2802. Boscags7_HumanNamesDb_BUI1156:
  2803. return 4: , #spc , Dark , #spc , Blue , #spc , Cloth
  2804. Boscags7_HumanNamesDb_BUI1175:
  2805. return 4: , #spc , Charcoal , #spc , Cloth
  2806. Boscags7_HumanNamesDb_BUI1161:
  2807. return 5: , #spc , Fire , #spc , Cloth
  2808. Boscags7_HumanNamesDb_BUI1151:
  2809. return 5: , #spc , Ice , #spc , Green , #spc , Cloth
  2810. Boscags7_HumanNamesDb_BUI1154:
  2811. return 5: , #spc , Ice , #spc , Blue , #spc , Cloth
  2812. Boscags7_HumanNamesDb_BUI1150:
  2813. return 5: , #spc , Ice , #spc , White , #spc , Cloth
  2814.  
  2815. ; Sandali
  2816. Boscags7_HumanNamesDb_NVI1167:
  2817. return Neon , #spc , Green , #spc , Sandals
  2818. Boscags7_HumanNamesDb_NVI1172:
  2819. return Red/Blue , #spc , Sandals
  2820. Boscags7_HumanNamesDb_NVI1156:
  2821. return Dark , #spc , Blue , #spc , Sandals
  2822. Boscags7_HumanNamesDb_NVI1175:
  2823. return Charcoal , #spc , Sandals
  2824. Boscags7_HumanNamesDb_NVI1161:
  2825. return Fire , #spc , Sandals
  2826. Boscags7_HumanNamesDb_NVI1151:
  2827. return Ice , #spc , Green , #spc , Sandals
  2828. Boscags7_HumanNamesDb_NVI1154:
  2829. return Ice , #spc , Blue , #spc , Sandals
  2830. Boscags7_HumanNamesDb_NVI1150:
  2831. return Ice , #spc , White , #spc , Sandals
  2832.  
  2833. ; Altri premi tailoring
  2834. Boscags7_HumanNamesDb_EWHmsh:
  2835. return Medium , #spc , Stretched , #spc , Hide
  2836. Boscags7_HumanNamesDb_EWHlsh:
  2837. return Large , #spc , Stretched , #spc , Hide
  2838. Boscags7_HumanNamesDb_EWHdft:
  2839. return Dark , #spc , Flower , #spc , Tapestry
  2840. Boscags7_HumanNamesDb_EWHlft:
  2841. return Light , #spc , Flower , #spc , Tapestry
  2842. Boscags7_HumanNamesDb_EWHbbr:
  2843. return Brown , #spc , Bear , #spc , Rug
  2844. Boscags7_HumanNamesDb_EWHpbr:
  2845. return Polar , #spc , Bear , #spc , Rug
  2846. Boscags7_HumanNamesDb_EWHt5:
  2847. return SOP , #spc , +5 , #spc , Tailoring
  2848. Boscags7_HumanNamesDb_EWHt10:
  2849. return SOP , #spc , +10 , #spc , Tailoring
  2850. Boscags7_HumanNamesDb_EWHt15:
  2851. return SOP , #spc , +15 , #spc , Tailoring
  2852. Boscags7_HumanNamesDb_EWHt20:
  2853. return SOP , #spc , +20 , #spc , Tailoring
  2854. Boscags7_HumanNamesDb_EWHb:
  2855. return Bless , #spc , Deed
  2856. Boscags7_HumanNamesDb_HAG2220:
  2857. return Spined , #spc , Kit
  2858. Boscags7_HumanNamesDb_HAG2117:
  2859. return Horned , #spc , Kit
  2860. Boscags7_HumanNamesDb_HAG2129:
  2861. return Barbed , #spc , Kit
  2862.  
  2863. ; Anvils
  2864. Boscags7_HumanNamesDb_ZAG2419:
  2865. return Dull , #spc , Copper , #spc , Anvil
  2866. Boscags7_HumanNamesDb_ZAG2406:
  2867. return Shadow , #spc , Anvil
  2868. Boscags7_HumanNamesDb_ZAG2413:
  2869. return Copper , #spc , Anvil
  2870. Boscags7_HumanNamesDb_ZAG2418:
  2871. return Bronze , #spc , Anvil
  2872. Boscags7_HumanNamesDb_ZAG2213:
  2873. return Gold , #spc , Anvil
  2874. Boscags7_HumanNamesDb_ZAG2425:
  2875. return Agapite , #spc , Anvil
  2876. Boscags7_HumanNamesDb_ZAG2207:
  2877. return Verite , #spc , Anvil
  2878. Boscags7_HumanNamesDb_ZAG2219:
  2879. return Valorite , #spc , Anvil
  2880.  
  2881. ; Hammers
  2882. Boscags7_HumanNamesDb_TLH2419:
  2883. return Dull , #spc , Copper , #spc , Hammer
  2884. Boscags7_HumanNamesDb_TLH2406:
  2885. return Shadow , #spc , Hammer
  2886. Boscags7_HumanNamesDb_TLH2413:
  2887. return Copper , #spc , Hammer
  2888. Boscags7_HumanNamesDb_TLH2418:
  2889. return Bronze , #spc , Hammer
  2890. Boscags7_HumanNamesDb_TLH2213:
  2891. return Gold , #spc , Hammer
  2892. Boscags7_HumanNamesDb_TLH2425:
  2893. return Agapite , #spc , Hammer
  2894. Boscags7_HumanNamesDb_TLH2207:
  2895. return Verite , #spc , Hammer
  2896. Boscags7_HumanNamesDb_TLH2219:
  2897. return Valorite , #spc , Hammer
  2898.  
  2899. ; Altri blacksmith
  2900. Boscags7_HumanNamesDb_TWF2419:
  2901. return Sturdy , #spc , Shovel
  2902. Boscags7_HumanNamesDb_QPF2419:
  2903. return Sturdy , #spc , Pickaxe
  2904. Boscags7_HumanNamesDb_GBG2419:
  2905. return Prospector's , #spc , Tools
  2906. Boscags7_HumanNamesDb_QPFg:
  2907. return Gargoyle's , #spc , Pickaxe
  2908. Boscags7_HumanNamesDb_KEG2419:
  2909. return Powder , #spc , of , #spc , Fortifying
  2910. Boscags7_HumanNamesDb_KKHm1:
  2911. return Gloves , #spc , of , #spc , Mining , #spc , +1
  2912. Boscags7_HumanNamesDb_XKHm3:
  2913. return Gloves , #spc , of , #spc , Mining , #spc , +3
  2914. Boscags7_HumanNamesDb_BMHm5:
  2915. return Gloves , #spc , of , #spc , Mining , #spc , +5
  2916. Boscags7_HumanNamesDb_EWHs5:
  2917. return SOP , #spc , +5 , #spc , Blacksmithy
  2918. Boscags7_HumanNamesDb_EWHs10:
  2919. return SOP , #spc , +10 , #spc , Blacksmithy
  2920. Boscags7_HumanNamesDb_EWHs15:
  2921. return SOP , #spc , +15 , #spc , Blacksmithy
  2922. Boscags7_HumanNamesDb_EWHs20:
  2923. return SOP , #spc , +20 , #spc , Blacksmithy
  2924. Boscags7_HumanNamesDb_OLHa10:
  2925. return Ancient , #spc , Hammer , #spc , +10
  2926. Boscags7_HumanNamesDb_OLHa15:
  2927. return Ancient , #spc , Hammer , #spc , +15
  2928. Boscags7_HumanNamesDb_OLHa30:
  2929. return Ancient , #spc , Hammer , #spc , +30
  2930. Boscags7_HumanNamesDb_OLHa60:
  2931. return Ancient , #spc , Hammer , #spc , +60
  2932.  
  2933. ; Resources
  2934. Boscags7_HumanNamesDb_JJG0:
  2935. return Normal , #spc , Leather
  2936. Boscags7_HumanNamesDb_JJG2220:
  2937. return Spined , #spc , Leather
  2938. Boscags7_HumanNamesDb_JJG2117:
  2939. return Horned , #spc , Leather
  2940. Boscags7_HumanNamesDb_JJG2129:
  2941. return Barbed , #spc , Leather
  2942. Boscags7_HumanNamesDb_BUI0:
  2943. return Cloth
  2944. Boscags7_HumanNamesDb_GUF0:
  2945. return Bones
  2946. Boscags7_HumanNamesDb_ENK0:
  2947. return Iron , #spc , Ingots
  2948. Boscags7_HumanNamesDb_ENK2419:
  2949. return Dull , #spc , Copper , #spc , Ingots
  2950. Boscags7_HumanNamesDb_ENK2406:
  2951. return Shadow , #spc , Iron , #spc , Ingots
  2952. Boscags7_HumanNamesDb_ENK2413:
  2953. return Copper , #spc , Ingots
  2954. Boscags7_HumanNamesDb_ENK2418:
  2955. return Bronze , #spc , Ingots
  2956. Boscags7_HumanNamesDb_ENK2213:
  2957. return Gold , #spc , Ingots
  2958. Boscags7_HumanNamesDb_ENK2425:
  2959. return Agapite , #spc , Ingots
  2960. Boscags7_HumanNamesDb_ENK2207:
  2961. return Verite , #spc , Ingots
  2962. Boscags7_HumanNamesDb_ENK2219:
  2963. return Valorite , #spc , Ingots
  2964.  
  2965. ; Tools
  2966. Boscags7_HumanNamesDb_FillSmallBod:
  2967. return Riempi , #spc , Small , #spc , BOD
  2968. Boscags7_HumanNamesDb_FillLargeBod:
  2969. return Riempi , #spc , Large , #spc , BOD
  2970. Boscags7_HumanNamesDb_DeliverBod:
  2971. return Consegna , #spc , BOD
  2972. Boscags7_HumanNamesDb_PlaceObject:
  2973. return Sistema , #spc , oggetto
  2974. Boscags7_HumanNamesDb_BankRestock:
  2975. return Restock , #spc , da , #spc , banca
  2976. Boscags7_HumanNamesDb_AnalyzeObject:
  2977. return Analizza , #spc , oggetto
  2978. Boscags7_HumanNamesDb_MoveObject:
  2979. return Sposta , #spc , oggetti
  2980. return
  2981.  
  2982. ;=======================================
  2983. ;* @name Model_LoadDefaultConfig
  2984. ;* @author AG
  2985. ;* @purpose Inizializza tutte le variabili di configurazione (prefisso "Config_") al loro valore predefinito.
  2986. ;* Questa funzione può essere usata come riferimento da nuovi scripters per conoscere le variabili usate dallo script.
  2987. ;* Per garantire maggiore flessibilità, spesso alcune variabili sono ridondanti rispetto alle opzioni di menu.
  2988. ;* @params
  2989. ;* @returns
  2990. ;* @example gosub safecall Model_LoadDefaultConfig
  2991.  
  2992. sub Model_LoadDefaultConfig
  2993. set %Config_Runebooks_Home !null ; _runebook:runa_ ; esempio: _EASYDNV:3_EASYDNV:4_
  2994. set %Config_Runebooks_Bank !null ; _runebook:runa_ ; esempio: _EASYDNV:3_EASYDNV:4_
  2995. set %Config_Runebooks_Tailor !null ; _runebook:runa_ ; esempio: _EASYDNV:3_EASYDNV:4_
  2996. set %Config_Runebooks_Smith !null ; _runebook:runa_ ; esempio: _EASYDNV:3_EASYDNV:4_
  2997. set %Config_RecallMode !null ; "recall" oppure "journey"
  2998. set %Config_RecallAsWraith !null ; #true / #false
  2999. set %Config_Chests_Work !null ; elenco chests - esempio: _IGJDCND_PZHCCND_
  3000. set %Config_Chests_Bank !null
  3001. set %Config_Chests_Rewards !null
  3002. set %Config_Bodbooks_Fill !null ; id di un bodbook
  3003. set %Config_Bodbooks_Keep !null
  3004. set %Config_Bodbooks_Deliver !null
  3005. set %Config_Bodbooks_Trash !null
  3006. set %Config_Bodbooks_Failed !null
  3007. set %Config_Home_PosX !null
  3008. set %Config_Home_PosY !null
  3009. set %Config_Home_PosZ !null
  3010. set %Config_BodFilter_TrashBoneBods #false ; #true o #false
  3011. set %Config_BodFilter_Rewards _BlessDeed_BarbedKit_Tailoring20_
  3012. +GoldHammer_AgapiteHammer_VeriteHammer_ValoriteHammer_
  3013. +AncientHammer30_AncientHammer60_Blacksmithy20_
  3014. set %Config_RewardFilter_Rewards _BUI:1161_BUI:1151_BUI:1154_BUI:1150_BUI:1167_BUI:1172_BUI:1156_BUI:1175_
  3015. +NVI:1167_NVI:1172_NVI:1156_NVI:1175_NVI:1161_NVI:1151_NVI:1154_NVI:1150_
  3016. +EWH:msh_EWH:lsh_EWH:lft_EWH:dft_EWH:bbr_EWH:pbr_EWH:t20_EWH:b_HAG:2220_
  3017. +HAG:2117_HAG:2129_EWH:t5_EWH:t10_
  3018. +EWH:t15_ZAG:2419_ZAG:2406_ZAG:2413_ZAG:2418_ZAG:2213_ZAG:2425_ZAG:2207_
  3019. +ZAG:2219_TLH:2413_TLH:2418_TLH:2213_TLH:2425_TLH:2207_TLH:2219_OLH:a10_
  3020. +OLH:a15_OLH:a30_OLH:a60_TLH:2419_TLH:2406_GBG:2419_QPF:g_BMH:m5_EWH:s5_
  3021. +EWH:s10_EWH:s15_EWH:s20_KEG:2419_
  3022. return
  3023.  
  3024. ;=======================================
  3025. ;* @name Model_LoadConfig
  3026. ;* @author AG
  3027. ;* @purpose Carica la configurazione avente il nome richiesto.
  3028. ;* Se si specifica "Default", o se la configurazione specificata non esiste, la funzione richiamerà Model_LoadDefaultConfig.
  3029. ;* @params %1 opt Nome della configurazione da caricare. Il valore predefinito è "Current".
  3030. ;* @returns
  3031. ;* @example gosub safecall Model_LoadConfig Configuration1
  3032.  
  3033. sub Model_LoadConfig ; %configName
  3034. if %0 < 1 || %1 = !null
  3035. set !configName Current
  3036. else
  3037. set !configName %1
  3038. gosub safecall Model_LoadDefaultConfig
  3039. if !configName <> Default
  3040. {
  3041. gosub safecall Std_LoadPersistentVariables |Config_Initialized| !configName
  3042. if %Config_Initialized = #true
  3043. {
  3044. gosub safecall Std_LoadPersistentVariables %Constants_PersistentVars !configName
  3045. }
  3046. }
  3047. gosub safecall Model_OverrideConfig
  3048. set %Config_Initialized #true
  3049. return
  3050.  
  3051. ;=======================================
  3052. ;* @name Model_AutoConfig
  3053. ;* @author AG
  3054. ;* @purpose Determina parametri di configurazione on-the-fly.
  3055. ;* @example gosub safecall Model_AutoConfig
  3056.  
  3057. sub Model_AutoConfig
  3058. gosub safecall Model_FindBodbooks
  3059. ;gosub safecall Model_InitRails
  3060.  
  3061. chooseskill mage
  3062. set !magery #skill
  3063. chooseskill necr
  3064. set !necro #skill
  3065. chooseskill chiv
  3066. set !chivalry #skill
  3067.  
  3068. set %Config_RecallAsWraith ( !necro > !chivalry && !necro > !magery )
  3069. if !magery >= !chivalry || %Config_RecallAsWraith
  3070. set %Config_RecallMode recall
  3071. else
  3072. set %Config_RecallMode sacred_journey
  3073. return
  3074.  
  3075. ;=======================================
  3076. ;* @name Model_OverrideConfig
  3077. ;* @author AG
  3078. ;* @purpose Forza il settaggio di determinati valori di configurazione.
  3079. ;* Usato sia per settaggi automatici che per settaggi manuali.
  3080. ;* @returns
  3081. ;* @example gosub safecall Model_OverrideConfig
  3082.  
  3083. sub Model_OverrideConfig
  3084. set %Config_CharNumber 4
  3085. return
  3086.  
  3087. ;=======================================
  3088. ;* @name Model_SaveConfig
  3089. ;* @author AG
  3090. ;* @purpose Salva la configurazione corrente con il nome richiesto.
  3091. ;* @params %1 opt Nome con cui salvare la configurazione corrente.
  3092. ;* Il valore predefinito è "Current". Il valore "Default" non è ammesso.
  3093. ;* @returns
  3094. ;* @example gosub safecall Model_SaveConfig Configuration1
  3095.  
  3096. sub Model_SaveConfig ; %configName
  3097. if %0 < 1 || %1 = !null
  3098. set !configName Current
  3099. else
  3100. set !configName %1
  3101.  
  3102. if !configName = Default
  3103. return
  3104.  
  3105. set %Config_Initialized #true
  3106. gosub safecall Std_SavePersistentVariables |Config_Initialized| !configName
  3107. gosub safecall Std_SavePersistentVariables %Constants_PersistentVars !configName
  3108. return
  3109.  
  3110.  
  3111. ;==========================================================
  3112. ;= SEZIONE 2: Funzioni esecutive (livello Model)
  3113. ;==========================================================
  3114.  
  3115. ;=======================================
  3116. ;* @name Yeld
  3117. ;* @author AG
  3118. ;* @purpose Funzione speciale di livello Model, richiamata da ogni sub ogniqualvota è possibile fermarsi
  3119. ;* per eseguire check di sicurezza (tipo Std_WaitForSave).
  3120. ;* Dovrebbe essere richiamata ad intervalli anche irregolari di 2-5 secondi.
  3121. ;* @example gosub safecall Yeld
  3122.  
  3123. sub Yeld
  3124. if #systime < %Yeld_DelayTime
  3125. return
  3126. set %Yeld_DelayTime #systime + 1000
  3127.  
  3128. ; attesa durante save/cleaning
  3129. gosub safecall Model_WaitForSave
  3130.  
  3131. ; check for connection lost
  3132. gosub safecall CheckForConnectionLost ;Model_CheckConnection
  3133. return
  3134.  
  3135. ;=======================================
  3136. ;* @name DoTasks
  3137. ;* @author AG
  3138. ;* @purpose Funzione speciale di livello Model, richiamata da ogni sub ogniqualvota è possibile fermarsi
  3139. ;* per eseguire task complementari definiti dall'utente.
  3140. ;* Questa funzione può essere personalizzata dagli utenti per effettuare task anche molto complessi
  3141. ;* (tipo la raccolta di nuovi bod).
  3142. ;* Si consiglia di utilizzare istruzioni call anzichè implementare tutto in loco.
  3143. ;* @example gosub safecall DoTasks
  3144.  
  3145. sub DoTasks
  3146. ; aggiungi collegamenti ai tuoi script qui.
  3147. return
  3148.  
  3149. ;=======================================
  3150. ;* @name Model_WaitForSave
  3151. ;* @author AG
  3152. ;* @purpose Attende il termine di una fase di save o cleaning.
  3153. ;* @example gosub safecall Model_WaitForSave
  3154.  
  3155. sub Model_WaitForSave
  3156. gosub safecall Std_GetWorldStatus
  3157. if #result = saving || #result = cleaning || #result = savewarning
  3158. {
  3159. if #result = saving || #result = savewarning
  3160. {
  3161. event exmsg #charid 3 0 Save in corso!
  3162. set !timeout #systime + 60000
  3163. }
  3164. else
  3165. {
  3166. event exmsg #charid 3 0 Cleaning in corso!
  3167. set !timeout #systime + 15000
  3168. }
  3169. gosub safecall Std_GetWorldStatus
  3170. while #systime < !timeout && #result <> running
  3171. {
  3172. gosub safecall Std_GetWorldStatus
  3173. }
  3174. event exmsg #charid 3 0 Riprendo a lavorare.
  3175. }
  3176. return
  3177.  
  3178. ;=======================================
  3179. ;* @name Model_CheckConnection
  3180. ;* @author AG
  3181. ;* @purpose In caso di connection lost, ristabilisce la connessione.
  3182. ;* @example gosub safecall Model_CheckConnection
  3183.  
  3184. sub Model_CheckConnection
  3185. gosub safecall Std_CheckConnection
  3186. if #result = #false && ! ( #time >= 065000 && #time < 070500 )
  3187. gosub safecall Model_Login %Config_CharNumber
  3188. return
  3189.  
  3190. ;=======================================
  3191. ;* @name Model_Login
  3192. ;* @author AG
  3193. ;* @purpose Effettua il login con il personaggio specificato.
  3194. ;* Incapsula tutte le operazioni di login in una sub centralizzata.
  3195. ;* @params %1 req Indice del personaggio da loggare.
  3196. ;* @example gosub safecall Model_Login
  3197. ;* @login Bookmark per trovare velocemente questa sub.
  3198.  
  3199. sub Model_Login ; %charnum
  3200. set !charnum %1
  3201.  
  3202. set !username !null ; inserite qui il vostro username; usate !null per indicare l'account predefinito.
  3203. set !password !null ; xxxxxxxxxx ; inserite qui la vostra password.
  3204. set !charnum 1 ; PROVVISORIO: inserite qui l'indice del vostro pg worker nella lista personaggi.
  3205.  
  3206. ;call LoginData.txt ; questa riga potete anche cancellarla
  3207. gosub safecall Std_Login !username !password !charnum
  3208. set !username !null
  3209. set !password !null
  3210. return
  3211.  
  3212. ;=======================================
  3213. ;* @name Model_DetectLocation
  3214. ;* @author AG
  3215. ;* @purpose Determina in maniera automatica il luogo in cui ci si trova (casa, banca, sarto, fabbro).
  3216. ;* @params
  3217. ;* @returns Uno di questi valori: home, bank, tailor, smith. Oppure #false se il luogo è sconosciuto.
  3218. ;* Inoltre, NEI SOLI CASI DI bank, tailor e smith, salva all'interno delle variabili di tipo #find*
  3219. ;* informazioni sul vendor relativo a quel luogo.
  3220. ;* @example gosub safecall Model_DetectLocation
  3221. ;* @status Tested and working
  3222.  
  3223. sub Model_DetectLocation
  3224. ; Quanto siamo vicini alla home position?
  3225. set !distX #charposx - %Config_Home_PosX
  3226. set !distY #charposy - %Config_Home_PosY
  3227. if ( !distX * !distX ) <= 400 && ( !distY * !distY ) <= 400
  3228. {
  3229. set %Location_Name home
  3230. set %Location_X %Config_Home_PosX
  3231. set %Location_Y %Config_Home_PosY
  3232. set %Location_Z %Config_Home_PosZ
  3233. set %Location_Vendor !null
  3234. return %Location_Name
  3235. }
  3236.  
  3237. set !vendor !null
  3238. set !vendorType unknown
  3239. set !clsVendors %Constants_Vendor
  3240. finditem !clsVendors G_25
  3241. if #findkind <> -1
  3242. {
  3243. set !strBanker1 #spc , the , #spc , Banker , #spc
  3244. set !strBanker2 #spc , the , #spc , Minter , #spc
  3245. set !strTailor1 #spc , the , #spc , Tailor , #spc
  3246. set !strTailor2 #spc , the , #spc , Weaver , #spc
  3247. set !strSmith1 #spc , the , #spc , Blacksmith , #spc
  3248. set !strSmith2 #spc , the , #spc , Blacksmith , #spc
  3249. set !strGuildMaster #spc , GuildMaster , #spc
  3250.  
  3251. set !distance 1000
  3252. for #findindex 1 #findcnt
  3253. {
  3254. gosub safecall Std_ReadProperty #findid
  3255. set !property #result
  3256. str pos !property $
  3257. set !length #strres - 1
  3258. str left !property !length
  3259. set !property #strres , #spc
  3260.  
  3261. if !strGuildmaster in !property || #finddist >= !distance
  3262. {
  3263. continue
  3264. }
  3265. if !strBanker1 in !property || !strBanker2 in !property
  3266. {
  3267. set !vendorType bank
  3268. set !distance #finddist
  3269. set !vendor #findid
  3270. }
  3271. if !strTailor1 in !property || !strTailor2 in !property
  3272. {
  3273. set !vendorType tailor
  3274. set !distance #finddist
  3275. set !vendor #findid
  3276. }
  3277. if !strSmith1 in !property || !strSmith2 in !property
  3278. {
  3279. set !vendorType smith
  3280. set !distance #finddist
  3281. set !vendor #findid
  3282. }
  3283. }
  3284. }
  3285.  
  3286. if !vendorType = unknown
  3287. {
  3288. set %Location_Name unknown
  3289. set %Location_Vendor !null
  3290. set %Location_X !null
  3291. set %Location_Y !null
  3292. set %Location_Z !null
  3293. }
  3294. else
  3295. {
  3296. finditem !vendor G_25
  3297. set %Location_Name !vendorType
  3298. set %Location_Vendor #findid
  3299. set %Location_X #findx
  3300. set %Location_Y #findy
  3301. set %Location_Z #findz
  3302. }
  3303. return %Location_Name
  3304.  
  3305. ;=======================================
  3306. ;* @name Model_ChangeLocation
  3307. ;* @author AG
  3308. ;* @purpose Recalla il PG nel tipo di luogo specificato (banca, casa, sarto, fabbro) e gli fa raggiungere la posizione
  3309. ;* più opportuna (la "posizione a casa", oppure una posizione vicina al vendor).
  3310. ;* Sia la fase di recall che quella di pathfinding sono evitate se non necessarie.
  3311. ;* @params %1 req Tipo di luogo in cui si desidera spostarsi.
  3312. ;* @returns #true se la destinazione viene raggiunta con successo. #false altrimenti.
  3313. ;* Inoltre, NEI SOLI CASI DI bank, tailor e smith, salva all'interno delle variabili di tipo #find*
  3314. ;* informazioni sul vendor relativo a quel luogo.
  3315. ;* @example gosub safecall Model_ChangeLocation tailor
  3316. ;* @status Tested and working.
  3317.  
  3318. sub Model_ChangeLocation ; %destination (home|bank|tailor|smith)
  3319. set !destination %1
  3320. set !recallMode %Config_RecallMode
  3321. set !runes_home %Config_Runebooks_Home
  3322. set !runes_tailor %Config_Runebooks_Tailor
  3323. set !runes_smith %Config_Runebooks_Smith
  3324. set !runes_bank %Config_Runebooks_Bank
  3325.  
  3326. set !runes !runes_ . !destination
  3327. gosub safecall AG_Tokenize !runes _ Temp_Array_
  3328. set !count #result
  3329.  
  3330. for !i 0 !count ; parti da 0 per consentire il pathfind iniziale
  3331. {
  3332. gosub safecall Yeld
  3333. if !i = 0
  3334. {
  3335. gosub safecall Model_DetectLocation
  3336. }
  3337. else
  3338. {
  3339. set !runeCode %Temp_Array_ . !i ; esempio runecode: ABCDEF:3
  3340. gosub safecall AG_Tokenize !runeCode : Temp_Array2_
  3341. set !runebook %Temp_Array2_1
  3342. set !runeindex %Temp_Array2_2
  3343. if !runebook = !null || !runeindex = !null
  3344. continue
  3345.  
  3346. if %Config_RecallAsWraith
  3347. gosub safecall Std_EnsureWraithForm
  3348. gosub safecall Std_SafeUseRunebook !runebook !recallMode !runeindex
  3349. gosub safecall Model_DetectLocation
  3350. }
  3351. if %Location_Name <> !destination
  3352. continue
  3353.  
  3354. if %Location_Name = home
  3355. {
  3356. gosub safecall Model_CustomHomePathfind
  3357. gosub safecall Std_SmartPathfind %Location_X %Location_Y %Location_Z 0
  3358. }
  3359. if %Location_Name = bank
  3360. gosub safecall Std_SmartPathfind %Location_X %Location_Y !null 11
  3361. if %Location_Name = tailor || %Location_Name = smith
  3362. gosub safecall Std_SmartPathfind %Location_X %Location_Y %Location_Z 1
  3363. if #result <> #true
  3364. continue ; next rune!
  3365. return #true
  3366. }
  3367. return #false
  3368.  
  3369. ;=======================================
  3370. ;* @name Model_CustomHomePathfind
  3371. ;* @author AG
  3372. ;* @purpose Questa sub può essere personalizzata manualmente per consentire il pathfind anche all'interno di case molto complesse.
  3373. ;* La versione che fornisco è personalizzata per casa mia, e scatta solo se i #charid sono quelli dei miei personaggi.
  3374. ;* @returns #true se la destinazione viene raggiunta con successo. #false altrimenti.
  3375. ;* @example gosub safecall Model_CustomHomePathfind
  3376. ;* @status Tested and working.
  3377.  
  3378. sub Model_CustomHomePathfind
  3379. call AG_Routines.txt agUseHomeTeleport
  3380. return #true
  3381.  
  3382. ;=======================================
  3383. ;* @name Std_EnsureWraithForm
  3384. ;* @author AG
  3385. ;* @purpose Questa sub si assicura che il pg sia trasformato in wraith.
  3386. ;* @example gosub safecall Std_EnsureWraithForm
  3387.  
  3388. sub Std_EnsureWraithForm
  3389. while #true ; @todo inserire timeout
  3390. {
  3391. finditem #charid G_0
  3392. if _ , #findtype , _ in _RAB_MAB_
  3393. return
  3394. event macro 15 116 ; CastSpell Wraith Form
  3395. wait 4s
  3396. }
  3397. return
  3398.  
  3399. ;=======================================
  3400. ;* @name Model_FindBodbooks
  3401. ;* @author AG
  3402. ;* @purpose Ricerca i bodbook all'interno del backpack e li riconosce in base al nome.
  3403. ;* @example gosub safecall Model_FindBodbooks
  3404. ;* @status Under development.
  3405.  
  3406. sub Model_FindBodbooks
  3407. set %Config_Bodbooks_Fill !null
  3408. set %Config_Bodbooks_Keep !null
  3409. set %Config_Bodbooks_Deliver !null
  3410. set %Config_Bodbooks_Failed !null
  3411. set %Config_Bodbooks_Trash !null
  3412. finditem %Constants_Bodbook C_ , #backpackid
  3413. if #findcnt > 0
  3414. {
  3415. for #findindex 1 #findcnt
  3416. {
  3417. set !book #findid
  3418. gosub safecall Std_ReadProperty !book
  3419. set !property #result
  3420. if scarta in !property || trash in !property
  3421. set %Config_Bodbooks_Trash !book
  3422. if falliti in !property || riprova in !property || retry in !property || failed in !property
  3423. set %Config_Bodbooks_Failed !book
  3424. if consegna in !property || deliver in !property
  3425. set %Config_Bodbooks_Deliver !book
  3426. if conserva in !property || keep in !property
  3427. set %Config_Bodbooks_Keep !book
  3428. if riempi in !property || fill in !property || vuot in !property || empt in !property
  3429. set %Config_Bodbooks_Fill !book
  3430. }
  3431. }
  3432. return
  3433.  
  3434. ;=======================================
  3435. ;* @name Model_AnalyzeBod
  3436. ;* @author AG
  3437. ;* @purpose Analizza un bod e riempie correttamente tutti i campi della struttura CurrentBod_.
  3438. ;* I campi sono numerosissimi:
  3439. ;* - Tutti i campi restituiti dalla sub analyzeBod di BodFunctions.euo
  3440. ;* - Campi addizionali riguardanti RequiredItems, RequiredMaterial, RequiredBones, RequiredTools, ecc.
  3441. ;* - Informazioni di filtering (%CurrentBod_Filter_Fill, %CurrentBod_Filter_Keep).
  3442. ;* - Informazioni sull'azione da intraprendere con il BOD (%CurrentBod_Action)
  3443. ;* La funzione è ottimizzata in maniera da evitare il ricalcolo inutile di informazioni già calcolate.
  3444. ;* @params %1 req Il BOD da analizzare
  3445. ;* @returns #true se l'operazione termina con successo. #false altrimenti.
  3446. ;* @example gosub safecall Model_AnalyzeBod %bod
  3447.  
  3448. sub Model_AnalyzeBod ; %bod
  3449. set !bod %1
  3450. set !bones_id %Constants_Bones
  3451. set !tailorTools %Constants_SewingKit
  3452. set !smithTools %Constants_SmithTools
  3453.  
  3454. ;-----------------
  3455. ; Dati di base
  3456. ;-----------------
  3457.  
  3458. if !bod = %CurrentBod_Id
  3459. gosub libcall BodFunctions.euo analyzeBod !bod CurrentBod_ q ; aggiorna solo le quantità (unico elemento variabile)
  3460. else
  3461. gosub libcall BodFunctions.euo analyzeBod !bod CurrentBod_ ; aggiorna tutto
  3462. if #result <> #true
  3463. {
  3464. set %CurrentBod_Id !null ; evita ottimizzazione
  3465. return #false
  3466. }
  3467.  
  3468. ;----------------------
  3469. ; Dati di crafting
  3470. ;----------------------
  3471.  
  3472. if %CurrentBod_Large = #false
  3473. {
  3474. set %CurrentBod_RequiredItems_Id %CurrentBod_ItemId
  3475. set %CurrentBod_RequiredItems_Color %CurrentBod_MaterialColor
  3476. set %CurrentBod_RequiredItems_Count %CurrentBod_Quantity - %CurrentBod_FillCount
  3477. set %CurrentBod_RequiredBones_Id !bones_id
  3478. set %CurrentBod_RequiredBones_Color 0
  3479. set %CurrentBod_RequiredBones_Count %CurrentBod_Bones
  3480. set %CurrentBod_RequiredMaterial_Id %CurrentBod_MaterialId
  3481. set %CurrentBod_RequiredMaterial_Color %CurrentBod_MaterialColor
  3482.  
  3483. if %CurrentBod_Tailor
  3484. {
  3485. if %CurrentBod_MaterialName = cloth
  3486. {
  3487. set %CurrentBod_RequiredMaterial_Count %CurrentBod_Cloth
  3488. set %CurrentBod_RequiredMaterial_Id %CurrentBod_MaterialId , _ , %Constants_CutUpCloth
  3489. }
  3490. else
  3491. {
  3492. set %CurrentBod_RequiredMaterial_Count %CurrentBod_Hides
  3493. }
  3494. set %CurrentBod_RequiredTools !tailorTools
  3495. }
  3496. else
  3497. {
  3498. set %CurrentBod_RequiredMaterial_Count %CurrentBod_Ingots
  3499. set %CurrentBod_RequiredTools !smithTools
  3500. }
  3501. }
  3502.  
  3503. ;--------------------------
  3504. ; Dati di filtering
  3505. ;--------------------------
  3506.  
  3507. gosub safecall Model_MainBodFilter
  3508. set %CurrentBod_Filter_Keep ( keep in #result )
  3509. set %CurrentBod_Filter_Fill ( fill in #result )
  3510.  
  3511. ;----------------
  3512. ; Action
  3513. ;----------------
  3514.  
  3515. set !keep %CurrentBod_Filter_Keep
  3516. set !fill %CurrentBod_Filter_Fill
  3517. set !large %CurrentBod_Large
  3518. set !filled %CurrentBod_Filled
  3519.  
  3520. set !action fill
  3521. if !keep
  3522. {
  3523. if !filled || !large || ! !fill
  3524. set !action keep
  3525. if !large && !filled
  3526. set !action deliver
  3527. }
  3528. else
  3529. {
  3530. if !filled
  3531. {
  3532. set !action deliver
  3533. }
  3534. else
  3535. {
  3536. if !large || ! !fill
  3537. set !action trash
  3538. }
  3539. }
  3540. set %CurrentBod_Action !action
  3541. return #true
  3542.  
  3543. ;=======================================
  3544. ;* @name Model_MainBodFilter
  3545. ;* @author AG
  3546. ;* @purpose Implementa il filtro BOD principale dello script.
  3547. ;* Il filtro è configurabile per mezzo delle variabili:
  3548. ;* %Config_BodFilter_Rewards: elenco di tutti i rewards per i quali conservare large bods.
  3549. ;* %Config_BodFilter_TrashBoneBods: se #true, tutti i bod che richiedono ossa verranno trashati.
  3550. ;* @returns Una stringa contenente "fill" se il bod è da riempire e "keep" se il bod è da conservare
  3551. ;* (può quindi restituire: fill, keep, fill_keep, N/A).
  3552. ;* @pre Si aspetta che i dati riguardanti il bod siano già presenti nelle variabili %CurrentBod_*.
  3553. ;* @example gosub safecall Model_MainBodFilter
  3554.  
  3555. sub Model_MainBodFilter
  3556. set !goodRewards %Config_BodFilter_Rewards
  3557. set !trashBoneBods %Config_BodFilter_TrashBoneBods
  3558. set !fill #true
  3559. set !keep #false
  3560.  
  3561. gosub safecall AG_Tokenize %CurrentBod_LargeRewards _ Temp_Array_
  3562. set !count #result
  3563. if !count > 0
  3564. {
  3565. for !i 1 !count
  3566. {
  3567. set !entry %Temp_Array_ . !i
  3568. str pos !entry :
  3569. set !len #strres - 1
  3570. str left !entry !len
  3571. set !reward #strres
  3572. if !reward in !goodRewards
  3573. {
  3574. set !keep #true
  3575. break
  3576. }
  3577. }
  3578. }
  3579.  
  3580. if !trashBoneBods && %CurrentBod_Bones > 0
  3581. {
  3582. set !fill #false
  3583. }
  3584.  
  3585. set !result !null
  3586. if !fill
  3587. set !result fill
  3588. if !keep
  3589. set !result keep
  3590. if !fill && !keep
  3591. set !result fill_keep
  3592. return !result
  3593.  
  3594. ;=======================================
  3595. ;* @name Model_FillSmallBod
  3596. ;* @author AG
  3597. ;* @purpose Ciclo per riempire uno small BOD, eseguendo anche operazioni ausiliarie, del tipo:
  3598. ;* - spostamento del PG nella posizione di lavoro
  3599. ;* - restockaggio risorse
  3600. ;* - restockaggio tools (o crafting)
  3601. ;* - riciclaggio item non exceptional quando necessario
  3602. ;* @params %1 req Il BOD da riempire.
  3603. ;* @returns #true se l'operazione termina con successo. Altrimenti, un codice di errore fra i seguenti:
  3604. ;* - cannot_open_work_chests
  3605. ;* - cannot_restock_material
  3606. ;* - cannot_restock_bones
  3607. ;* - cannot_restock_tools
  3608. ;* - too_many_attempts
  3609. ;* - unexpected_error
  3610. ;* - bod_is_large
  3611. ;* @example gosub safecall Model_FillSmallBod %bod
  3612.  
  3613. sub Model_FillSmallBod ; %bod
  3614. set !bod %1
  3615. gosub Model_FillSmallBod_Core !bod
  3616. set !result #result
  3617. gosub safecall Model_RecycleItems
  3618. if ( %Config_Bodbooks_Failed <> !null ) && ( cannot_restock in !result || too_many_attempts in !result )
  3619. {
  3620. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Failed
  3621. }
  3622. return !result
  3623.  
  3624. ;=======================================
  3625. ;* @name Model_FillSmallBod_Core
  3626. ;* @author AG, fixed by Smjert
  3627.  
  3628. sub Model_FillSmallBod_Core ; %bod
  3629. set !bod %1
  3630. set !multiplier 1
  3631. set !i 0
  3632. while #true
  3633. {
  3634. gosub safecall Yeld
  3635. set !i !i + 1
  3636. gosub safecall Model_AnalyzeBod !bod
  3637. if #result <> #true
  3638. return unexpected_error
  3639. if %CurrentBod_Large
  3640. return bod_is_large
  3641. if %CurrentBod_Filled
  3642. return #true
  3643. if !i > 10
  3644. {
  3645. if !lastResult = not_enough_material || !lastResult = not_enough_bones
  3646. event exmsg #charid 3 0 Risorse insufficienti!
  3647. if !lastResult = not_enough_tools
  3648. event exmsg #charid 3 0 Crafting Tools insufficienti!
  3649. return !lastResult
  3650. }
  3651.  
  3652. gosub safecall Model_Restock !multiplier
  3653. if #result <> #true
  3654. {
  3655. if !chestsOpened = !null
  3656. {
  3657. set !chestsOpened #true
  3658. gosub safecall Model_OpenChests work
  3659. if #result <> #true
  3660. return cannot_open_work_chests
  3661. continue
  3662. }
  3663. return #result
  3664. }
  3665.  
  3666. gosub safecall Yeld
  3667. gosub safecall Std_FillSmallBod !bod %Config_Home_DyingTub
  3668. set !lastResult #result
  3669. gosub safecall Model_RecycleItems ; Aggiunto perchè se fallisce a fare pezzi exe va overweight
  3670. if !lastResult = #true || !lastResult = not_enough_tools
  3671. continue
  3672. if !lastResult = not_enough_material || !lastResult = not_enough_bones
  3673. {
  3674. set !multiplier 2
  3675. continue
  3676. }
  3677. return #result
  3678. }
  3679. return too_many_attempts
  3680.  
  3681. ;=======================================
  3682. ;* @name Model_Restock
  3683. ;* @author AG
  3684. ;* @purpose Rifornisce il backpack di tutto il necessario per fillare il bod corrente.
  3685. ;* @params %1 opt Multiplier: utilizzato per aumentare la quantità di materiale restockata (per bod difficili).
  3686. ;* @returns #true se l'operazione termina con successo. #false altrimenti.
  3687. ;* @pre Bod corrente analizzato con Model_AnalyzeBod.
  3688. ;* @example gosub safecall Model_Restock
  3689. ;* @status Partially tested
  3690.  
  3691. sub Model_Restock ; %multiplier
  3692. if %0 < 1 || %1 = !null
  3693. set !multiplier 1
  3694. else
  3695. set !multiplier %1
  3696.  
  3697. set !source %Config_Chests_Work
  3698. set !material_id %CurrentBod_RequiredMaterial_Id
  3699. set !material_color %CurrentBod_RequiredMaterial_Color
  3700. set !material_min %CurrentBod_RequiredMaterial_Count * %CurrentBod_RequiredItems_Count
  3701. set !material_max !material_min * !multiplier
  3702. set !bones_id %CurrentBod_RequiredBones_Id
  3703. set !bones_min %CurrentBod_RequiredBones_Count * %CurrentBod_RequiredItems_Count
  3704. set !bones_max !bones_min * !multiplier
  3705. set !button1 2
  3706. if %CurrentBod_Tailor
  3707. {
  3708. set !tool_id %Constants_SewingKit
  3709. set !button2 7
  3710. }
  3711. else
  3712. {
  3713. set !tool_id %Constants_Tongs
  3714. set !button2 13
  3715. }
  3716.  
  3717. ; Restock materiali
  3718. gosub safecall Yeld
  3719. gosub safecall Std_RestockItem !bones_id !source #backpackid !bones_min !bones_max 0 #true
  3720. if #result = #false
  3721. return cannot_restock_bones
  3722.  
  3723. gosub safecall Yeld
  3724. gosub safecall Std_RestockItem !material_id !source #backpackid !material_min !material_max !material_color #true
  3725. if #result = #false
  3726. return cannot_restock_material
  3727.  
  3728. ; Restock tools (da container)
  3729. gosub safecall Yeld
  3730. gosub safecall Std_RestockItem !tool_id !source #backpackid 2 2 0
  3731. if #result = #true
  3732. return #true
  3733.  
  3734. ; Craft needed tools (5 attempts)
  3735. chooseskill Tink
  3736. if #skill < 350
  3737. return cannot_restock_tools
  3738. if !material_id = %Constants_Ingots && !material_color = 0
  3739. {
  3740. set !minIngots !material_min + 10
  3741. set !maxIngots !material_max + 40
  3742. }
  3743. else
  3744. {
  3745. set !minIngots 10
  3746. set !maxIngots 40
  3747. }
  3748. for !i 1 5
  3749. {
  3750. gosub safecall Yeld
  3751.  
  3752. ; best-effort ingots restock (do not fail if error)
  3753. gosub safecall Std_RestockItem %Constants_Ingots !source #backpackid !minIngots !maxIngots 0 #true
  3754.  
  3755. gosub safecall Std_RestockItem %Constants_TinkersTools !source #backpackid 2 2 0
  3756. set !craftTinkersTools ! #result
  3757.  
  3758. finditem %Constants_TinkersTools C_ , #backpackid
  3759. if #findkind = -1
  3760. return cannot_restock_tools
  3761. set !tinkersTools #findid
  3762.  
  3763. if !craftTinkersTools
  3764. gosub safecall Std_CraftItem !tinkersTools last !button1 4
  3765. gosub safecall Std_CraftItem !tinkersTools last !button1 !button2
  3766.  
  3767. finditem !tool_id C_ , #backpackid
  3768. if #findkind <> -1 && #findcnt >= 2
  3769. return #true
  3770. }
  3771.  
  3772. finditem !tool_id C_ , #backpackid
  3773. if #findkind = -1
  3774. return cannot_restock_tools
  3775. return #true
  3776.  
  3777. ;=======================================
  3778. ;* @name Model_OpenChests
  3779. ;* @version 2.0
  3780. ;* @author AG (thanks to TakilianRueshin for finding a bug)
  3781. ;* @purpose Apre il gruppo di contenitori specificato (work|bank|rewards).
  3782. ;* @params %1 req Gruppo di contenitori da aprire. Può essere: work, bank, rewards.
  3783. ;* version 2.0: Può essere un elenco di contenitori del tipo: _location_container1_container2_location2_container3_
  3784. ;* le location valide sono: home, bank, tailor, smith
  3785. ;* @returns #true se l'operazione termina con successo. #false altrimenti.
  3786. ;* @example gosub safecall Model_OpenChests work
  3787. ;* gosub safecall Model_OpenChests home_ABCDEFG_HIJKLMN
  3788. ;* @status tested
  3789.  
  3790. sub Model_OpenChests ; %type (work|bank|rewards)
  3791. set !input %1
  3792. if !input <> work && !input <> bank && !input <> rewards
  3793. set !chests !input
  3794. if !input = work
  3795. set !chests home , _ , %Config_Chests_Work
  3796. if !input = rewards
  3797. set !chests home , _ , %Config_Chests_Rewards
  3798. if !input = bank
  3799. set !chests bank , _ , %Config_Chests_Bank
  3800.  
  3801. gosub safecall AG_Tokenize !chests _ Model_OpenChests_Array_
  3802. if #result <= 0
  3803. return #false
  3804. set !count #result
  3805.  
  3806. for !i 1 !count
  3807. {
  3808. set !chest %Model_OpenChests_Array_ . !i
  3809. if !chest = bank || !chest = home || !chest = smith || !chest = tailor
  3810. {
  3811. gosub safecall Model_ChangeLocation !chest
  3812. if #result <> #true
  3813. return #false
  3814.  
  3815. if !chest = bank
  3816. gosub safecall Std_OpenBankBox %Location_Vendor
  3817. }
  3818. else
  3819. {
  3820. gosub safecall Yeld
  3821. set !contposx #contposx
  3822. set !contposy #contposy
  3823. set !contsize #contsize
  3824. gosub safecall Std_UseObject !chest
  3825. set !timeout #systime + 3000
  3826. set !minTimeout #systime + 500
  3827. while #systime < !timeout && #contposx = !contposx && #contposy = !contposy && !contsize = #contsize
  3828. {
  3829. }
  3830. while #systime < !minTimeout
  3831. {
  3832. }
  3833. }
  3834. }
  3835. return #true
  3836.  
  3837. ;=======================================
  3838. ;* @name Model_RecycleItems
  3839. ;* @author AG
  3840. ;* @purpose Ricicla tutti gli item inutilizzati nel backpack, aventi tipo di oggetto uguale a quello necessario
  3841. ;* per fillare il bod corrente.
  3842. ;* Esclude a priori tutti gli item blessed ed insured.
  3843. ;* Tenta di riciclare ciò che può. Se delle operazioni falliscono, gli errori vengono ignorati.
  3844. ;* @returns #true, sempre e comunque.
  3845. ;* @example gosub safecall Model_RecycleItems
  3846. ;* @status Partially tested
  3847.  
  3848. sub Model_RecycleItems
  3849. set !cutUpCloth %Constants_CutUpCloth
  3850. set !trash %Config_Home_Trash
  3851. set !type %CurrentBod_ItemID
  3852. set !uncuttables %Constants_BoneItems
  3853. if %CurrentBod_Tailor
  3854. set !method cut
  3855. else
  3856. set !method smelt
  3857.  
  3858. gosub safecall Yeld
  3859.  
  3860. ; Ottimizzazione per uncuttables: si imposta un metodo di riciclaggio sconosciuto (trash),
  3861. ; in modo da causare la semplice restituzione della lista di oggetti, filtrata secondo le politiche di sicurezza.
  3862. if !type in !uncuttables
  3863. gosub safecall Std_RecycleItems !type trash #backpackid
  3864. else
  3865. gosub safecall Std_RecycleItems !type !method #backpackid
  3866. set !notRecycled #result
  3867.  
  3868. gosub safecall Yeld
  3869. if !method = cut
  3870. gosub safecall Std_RecycleItems !cutUpCloth combine #backpackid
  3871.  
  3872. gosub safecall AG_Tokenize !notRecycled _ Temp_Array_
  3873. set !count #result
  3874. if !count > 0
  3875. {
  3876. for !i 1 !count
  3877. {
  3878. set !item %Temp_Array_ . !i
  3879. gosub safecall Std_MoveObject !item !trash
  3880. gosub safecall Yeld
  3881. }
  3882. }
  3883. return #true
  3884.  
  3885. ;=======================================
  3886. ;* @name Model_PlaceCurrentBod
  3887. ;* @author AG
  3888. ;* @purpose Sposta il BOD corrente in maniera intelligente, a seconda del luogo in cui ci si trova.
  3889. ;* @returns
  3890. ;* @example gosub safecall Model_PlaceCurrentBod
  3891. ;* @status Partially tested
  3892.  
  3893. ;=======================================
  3894. ;* @name Model_PlaceCurrentBod
  3895. ;* @author AG, fixed by TakilianRueshin
  3896. ;* @purpose Sposta il BOD corrente in maniera intelligente, a seconda del luogo in cui ci si trova.
  3897. ;* @returns
  3898. ;* @example gosub safecall Model_PlaceCurrentBod
  3899. ;* @status Partially tested
  3900.  
  3901. sub Model_PlaceCurrentBod
  3902. set !bod %CurrentBod_Id
  3903. set !clsTrash %Constants_TrashBarrel
  3904. set !location %Location_Name
  3905. set !tailor %CurrentBod_Tailor
  3906. set !action %CurrentBod_Action
  3907. set !dismissBodbook #false
  3908.  
  3909. gosub safecall Yeld
  3910. if !action = keep
  3911. {
  3912. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Keep
  3913. set !dismissBodbook #true
  3914. }
  3915. if !action = trash
  3916. {
  3917. if %Config_Bodbooks_Trash <> !null
  3918. {
  3919. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Trash
  3920. set !dismissBodbook #true
  3921. }
  3922. else
  3923. {
  3924. finditem !clsTrash G_2
  3925. if #findkind <> -1
  3926. {
  3927. gosub safecall Std_MoveObject !bod #findid
  3928. }
  3929. else
  3930. {
  3931. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Fill
  3932. set !dismissBodbook #true
  3933. }
  3934. }
  3935. }
  3936. if !action = deliver
  3937. {
  3938. if ( !tailor && !location = tailor ) || ( ! !tailor && !location = smith )
  3939. {
  3940. gosub safecall Std_Pathfind %Location_X %Location_Y %Location_Z
  3941. gosub safecall Std_MoveObject !bod %Location_Vendor
  3942. }
  3943. else
  3944. {
  3945. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Deliver
  3946. set !dismissBodbook #true
  3947. }
  3948. }
  3949. if !action = fill
  3950. {
  3951. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Fill
  3952. set !dismissBodbook #true
  3953. }
  3954. if !dismissBodbook
  3955. {
  3956. set !timeout #systime + 3000
  3957. while #systime < !timeout && #contsize <> 615_454 ; dismiss bodbook
  3958. {
  3959. }
  3960. if #contsize = 615_454
  3961. {
  3962. set !x #contposx + 50
  3963. set !y #contposy + 50
  3964. click !x !y r
  3965. }
  3966. }
  3967. return
  3968.  
  3969. sub Model_PlaceCurrentBod_old ; before Takilian's fix
  3970. set !bod %CurrentBod_Id
  3971. set !clsTrash %Constants_TrashBarrel
  3972. set !location %Location_Name
  3973. set !tailor %CurrentBod_Tailor
  3974. set !action %CurrentBod_Action
  3975. set !dismissBodbook #false
  3976.  
  3977. gosub safecall Yeld
  3978. if !action = keep
  3979. {
  3980. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Keep
  3981. set !dismissBodbook #true
  3982. }
  3983. if !action = trash
  3984. {
  3985. if %Config_Bodbooks_Trash <> !null
  3986. {
  3987. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Trash
  3988. }
  3989. else
  3990. {
  3991. finditem !clsTrash G_2
  3992. if #findkind <> -1
  3993. {
  3994. gosub safecall Std_MoveObject !bod #findid
  3995. }
  3996. else
  3997. {
  3998. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Fill
  3999. set !dismissBodbook #true
  4000. }
  4001. }
  4002. }
  4003. if !action = deliver
  4004. {
  4005. if ( !tailor && !location = tailor ) || ( ! !tailor && !location = smith )
  4006. {
  4007. gosub safecall Std_Pathfind %Location_X %Location_Y %Location_Z
  4008. gosub safecall Std_MoveObject !bod %Location_Vendor
  4009. }
  4010. else
  4011. {
  4012. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Deliver
  4013. set !dismissBodbook #true
  4014. }
  4015. }
  4016. if !action = fill
  4017. {
  4018. gosub safecall Std_MoveObject !bod %Config_Bodbooks_Fill
  4019. set !dismissBodbook #true
  4020. }
  4021. if !dismissBodbook
  4022. {
  4023. set !timeout #systime + 3000
  4024. while #systime < !timeout && #contsize <> 615_454 ; dismiss bodbook
  4025. {
  4026. }
  4027. if #contsize = 615_454
  4028. {
  4029. set !x #contposx + 50
  4030. set !y #contposy + 50
  4031. click !x !y r
  4032. }
  4033. }
  4034. return
  4035.  
  4036. ;=======================================
  4037. ;* @name Model_FillSmallBodCycle
  4038. ;* @author AG, fixed by Smjert
  4039. ;* @purpose Riempie small bods a ripetizione, estraendoli dai bodbooks.
  4040. ;* @params %1 opt Numero di iterazioni da eseguire. Se non specificato, si itera all'infinito.
  4041. ;* @returns #true se tutte le iterazioni sono terminate. Un codice di errore in caso contrario.
  4042. ;* @example gosub safecall Model_FillSmallBodCycle 20
  4043. ;* @status Under development
  4044.  
  4045. sub Model_FillSmallBodCycle
  4046. if %0 < 1 || ! ( %1 > 0 )
  4047. set !iterations 10000
  4048. else
  4049. set !iterations %1
  4050.  
  4051. ; @todo: Eliminare algoritmo di alternanza (deprecato)
  4052. set !bodbook1 %Config_Bodbooks_Fill
  4053. set !bodbook2 %Config_Bodbooks_Fill
  4054. set !bodbook !bodbook1
  4055. set !alternate !bodbook1 <> !bodbook2
  4056.  
  4057. while #true
  4058. {
  4059. gosub safecall Std_ReadProperty %Config_Bodbooks_Deliver
  4060. set !property #result
  4061. str pos !property Book:
  4062. set !index #strres + 5
  4063. str del !property 1 !index
  4064. set !property #strres
  4065. str pos !property $
  4066. set !index #strres - 1
  4067. str left !property !index
  4068. set !property #strres
  4069.  
  4070. if !property >= !iterations
  4071. break
  4072.  
  4073. gosub safecall DoTasks
  4074. gosub safecall Model_ChangeLocation home
  4075. if #result = #false
  4076. return cannot_change_location
  4077. if h notin #charstatus
  4078. event macro 13 21 ; Useskill Hiding
  4079.  
  4080. finditem %Constants_Bod C_ , #backpackid
  4081. if #findkind = -1
  4082. {
  4083. if !alternate
  4084. {
  4085. if !bodbook = !bodbook1
  4086. set !bodbook !bodbook2
  4087. else
  4088. set !bodbook !bodbook1
  4089. }
  4090.  
  4091. gosub safecall Std_ExtractBod !bodbook
  4092. if #result = #false
  4093. {
  4094. set !alternate #false ; smettila di alternare se uno dei due bodbook è vuoto!
  4095. if !bodbook = !bodbook1
  4096. set !bodbook !bodbook2
  4097. else
  4098. set !bodbook !bodbook1
  4099.  
  4100. gosub safecall Std_ExtractBod !bodbook
  4101. if #result = #false
  4102. return empty_bodbooks
  4103. }
  4104. continue
  4105. }
  4106. set !bod #findid
  4107.  
  4108. gosub safecall Model_AnalyzeBod !bod
  4109.  
  4110. if %CurrentBod_Action = fill
  4111. {
  4112. gosub safecall Model_FillSmallBod !bod
  4113. if cannot_restock_material in #result || too_many_attempts in #result
  4114. continue
  4115.  
  4116. if cannot_restock_tools in #result
  4117. {
  4118. return #result
  4119. }
  4120. ; @todo aggiornare statistiche
  4121. gosub safecall Model_AnalyzeBod !bod
  4122. }
  4123.  
  4124. gosub safecall Model_PlaceCurrentBod
  4125. ; @todo aggiornare statistiche
  4126. }
  4127. return #true
  4128.  
  4129. ;=======================================
  4130. ;* @name Model_DeliverBodCycle
  4131. ;* @author AG
  4132. ;* @purpose Consegna small bods a ripetizione, estraendoli dai bodbooks.
  4133. ;* Richiede nuovi bod al vendor man mano che consegna.
  4134. ;* Si ferma se il peso è eccessivo a causa dei troppi premi ricevuti.
  4135. ;* @params %1 req A chi consegnare? Può essere: tailor, smith.
  4136. ;* %2 opt Numero di iterazioni da eseguire. Se non specificato, si itera all'infinito.
  4137. ;* @returns #true se tutte le iterazioni sono terminate. Un codice di errore in caso contrario.
  4138. ;* @example gosub safecall Model_DeliverBodCycle tailor 20
  4139. ;* @status Under development
  4140.  
  4141. sub Model_DeliverBodCycle ; %location %iterations
  4142. if %0 < 1 || ( %1 <> tailor && %1 <> smith )
  4143. {
  4144. event exmsg #charid 3 0 Unexpected value for location: %1
  4145. return invalid_params
  4146. }
  4147. set !location %1
  4148. set !tailor !location = tailor
  4149. if %0 < 2 || ! ( %2 > 0 )
  4150. set !iterations 10000
  4151. else
  4152. set !iterations %2
  4153. set !bodbook %Config_Bodbooks_Deliver
  4154. set !clsBod %Constants_Bod
  4155.  
  4156. gosub safecall Yeld
  4157. event exmsg #charid 3 0 Vado a consegnare i BOD !location , #dot
  4158. gosub safecall Std_SetBodbookFilter !bodbook all all !location all
  4159.  
  4160. if #result = #false
  4161. return book_empty
  4162.  
  4163. set !delivered 0
  4164. while #true
  4165. {
  4166. if !delivered > !iterations
  4167. return #true
  4168.  
  4169. gosub safecall DoTasks
  4170. gosub safecall Yeld
  4171. gosub safecall Std_CheckOverweight 50 15
  4172. if #result <> #false
  4173. return overweight
  4174.  
  4175. ; cerca bod nel backpack
  4176. finditem !clsBod C_ , #backpackid
  4177. if #findkind = -1
  4178. {
  4179. gosub safecall Std_ExtractBod !bodbook
  4180. if #result = #false
  4181. return no_more_bods
  4182. wait 4s ; Il turn-in dei bod è ogni 10sec, da qui bastano 6sec di wait circa
  4183. continue
  4184. }
  4185. set !bod #findid
  4186.  
  4187. gosub safecall Model_AnalyzeBod !bod
  4188. if #result <> #true
  4189. continue
  4190.  
  4191. if %CurrentBod_Tailor <> !tailor
  4192. {
  4193. gosub safecall Model_PlaceCurrentBod
  4194. gosub safecall Yeld
  4195. gosub safecall Std_SetBodbookFilter !bodbook small all !location all
  4196. continue
  4197. }
  4198. if %CurrentBod_Action <> deliver
  4199. {
  4200. gosub safecall Model_PlaceCurrentBod
  4201. continue
  4202. }
  4203.  
  4204. gosub safecall Model_DetectLocation ; extra check for stability
  4205. if %Location_Name <> !location
  4206. {
  4207. gosub safecall Model_ChangeLocation !location
  4208. if #result = #false
  4209. return cannot_change_location
  4210. }
  4211. set !vendor %Location_Vendor
  4212.  
  4213. if !delivered = 0
  4214. gosub safecall Std_AskNewBod !vendor
  4215. gosub safecall Model_PlaceCurrentBod !bod
  4216. gosub safecall Yeld
  4217. gosub safecall Std_AskNewBod !vendor
  4218. set !delivered !delivered + 1
  4219. }
  4220. return #true
  4221.  
  4222. sub Model_AnalyzeRunebook ; %runebook
  4223. set !runebook %1
  4224. set !recallMode %Config_RecallMode
  4225.  
  4226. set !result
  4227. for !i 1 16
  4228. {
  4229. if !no_more_runes = #true
  4230. {
  4231. set !result !result , x
  4232. continue
  4233. }
  4234. while #mana < 20
  4235. {
  4236. gosub safecall Yeld
  4237. event exmsg #charid 3 0 Troppo poco mana! 15 secondi di meditazione.
  4238. event macro 13 46 ; UseSkill Meditation
  4239. wait 15s
  4240. }
  4241. gosub safecall Yeld
  4242. gosub safecall Std_SafeUseRunebook !runebook !recallMode !i
  4243. if #result = #false
  4244. {
  4245. event exmsg #charid 3 0 Runebook terminato.
  4246. set !no_more_runes #true
  4247. set !result !result , x
  4248. continue
  4249. }
  4250. gosub safecall Model_DetectLocation
  4251. if %Location_Name = unknown
  4252. event exmsg #charid 3 0 Non riconosco questo luogo.
  4253. if %Location_Name = smith
  4254. event exmsg #charid 3 0 Ho trovato un fabbro!
  4255. if %Location_Name = tailor
  4256. event exmsg #charid 3 0 Ho trovato un sarto!
  4257. if %Location_Name = bank
  4258. event exmsg #charid 3 0 Ho trovato una banca!
  4259. if %Location_Name = home
  4260. event exmsg #charid 3 0 Ho trovato casa!
  4261. str left %Location_Name 1
  4262. set !result !result , #strres
  4263. }
  4264. return !result
  4265.  
  4266. sub Model_PlaceObjects ; %customList
  4267. set !objectTypes %Constants_Resources_Types , _ , %Constants_Rewards_Types , _ , %Constants_Bod
  4268.  
  4269. if %0 < 1 || %1 = !null
  4270. {
  4271. finditem !objectTypes C_ , #backpackid
  4272. if #findkind = -1
  4273. return #true
  4274. set !objects_count #findcnt
  4275. if !objects_count > 0
  4276. {
  4277. for #findindex 1 #findcnt
  4278. {
  4279. set !objects_ . #findindex #findid
  4280. }
  4281. }
  4282. }
  4283. else
  4284. {
  4285. gosub safecall AG_Tokenize %1 _ Temp_Array_
  4286. set !objects_count #result
  4287. if !objects_count <= 0
  4288. return #true
  4289. if !objects_count > 0
  4290. {
  4291. for !i 1 !objects_count
  4292. {
  4293. set !objects_ . !i %Temp_Array_ . !i
  4294. }
  4295. }
  4296. }
  4297.  
  4298. gosub safecall Model_ChangeLocation home
  4299.  
  4300. for !i 1 !objects_count
  4301. {
  4302. set !object !objects_ . !i
  4303. finditem !object C_ , #backpackid
  4304. if #findkind = -1
  4305. continue
  4306. set !type #findtype
  4307. set !quantity #findstack
  4308.  
  4309. if !type = %Constants_Bod
  4310. {
  4311. gosub safecall Model_AnalyzeBod !object
  4312. gosub safecall Model_PlaceCurrentBod
  4313. continue
  4314. }
  4315.  
  4316. gosub safecall Std_IdentifyObject !object
  4317. if #result = #false
  4318. set !code !null
  4319. else
  4320. set !code #result
  4321. set !chestType !null
  4322. if !code in %Constants_Rewards_All
  4323. {
  4324. if !code notin %Config_RewardFilter_Rewards ; trash or recycle
  4325. {
  4326. gosub safecall Yeld
  4327. if !type = %Constants_Cloth
  4328. gosub safecall Std_UseObject %Config_Home_DyingTub !object
  4329. else
  4330. gosub safecall Std_MoveObject !object %Config_Home_Trash !quantity
  4331. continue
  4332. }
  4333. set !chestType rewards
  4334. }
  4335. if !code in %Constants_Resources_All
  4336. {
  4337. set !chestType work
  4338. }
  4339. if !chestType = !null ; unrecognized object
  4340. {
  4341. continue
  4342. }
  4343.  
  4344. if !chests_ . !chestType = !null
  4345. {
  4346. gosub safecall Model_OpenChests !chestType
  4347. if #result = #false
  4348. set !chests_ . !chestType #false
  4349. else
  4350. set !chests_ . !chestType %Config_Chests_ . !chestType
  4351. }
  4352. if !chests_ . !chestType = #false
  4353. {
  4354. continue
  4355. }
  4356.  
  4357. gosub safecall Yeld
  4358. set !containers !chests_ . !chestType
  4359. gosub safecall Std_GetMostAffineContainer !containers !object ; @todo ottimizzare con caching risultati
  4360. set !destination #result
  4361. gosub safecall Std_MoveObject !object !destination !quantity
  4362. }
  4363. return #true
  4364.  
  4365. ;=======================================
  4366. ;* @name Model_RecallingRestock
  4367. ;* @author AG
  4368. ;* @purpose Effettua il restock di oggetti anche da containers che si trovano in luoghi diversi.
  4369. ;* Gli unici luoghi supportati al momento sono quelli definiti per lo script: home, bank, tailor, smith.
  4370. ;* @params %1 req Lista di contenitori sorgente. E' possibile specificare una location all'inizio della lista.
  4371. ;* %2 req Lista di contenitori destinazione. E' possibile specificare una location all'inizio della lista.
  4372. ;* %3 req ID del tipo di oggetto da restockare.
  4373. ;* %4 opt Colore del tipo di oggetti da restockare. Default = 0.
  4374. ;* %5 opt Peso di un singolo oggetto del tipo da restockare. Se non specificato, la sub lo calcolerà automaticamente.
  4375. ;* @returns #true se l'operazione va a buon fine. #false altrimenti.
  4376. ;* @example gosub safecall Model_RecallingRestock %source %dest %materialId %materialColor %materialWeight
  4377. ;* @status Under development
  4378.  
  4379. sub Model_RecallingRestock ; %source %dest %materialId %materialColor %materialWeight %maxRestock
  4380. set !source %1
  4381. set !dest %2
  4382. set !materialId %3
  4383. if %0 < 4 || %4 = !null
  4384. set !materialColor 0
  4385. else
  4386. set !materialColor %4
  4387. if %0 < 5
  4388. set !materialWeight !null
  4389. else
  4390. set !materialWeight %5
  4391. if %0 < 6
  4392. set !maxRestock 60000
  4393. else
  4394. set !maxRestock %6
  4395.  
  4396. if !materialWeight = !null
  4397. {
  4398. gosub safecall Std_GetObjectWeight !materialId
  4399. if ! ( #result > 0 )
  4400. {
  4401. gosub safecall Model_OpenChests !source
  4402. gosub safecall Std_GetObjectWeight !materialId
  4403. if ! ( #result > 0 )
  4404. return #false
  4405. }
  4406. set !materialWeight #result
  4407. }
  4408.  
  4409. gosub safecall Helper_StripLocation !source
  4410. set !sourceChests #result
  4411. gosub safecall Helper_StripLocation !dest
  4412. set !destChests #result
  4413. set !minQuantity 1
  4414.  
  4415. while #true
  4416. {
  4417. set !maxQuantity ( #maxweight - #weight - 20 ) * 1000 / !materialWeight
  4418. gosub safecall Std_GetObjectCount C_ , #backpackid !materialId !materialColor
  4419. set !maxQuantity !maxQuantity + #result
  4420.  
  4421. gosub safecall Model_OpenChests !source
  4422. if #result = #false
  4423. break
  4424.  
  4425. gosub safecall Yeld
  4426. gosub safecall Std_RestockItem !materialId !sourceChests #backpackid !minQuantity !maxQuantity !materialColor #true
  4427. if #result = #false
  4428. break
  4429.  
  4430. gosub safecall Model_OpenChests !dest
  4431. if #result = #false
  4432. break
  4433.  
  4434. gosub safecall Std_GetMostAffineContainer !destChests !materialId !materialColor !null
  4435. set !destChest #result
  4436. gosub safecall Yeld
  4437. gosub safecall Std_RestockItem !materialId #backpackid !destChest !maxRestock !maxRestock !materialColor #false
  4438. if #result = #true
  4439. break
  4440. }
  4441. return #true
  4442.  
  4443. sub Helper_StripLocation ; %input
  4444. set !input %1
  4445. set !location !null
  4446. if home_ in !input
  4447. set !location home_
  4448. if bank_ in !input
  4449. set !location bank_
  4450. if tailor_ in !input
  4451. set !location tailor_
  4452. if smith_ in !input
  4453. set !location smith_
  4454. if !location = !null
  4455. return !input
  4456.  
  4457. str pos !input !location
  4458. set !index #strres
  4459. str len !location
  4460. set !index !index + #strres - 1
  4461. str del !input 1 !index
  4462. return #strres
  4463.  
  4464. ;=======================================
  4465. ;* @name Model_BankRestock
  4466. ;* @author AG
  4467. ;* @purpose Effettua il restock di oggetti dalla banca verso i containers a casa.
  4468. ;* @params %1 req Lista di risorse da restockare, nella forma _id:color_id:color_.
  4469. ;* @example gosub safecall Model_BankRestock %Constants_Resources_All
  4470.  
  4471. sub Model_BankRestock ; %resourceList
  4472. set !resources %1
  4473. gosub safecall AG_Tokenize !resources _ Model_BankRestock_List_
  4474. set !count #result
  4475. if !count <= 0
  4476. return
  4477.  
  4478. set !source bank_ , %Config_Chests_Bank
  4479. set !dest home_ , %Config_Chests_Work
  4480. for !i 1 !count
  4481. {
  4482. set !code %Model_BankRestock_List_ . !i
  4483. gosub safecall Model_GetHumanName !code
  4484. if #result = !null
  4485. set #result Item
  4486. event exmsg #charid 3 0 Restocking #result , #dot
  4487.  
  4488. gosub safecall AG_Tokenize !code : Temp_Array_
  4489. set !type %Temp_Array_1
  4490. set !color %Temp_Array_2
  4491. set !weight !null
  4492. if !type in %Constants_Resources_Light
  4493. set !weight 100
  4494. if !type in %Constants_Resources_Heavy
  4495. set !weight 1000
  4496. gosub safecall Model_RecallingRestock !source !dest !type !color !weight
  4497. }
  4498. return
  4499.  
  4500. ;=======================================
  4501. ;* @name Model_FillLargeBodCycle
  4502. ;* @author AG
  4503. ;* @purpose Ciclo per riempire tutti i bod large che si trovano nel bodbook "da conservare".
  4504. ;* @example gosub safecall Model_FillLargeBodCycle
  4505. ;* @status Under development
  4506.  
  4507. sub Model_FillLargeBodCycle
  4508. set !book %Config_Bodbooks_Keep
  4509. set !clsBod %Constants_Bod
  4510.  
  4511. while #true
  4512. {
  4513. ;---------------------------------
  4514. ; Fase 1: Estrazione large BODs
  4515. ;---------------------------------
  4516.  
  4517. if !moreSmall <> #true
  4518. {
  4519. ; rimetti a posto tutti i bod nel backpack
  4520. gosub safecall Model_PlaceObjects
  4521.  
  4522. ; estrai un bod large
  4523. gosub safecall Yeld
  4524. gosub safecall Std_SetBodbookFilter !book large all all all
  4525. gosub safecall Std_ExtractBod !book
  4526. if #result = #false
  4527. break
  4528. finditem !clsBod C_ , #backpackid
  4529. if #findkind = -1 ; should never happen
  4530. break
  4531. set !largebod #findid
  4532.  
  4533. ; analizza il bod corrente
  4534. set !timeout #systime + 3000
  4535. repeat
  4536. gosub libcall BodFunctions.euo AnalyzeBod !largebod Model_FillLargeBod_ obmq
  4537. until #result = #true || #systime > !timeout
  4538. if #result = #false
  4539. continue ; error
  4540.  
  4541. set !material %Model_FillLargeBod_MaterialName
  4542. set !quantity %Model_FillLargeBod_Quantity
  4543. if %Model_FillLargeBod_Exceptional
  4544. set !exceptional exceptional
  4545. else
  4546. set !exceptional normal
  4547.  
  4548. ; salva la tipologia di filtro, in maniera da non ripeterla in seguito
  4549. set !filterId !exceptional , _ , !material , _ , !quantity
  4550. if !firstFilterId = !null
  4551. {
  4552. set !firstFilterId !filterId
  4553. }
  4554. else
  4555. {
  4556. if !firstFilterId = !filterId
  4557. {
  4558. event exmsg #charid 3 0 Ho analizzato l'intero libro.
  4559. break
  4560. }
  4561. }
  4562.  
  4563. ; estrai i bod simili a quello corrente (solo large)
  4564. gosub safecall Yeld
  4565. gosub safecall Std_SetBodbookFilter !book large !exceptional !material !quantity
  4566. gosub safecall Std_ExtractBod !book 40 ;all
  4567. }
  4568.  
  4569. ;-----------------------------
  4570. ; Fase 2: Analisi large BODs
  4571. ;-----------------------------
  4572.  
  4573. event exmsg #charid 3 0 Sto analizzando i large BOD nel backpack.
  4574.  
  4575. ; salva tutti i large bod estratti in !listLarge
  4576. set !listLarge_count 0
  4577. set !listLarge_string _
  4578. finditem !clsBod C_ , #backpackid
  4579. if #findkind <> -1
  4580. {
  4581. for #findindex 1 #findcnt
  4582. {
  4583. set !listLarge_count !listLarge_count + 1
  4584. set !listLarge_ . !listLarge_count #findid
  4585. set !listLarge_string !listLarge_string , #findid , _
  4586. }
  4587. }
  4588. if !listLarge_count = 0
  4589. {
  4590. event exmsg #charid 3 0 Comportamento inatteso...
  4591. continue
  4592. }
  4593.  
  4594. ; riempi le liste list0...list6 in base al valore di Quantity - FillCount
  4595. set !list0_count 0
  4596. set !list1_count 0
  4597. set !list2_count 0
  4598. set !list3_count 0
  4599. set !list4_count 0
  4600. set !list5_count 0
  4601. set !list6_count 0
  4602. for !i 1 !listLarge_count
  4603. {
  4604. set !bod !listLarge_ . !i
  4605. set !timeout #systime + 3000
  4606. repeat
  4607. gosub libcall BodFunctions.euo AnalyzeBod !bod Model_FillLargeBod_ obmq
  4608. until #result = #true || #systime > !timeout
  4609. if #result = #false
  4610. continue
  4611.  
  4612. set !leftCount %Model_FillLargeBod_Cardinality - %Model_FillLargeBod_FillCount
  4613. set !listname list , !leftCount , _
  4614.  
  4615. ; aggiorna list[i]_count
  4616. set !varname !listname , count
  4617. set !count ! . !varname
  4618. set !count !count + 1
  4619. set ! . !varname !count
  4620.  
  4621. ; aggiungi a list[i]
  4622. set !varname !listname , !count
  4623. set ! . !varname !bod
  4624. }
  4625.  
  4626. ;----------------------------------
  4627. ; Fase 3: Estrazione small BODs
  4628. ;----------------------------------
  4629.  
  4630. ; estrai i bod simili a quello corrente (solo small)
  4631. gosub safecall Yeld
  4632. gosub safecall Std_SetBodbookFilter !book small !exceptional !material !quantity
  4633. gosub safecall Std_ExtractBod !book 25 ;25
  4634.  
  4635. ; salva gli small bod estratti dentro !listSmall
  4636. set !listSmall_string _
  4637. set !listSmall_count 0
  4638. finditem !clsBod C_ , #backpackid
  4639. if #findkind <> -1
  4640. {
  4641. for #findindex 1 #findcnt
  4642. {
  4643. if #findid in !listLarge_string ; ignora i bod large
  4644. continue
  4645. set !listSmall_count !listSmall_count + 1
  4646. set !listSmall_ . !listSmall_count #findid
  4647. set !listSmall_string !listSmall_string , #findid , _
  4648. }
  4649. }
  4650.  
  4651. ;----------------------------------
  4652. ; Fase 4: Fillaggio
  4653. ;----------------------------------
  4654.  
  4655. if !listSmall_count > 0
  4656. {
  4657. for !i 1 6 ; itera attraverso le liste
  4658. {
  4659. set !listname list , !i , _
  4660. set !varname !listname , count
  4661. set !list_count ! . !varname
  4662. if !list_count = 0
  4663. continue
  4664.  
  4665. for !j 1 !list_count ; itera nella lista corrente
  4666. {
  4667. set !varname !listname , !j
  4668. set !largebod ! . !varname
  4669.  
  4670. gosub safecall Yeld
  4671. gosub safecall Std_UseObject !largebod
  4672. gosub safecall Std_WaitForBodGump
  4673. if #result = #false
  4674. continue ; fallimento
  4675.  
  4676. for !k 1 !listSmall_count ; itera fra gli small bods
  4677. {
  4678. set !smallbod !listSmall_ . !k
  4679.  
  4680. finditem !smallbod C_ , #backpackid
  4681. if #findkind = -1
  4682. continue
  4683.  
  4684. gosub safecall Yeld
  4685. gosub safecall Std_ClickBodGumpButton fill
  4686. gosub safecall Std_SelectTarget !smallbod
  4687. if #result = #false ; mirino non visualizzato: probabilmente il large bod è pieno
  4688. break
  4689. }
  4690.  
  4691. ; dismiss gump if opened
  4692. gosub safecall Std_CheckForBodGump
  4693. if #result = #true
  4694. gosub safecall Std_ClickBodGumpButton exit
  4695. if #targcurs = 1
  4696. set #targcurs 0
  4697. }
  4698. }
  4699. }
  4700.  
  4701. ; ci sono ancora small da estrarre se "ne erano stati estratti 25 o più" e "ne è stato inserito almeno uno" (evita cicli)
  4702. finditem !listSmall_string C_ , #backpackid
  4703. set !smallbod_count #findcnt
  4704. set !moreSmall ( !listSmall_count >= 25 ) && ( !smallbod_count < !listSmall_count )
  4705.  
  4706. ; piccolo trucco per "ingannare" lo script nel caso di bod misti cloth + leather
  4707. if ( !material = cloth ) && ( !moreSmall = #false )
  4708. {
  4709. set !material leather
  4710. set !moreSmall #true
  4711. }
  4712.  
  4713. gosub safecall Model_PlaceObjects !listSmall_string ; sposta solo i bod small
  4714. }
  4715.  
  4716. gosub safecall Model_PlaceObjects
  4717. return
  4718.  
  4719. sub Model_FullCycle
  4720. while #true
  4721. {
  4722. gosub safecall Model_PlaceObjects
  4723. gosub safecall Model_FillSmallBodCycle 20
  4724. gosub safecall Model_DeliverBodCycle tailor
  4725. gosub safecall Model_PlaceObjects
  4726. gosub safecall Model_DeliverBodCycle smith
  4727. }
  4728. return
  4729.  
  4730.  
  4731.  
  4732. ;==========================================================
  4733. ;=
  4734. ;=
  4735. ;= FUNZIONI DI INTERFACCIA GRAFICA (prefisso "View")
  4736. ;=
  4737. ;=
  4738. ;==========================================================
  4739.  
  4740. ;=======================================
  4741. ;* @name View_MenuLoop
  4742. ;* @author AG
  4743. ;* @purpose Loop che cicla da un menu all'altro a seconda del valore di %Menu_Name.
  4744. ;* Se %Menu_Name viene impostato su un valore non valido, la funzione ritorna (usare questo sistama per uscire).
  4745. ;* @params %1 req Menu di partenza. I valori ammessi sono: View_GeneralMenu, View_BodFilterMenu, View_RewardFilterMenu, ecc.
  4746. ;* @example gosub safecall View_MenuLoop View_GeneralMenu
  4747.  
  4748. sub View_MenuLoop
  4749. set %Menu_Name %1
  4750. while #true
  4751. {
  4752. if ( | , %Menu_Name , | ) notin |View_GeneralMenu|View_BodFilterMenu|View_RewardFilterMenu|
  4753. break
  4754. gosub safecall Std_RunMenu %Menu_Name
  4755. set %Menu_Name #result
  4756. }
  4757. return
  4758.  
  4759. ;=======================================
  4760. ;* @name View_SetStatusMessage
  4761. ;* @author AG
  4762. ;* @purpose Routine generica per impostare il messaggio di stato della GUI corrente.
  4763. ;* La GUI deve essere dotata di una label chiamata LblStatus.
  4764. ;* @params Tutti i parametri forniti vengono fusi in un testo di messaggio, usando #spc come separatore.
  4765. ;* @note La sub può essere utilizzata anche senza safecall.
  4766. ;* In particolare, se gli argomenti sono troppi (più di 10), safecall NON PUO' essere utilizzato.
  4767. ;* @example gosub View_SetStatusMessage Questo è un messaggio.
  4768.  
  4769. sub View_SetStatusMessage ; %1...->
  4770. namespace push
  4771. namespace local View_SetStatusMessage , #systime , #random
  4772. set !msg
  4773. if %0 > 0
  4774. {
  4775. for !i 1 %0
  4776. {
  4777. set !arg % . !i
  4778. set !msg !msg , !arg , #spc
  4779. }
  4780. }
  4781. menu set LblStatus !msg
  4782. namespace pop
  4783. namespace clear
  4784. return
  4785.  
  4786. ;=======================================
  4787. ;* @name View_GeneralMenu_Init
  4788. ;* @author AG (using EasyUO Menu Designer)
  4789. ;* @purpose Crea il menu generale.
  4790. ;* @example gosub safecall View_GeneralMenu_Init
  4791.  
  4792. sub View_GeneralMenu_Init
  4793. menu Clear
  4794. menu Window Title Boscags7
  4795. menu Window Color Black
  4796. menu Window Size 305 455
  4797. menu Font Transparent #true
  4798. menu Font Align Right
  4799. menu Shape EUOShape1 4 31 297 387 3 7 2 Blue 7 Black
  4800. menu Shape EUOShape8 154 288 146 5 3 7 1 Blue 7 Black
  4801. menu Shape EUOShape5 4 4 97 33 4 7 2 Blue 7 Black
  4802. menu Shape EUOShape4 5 32 295 5 3 7 1 Blue 7 Black
  4803. menu Shape EUOShape6 5 412 295 5 3 7 1 Blue 7 Black
  4804. menu Shape EUOShape7 151 36 4 361 3 7 1 Blue 7 Black
  4805. menu Shape EUOShape2 5 136 295 5 3 7 1 Blue 7 Black
  4806. menu Shape EUOShape3 5 232 295 5 3 7 1 Blue 7 Black
  4807. menu Shape EUOShape9 5 392 295 5 3 7 1 Blue 7 Black
  4808. menu Shape EUOShape10 154 292 146 101 3 7 1 Blue 7 Navy
  4809. menu Font Name Tahoma
  4810. menu Font Size 10
  4811. menu Font Style b
  4812. menu Font Color Aqua
  4813. menu Font Align Left
  4814. menu Font BGColor Black
  4815. menu Text EUOLabel21 23 9 Generale
  4816. menu Font Name MS Sans Serif
  4817. menu Font Style
  4818. menu Font Color Lime
  4819. menu Text EUOLabel7 12 44 Casa
  4820. menu Text EUOLabel11 160 44 Runebooks
  4821. menu Text EUOLabel24 12 148 Contenitori
  4822. menu Text EUOLabel28 160 148 BOD-Books
  4823. menu Text EUOLabel32 12 244 Strumenti
  4824. menu Font Size 8
  4825. menu Font Color White
  4826. menu Text EUOLabel4 12 116 Dying Tub
  4827. menu Text EUOLabel3 12 104 Trash Barrel
  4828. menu Text EUOLabel2 12 92 Incudine
  4829. menu Text EUOLabel1 12 80 Forgia
  4830. menu Text EUOLabel14 12 68 Coordinate
  4831. menu Text LblHomeTub 92 116 ?
  4832. menu Text LblHomeTrash 92 104 ?
  4833. menu Text LblHomeAnvil 92 92 ?
  4834. menu Text LblHomeForge 92 80 ?
  4835. menu Text LblHomePosition 92 68 ?
  4836. menu Text EUOLabel12 160 68 Casa
  4837. menu Text EUOLabel13 160 80 Banca
  4838. menu Text EUOLabel15 160 92 Sarto
  4839. menu Text EUOLabel16 160 104 Fabbro
  4840. menu Text EUOLabel17 160 116 Skill
  4841. menu Text LblRunebookSkill 240 116 ?
  4842. menu Text LblRunebookSmith 240 104 ?
  4843. menu Text LblRunebookTailor 240 92 ?
  4844. menu Text LblRunebookHome 240 68 ?
  4845. menu Text LblRunebookBank 240 80 ?
  4846. menu Text EUOLabel25 12 172 Risorse (casa)
  4847. menu Text EUOLabel26 12 192 Risorse (banca)
  4848. menu Text EUOLabel27 12 212 Premi
  4849. menu Text EUOLabel29 160 172 Da riempire
  4850. menu Text EUOLabel30 160 184 Da consegnare
  4851. menu Text EUOLabel31 160 196 Da conservare
  4852. menu Text LblStatus 12 398 Pronto
  4853. menu Font Name Times New Roman
  4854. menu Font Size 16
  4855. menu Font Style bi
  4856. menu Font Color Aqua
  4857. menu Font BGColor navy ;White
  4858. menu Text EUOLabel35 190 296 Boscags7
  4859. menu Font Size 8
  4860. menu Font Style i
  4861. menu Font Color Lime
  4862. menu Text EUOLabel36 165 321 The Ultimate Bodding Tool
  4863. menu Font Style
  4864. menu Font Color White
  4865. menu Text EUOLabel37 190 336 - by kusanagi97 -
  4866. menu Font Color Gray
  4867. menu Text EUOLabel38 168 372 Boydon, Scorna, Snicker7
  4868. menu Text EUOLabel39 168 360 many thanks to:
  4869. menu Font Name MS Sans Serif
  4870. menu Font Color White
  4871. menu Font BGColor Black
  4872. menu Text EUOLabel5 160 208 Da ritentare
  4873. menu Text LblBodbookFill 240 172 ?
  4874. menu Text LblBodbookDeliver 240 184 ?
  4875. menu Text LblBodbookKeep 240 196 ?
  4876. menu Text LblBodbookFailed 240 208 ?
  4877. menu Font Size 10
  4878. menu Font Color Lime
  4879. menu Text EUOLabel6 160 244 Opzioni Avanzate
  4880. menu Font Name Tahoma
  4881. menu Font Style b
  4882. menu Font Color Teal
  4883. menu Button BtnRewardFilter 104 4 98 25 Filtro Premi
  4884. menu Button BtnBodFilter 204 4 98 25 Filtro BOD
  4885. menu Font Color Lime
  4886. menu Button BtnStart 204 424 98 25 Avvia
  4887. menu Font Name MS Sans Serif
  4888. menu Font Size 8
  4889. menu Font Style
  4890. menu Font Color White
  4891. menu Check ChkToolCycle 12 368 53 17 #false cicla
  4892. menu Font Name Tahoma
  4893. menu Font Size 7
  4894. menu Font Color Lime
  4895. menu Button BtnSetHome 92 44 26 17 SET
  4896. menu Button BtnSetRunebooks 240 44 26 17 SET
  4897. menu Button BtnSetWorkChests 92 168 26 17 SET
  4898. menu Button BtnSetBankChests 92 188 26 17 SET
  4899. menu Button BtnSetRewardChests 92 208 26 17 SET
  4900. menu Button BtnShowHome 120 44 26 17 GO
  4901. menu Button BtnShowWorkChests 120 168 26 17 USE
  4902. menu Button BtnShowBankChests 120 188 26 17 USE
  4903. menu Button BtnShowRewardChests 120 208 26 17 USE
  4904. menu Button BtnExecuteTool 92 368 54 17 ESEGUI
  4905. menu Button BtnBodbooksHelp 268 148 26 17 ?
  4906. menu Button BtnSetBodbooks 240 148 26 17 SET
  4907. menu Font Color Gray
  4908. menu Button BtnAdvancedOptions 160 264 134 17 VISUALIZZA
  4909. menu Font Name MS Sans Serif
  4910. menu Font Size 8
  4911. menu Font Color Blue
  4912. menu Font BGColor White
  4913. menu List Create LstTools 12 264 133 101
  4914. menu Font BGColor Black
  4915.  
  4916. ; dynamic code begin
  4917. gosub safecall AG_Tokenize %Constants_Tools | View_GeneralMenu_Tools_
  4918. set !count #result
  4919. if !count > 0
  4920. {
  4921. for !i 1 !count
  4922. {
  4923. set !tool %View_GeneralMenu_Tools_ . !i
  4924. gosub safecall Model_GetHumanName !tool
  4925. set !name #result
  4926. menu List Add LstTools !name
  4927. }
  4928. }
  4929. ; dynamic code end
  4930.  
  4931. menu Show
  4932. return |LstTools|ChkToolCycle|LblStatus|
  4933.  
  4934. sub View_GeneralMenu_Idle
  4935. set !no ?
  4936. set !yes OK
  4937.  
  4938. if %Config_Home_DyingTub = !null
  4939. menu set LblHomeTub !no
  4940. else
  4941. menu set LblHomeTub !yes
  4942.  
  4943. if %Config_Home_Trash = !null
  4944. menu set LblHomeTrash !no
  4945. else
  4946. menu set LblHomeTrash !yes
  4947.  
  4948. if %Config_Home_Anvil = !null
  4949. menu set LblHomeAnvil !no
  4950. else
  4951. menu set LblHomeAnvil !yes
  4952.  
  4953. if %Config_Home_Forge = !null
  4954. menu set LblHomeForge !no
  4955. else
  4956. menu set LblHomeForge !yes
  4957.  
  4958. if %Config_Home_PosX = !null || %Config_Home_PosY = !null || %Config_Home_PosZ = !null
  4959. menu set LblHomePosition !no
  4960. else
  4961. menu set LblHomePosition !yes
  4962.  
  4963. if %Config_Bodbooks_Fill = !null
  4964. menu set LblBodbookFill !no
  4965. else
  4966. menu set LblBodbookFill !yes
  4967.  
  4968. if %Config_Bodbooks_Deliver = !null
  4969. menu set LblBodbookDeliver !no
  4970. else
  4971. menu set LblBodbookDeliver !yes
  4972.  
  4973. if %Config_Bodbooks_Keep = !null
  4974. menu set LblBodbookKeep !no
  4975. else
  4976. menu set LblBodbookKeep !yes
  4977.  
  4978. if %Config_Bodbooks_Failed = !null
  4979. menu set LblBodbookFailed !no
  4980. else
  4981. menu set LblBodbookFailed !yes
  4982.  
  4983. set !recallMode !no
  4984. if %Config_RecallMode = recall
  4985. set !recallMode Magery
  4986. if %Config_RecallMode = journey
  4987. set !recallMode Chivalry
  4988. if %Config_RecallAsWraith
  4989. set !recallMode Necromancy
  4990. menu set LblRunebookSkill !recallMode
  4991.  
  4992. gosub safecall AG_Tokenize %Config_Runebooks_Home _ %Temp_Array_
  4993. if #result = 1
  4994. menu set LblRunebookHome #result , #spc , runa
  4995. else
  4996. menu set LblRunebookHome #result , #spc , rune
  4997.  
  4998. gosub safecall AG_Tokenize %Config_Runebooks_Bank _ %Temp_Array_
  4999. if #result = 1
  5000. menu set LblRunebookBank #result , #spc , runa
  5001. else
  5002. menu set LblRunebookBank #result , #spc , rune
  5003.  
  5004. gosub safecall AG_Tokenize %Config_Runebooks_Tailor _ %Temp_Array_
  5005. if #result = 1
  5006. menu set LblRunebookTailor #result , #spc , runa
  5007. else
  5008. menu set LblRunebookTailor #result , #spc , rune
  5009.  
  5010. gosub safecall AG_Tokenize %Config_Runebooks_Smith _ %Temp_Array_
  5011. if #result = 1
  5012. menu set LblRunebookSmith #result , #spc , runa
  5013. else
  5014. menu set LblRunebookSmith #result , #spc , rune
  5015.  
  5016. gosub View_SetStatusMessage Pronto.
  5017. gosub safecall Model_SaveConfig
  5018. return
  5019.  
  5020. sub View_GeneralMenu_BtnGeneral
  5021. gosub safecall Std_CloseMenu %Menu_Name View_GeneralMenu
  5022. return
  5023.  
  5024. sub View_GeneralMenu_BtnRewardFilter
  5025. gosub safecall Std_CloseMenu %Menu_Name View_RewardFilterMenu
  5026. return
  5027.  
  5028. sub View_GeneralMenu_BtnBodFilter
  5029. gosub safecall Std_CloseMenu %Menu_Name View_BodFilterMenu
  5030. return
  5031.  
  5032. sub View_GeneralMenu_BtnStart
  5033. menu hide
  5034. gosub safecall Model_FullCycle
  5035. return
  5036.  
  5037. sub View_GeneralMenu_Closed
  5038. gosub safecall Std_CloseMenu %Menu_Name Quit
  5039. return
  5040.  
  5041. sub View_GeneralMenu_BtnSetHome
  5042. gosub View_SetStatusMessage Analisi della posizione corrente...
  5043. gosub safecall Ctrl_SetHomePosition
  5044. return
  5045. sub View_GeneralMenu_BtnShowHome
  5046. gosub View_SetStatusMessage Movimento verso la posizione a casa...
  5047. gosub safecall Model_ChangeLocation home
  5048. return
  5049.  
  5050. sub View_GeneralMenu_BtnSetRunebooks
  5051. gosub View_SetStatusMessage Impostazione dei runebooks...
  5052. gosub safecall Ctrl_AnalyzeRunebooks
  5053. return
  5054. sub View_GeneralMenu_BtnShowRunebooks
  5055. gosub View_SetStatusMessage Non ancora implementato. ; @todo
  5056. ; @todo
  5057. return
  5058.  
  5059. sub View_GeneralMenu_BtnSetWorkChests
  5060. gosub View_SetStatusMessage Impostazione contenitori di risorse in casa...
  5061. gosub safecall Ctrl_SelectChests work
  5062. return
  5063. sub View_GeneralMenu_BtnSetBankChests
  5064. gosub View_SetStatusMessage Impostazione contenitori di risorse in banca...
  5065. gosub safecall Ctrl_SelectChests bank
  5066. return
  5067. sub View_GeneralMenu_BtnSetRewardChests
  5068. gosub View_SetStatusMessage Impostazione contenitori per i premi...
  5069. gosub safecall Ctrl_SelectChests rewards
  5070. return
  5071. sub View_GeneralMenu_BtnShowWorkChests
  5072. gosub View_SetStatusMessage Apertura contenitori di risorse in casa...
  5073. gosub safecall Model_OpenChests work
  5074. return
  5075. sub View_GeneralMenu_BtnShowBankChests
  5076. gosub View_SetStatusMessage Apertura contenitori di risorse in banca...
  5077. gosub safecall Model_OpenChests bank
  5078. return
  5079. sub View_GeneralMenu_BtnShowRewardChests
  5080. gosub View_SetStatusMessage Apertura contenitori di risorse per i premi...
  5081. gosub safecall Model_OpenChests rewards
  5082. return
  5083.  
  5084. ;--- deprecated ---;
  5085. sub View_GeneralMenu_BtnSetBodbookFill
  5086. gosub View_SetStatusMessage Impostazione BodBook per i BOD da riempire...
  5087. gosub safecall Ctrl_SelectBodBook fill
  5088. return
  5089. sub View_GeneralMenu_BtnSetBodbookDeliver
  5090. gosub View_SetStatusMessage Impostazione BodBook per i BOD da consegnare...
  5091. gosub safecall Ctrl_SelectBodBook deliver
  5092. return
  5093. sub View_GeneralMenu_BtnSetBodbookKeep
  5094. gosub View_SetStatusMessage Impostazione BodBook per i BOD da conservare...
  5095. gosub safecall Ctrl_SelectBodBook keep
  5096. return
  5097. sub View_GeneralMenu_BtnShowBodbookFill
  5098. gosub View_SetStatusMessage Apertura BodBook per i BOD da riempire...
  5099. gosub safecall Std_UseObject %Config_Bodbooks_Fill
  5100. return
  5101. sub View_GeneralMenu_BtnShowBodbookDeliver
  5102. gosub View_SetStatusMessage Apertura BodBook per i BOD da consegnare...
  5103. gosub safecall Std_UseObject %Config_Bodbooks_Deliver
  5104. return
  5105. sub View_GeneralMenu_BtnShowBodbookKeep
  5106. gosub View_SetStatusMessage Apertura BodBook per i BOD da conservare...
  5107. gosub safecall Std_UseObject %Config_Bodbooks_Keep
  5108. return
  5109. ;--- end of deprecated ---;
  5110.  
  5111. sub View_GeneralMenu_BtnSetBodbooks
  5112. gosub View_SetStatusMessage Scansione dei Bodbook nel backpack...
  5113. gosub safecall Model_FindBodbooks
  5114. return
  5115. sub View_GeneralMenu_BtnBodbooksHelp
  5116. gosub View_SetStatusMessage Visualizzazione aiuto per "Set Bodbooks"...
  5117. display ok Per essere riconosciuto, un Bodbook deve contenere nel nome una delle seguenti diciture:$
  5118. +- Da riempire: riempi / vuoti / fill / empty$
  5119. +- Da consegnare: consegna / deliver$
  5120. +- Da conservare: conserva / keep$
  5121. +- Da riprovare: riprova / falliti / retry / failed$
  5122. +- Da scartare (debug): scarta / trash$
  5123. return
  5124.  
  5125. sub View_GeneralMenu_BtnAdvancedOptions
  5126. gosub View_SetStatusMessage Non ancora implementato. ; @todo
  5127. return
  5128.  
  5129. sub View_GeneralMenu_BtnExecuteTool
  5130. gosub safecall View_GeneralMenu_BtnExecuteTool_Inner
  5131. if #result = #true ; Restore menu
  5132. {
  5133. set #menubutton !null
  5134. set #menures !null
  5135. gosub safecall Std_CloseMenu %Menu_Name
  5136. gosub safecall Std_RunMenu %Menu_Name
  5137. }
  5138. return
  5139.  
  5140. sub View_GeneralMenu_BtnExecuteTool_Inner
  5141. set !cycle %View_GeneralMenu_ChkToolCycle
  5142. set !index %View_GeneralMenu_LstTools
  5143. set !tool %View_GeneralMenu_Tools_ . !index
  5144. set !label View_GeneralMenu_Tool_ , !tool
  5145. if !cycle
  5146. set !label !label , _Cycle
  5147.  
  5148. goto !label
  5149. gosub View_SetStatusMessage Strumento non riconosciuto!
  5150. wait 1s
  5151. return
  5152.  
  5153. View_GeneralMenu_Tool_FillSmallBod:
  5154. gosub View_SetStatusMessage Riempimento di un singolo BOD small...
  5155. gosub safecall Ctrl_FillSmallBod
  5156. return
  5157. View_GeneralMenu_Tool_FillSmallBod_Cycle:
  5158. gosub View_SetStatusMessage Riempimento di tutti i BOD small...
  5159. gosub safecall Model_FillSmallBodCycle
  5160. return
  5161. View_GeneralMenu_Tool_FillLargeBod:
  5162. gosub View_SetStatusMessage Versione senza "ciclo" non ancora implementata.
  5163. wait 1s
  5164. return
  5165. View_GeneralMenu_Tool_FillLargeBod_Cycle:
  5166. gosub View_SetStatusMessage Riempimento di tutti i BOD large...
  5167. gosub safecall Model_FillLargeBodCycle
  5168. return
  5169. View_GeneralMenu_Tool_DeliverBod:
  5170. gosub View_SetStatusMessage Consegna di un singolo BOD...
  5171. gosub safecall Ctrl_DeliverBod
  5172. return
  5173. View_GeneralMenu_Tool_DeliverBod_Cycle:
  5174. gosub View_SetStatusMessage Consegna di tutti i BOD...
  5175. gosub safecall Ctrl_DeliverBodCycle
  5176. return
  5177. View_GeneralMenu_Tool_PlaceObject:
  5178. gosub View_SetStatusMessage Posizionamento automatico di un oggetto...
  5179. gosub safecall Ctrl_PlaceReward
  5180. return
  5181. View_GeneralMenu_Tool_PlaceObject_Cycle:
  5182. gosub View_SetStatusMessage Posizionamento automatico degli oggetti nel backpack...
  5183. gosub safecall Ctrl_PlaceRewardCycle
  5184. return
  5185. View_GeneralMenu_Tool_BankRestock:
  5186. gosub View_SetStatusMessage Restock da banca di un singolo materiale...
  5187. gosub safecall Ctrl_BankRestock
  5188. return
  5189. View_GeneralMenu_Tool_BankRestock_Cycle:
  5190. gosub View_SetStatusMessage Restock da banca di tutti i materiali...
  5191. gosub safecall Ctrl_BankRestockCycle
  5192. return
  5193. View_GeneralMenu_Tool_AnalyzeObject:
  5194. gosub View_SetStatusMessage Analisi di un singolo oggetto...
  5195. gosub safecall Ctrl_AnalyzeObject #false
  5196. return #true
  5197. View_GeneralMenu_Tool_AnalyzeObject_Cycle:
  5198. gosub View_SetStatusMessage Analisi di oggetti multipli...
  5199. gosub safecall Ctrl_AnalyzeObject #true
  5200. return #true
  5201. View_GeneralMenu_Tool_MoveObject:
  5202. gosub View_SetStatusMessage Spostamento di oggetti simili (stesso colore)...
  5203. gosub safecall Ctrl_MoveObject #true
  5204. return
  5205. View_GeneralMenu_Tool_MoveObject_Cycle:
  5206. gosub View_SetStatusMessage Spostamento di oggetti simili (colori diversi)...
  5207. gosub safecall Ctrl_MoveObject #false
  5208. return
  5209. return
  5210.  
  5211. ;=======================================
  5212. ;* @name View_RewardFilterMenu_Init
  5213. ;* @author AG (using EasyUO Menu Designer)
  5214. ;* @purpose Crea il menu di filtraggio premi.
  5215. ;* @example gosub safecall View_RewardFilterMenu_Init
  5216.  
  5217. sub View_RewardFilterMenu_Init
  5218. menu Clear
  5219. menu Window Title Boscags7
  5220. menu Window Color Black
  5221. menu Window Size 305 455
  5222. menu Font Transparent #true
  5223. menu Font Align Right
  5224. menu Shape EUOShape1 4 31 297 387 3 7 2 Blue 7 Black
  5225. menu Shape EUOShape5 104 4 97 33 4 7 2 Blue 7 Black
  5226. menu Shape EUOShape6 5 412 295 5 3 7 1 Blue 7 Black
  5227. menu Shape EUOShape3 5 308 295 5 3 7 1 Blue 7 Black
  5228. menu Shape EUOShape2 5 392 295 5 3 7 1 Blue 7 Black
  5229. menu Shape EUOShape7 5 32 295 5 3 7 1 Blue 7 Black
  5230. menu Font Name Tahoma
  5231. menu Font Size 10
  5232. menu Font Style b
  5233. menu Font Color Aqua
  5234. menu Font Align Left
  5235. menu Font BGColor Black
  5236. menu Text EUOLabel21 117 9 Filtro Premi
  5237. menu Font Name MS Sans Serif
  5238. menu Font Style
  5239. menu Font Color Lime
  5240. menu Text EUOLabel7 12 44 Filtro Premi
  5241. menu Text EUOLabel3 12 320 Disposizione Premi
  5242. menu Font Size 8
  5243. menu Font Color Red
  5244. menu Text EUOLabel1 12 72 Da scartare / riciclare
  5245. menu Font Color Blue
  5246. menu Text EUOLabel2 168 72 Da conservare
  5247. menu Font Color Silver
  5248. menu Text EUOLabel8 12 280 Seleziona i premi da conservare e quelli da scartare.
  5249. menu Text EUOLabel4 12 340 Ogni volta che lo script dovrà posizionare un certo premio,
  5250. menu Text EUOLabel5 12 352 tenterà di collocarlo assieme ai premi ad esso più simili.
  5251. menu Text EUOLabel6 12 364 Se non riuscisse a trovarne, lo collocherà nel primo
  5252. menu Text EUOLabel9 12 376 contenitore premi disponibile.
  5253. menu Font Color White
  5254. menu Text LblStatus 12 398 Pronto
  5255. menu Font Name Tahoma
  5256. menu Font Size 10
  5257. menu Font Style b
  5258. menu Font Color Teal
  5259. menu Button BtnGeneral 4 4 98 25 Generale
  5260. menu Button BtnBodFilter 204 4 98 25 Filtro BOD
  5261. menu Font Color Lime
  5262. menu Button BtnStart 204 424 98 25 Avvia
  5263. menu Font Size 7
  5264. menu Font Style
  5265. menu Font Color Blue
  5266. menu Button BtnKeep 144 164 18 17 >
  5267. menu Button BtnKeepAll 144 144 18 17 >>
  5268. menu Font Color Red
  5269. menu Button BtnTrash 144 184 18 17 <
  5270. menu Button BtnTrashAll 144 204 18 17 <<
  5271. menu Font Name MS Sans Serif
  5272. menu Font Size 8
  5273. menu Font Style
  5274. menu Font Color Red
  5275. menu Font BGColor White
  5276. menu List Create LstTrash 12 88 125 189
  5277. menu Font Name MS Sans Serif
  5278. menu Font Size 8
  5279. menu Font Style
  5280. menu Font Color Blue
  5281. menu List Create LstKeep 168 88 125 189
  5282. menu Font Name MS Sans Serif
  5283. menu Font Size 8
  5284. menu Font Style
  5285. menu Font Color WindowText
  5286. menu Font BGColor Window
  5287. menu Combo Create CmbRewardType 168 44 125
  5288. menu Combo Add CmbRewardType Stoffe (sarto)
  5289. menu Combo Add CmbRewardType Sandali (sarto)
  5290. menu Combo Add CmbRewardType Altro (sarto)
  5291. menu Combo Add CmbRewardType Incudini (fabbro)
  5292. menu Combo Add CmbRewardType Martelli (fabbro)
  5293. menu Combo Add CmbRewardType Altro (fabbro)
  5294. menu Combo Select CmbRewardType 1
  5295. menu Show
  5296. return |CmbRewardType|LstTrash|LstKeep|
  5297.  
  5298. sub View_RewardFilterMenu_Over
  5299. set %View_RewardFilterMenu_Initialized !null
  5300. return
  5301.  
  5302. sub View_RewardFilterMenu_Idle
  5303. if %View_RewardFilterMenu_Initialized = !null
  5304. {
  5305. set %View_RewardFilterMenu_Initialized #true
  5306. gosub safecall View_RewardFilterMenu_RefreshLists
  5307. }
  5308.  
  5309. gosub safecall Model_SaveConfig
  5310. return
  5311.  
  5312. sub View_RewardFilterMenu_BtnGeneral
  5313. gosub safecall View_GeneralMenu_BtnGeneral
  5314. return
  5315.  
  5316. sub View_RewardFilterMenu_BtnRewardFilter
  5317. gosub safecall View_GeneralMenu_BtnRewardFilter
  5318. return
  5319.  
  5320. sub View_RewardFilterMenu_BtnBodFilter
  5321. gosub safecall View_GeneralMenu_BtnBodFilter
  5322. return
  5323.  
  5324. sub View_RewardFilterMenu_Closed
  5325. gosub safecall View_GeneralMenu_Closed
  5326. return
  5327.  
  5328. sub View_RewardFilterMenu_BtnStart
  5329. gosub safecall View_GeneralMenu_BtnStart
  5330. return
  5331.  
  5332. sub View_RewardFilterMenu_CmbRewardType
  5333. if %View_RewardFilterMenu_Initialized = #true
  5334. gosub safecall View_RewardFilterMenu_RefreshLists
  5335. return
  5336.  
  5337. sub View_RewardFilterMenu_GetCurrentMask
  5338. set !suffix1 Cloth
  5339. set !suffix2 Sandals
  5340. set !suffix3 Tailor
  5341. set !suffix4 Anvils
  5342. set !suffix5 Hammers
  5343. set !suffix6 Smith
  5344. set !suffix !suffix . %View_RewardFilterMenu_CmbRewardType
  5345. return %Constants_Rewards_ . !suffix
  5346.  
  5347. sub View_RewardFilterMenu_RefreshLists
  5348. gosub safecall View_RewardFilterMenu_GetCurrentMask
  5349. set !mask #result
  5350. set !trues %Config_RewardFilter_Rewards
  5351. gosub safecall View_RefreshOppositeLists !mask !trues
  5352. return
  5353.  
  5354. sub View_RewardFilterMenu_BtnKeep
  5355. set !index %View_RewardFilterMenu_LstTrash
  5356. set !item %Menu_OppositeLists_Sx_ . !index
  5357.  
  5358. gosub safecall AG_AddToken %Config_RewardFilter_Rewards !item _
  5359. set %Config_RewardFilter_Rewards #result
  5360.  
  5361. gosub safecall View_RewardFilterMenu_RefreshLists
  5362. menu List Select LstTrash !index
  5363. return
  5364.  
  5365. sub View_RewardFilterMenu_BtnTrash
  5366. set !index %View_RewardFilterMenu_LstKeep
  5367. set !item %Menu_OppositeLists_Dx_ . !index
  5368.  
  5369. gosub safecall AG_RemoveToken %Config_RewardFilter_Rewards !item _
  5370. set %Config_RewardFilter_Rewards #result
  5371.  
  5372. gosub safecall View_RewardFilterMenu_RefreshLists
  5373. menu List Select LstKeep !index
  5374. return
  5375.  
  5376. sub View_RewardFilterMenu_BtnKeepAll
  5377. gosub safecall View_RewardFilterMenu_GetCurrentMask
  5378. set !mask #result
  5379.  
  5380. gosub safecall AG_AddTokens %Config_RewardFilter_Rewards !mask _
  5381. set %Config_RewardFilter_Rewards #result
  5382.  
  5383. gosub safecall View_RewardFilterMenu_RefreshLists
  5384. return
  5385.  
  5386. sub View_RewardFilterMenu_BtnTrashAll
  5387. gosub safecall View_RewardFilterMenu_GetCurrentMask
  5388. set !mask #result
  5389.  
  5390. gosub safecall AG_RemoveTokens %Config_RewardFilter_Rewards !mask _
  5391. set %Config_RewardFilter_Rewards #result
  5392.  
  5393. gosub safecall View_RewardFilterMenu_RefreshLists
  5394. return
  5395.  
  5396. ;=======================================
  5397. ;* @name View_BodFilterMenu_Init
  5398. ;* @author AG (using EasyUO Menu Designer)
  5399. ;* @purpose Crea il menu di filtraggio bod.
  5400. ;* @example gosub safecall View_BodFilterMenu_Init
  5401.  
  5402. sub View_BodFilterMenu_Init
  5403. menu Clear
  5404. menu Window Title Boscags7
  5405. menu Window Color Black
  5406. menu Window Size 305 455
  5407. menu Font Transparent #true
  5408. menu Font Align Right
  5409. menu Shape EUOShape1 4 31 297 387 3 7 2 Blue 7 Black
  5410. menu Shape EUOShape5 204 4 97 33 4 7 2 Blue 7 Black
  5411. menu Shape EUOShape6 5 412 295 5 3 7 1 Blue 7 Black
  5412. menu Shape EUOShape2 5 392 295 5 3 7 1 Blue 7 Black
  5413. menu Shape EUOShape7 5 32 295 5 3 7 1 Blue 7 Black
  5414. menu Shape EUOShape3 5 308 295 5 3 7 1 Blue 7 Black
  5415. menu Font Name Tahoma
  5416. menu Font Size 10
  5417. menu Font Style b
  5418. menu Font Color Aqua
  5419. menu Font Align Left
  5420. menu Font BGColor Black
  5421. menu Text EUOLabel21 224 9 Filtro BOD
  5422. menu Font Name MS Sans Serif
  5423. menu Font Style
  5424. menu Font Color Lime
  5425. menu Text EUOLabel7 12 44 Filtro BOD basato sui premi
  5426. menu Text EUOLabel3 12 320 Filtri BOD basati su altri criteri
  5427. menu Font Size 8
  5428. menu Font Color Red
  5429. menu Text EUOLabel1 12 72 Da scartare / riciclare
  5430. menu Font Color Blue
  5431. menu Text EUOLabel2 168 72 Da conservare
  5432. menu Font Color White
  5433. menu Text EUOLabel29 12 344 BOD che richiedono ossa:
  5434. menu Text LblStatus 12 398 Pronto
  5435. menu Font Color Silver
  5436. menu Text EUOLabel8 12 280 Seleziona i premi per i quali vale la pena conservare dei
  5437. menu Text EUOLabel9 12 292 large bods. Saranno conservati anche i relativi small bods.
  5438. menu Font Name Tahoma
  5439. menu Font Size 10
  5440. menu Font Style b
  5441. menu Font Color Teal
  5442. menu Button BtnGeneral 4 4 98 25 Generale
  5443. menu Button BtnRewardFilter 104 4 98 25 Filtro Premi
  5444. menu Font Color Lime
  5445. menu Button BtnStart 204 424 98 25 Avvia
  5446. menu Font Size 7
  5447. menu Font Style
  5448. menu Font Color Blue
  5449. menu Button BtnKeep 144 164 18 17 >
  5450. menu Button BtnKeepAll 144 144 18 17 >>
  5451. menu Font Color Red
  5452. menu Button BtnTrash 144 184 18 17 <
  5453. menu Button BtnTrashAll 144 204 18 17 <<
  5454. menu Font Name MS Sans Serif
  5455. menu Font Size 8
  5456. menu Font Style
  5457. menu Font Color Silver
  5458. menu Font BGColor White
  5459. menu List Create LstTrash 12 88 125 189
  5460. menu Font Name MS Sans Serif
  5461. menu Font Size 8
  5462. menu Font Style
  5463. menu Font Color Silver
  5464. menu List Create LstKeep 168 88 125 189
  5465. menu Font Name MS Sans Serif
  5466. menu Font Size 8
  5467. menu Font Style
  5468. menu Font Color WindowText
  5469. menu Combo Create CmbBoneFilter 168 340 125
  5470. menu Combo Add CmbBoneFilter Riempi / Ignora
  5471. menu Combo Add CmbBoneFilter Scarta
  5472. menu Font Name MS Sans Serif
  5473. menu Font Size 8
  5474. menu Font Style
  5475. menu Font Color WindowText
  5476. menu Font BGColor Window
  5477. menu Combo Create CmbBodRewardType 192 44 101
  5478. menu Combo Add CmbBodRewardType Premi sarto
  5479. menu Combo Add CmbBodRewardType Premi fabbro
  5480. menu Combo Select CmbBodRewardType 1
  5481. menu Show
  5482. return |CmbBodRewardType|LstTrash|LstKeep|CmbBoneFilter|
  5483.  
  5484. sub View_BodFilterMenu_Over
  5485. set %View_BodFilterMenu_Initialized !null
  5486. return
  5487.  
  5488. sub View_BodFilterMenu_Idle
  5489. if %View_BodFilterMenu_Initialized = !null
  5490. {
  5491. set %View_BodFilterMenu_Initialized #true
  5492. gosub safecall View_BodFilterMenu_RefreshLists
  5493. }
  5494.  
  5495. if %Config_BodFilter_TrashBoneBods
  5496. set %View_BodFilterMenu_CmbBoneFilter 2
  5497. else
  5498. set %View_BodFilterMenu_CmbBoneFilter 1
  5499.  
  5500. gosub safecall Model_SaveConfig
  5501. return
  5502.  
  5503. sub View_BodFilterMenu_CmbBoneFilter
  5504. if %View_BodFilterMenu_Initialized = #true
  5505. set %Config_BodFilter_TrashBoneBods ( %View_BodFilterMenu_CmbBoneFilter = 2 )
  5506. return
  5507.  
  5508. sub View_BodFilterMenu_CmbBodRewardType
  5509. if %View_BodFilterMenu_Initialized = #true
  5510. gosub safecall View_BodFilterMenu_RefreshLists
  5511. return
  5512.  
  5513. sub View_BodFilterMenu_RefreshLists
  5514. gosub safecall View_BodFilterMenu_GetCurrentMask
  5515. set !mask #result
  5516. set !trues %Config_BodFilter_Rewards
  5517. gosub safecall View_RefreshOppositeLists !mask !trues
  5518. return
  5519.  
  5520. sub View_BodFilterMenu_BtnGeneral
  5521. gosub safecall View_GeneralMenu_BtnGeneral
  5522. return
  5523.  
  5524. sub View_BodFilterMenu_BtnRewardFilter
  5525. gosub safecall View_GeneralMenu_BtnRewardFilter
  5526. return
  5527.  
  5528. sub View_BodFilterMenu_BtnBodFilter
  5529. gosub safecall View_GeneralMenu_BtnBodFilter
  5530. return
  5531.  
  5532. sub View_BodFilterMenu_Closed
  5533. gosub safecall View_GeneralMenu_Closed
  5534. return
  5535.  
  5536. sub View_BodFilterMenu_BtnStart
  5537. gosub safecall View_GeneralMenu_BtnStart
  5538. return
  5539.  
  5540. sub View_BodFilterMenu_GetCurrentMask
  5541. set !suffix1 Tailor
  5542. set !suffix2 Smith
  5543. set !suffix !suffix . %View_BodFilterMenu_CmbBodRewardType
  5544. return %Constants_LargeRewards_ . !suffix
  5545.  
  5546. sub View_BodFilterMenu_BtnKeep
  5547. set !index %View_BodFilterMenu_LstTrash
  5548. set !item %Menu_OppositeLists_Sx_ . !index
  5549.  
  5550. gosub safecall AG_AddToken %Config_BodFilter_Rewards !item _
  5551. set %Config_BodFilter_Rewards #result
  5552.  
  5553. gosub safecall View_BodFilterMenu_RefreshLists
  5554. menu List Select LstTrash !index
  5555. return
  5556.  
  5557. sub View_BodFilterMenu_BtnTrash
  5558. set !index %View_BodFilterMenu_LstKeep
  5559. set !item %Menu_OppositeLists_Dx_ . !index
  5560.  
  5561. gosub safecall AG_RemoveToken %Config_BodFilter_Rewards !item _
  5562. set %Config_BodFilter_Rewards #result
  5563.  
  5564. gosub safecall View_BodFilterMenu_RefreshLists
  5565. menu List Select LstKeep !index
  5566. return
  5567.  
  5568. sub View_BodFilterMenu_BtnKeepAll
  5569. gosub safecall View_BodFilterMenu_GetCurrentMask
  5570. set !mask #result
  5571.  
  5572. gosub safecall AG_AddTokens %Config_BodFilter_Rewards !mask _
  5573. set %Config_BodFilter_Rewards #result
  5574.  
  5575. gosub safecall View_BodFilterMenu_RefreshLists
  5576. return
  5577.  
  5578. sub View_BodFilterMenu_BtnTrashAll
  5579. gosub safecall View_BodFilterMenu_GetCurrentMask
  5580. set !mask #result
  5581.  
  5582. gosub safecall AG_RemoveTokens %Config_BodFilter_Rewards !mask _
  5583. set %Config_BodFilter_Rewards #result
  5584.  
  5585. gosub safecall View_BodFilterMenu_RefreshLists
  5586. return
  5587.  
  5588. ;=======================================
  5589. ;* @name View_RefreshOppositeLists
  5590. ;* @author AG
  5591. ;* @purpose Aggiorna le due liste di "elementi contrapposti" (LstTrash e LstKeep), in base ad una selezione
  5592. ;* di elementi e ad una "maschera".
  5593. ;* - Aggiorna le liste all'interno della GUI
  5594. ;* - Aggiorna gli array %Menu_OppositeLists_Sx_* e %Menu_OppositeLists_Dx_*
  5595. ;* @params %1 req "Maschera": Elenco di tutti gli elementi da inserire in una lista o nell'altra.
  5596. ;* %2 req "Selection": Elenco degli elementi da inserire nella lista di destra.
  5597. ;* La lista di sinistra viene determinata di conseguenza.
  5598. ;* @example gosub safecall View_RefreshOppositeLists
  5599.  
  5600. sub View_RefreshOppositeLists ; %mask %trues
  5601. set !mask %1
  5602. set !trues %2
  5603.  
  5604. set %Menu_OppositeLists_Dx_Count 0
  5605. set %Menu_OppositeLists_Sx_Count 0
  5606.  
  5607. gosub safecall AG_Tokenize !mask _ Temp_Array_
  5608. set !count #result
  5609. for !i 1 !count
  5610. {
  5611. set !item %Temp_Array_ . !i
  5612. if !item in !trues
  5613. {
  5614. set %Menu_OppositeLists_Dx_Count %Menu_OppositeLists_Dx_Count + 1
  5615. set %Menu_OppositeLists_Dx_ . %Menu_OppositeLists_Dx_Count !item
  5616. }
  5617. else
  5618. {
  5619. set %Menu_OppositeLists_Sx_Count %Menu_OppositeLists_Sx_Count + 1
  5620. set %Menu_OppositeLists_Sx_ . %Menu_OppositeLists_Sx_Count !item
  5621. }
  5622. }
  5623.  
  5624. menu Font Name MS Sans Serif
  5625. menu Font Transparent #true
  5626. menu Font Size 8
  5627. menu Font Style
  5628. menu Font Align Left
  5629. menu Font BGColor White
  5630.  
  5631. menu Font Color Red
  5632. menu Delete LstTrash
  5633. menu List Create LstTrash 12 88 125 189
  5634. if %Menu_OppositeLists_Sx_Count > 0
  5635. {
  5636. for !i 1 %Menu_OppositeLists_Sx_Count
  5637. {
  5638. set !item %Menu_OppositeLists_Sx_ . !i
  5639. gosub safecall Model_GetHumanName !item
  5640. menu List Add LstTrash #result
  5641. }
  5642. }
  5643.  
  5644. menu Font Color Blue
  5645. menu Delete LstKeep
  5646. menu List Create LstKeep 168 88 125 189
  5647. if %Menu_OppositeLists_Dx_Count > 0
  5648. {
  5649. for !i 1 %Menu_OppositeLists_Dx_Count
  5650. {
  5651. set !item %Menu_OppositeLists_Dx_ . !i
  5652. gosub safecall Model_GetHumanName !item
  5653. menu List Add LstKeep #result
  5654. }
  5655. }
  5656. return
  5657.  
  5658.  
  5659.  
  5660. ;==========================================================
  5661. ;=
  5662. ;=
  5663. ;= FUNZIONI ESECUTIVE (prefisso "Ctrl")
  5664. ;=
  5665. ;=
  5666. ;==========================================================
  5667.  
  5668. sub Main
  5669. linespercycle 500
  5670. gosub safecall Model_Init
  5671. gosub safecall View_MenuLoop View_GeneralMenu
  5672. return
  5673.  
  5674. sub Ctrl_FillSmallBod
  5675. event exmsg #charid 3 0 Seleziona il BOD da riempire.
  5676. gosub safecall Std_AskForTarget
  5677. if #result = #false
  5678. {
  5679. event exmsg #charid 3 0 Operazione annullata.
  5680. return
  5681. }
  5682. gosub safecall Model_FillSmallBod #ltargetid
  5683. if #result = #true
  5684. event exmsg #charid 3 0 Operazione completata con successo.
  5685. else
  5686. event exmsg #charid 3 0 Operazione fallita: #result , #dot
  5687. return
  5688.  
  5689. sub Ctrl_DeliverBod
  5690. event exmsg #charid 3 0 Seleziona il BOD da consegnare.
  5691. gosub safecall Std_AskForTarget
  5692. if #result = #false
  5693. {
  5694. event exmsg #charid 3 0 Operazione annullata.
  5695. return
  5696. }
  5697. ;gosub safecall Model_DeliverBod #ltargetid ; @todo
  5698. event exmsg #charid 3 0 Operazione completata.
  5699. return
  5700.  
  5701. sub Ctrl_DeliverBodCycle
  5702. gosub safecall Model_DeliverBodCycle tailor
  5703. gosub safecall Model_PlaceObjects
  5704. gosub safecall Model_DeliverBodCycle smith
  5705. gosub safecall Model_PlaceObjects
  5706. event exmsg #charid 3 0 Operazione completata.
  5707. return
  5708.  
  5709. sub Ctrl_PlaceReward
  5710. event exmsg #charid 3 0 Seleziona l'oggetto da posizionare.
  5711. gosub safecall Std_AskForTarget
  5712. if #result = #false
  5713. {
  5714. event exmsg #charid 3 0 Operazione annullata.
  5715. return
  5716. }
  5717. ;gosub safecall Model_DeliverBod #ltargetid ; @todo
  5718. event exmsg #charid 3 0 Operazione completata.
  5719. return
  5720.  
  5721. sub Ctrl_PlaceRewardCycle
  5722. gosub safecall Model_PlaceObjects
  5723. event exmsg #charid 3 0 Operazione completata.
  5724. return
  5725.  
  5726. sub Ctrl_BankRestock
  5727. event exmsg #charid 3 0 Seleziona il materiale da restockare.
  5728. gosub safecall Std_AskForTarget
  5729. if #result = #false
  5730. {
  5731. event exmsg #charid 3 0 Operazione annullata.
  5732. return
  5733. }
  5734. set !target #ltargetid
  5735. finditem !target C
  5736. if #findkind = -1
  5737. {
  5738. event exmsg #charid 3 0 Impossibile trovare la risorsa specificata. Operazione annullata.
  5739. return
  5740. }
  5741. set !list _ , #findtype , : , #findcol , _
  5742. gosub safecall Model_BankRestock !list
  5743. event exmsg #charid 3 0 Operazione completata.
  5744. return
  5745.  
  5746. sub Ctrl_BankRestockCycle
  5747. gosub safecall Model_BankRestock %Constants_Resources_All
  5748. event exmsg #charid 3 0 Operazione completata.
  5749. return
  5750.  
  5751. sub Ctrl_AnalyzeObject ; %cycle
  5752. if %0 < 1 || %1 <> #true
  5753. {
  5754. set !cycle #false
  5755. set !limit 1
  5756. }
  5757. else
  5758. {
  5759. set !cycle #true
  5760. set !limit 10000
  5761. }
  5762.  
  5763. for !i 1 !limit
  5764. {
  5765. gosub safecall Std_AskForTarget
  5766. if #result = #false
  5767. {
  5768. if !cycle = #false
  5769. event exmsg #charid 3 0 Operazione annullata.
  5770. return
  5771. }
  5772. set !target #result
  5773.  
  5774. finditem !target C
  5775. if #findkind = -1
  5776. {
  5777. finditem !target G
  5778. if #findkind = -1
  5779. {
  5780. event exmsg #charid 3 0 Impossibile trovare l'oggetto specificato.
  5781. continue
  5782. }
  5783. }
  5784. set !object #findid
  5785. set !type #findtype
  5786. set !color #findcol
  5787.  
  5788. if !type = %Constants_Bod
  5789. {
  5790. gosub safecall Model_AnalyzeBod !target
  5791. event exmsg #charid 3 0 action = %CurrentBod_Action
  5792. gosub libcall BodFunctions.euo ShowBodPanel !target
  5793. while #menubutton <> closed
  5794. {
  5795. }
  5796. continue
  5797. }
  5798.  
  5799. gosub safecall Std_IdentifyObject !object
  5800. if #result <> #false && #result in %Constants_Rewards_All
  5801. {
  5802. set !rewardCode #result
  5803. gosub safecall Model_GetHumanName !rewardCode
  5804. set !humanName #result
  5805. event exmsg #charid 3 0 Riconosciuto un premio: !humanName
  5806. continue
  5807. }
  5808.  
  5809. event exmsg #charid 3 0 id = !object
  5810. event exmsg #charid 3 0 type = !type
  5811. event exmsg #charid 3 0 color = !color
  5812.  
  5813. if !cycle = #false
  5814. break
  5815. }
  5816. return
  5817.  
  5818. sub Ctrl_SetHomePosition
  5819. set !x #charposx
  5820. set !y #charposy
  5821. set !z #charposz
  5822. set !oldx %Config_Home_PosX
  5823. set !oldy %Config_Home_PosY
  5824. set !oldz %Config_Home_PosZ
  5825. set %Config_Home_PosX !x
  5826. set %Config_Home_PosY !y
  5827. set %Config_Home_PosZ !z
  5828.  
  5829. set !locationChanged abs ( !oldx - !x ) > 10 && abs ( !oldy - !y ) > 10 && abs ( !oldz - !z ) > 10
  5830. if !locationChanged
  5831. {
  5832. set %Config_Runebooks_Home _
  5833. }
  5834.  
  5835. finditem %Constants_Forges G_2
  5836. if #findkind <> -1
  5837. set %Config_Home_Forge #findid
  5838. else
  5839. set %Config_Home_Forge !null
  5840.  
  5841. finditem %Constants_Anvils G_2
  5842. if #findkind <> -1
  5843. set %Config_Home_Anvil #findid
  5844. else
  5845. set %Config_Home_Anvil !null
  5846.  
  5847. finditem %Constants_TrashBarrel G_2
  5848. if #findkind <> -1
  5849. set %Config_Home_Trash #findid
  5850. else
  5851. set %Config_Home_Trash !null
  5852.  
  5853. finditem %Constants_DyingTub G_1 ; deve essere a distanza 1!!!
  5854. if #findkind <> -1 && #findcol = 0
  5855. set %Config_Home_DyingTub #findid
  5856. else
  5857. set %Config_Home_DyingTub !null
  5858. return
  5859.  
  5860. sub Ctrl_AnalyzeRunebooks
  5861. if %Config_Home_PosX = !null || %Config_Home_PosY = !null || %Config_Home_PosZ = !null
  5862. {
  5863. event exmsg #charid 3 0 Devi prima impostare la posizione a casa!
  5864. return
  5865. }
  5866.  
  5867. set %Config_Runebooks_Tailor _
  5868. set %Config_Runebooks_Smith _
  5869. set %Config_Runebooks_Home _
  5870. set %Config_Runebooks_Bank _
  5871. while #true
  5872. {
  5873. event exmsg #charid 3 0 Seleziona un runebook da analizzare, oppure premi ESC per terminare.
  5874. gosub safecall Std_AskForTarget
  5875. if #result = #false
  5876. break
  5877. set !runebook #result
  5878. finditem !runebook C_ , #backpackid
  5879. if #findkind = -1
  5880. {
  5881. event exmsg #charid 3 0 Il runebook deve trovarsi nel backpack!
  5882. continue
  5883. }
  5884. if #findtype <> %Constants_Runebook ; @todo add
  5885. {
  5886. event exmsg #charid 3 0 L'oggetto selezionato non e' un runebook!
  5887. continue
  5888. }
  5889. gosub safecall Model_AnalyzeRunebook !runebook
  5890. set !info #result
  5891. for !i 1 16
  5892. {
  5893. str mid !info !i 1
  5894. set !char #strres
  5895. set !recallCode !runebook , : , !i
  5896. if !char = t
  5897. set %Config_Runebooks_Tailor %Config_Runebooks_Tailor , !recallCode , _
  5898. if !char = s
  5899. set %Config_Runebooks_Smith %Config_Runebooks_Smith , !recallCode , _
  5900. if !char = h
  5901. set %Config_Runebooks_Home %Config_Runebooks_Home , !recallCode , _
  5902. if !char = b
  5903. set %Config_Runebooks_Bank %Config_Runebooks_Bank , !recallCode , _
  5904. }
  5905. }
  5906. return
  5907.  
  5908. sub Ctrl_SelectChests ; %type (work|rewards|bank)
  5909. set !type %1
  5910. if !type = work || !type = rewards
  5911. {
  5912. if %Config_Home_PosX = !null || %Config_Home_PosY = !null || %Config_Home_PosZ = !null
  5913. {
  5914. event exmsg #charid 3 0 Devi prima impostare la posizione a casa!
  5915. return
  5916. }
  5917. gosub safecall Model_ChangeLocation home
  5918. }
  5919. if !type = bank
  5920. {
  5921. gosub safecall Model_DetectLocation
  5922. if %Location_Name <> bank
  5923. {
  5924. if %Config_Runebooks_Bank = !null || %Config_Runebooks_Bank = _
  5925. {
  5926. event exmsg #charid 3 0 Devi trovarti in banca!
  5927. return
  5928. }
  5929. gosub safecall Model_ChangeLocation bank
  5930. }
  5931. gosub safecall Std_OpenBankBox %Location_Vendor
  5932. }
  5933.  
  5934. event exmsg #charid 3 0 Seleziona tutti i contenitori desiderati. Premi ESC per terminare.
  5935. set !result _
  5936. set !count 0
  5937. while #true
  5938. {
  5939. gosub safecall Std_AskForTarget
  5940. if #result = #false && #targcurs = 0
  5941. break
  5942. set !chest #result
  5943.  
  5944. finditem !chest C
  5945. if #findkind = -1
  5946. {
  5947. finditem !chest G_2
  5948. if #findkind = -1
  5949. {
  5950. event exmsg #charid 3 0 Non riesco a trovare il contenitore selezionato.
  5951. continue
  5952. }
  5953. }
  5954.  
  5955. ; @todo aggiungere check su root container
  5956.  
  5957. set !timeout #systime + 1000 ; minimum timeout for paperdoll
  5958. gosub safecall Std_OpenPaperdoll
  5959. while #systime < !timeout
  5960. {
  5961. }
  5962.  
  5963. gosub safecall Std_UseObject !chest
  5964. set !timeout #systime + 5000
  5965. while #systime < !timeout && #contsize = 262_324
  5966. {
  5967. }
  5968. if #contsize = 262_324
  5969. {
  5970. event exmsg #charid 3 0 Non riesco ad aprire il contenitore selezionato.
  5971. continue
  5972. }
  5973. set !count !count + 1
  5974. set !result !result , #findid , _
  5975. }
  5976. event exmsg #charid 3 0 Selezionati !count contenitori.
  5977.  
  5978. if !type = work
  5979. set %Config_Chests_Work !result
  5980. if !type = bank
  5981. set %Config_Chests_Bank !result
  5982. if !type = rewards
  5983. set %Config_Chests_Rewards !result
  5984. return
  5985.  
  5986. sub Ctrl_SelectBodbook ; %type
  5987. set !type %1
  5988.  
  5989. if !type = fill
  5990. set %Config_Bodbooks_Fill !null
  5991. if !type = keep
  5992. set %Config_Bodbooks_Keep !null
  5993. if !type = deliver
  5994. set %Config_Bodbooks_Deliver !null
  5995.  
  5996. set !allBodbooks %Config_Bodbooks_Fill , _ , %Config_Bodbooks_Keep , _ , %Config_Bodbooks_Deliver , _ , %Config_Bodbooks_Trash
  5997.  
  5998. event exmsg #charid 3 0 Seleziona un bodbook.
  5999. gosub safecall Std_AskForTarget
  6000. if #result = #false || #result = !null
  6001. {
  6002. event exmsg #charid 3 0 Nessun bodbook selezionato!
  6003. return
  6004. }
  6005. set !bodbook #result
  6006. finditem !bodbook C_ , #backpackid
  6007. if #findkind = -1
  6008. {
  6009. event exmsg #charid 3 0 Il bodbook deve trovarsi nel backpack!
  6010. return
  6011. }
  6012. if #findtype <> %Constants_Bodbook
  6013. {
  6014. event exmsg #charid 3 0 L'oggetto selezionato non e' un bodbook!
  6015. return
  6016. }
  6017. if !bodbook in !allBodbooks
  6018. {
  6019. event exmsg #charid 3 0 Questo bodbook e' gia' utilizzato per altri scopi!
  6020. return
  6021. }
  6022.  
  6023. if !type = fill
  6024. set %Config_Bodbooks_Fill !bodbook
  6025. if !type = keep
  6026. set %Config_Bodbooks_Keep !bodbook
  6027. if !type = deliver
  6028. set %Config_Bodbooks_Deliver !bodbook
  6029.  
  6030. event exmsg #charid 3 0 Bodbook selezionato correttamente.
  6031. return
  6032.  
  6033. sub Ctrl_MoveObject ; %colorMatters
  6034. set !colorMatters ( %0 >= 1 && %1 = #true )
  6035. if !colorMatters
  6036. event exmsg #charid 3 0 Seleziona il tipo di oggetto da muovere (tieni conto anche del colore).
  6037. else
  6038. event exmsg #charid 3 0 Seleziona il tipo di oggetto da muovere (il colore non è importante).
  6039.  
  6040. gosub safecall Std_AskForTarget
  6041. if #result = #false
  6042. {
  6043. event exmsg #charid 3 0 Operazione annullata.
  6044. return
  6045. }
  6046. set !object #ltargetid
  6047.  
  6048. finditem !object C
  6049. if #findkind = -1
  6050. {
  6051. event exmsg #charid 3 0 Impossibile trovare l'oggetto selezionato.
  6052. return
  6053. }
  6054. set !type #findtype
  6055. set !color #findcol
  6056.  
  6057. event exmsg #charid 3 0 Seleziona il contenitore di destinazione.
  6058. gosub safecall Std_AskForTarget
  6059. if #result = #false
  6060. {
  6061. event exmsg #charid 3 0 Operazione annullata.
  6062. return
  6063. }
  6064. set !dest #ltargetid
  6065.  
  6066. ignoreitem reset
  6067. finditem !type C_ , !dest
  6068. for #findindex 1 #findcnt
  6069. {
  6070. ignoreitem #findid
  6071. }
  6072.  
  6073. while #true
  6074. {
  6075. finditem !type C
  6076. if #findkind = -1
  6077. break
  6078. set !object #findid
  6079. set !quantity #findstack
  6080. if !colorMatters = #false || #findcol = !color
  6081. {
  6082. gosub safecall Std_MoveObject !object !dest !quantity
  6083. }
  6084. ignoreitem !object
  6085. }
  6086. ignoreitem reset
  6087. event exmsg #charid 3 0 Operazione completata.
  6088. return
  6089.  
  6090.  
  6091.  
  6092. ;==========================================================
  6093. ;=
  6094. ;=
  6095. ;= FUNZIONI IMPORTATE (prefissi variabili)
  6096. ;=
  6097. ;=
  6098. ;==========================================================
  6099.  
  6100. ;=======================================================
  6101. ; CEO Filesystem
  6102. ;=======================================================
  6103. Sub CEO_getGlobalVar
  6104. nameSpace push
  6105. nameSpace local #systime , _ , %2 , GET
  6106. set !lpc #lpc
  6107. set #lpc 1000
  6108. set !global * . %1
  6109. set !varName v , %2 , |
  6110. str pos !global !varName
  6111. set #result #strres <> 0
  6112. if #result
  6113. {
  6114. set !varNamePos #strres
  6115. str len !varName
  6116. set !delString !varNamePos + #strres - 1
  6117. str del !global 1 !delString
  6118. set !global #strres
  6119. str pos !global |
  6120. set !varNamePos #strres - 1
  6121. str left !global !varNamePos
  6122. set % . %2 #strres
  6123. }
  6124. else
  6125. {
  6126. set % . %2 N/A
  6127. }
  6128. set #lpc !lpc
  6129. nameSpace Clear
  6130. nameSpace Pop
  6131. return #result
  6132. ;=======================================================
  6133. Sub CEO_putGlobalVar
  6134. nameSpace push
  6135. nameSpace local #systime , _ , %2 , PUT
  6136. set !lpc #lpc
  6137. set #lpc 1000
  6138. set !global * . %1
  6139. set !varName v , %2 , |
  6140. str pos !global !varName
  6141. if #strres = 0
  6142. {
  6143. if |CEO*FILESYSTEM_MODIFIED| notin !global
  6144. set !global |CEO*FILESYSTEM_MODIFIED|
  6145. set * . %1 !global , !varName , % . %2 , |
  6146. set #lpc !lpc
  6147. nameSpace clear
  6148. nameSpace pop
  6149. return #true
  6150. }
  6151. set !varNamePos #strres
  6152. str len !varName
  6153. set !splitString !varNamePos + #strres - 1
  6154. str left !global !splitstring
  6155. set !globalPart1 #strres
  6156. str del !global 1 !splitString
  6157. set !global #strres
  6158. str len !global
  6159. set !globalLen #strres
  6160. str pos !global |
  6161. set !splitString !globalLen - #strres + 1
  6162. str right !global !splitstring
  6163. set !global #strres
  6164. set * . %1 !globalPart1 , % . %2 , !global
  6165. set #lpc !lpc
  6166. nameSpace clear
  6167. nameSpace pop
  6168. return #true
  6169.  
  6170. ;=============================================================
  6171. ; Boydon utilities
  6172. ;=============================================================
  6173.  
  6174. ;==================
  6175. ;**
  6176. ;* @name OpenStatusBar
  6177. ;* @ver 1.0 14Oct05
  6178. ;* @author Boydon
  6179. ;* @purpose Open the StatusBar to a givent location an optionaly minimize it
  6180. ;* @params %1 opt #contposx where you want to open the statusbar (default will be 0)
  6181. ;* %2 opt #contposy where you want to open the statusbar (default will be 0)
  6182. ;* %3 opt #true to minimize status bar (default is #false: status bar won't be minimized)
  6183. ;* @returns
  6184. ;* @dependencies
  6185. ;* @example gosub openStatusBar
  6186. ;* this is the standard call and will open your statusbar to pos 0 0
  6187. ;* gosub OpenStatusBar 205 25
  6188. ;* this will open statusbar at positions 205 25
  6189. ;* gosub OpenPaperdoll 205 25 #true
  6190. ;* this will open your status at positions 205 25 and minimize it
  6191. ;* @status Tested and working
  6192.  
  6193. sub Boydon_OpenStatusBar
  6194.  
  6195. if %1 = N/A || %0 = 0
  6196. set %1 0
  6197. if %2 = N/A || %0 <= 1
  6198. set %2 0
  6199. if %3 = N/A || %0 <= 2
  6200. set %3 #false
  6201.  
  6202. nameSpace Push
  6203. nameSpace Local OpenStatusBar , #time , #random , #scnt2
  6204.  
  6205. set !OpenX %1
  6206. set !OpenY %2
  6207. set !Minimize %3
  6208.  
  6209. __boy_osb1:
  6210. ;gosub CheckForWorldSave
  6211. set #nextCPosX !OpenX
  6212. set #nextCPosY !OpenY
  6213. Event Macro 8 2 ;Open StatusBar
  6214. wait 20
  6215.  
  6216. if #contname <> status_gump
  6217. goto __boy_osb1
  6218.  
  6219. if ! !Minimize
  6220. {
  6221. if #contposx <> !OpenX || #contposy <> !OpenY
  6222. {
  6223. contpos !OpenX !OpenY
  6224. wait 20
  6225. }
  6226. }
  6227.  
  6228. if !Minimize
  6229. {
  6230. set !MinimizeX #contposx + 395
  6231. set !MinimizeY #contposy + 155
  6232.  
  6233. click !MinimizeX !MinimizeY f
  6234. }
  6235.  
  6236. nameSpace CLear
  6237. nameSpace Pop
  6238.  
  6239. return
  6240.  
  6241. ;==================
  6242. ;**
  6243. ;* @name GetProperty
  6244. ;* @ver 1.0 15May05
  6245. ;* @author Boydon
  6246. ;* @purpose Get the #property of a given item tring to avoid errors, null values and
  6247. ;* unexpected values.
  6248. ;* @params %1 req Id of the item you want to EP
  6249. ;* @returns #property of %1
  6250. ;* @dependencies
  6251. ;* @example gosub GetProperty #findid
  6252. ;* tis is the standard call and will EP #findid
  6253. ;* @status Fully tested and working
  6254.  
  6255. sub Boydon_GetProperty
  6256.  
  6257. if %0 < 1 || %1 = N/A
  6258. {
  6259. event exmsg #charid 3 0 Wrong use of Sub GetProperty: some required arguments are missing!
  6260. set %fine_fillabod #true
  6261. return
  6262. }
  6263.  
  6264. nameSpace Push
  6265. nameSpace Local GetProperty , #time , #random , #scnt2
  6266.  
  6267. __boy_gp_loop1:
  6268. event property %1
  6269. set !Property1 #property
  6270. event property %1
  6271. set !Property2 #property
  6272. event property %1
  6273. set !Property3 #property
  6274.  
  6275. if ! ( !Property1 = !Property2 && !Property2 = !Property3 )
  6276. goto __boy_gp_loop1
  6277.  
  6278. nameSpace Clear
  6279. nameSpace Pop
  6280.  
  6281. return #property
  6282.  
  6283. ;==================
  6284. ;**
  6285. ;* @name CheckForWorldSave
  6286. ;* @ver 1.0 20May05
  6287. ;* @author Boydon
  6288. ;* @purpose To detect world saves and resources cleaning of RunUO Shards
  6289. ;* @params
  6290. ;* @returns
  6291. ;* @notes the sub keep track of the last scanned journal line using
  6292. ;* the variable %Saveindex: every time the sub is called the script will
  6293. ;* start to scan from that line.
  6294. ;* @dependencies sub WaitForSaveEnd
  6295. ;* @example gosub CheckForWorldSave
  6296. ;* @status Tested and working fine
  6297.  
  6298. sub Boydon_CheckForWorldSave
  6299. nameSpace Push
  6300. nameSpace Local CheckForWorldSave , #time , #random , #scnt2
  6301.  
  6302. if %SaveIndex = N/A
  6303. set %SaveIndex #jindex
  6304.  
  6305. set !Save #false
  6306. set !Jstart %SaveIndex
  6307. for !i !Jstart #jindex
  6308. {
  6309. scanjournal !i
  6310. if #jcolor = 53
  6311. {
  6312. if THE_WORLD_WILL_SAVE_IN in #journal || WORLD_IS_SAVING in #journal
  6313. {
  6314. set !Save #true
  6315. set #sysmsgcol 33
  6316. event sysmessage >>>>SAVE DETECTED<<<<<<
  6317. ;Event ExMsg #charid 3 33 SAVE Detected
  6318. gosub Boydon_WaitForSaveEnd WORLD_SAVE_COMPLETE 100 !i SAVE
  6319. set %SaveIndex #jindex
  6320. set !i #jindex
  6321. }
  6322. if CLEANING in #journal
  6323. {
  6324. set !Save #true
  6325. set #sysmsgcol 33
  6326. event sysmessage >>>>>CLEANING DETECTED<<<<<<
  6327. ;Event ExMsg #charid 3 33 CLEANING Detected
  6328. gosub Boydon_WaitForSaveEnd CLEANED 30 !i CLEANING
  6329. set %SaveIndex #jindex
  6330. set !i #jindex
  6331. }
  6332. }
  6333. set %SaveIndex !i
  6334. }
  6335.  
  6336. nameSpace Clear
  6337. nameSpace Pop
  6338. return
  6339.  
  6340. ;==================
  6341. ;**
  6342. ;* @name WaitForSaveEnd
  6343. ;* @ver 1.0 20May05
  6344. ;* @author Boydon
  6345. ;* @purpose To detect when world save/resource cleaning has ended
  6346. ;* @params %1 req End of save message
  6347. ;* %2 req Time to wait before the sub goes in time out
  6348. ;* %3 req #jindex of world save start message
  6349. ;* %4 req Tells what are we waiting for, can be SAVE|CLEANING
  6350. ;* @returns
  6351. ;* @notes This sub _MUST_ be called _ONLY_FROM_ sub CheckForWorldSave.
  6352. ;* This sub uses the same namespace as sub CheckForSave.
  6353. ;* @dependencies sub CheckForWorldSave
  6354. ;* @example
  6355. ;* @status Tested and working fine
  6356.  
  6357. sub Boydon_WaitForSaveEnd
  6358.  
  6359. if %0 < 4 || %1 = N/A || %2 = N/A || %3 = N/A || %4 = N/A
  6360. {
  6361. display ok Wrong use of Sub WaitForSaveEnd: some required arguments are missing!
  6362. +$Script will be halted.
  6363. halt
  6364. }
  6365.  
  6366. set !EndOfSave %1
  6367. set !SaveTimeOut #scnt + %2
  6368. set !Jstart %3
  6369. set !Message %4
  6370.  
  6371. waitforsaveend:
  6372.  
  6373. for !j !jstart #jindex
  6374. {
  6375. scanjournal !j
  6376. if #jcolor = 53
  6377. {
  6378. if !EndOfSave in #journal
  6379. {
  6380. set !Save #false
  6381. set %SaveIndex #jindex
  6382. set !j #jindex
  6383. }
  6384. }
  6385. }
  6386. if !Save = #true && #scnt <= !SaveTimeOut
  6387. {
  6388. wait 1
  6389. goto waitforsaveend
  6390. }
  6391. if #scnt > !SaveTimeOut
  6392. {
  6393. set !Save #false
  6394. set %SaveIndex #jindex
  6395. event ExMsg #charid 3 33 !Message detection timed out...
  6396. }
  6397. event ExMsg #charid 3 33 End of !Message Detected
  6398. return
  6399.  
  6400. ;=============================================================
  6401. ; AG EasyUO Library
  6402. ;=============================================================
  6403.  
  6404. sub AG_Tokenize
  6405. namespace push
  6406. namespace local agTokenize , #systime , #random
  6407. set !string %1
  6408. set !sep %2
  6409. set !array %3
  6410.  
  6411. if ( !string = !null ) || ( !string = !sep )
  6412. {
  6413. set !count 0
  6414. }
  6415. else
  6416. {
  6417. ; Must end with a separator!
  6418. str right !string 1
  6419. if #strres <> !sep
  6420. {
  6421. set !string !string , !sep
  6422. }
  6423.  
  6424. str count !string !sep
  6425. set !count #strres
  6426. set !start 1
  6427.  
  6428. set !j 0 ; !j is the array index. !j is different from !i if empty tokens are present (example: _a_b__c_)
  6429. for !i 1 !count
  6430. {
  6431. str pos !string !sep !i
  6432. set !length #strres - !start
  6433. str mid !string !start !length
  6434. set !token #strres
  6435. set !start !start + !length + 1
  6436.  
  6437. if !length > 0
  6438. {
  6439. set !j !j + 1
  6440. set !varname !array , !j
  6441. set % . !varname !token
  6442. }
  6443. }
  6444. set !count !j ; override !count with actual count
  6445. }
  6446. set !varname !array , count
  6447. set % . !varname !count
  6448. set #result !count
  6449. namespace clear
  6450. namespace pop
  6451. return #result
  6452.  
  6453. sub AG_AddToken ; %string %token %sep
  6454. namespace push
  6455. namespace local AG_AddToken , #systime , #random
  6456. set !string %1
  6457. set !item %2
  6458. set !sep %3
  6459.  
  6460. ; Must start with a separator!
  6461. str left !string 1
  6462. if #strres <> !sep
  6463. set !string !sep , !string
  6464.  
  6465. ; Must end with a separator!
  6466. str right !string 1
  6467. if #strres <> !sep
  6468. set !string !string , !sep
  6469.  
  6470. if !sep , !item , !sep notin !string
  6471. {
  6472. set !string !string , !item , !sep
  6473. }
  6474.  
  6475. set #result !string
  6476. namespace clear
  6477. namespace pop
  6478. return #result
  6479.  
  6480. sub AG_RemoveToken ; %string %token %sep
  6481. namespace push
  6482. namespace local AG_AddToken , #systime , #random
  6483. set !string %1
  6484. set !item %2
  6485. set !sep %3
  6486.  
  6487. ; Must start with a separator!
  6488. str left !string 1
  6489. if #strres <> !sep
  6490. set !string !sep , !string
  6491.  
  6492. ; Must end with a separator!
  6493. str right !string 1
  6494. if #strres <> !sep
  6495. set !string !string , !sep
  6496.  
  6497. set !sepItem !sep , !item , !sep
  6498. if !sepItem in !string
  6499. {
  6500. str pos !string !sepItem
  6501. set !pos #strres
  6502. str len !sepItem
  6503. set !len #strres - 1
  6504. str del !string !pos !len
  6505. set !string #strres
  6506. }
  6507.  
  6508. set #result !string
  6509. namespace clear
  6510. namespace pop
  6511. return #result
  6512.  
  6513. sub AG_AddTokens ; %source %tokens %separator
  6514. namespace push
  6515. namespace local AG_AddTokens , #systime , #random
  6516. set !source %1
  6517. set !tokens %2
  6518. set !sep %3
  6519.  
  6520. gosub AG_Tokenize !tokens !sep AG_AddTokens_Array_
  6521. set !count #result
  6522. for !i 1 !count
  6523. {
  6524. set !token %AG_AddTokens_Array_ . !i
  6525. gosub AG_AddToken !source !token !sep
  6526. set !source #result
  6527. }
  6528.  
  6529. set #result !source
  6530. namespace clear
  6531. namespace pop
  6532. return #result
  6533.  
  6534. sub AG_RemoveTokens ; %source %tokens %separator
  6535. namespace push
  6536. namespace local AG_RemoveTokens , #systime , #random
  6537. set !source %1
  6538. set !tokens %2
  6539. set !sep %3
  6540.  
  6541. gosub AG_Tokenize !tokens !sep AG_RemoveTokens_Array_
  6542. set !count #result
  6543. for !i 1 !count
  6544. {
  6545. set !token %AG_RemoveTokens_Array_ . !i
  6546. gosub AG_RemoveToken !source !token !sep
  6547. set !source #result
  6548. }
  6549.  
  6550. set #result !source
  6551. namespace clear
  6552. namespace pop
  6553. return #result
  6554.  
  6555.  
  6556.  
  6557. ;==========================================================
  6558. ;=
  6559. ;=
  6560. ;= LIBRERIE LINKATE STATICAMENTE
  6561. ;=
  6562. ;=
  6563. ;==========================================================
  6564.  
  6565. ;==================================
  6566. ; Script Name: Boydon's RunUO Craftmenus' Handling Functions
  6567. ; Author: Boydon
  6568. ; Version: 1.4
  6569. ; Client Tested with: 5.0.0b
  6570. ; EUO version tested with: 1.5 TV 57
  6571. ; Shard OSI / FS: FS, RunUO 1.0
  6572. ; Revision Date: 07Oct05
  6573. ; Public Release: 14May05
  6574. ; Global Variables Used: None
  6575. ; Purpose: A callable library to handle crafting menues in RunUO Emulator.
  6576. ;==================================
  6577.  
  6578. set %_0 %0
  6579. goto %_0
  6580. 0:
  6581. exit
  6582. 1:
  6583. gosub %1
  6584. exit
  6585. 2:
  6586. gosub %1 %2
  6587. exit
  6588. 3:
  6589. gosub %1 %2 %3
  6590. exit
  6591. 4:
  6592. gosub %1 %2 %3 %4
  6593. exit
  6594. 5:
  6595. gosub %1 %2 %3 %4 %5
  6596. exit
  6597. 6:
  6598. gosub %1 %2 %3 %4 %5 %6
  6599. exit
  6600. 7:
  6601. gosub %1 %2 %3 %4 %5 %6 %7
  6602. exit
  6603. 8:
  6604. gosub %1 %2 %3 %4 %5 %6 %7 %8
  6605. exit
  6606. 9:
  6607. gosub %1 %2 %3 %4 %5 %6 %7 %8 %9
  6608. exit
  6609. 10:
  6610. gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
  6611. exit
  6612.  
  6613. ;==================
  6614. ;* To do list
  6615. ;*
  6616. ;* Nothing ATM
  6617. ;==================
  6618.  
  6619. ;==================================
  6620. ;* Special Thanks to:
  6621. ;*
  6622. ;* Allanon Wallace for his support, his help and his suggestions in testing phase
  6623. ;* Quintok / Raziel for their very nice and usefull waitForSysVars sub
  6624. ;* Anom that found a nasty bug
  6625. ;==================================
  6626.  
  6627. ;==================
  6628. ;**
  6629. ;* @name BringUpCraftMenu
  6630. ;* @ver 1.1 15May05
  6631. ;* @author Boydon
  6632. ;* @purpose bring up desidered craft menu
  6633. ;*
  6634. ;* @params %1 req The type/id of the tools you want to use.
  6635. ;* If you prefer you can specify the name of the skill to use.
  6636. ;* This can be tinker|tailor|smith|carpentry|bowcraft|alchemy|inscription|masonry|glassblow|cooking
  6637. ;*
  6638. ;* %2 opt This allow you to decide weather the script halts or not if a toolkit isn't found
  6639. ;* inside your #backpack. This can have two values #true or #false. Default value
  6640. ;* of this parameter is #true
  6641. ;*
  6642. ;* @returns This sub will return the id of the tools currently used (last #findid value): if you
  6643. ;* called the sub using the skill name (look above) this is very usefull cause you can
  6644. ;* know the exact id of the tool you are currently using and use it in various ways, as
  6645. ;* example you can calculate how many uses it has left... If you called the sub with halt
  6646. ;* option turned off returned value will be "X" (without the "" around) if a tool can't be found
  6647. ;*
  6648. ;* @example call CraftMenuFunctions.euo BringUpCraftMenu KTL
  6649. ;* call CraftMenuFunctions.euo BringUpCraftMenu tinker
  6650. ;* both this examples will bring up tinker Menu
  6651. ;* call CraftMenuFunctions.euo BringUpCraftMenu tinker #false
  6652. ;* this example will try to bring up tinker Menu and won't halt the script if a tool is not found
  6653. ;* @status tested and working properly
  6654.  
  6655. sub BringUpCraftMenu ; fixed by NeuZZo (@todo: controllare il codice. Per il momento ci si fida)
  6656. if %0 < 1 || %1 = N/A
  6657. {
  6658. display ok Wrong use of Sub BringUpCraftMenu: some required arguments are missing!
  6659. +$Script will be halted.
  6660. halt
  6661. }
  6662.  
  6663. if %2 = N/A || %0 <= 1
  6664. set %2 #true
  6665.  
  6666. if %2 <> #true && %2 <> #false
  6667. {
  6668. display ok Unexpected value for argument 2 in Sub BringUpCraftMenu!
  6669. +$Please check!$
  6670. +$Script will be halted.
  6671. halt
  6672. }
  6673.  
  6674. nameSpace Push
  6675. nameSpace Local BringUpCraftMenu , #time , #random , #scnt2
  6676.  
  6677. set !ToolsType %1
  6678. set !Halt %2
  6679.  
  6680. if !ToolsType = tinker
  6681. set !ToolsType JTL_GTL_KTL_
  6682. if !ToolsType = tailor
  6683. set !ToolsType HAG
  6684. if !ToolsType = smith
  6685. set !ToolsType TLH_FBG_GBG_OLH_OBG_TBG_
  6686. if !ToolsType = carpentry
  6687. set !ToolsType YFG_ZHG_CIG_BIG_AGG_EGG_AIG_WFG_IGG_KGG_ZFG_
  6688. if !ToolsType = bowcraft
  6689. set !ToolsType UFG
  6690. if !ToolsType = alchemy
  6691. set !ToolsType RQF
  6692. if !ToolsType = inscription
  6693. set !ToolsType PBG
  6694. if !ToolsType = masonry
  6695. set !ToolsType ZEH
  6696. if !ToolsType = glassblow
  6697. set !ToolsType CQF
  6698. if !ToolsType = Cooking
  6699. set !ToolsType BCG_DND_OGG_
  6700.  
  6701. UseTools:
  6702. set !StartContKind #contkind
  6703. set !StartContName #contname
  6704. set !StartContSize #contsize
  6705.  
  6706. FindTools:
  6707. finditem !ToolsType C_ , #backpackid
  6708. if #findkind = -1 && !Halt
  6709. {
  6710. display ok Impossible to find any craft tool in your backpack!
  6711. +$Script will be halted.
  6712. halt
  6713. }
  6714. if #findcol <> 0
  6715. {
  6716. ;display ok You seem to have some runik kits in your back pack! $Script will ignore them!
  6717. ignoreitem #findid runikkits
  6718. goto FindTools
  6719. }
  6720. if #findkind <> -1
  6721. set #lobjectid #findid
  6722.  
  6723. Event Macro 17 0 ;Last Object
  6724. wait 12
  6725.  
  6726. gosub waitForSysVars contkind <> !StartContKind contname <> !StartContName contsize <> !StartContSize 5
  6727.  
  6728. if ! #result ;Craft Gump was already opened?
  6729. {
  6730. set !CloseGumpX #contposx + 50
  6731. set !CloseGumpY #contposy + 50
  6732. click !CloseGumpX !CloseGumpY r
  6733. wait 5
  6734. if ( #contkind = !StartContKind || contname <> !StartContName || contsize <> !StartContSize )
  6735. {
  6736. set !CloseGumpX #contposx + 50
  6737. set !CloseGumpY #contposy + 50
  6738. click !CloseGumpX !CloseGumpY r
  6739. wait 5
  6740. }
  6741. goto UseTools
  6742. }
  6743.  
  6744. ignoreitem reset runikkits
  6745. nameSpace Clear
  6746. nameSpace Pop
  6747. return #findid
  6748.  
  6749. sub BringUpCraftMenu_old ; Before Neuzzo's fix
  6750.  
  6751. if %0 < 1 || %1 = N/A
  6752. {
  6753. display ok Wrong use of Sub BringUpCraftMenu: some required arguments are missing!
  6754. +$Script will be halted.
  6755. halt
  6756. }
  6757.  
  6758. if %2 = N/A || %0 <= 1
  6759. set %2 #true
  6760.  
  6761. if %2 <> #true && %2 <> #false
  6762. {
  6763. display ok Unexpected value for argument 2 in Sub BringUpCraftMenu!
  6764. +$Please check!$
  6765. +$Script will be halted.
  6766. halt
  6767. }
  6768.  
  6769. nameSpace Push
  6770. nameSpace Local BringUpCraftMenu , #time , #random , #scnt2
  6771.  
  6772. set !ToolsType %1
  6773. set !Halt %2
  6774.  
  6775. if !ToolsType = tinker
  6776. set !ToolsType JTL_GTL_KTL_
  6777. if !ToolsType = tailor
  6778. set !ToolsType HAG
  6779. if !ToolsType = smith
  6780. set !ToolsType TLH_FBG_GBG_OLH_OBG_TBG_
  6781. if !ToolsType = carpentry
  6782. set !ToolsType YFG_ZHG_CIG_BIG_AGG_EGG_AIG_WFG_IGG_KGG_ZFG_
  6783. if !ToolsType = bowcraft
  6784. set !ToolsType UFG
  6785. if !ToolsType = alchemy
  6786. set !ToolsType RQF
  6787. if !ToolsType = inscription
  6788. set !ToolsType PBG
  6789. if !ToolsType = masonry
  6790. set !ToolsType ZEH
  6791. if !ToolsType = glassblow
  6792. set !ToolsType CQF
  6793. if !ToolsType = Cooking
  6794. set !ToolsType BCG_DND_OGG_
  6795.  
  6796. UseTools:
  6797. set !StartContKind #contkind
  6798. set !StartContName #contname
  6799. set !StartContSize #contsize
  6800.  
  6801. FindTools:
  6802. finditem !ToolsType C_ , #backpackid
  6803. if #findkind = -1 && !Halt
  6804. {
  6805. display ok Impossible to find any craft tool in your backpack!
  6806. +$Script will be halted.
  6807. halt
  6808. }
  6809. if #findcol <> 0
  6810. {
  6811. ;display ok You seem to have some runik kits in your back pack! $Script will ignore them!
  6812. ignoreitem #findid runikkits
  6813. goto FindTools
  6814. }
  6815. if #findkind <> -1
  6816. set #lobjectid #findid
  6817.  
  6818. Event Macro 17 0 ;Last Object
  6819. wait 12
  6820.  
  6821. gosub waitForSysVars contkind <> !StartContKind contname <> !StartContName contsize <> !StartContSize 5
  6822.  
  6823. if ! #result ;Craft Gump was already opened?
  6824. {
  6825. set !CloseGumpX #contposx + 50
  6826. set !CloseGumpY #contposy + 50
  6827. click !CloseGumpX !CloseGumpY r
  6828. wait 5
  6829. goto UseTools
  6830. }
  6831.  
  6832. ignoreitem reset runikkits
  6833. nameSpace Clear
  6834. nameSpace Pop
  6835. return #findid
  6836.  
  6837. ;==================
  6838. ;**
  6839. ;* @name CraftAnything
  6840. ;* @ver 1.1 16May05
  6841. ;* @author Boydon
  6842. ;* @purpose craft the desiderd item from the menu
  6843. ;*
  6844. ;* @params %1 req the category number Where "LAST TEN" is category numer 0 and so on
  6845. ;* I decided to give "LAST TEN" number 0 cause it is pretty useless as category
  6846. ;* %2 req number of the piece to craft. This must be an absolute number.
  6847. ;* Because of menues having more than one page you have to count item numer from 1,
  6848. ;* so on page 1 there will be items from 1 to 10, on page 2 from 11 to 20 and so on..
  6849. ;*
  6850. ;* @returns
  6851. ;* @example call CraftMenuFunctions.euo CraftAnyThing 2 22
  6852. ;* @status tested and working fine
  6853.  
  6854. sub CraftAnything
  6855.  
  6856. if %0 < 2 || %1 = N/A || %2 = N/A
  6857. {
  6858. display ok Wrong use of Sub CraftAnything: some required arguments are missing!
  6859. +$Script will be halted.
  6860. halt
  6861. }
  6862.  
  6863. nameSpace Push
  6864. nameSpace Local CraftAnything , #time , #random , #scnt2
  6865.  
  6866. set !category %1
  6867. set !piece %2
  6868.  
  6869. set !CraftContKind #contkind
  6870. set !CraftContName #contname
  6871. set !CraftContSize #contsize
  6872.  
  6873. ; category
  6874. set !categoryX #contposx + 30
  6875. set !categoryY #contposy + 70 + !category * 20 ; +70 catergory *20
  6876. click !categoryX !categoryY f
  6877. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize 5
  6878.  
  6879. ; page
  6880. set !page ( !piece - 1 ) / 10
  6881.  
  6882. if !page > 0
  6883. {
  6884. for !i 1 !page
  6885. {
  6886. gosub ClickNextPage
  6887. }
  6888.  
  6889. if !piece % 10 <> 0
  6890. set !piece !piece % 10
  6891.  
  6892. if !piece % 10 = 0
  6893. set !piece 10
  6894. }
  6895.  
  6896. ;piece
  6897. set !pieceX #contposx + 235
  6898. set !pieceY #contposy + 50 + !piece * 20
  6899. click !pieceX !pieceY f
  6900. gosub waitForSysVars contkind <> !CraftContKind contname <> !CraftContName contsize <> !CraftContSize 5
  6901. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize 5
  6902.  
  6903. nameSpace Clear
  6904. nameSpace Pop
  6905. return
  6906.  
  6907. ;==================
  6908. ;**
  6909. ;* @name ChooseMaterial
  6910. ;* @ver 1.4 06Oct05
  6911. ;* @author Boydon
  6912. ;* @purpose Choose the material you to use to craft
  6913. ;*
  6914. ;* @params %1 req material name: it can be:
  6915. ;* iron|dull|shadow|copper|bronze|gold|agapite|verite|valorite|nocolor for Blacksmithy materials
  6916. ;* leather|spined|horned|barbed|nocolor for Tailoring materials
  6917. ;*
  6918. ;* As of version 1.4 of the library you can use ingots #findcol as argument, so values can be:
  6919. ;* 0|2419|2406|2413|2418|2213|2425|2207|2219 for Blacksmithy
  6920. ;* 0|2220|2117|2129 for Tailoring
  6921. ;* nocolor will be -1
  6922. ;*
  6923. ;* @returns
  6924. ;* @example call CraftMenuFunctions.euo ChooseMaterial iron
  6925. ;* @status tested and working properly
  6926.  
  6927. sub ChooseMaterial
  6928.  
  6929. if %0 < 1 || %1 = N/A
  6930. {
  6931. display ok Wrong use of Sub ChooseMaterial: some required arguments are missing!
  6932. +$Script will be halted.
  6933. halt
  6934. }
  6935.  
  6936. nameSpace Push
  6937. nameSpace Local ChooseMaterial , #time , #random , #scnt2
  6938.  
  6939. set !Material #false
  6940.  
  6941. if %1 = iron || %1 = leather || %1 = 0
  6942. set !Material 1
  6943. if %1 = dull || %1 = spined || %1 = 2220 || %1 = 2419
  6944. set !Material 2
  6945. if %1 = shadow || %1 = horned || %1 = 2117 || %1 = 2406
  6946. set !Material 3
  6947. if %1 = copper || %1 = barbed || %1 = 2129 || %1 = 2413
  6948. set !Material 4
  6949. if %1 = bronze || %1 = 2418
  6950. set !Material 5
  6951. if %1 = gold || %1 = 2213
  6952. set !Material 6
  6953. if %1 = agapite || %1 = 2425
  6954. set !Material 7
  6955. if %1 = verite || %1 = 2207
  6956. set !Material 8
  6957. if %1 = valorite || %1 = 2219
  6958. set !Material 9
  6959. if %1 = nocolor || %1 = -1
  6960. set !Material 11
  6961.  
  6962. if ! !Material
  6963. {
  6964. display ok Unknown material %1 ! $Script will be halted.
  6965. halt
  6966. }
  6967.  
  6968. set !CraftContKind #contkind
  6969. set !CraftContName #contname
  6970. set !CraftContSize #contsize
  6971.  
  6972. clickMaterialCategory:
  6973. set !MaterialX #contposx + 30
  6974. set !MaterialY #contposy + 370
  6975. click !MaterialX !MaterialY f
  6976.  
  6977. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize 5
  6978. if ! #result
  6979. goto clickMaterialCategory
  6980.  
  6981. clickMaterialColor:
  6982. set !ColorX #contposx + 235
  6983. set !ColorY #contposy + ( 50 + ( 20 * !Material ) )
  6984. click !ColorX !ColorY f
  6985.  
  6986. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize 5
  6987. if ! #result
  6988. goto clickMaterialColor
  6989.  
  6990. nameSpace Clear
  6991. nameSpace Pop
  6992. return
  6993.  
  6994. ;==================
  6995. ;**
  6996. ;* @name ClickNextPage
  6997. ;* @ver 1.0 24Apr05
  6998. ;* @author Boydon
  6999. ;* @purpose Once the craft menu is focused use this to click the next page button
  7000. ;*
  7001. ;* @params
  7002. ;*
  7003. ;* @returns
  7004. ;* @example call CraftMenuFunctions.euo ClickNextPage
  7005. ;* @status tested and working properly
  7006.  
  7007. sub ClickNextPage
  7008. nameSpace Push
  7009. nameSpace Local ClickNextPage , #time , #random , #scnt2
  7010.  
  7011. set !NextPageX #contposx + 385
  7012. set !NextPageY #contposy + 270
  7013. click !NextPageX !NextPageY f
  7014. wait 10
  7015.  
  7016. nameSpace Clear
  7017. nameSpace Pop
  7018. return
  7019.  
  7020. ;==================
  7021. ;**
  7022. ;* @name ClickMakeLast
  7023. ;* @ver 1.0 24Apr05
  7024. ;* @author Boydon
  7025. ;* @purpose Once the craft menu is focused use this to click the make last button
  7026. ;*
  7027. ;* @params
  7028. ;*
  7029. ;* @returns
  7030. ;* @example call CraftMenuFunctions.euo ClickMakeLast
  7031. ;* @status tested and working properly
  7032.  
  7033. sub ClickMakeLast
  7034. nameSpace Push
  7035. nameSpace Local ClickMakeLast , #time , #random , #scnt2
  7036.  
  7037. set !CraftContKind #contkind
  7038. set !CraftContName #contname
  7039. set !CraftContSize #contsize
  7040.  
  7041. set !MakeLastX #contposx + 280
  7042. set !MakeLastY #contposy + 430
  7043. click !MakeLastX !MakeLastY f
  7044. gosub waitForSysVars contkind <> !CraftContKind contname <> !CraftContName contsize <> !CraftContSize 5
  7045. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize 5
  7046.  
  7047. nameSpace Clear
  7048. nameSpace Pop
  7049. return
  7050.  
  7051. ;==================
  7052. ;**
  7053. ;* @name ClickExit
  7054. ;* @ver 1.0.1 14May05
  7055. ;* @author Boydon
  7056. ;* @purpose Once the craft menu is focused use this to click the exit button
  7057. ;*
  7058. ;* @params
  7059. ;*
  7060. ;* @returns
  7061. ;* @example call CraftMenuFunctions.euo ClickExit
  7062. ;* @status tested and working properly
  7063.  
  7064. sub ClickExit
  7065. nameSpace Push
  7066. nameSpace Local ClickExit , #time , #random , #scnt2
  7067.  
  7068. set !CraftContKind #contkind
  7069. set !CraftContName #contname
  7070. set !CraftContSize #contsize
  7071.  
  7072. set !ExitX #contposx + 30
  7073. set !ExitY #contposy + 430
  7074.  
  7075. ClickExit:
  7076. click !ExitX !ExitY f
  7077. gosub waitForSysVars contkind <> !CraftContKind contname <> !CraftContName contsize <> !CraftContSize 5
  7078.  
  7079. if ! #result && #contsize = 530_457 ; 530_457
  7080. goto ClickExit
  7081.  
  7082. nameSpace Clear
  7083. nameSpace Pop
  7084. return
  7085.  
  7086. ;==================
  7087. ;**
  7088. ;* @name ClickSmelt
  7089. ;* @ver 1.2 20Aug05
  7090. ;* @author Boydon
  7091. ;* @purpose Once the blacksmithy craft menu is focused use this to click the smelt button
  7092. ;*
  7093. ;* @params %1 opt The id of the item you want to smelt
  7094. ;*
  7095. ;* @returns
  7096. ;* @example call CraftMenuFunctions.euo ClickSmelt
  7097. ;* @status tested and working properly
  7098.  
  7099. sub ClickSmelt
  7100. nameSpace Push
  7101. nameSpace Local ClickSmelt , #time , #random , #scnt2
  7102.  
  7103. set !CraftContKind #contkind
  7104. set !CraftContName #contname
  7105. set !CraftContSize #contsize
  7106.  
  7107. set !TargetItem #false
  7108. if %0 = 1
  7109. {
  7110. set !TargetItem #true
  7111. set !Item %1
  7112. }
  7113.  
  7114. set !SmeltX #contposx + 30
  7115. set !SmeltY #contposy + 355
  7116. click !SmeltX !SmeltY f
  7117. gosub waitForSysVars contkind <> !CraftContKind contname <> !CraftContName contsize <> !CraftContSize targcurs = 1 5
  7118.  
  7119. if !TargetItem
  7120. {
  7121. set #ltargetkind 1
  7122. set #ltargetid !Item
  7123. Event Macro 22 0
  7124. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize targcurs = 0 5
  7125. }
  7126.  
  7127. nameSpace Clear
  7128. nameSpace Pop
  7129. return
  7130.  
  7131. ;==================
  7132. ;**
  7133. ;* @name ClickRepair
  7134. ;* @ver 1.2 20Aug05
  7135. ;* @author Boydon
  7136. ;* @purpose Once the craft menu is focused use this to click the repair button
  7137. ;*
  7138. ;* @params %1 opt The id of the item you want to repair
  7139. ;*
  7140. ;* @returns
  7141. ;* @example call CraftMenuFunctions.euo ClickRepair
  7142. ;* @status tested and working properly
  7143.  
  7144. sub ClickRepair
  7145. nameSpace Push
  7146. nameSpace Local ClickRepair , #time , #random , #scnt2
  7147.  
  7148. set !CraftContKind #contkind
  7149. set !CraftContName #contname
  7150. set !CraftContSize #contsize
  7151.  
  7152. set !TargetItem #false
  7153. if %0 = 1
  7154. {
  7155. set !TargetItem #true
  7156. set !Item %1
  7157. }
  7158.  
  7159. set !RepairX #contposx + 280
  7160. set !RepairY #contposy + 355
  7161.  
  7162. click !RepairX !RepairY f
  7163. gosub waitForSysVars contkind <> !CraftContKind contname <> !CraftContName contsize <> !CraftContSize targcurs = 1 5
  7164.  
  7165. if !TargetItem
  7166. {
  7167. set #ltargetkind 1
  7168. set #ltargetid !Item
  7169. Event Macro 22 0
  7170. gosub waitForSysVars contkind = !CraftContKind contname = !CraftContName contsize = !CraftContSize targcurs = 0 5
  7171. }
  7172.  
  7173. nameSpace Clear
  7174. nameSpace Pop
  7175. return
  7176.  
  7177. ;==================
  7178. ;**
  7179. ;* @name Initialize
  7180. ;* @ver 1.1 12Sep05
  7181. ;* @author Boydon
  7182. ;* @purpose This function is for internal purpose only. If you plan to use this
  7183. ;* library inside one of your script, running this will ensure you,
  7184. ;* returning the version number of the library, that you are calling
  7185. ;* the library in the right way.
  7186. ;*
  7187. ;* @params
  7188. ;*
  7189. ;* @returns Version of the library with no float
  7190. ;* @example call GetBodParameters.euo Initialize
  7191. ;* @status tested and working properly
  7192.  
  7193. Sub Initialize
  7194. return 140
  7195.  
  7196. Sub Inizialize ; misspelled, but required for backward compatibility
  7197. gosub Initialize
  7198. return #result
  7199.  
  7200.  
  7201. ;------------------------ IMPORTED SUBS ------------------------
  7202.  
  7203. ;==================================
  7204. ; Script Name: sub waitForSysVars
  7205. ; Author: Quintok / Raziel
  7206. ; Version: 1.04
  7207. ; Client Tested with: 4.0.2b
  7208. ; EUO version tested with: 0078
  7209. ; Shard OSI / FS: OSI / FS
  7210. ; Revision Date: 21st March 2004
  7211. ; Public Release: 20th March 2004
  7212. ; Global Variables Used: none
  7213. ; Purpose: same as waitForSysVar but for multiple inputs.
  7214. ;==================================
  7215. sub waitForSysVars
  7216. set !cnt %0 / 3
  7217. if ( %0 % 3 = 1 )
  7218. set !timeOut #scnt + % . %0
  7219. else
  7220. set !timeOut #scnt + 5
  7221. for !i 1 !cnt
  7222. {
  7223. set !offset 3 * !i - 2
  7224. set !evaluation !offset + 1
  7225. set !value !offset + 2
  7226. if ! ( # . % . !offset % . !evaluation % . !value )
  7227. set !i 0
  7228. if #scnt > !timeout
  7229. return #false
  7230. }
  7231. return #true
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238. ;==================================
  7239. ; Script Name: BodFunctions.euo
  7240. ; Author: Boydon & AG
  7241. ; Version: 2.0
  7242. ; Purpose: A callable library to handle BOD-related functions.
  7243. ;==================================
  7244.  
  7245. set %_0 %0
  7246. goto %_0
  7247. 0:
  7248. exit
  7249. 1:
  7250. gosub %1
  7251. exit
  7252. 2:
  7253. gosub %1 %2
  7254. exit
  7255. 3:
  7256. gosub %1 %2 %3
  7257. exit
  7258. 4:
  7259. gosub %1 %2 %3 %4
  7260. exit
  7261. 5:
  7262. gosub %1 %2 %3 %4 %5
  7263. exit
  7264. 6:
  7265. gosub %1 %2 %3 %4 %5 %6
  7266. exit
  7267. 7:
  7268. gosub %1 %2 %3 %4 %5 %6 %7
  7269. exit
  7270. 8:
  7271. gosub %1 %2 %3 %4 %5 %6 %7 %8
  7272. exit
  7273. 9:
  7274. gosub %1 %2 %3 %4 %5 %6 %7 %8 %9
  7275. exit
  7276. 10:
  7277. gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
  7278. exit
  7279.  
  7280. ;==================
  7281. ;* To do list
  7282. ;*
  7283. ;* Add support for Blacksmithing:
  7284. ;* Add blacksmity support implementing sub GetSmithyBodParameters (48 bods to be implemented!!)
  7285. ;* This has been partialy done (36 bod added)
  7286.  
  7287. ;==================
  7288. ;**
  7289. ;* @name GetTailorBodParameters
  7290. ;* @ver 1.0 11May05
  7291. ;* @author Boydon
  7292. ;* @purpose Get info about the piece that is needed to fill the BOD
  7293. ;*
  7294. ;* @params %1 req #property of the bod
  7295. ;* %2 opt name of the variable containing the category without the "%" symbol (default is "category")
  7296. ;* %3 opt name of the variable containing the piece without the "%" symbol (default is "piece")
  7297. ;* %4 opt name of the variable containing the required cloth without the "%" symbol (default is "cloth")
  7298. ;* %5 opt name of the variable containing the required hides without the "%" symbol (default is "hides")
  7299. ;* %6 opt name of the variable containing the required bones without the "%" symbol (default is "bones")
  7300. ;* %7 opt name of the variable containing the item type without the "%" symbol (default is "type")
  7301. ;*
  7302. ;* @returns
  7303. ;* @example call GetBodParameters.euo GetTailorBodParameters #property
  7304. ;* this is the standar call
  7305. ;* call GetBodParameters.euo GetTailorBodParameters #property selection piece_number cloth leather bone item_type
  7306. ;* this is a call wich will return infos in %selection, %piece_number,
  7307. ;* %cloth, %leather and %bone item_type variables
  7308. ;* @status deeply tested
  7309.  
  7310. sub GetTailorBodParameters ; TUTTO OK
  7311.  
  7312. if %0 < 1 || %1 = N/A
  7313. {
  7314. display ok Wrong use of Sub GetTailorBodParameters: some required arguments are missing!
  7315. +$Script will be halted.
  7316. halt
  7317. }
  7318.  
  7319. if %2 = N/A || %0 = 1
  7320. set %2 category
  7321. if %3 = N/A || %0 <= 2
  7322. set %3 piece
  7323. if %4 = N/A || %0 <= 3
  7324. set %4 cloth
  7325. if %5 = N/A || %0 <= 4
  7326. set %5 hides
  7327. if %6 = N/A || %0 <= 5
  7328. set %6 bones
  7329. if %7 = N/A || %0 <= 6
  7330. set %7 type
  7331.  
  7332. nameSpace Push
  7333. nameSpace Local GetTailorBodParameters , #time , #random , #scnt2
  7334.  
  7335. set !Property %1
  7336. set !Category %2
  7337. set !Piece %3
  7338. set !Cloth %4
  7339. set !Hides %5
  7340. set !Bones %6
  7341. set !Type %7
  7342.  
  7343. set !lpc #lpc
  7344. set #lpc 500
  7345.  
  7346. set % . !Category N/A
  7347. set % . !Cloth 0
  7348. set % . !Hides 0
  7349. set % . !Bones 0
  7350.  
  7351. if cap in !Property && skull in !Property && leather notin !Property
  7352. {
  7353. set % . !Category 2
  7354. set % . !Piece 1
  7355. set % . !Cloth 2
  7356. set % . !Type CZH
  7357. goto gbp_out
  7358. }
  7359.  
  7360. if cap in !Property && skull notin !Property && leather notin !Property
  7361. {
  7362. set % . !Category 2
  7363. set % . !Piece 4
  7364. set % . !Cloth 11
  7365. set % . !Type VVI
  7366. goto gbp_out
  7367. }
  7368.  
  7369. if bandana in !Property
  7370. {
  7371. set % . !Category 2
  7372. set % . !Piece 2
  7373. set % . !Cloth 2
  7374. set % . !Type GZH
  7375. goto gbp_out
  7376. }
  7377.  
  7378. if hat in !Property
  7379. {
  7380.  
  7381. if floppy in !Property
  7382. {
  7383. set % . !Category 2
  7384. set % . !Piece 3
  7385. set % . !Cloth 11
  7386. set % . !Type BWI
  7387. goto gbp_out
  7388. }
  7389.  
  7390. if wide in !Property
  7391. {
  7392. set % . !Category 2
  7393. set % . !Piece 5
  7394. set % . !Cloth 12
  7395. set % . !Type WVI
  7396. goto gbp_out
  7397. }
  7398.  
  7399. if straw in !Property && tall notin !Property
  7400. {
  7401. set % . !Category 2
  7402. set % . !Piece 6
  7403. set % . !Cloth 10
  7404. set % . !Type XVI
  7405. goto gbp_out
  7406. }
  7407.  
  7408. if straw in !Property && tall in !Property
  7409. {
  7410. set % . !Category 2
  7411. set % . !Piece 7
  7412. set % . !Cloth 13
  7413. set % . !Type YVI
  7414. goto gbp_out
  7415. }
  7416.  
  7417. if wizard in !Property
  7418. {
  7419. set % . !Category 2
  7420. set % . !Piece 8
  7421. set % . !Cloth 15
  7422. set % . !Type IWI
  7423. goto gbp_out
  7424. }
  7425.  
  7426. if feathered in !Property
  7427. {
  7428. set % . !Category 2
  7429. set % . !Piece 10
  7430. set % . !Cloth 12
  7431. set % . !Type KWI
  7432. goto gbp_out
  7433. }
  7434.  
  7435. if tricorne in !Property
  7436. {
  7437. set % . !Category 2
  7438. set % . !Piece 11
  7439. set % . !Cloth 12
  7440. set % . !Type JWI
  7441. goto gbp_out
  7442. }
  7443.  
  7444. if jester in !Property
  7445. {
  7446. set % . !Category 2
  7447. set % . !Piece 12
  7448. set % . !Cloth 15
  7449. set % . !Type EWI
  7450. goto gbp_out
  7451. }
  7452. }
  7453.  
  7454. if bonnet in !Property
  7455. {
  7456. set % . !Category 2
  7457. set % . !Piece 9
  7458. set % . !Cloth 11
  7459. set % . !Type HWI
  7460. goto gbp_out
  7461. }
  7462.  
  7463. if doublet in !Property
  7464. {
  7465. set % . !Category 3
  7466. set % . !Piece 1
  7467. set % . !Cloth 8
  7468. set % . !Type XVL
  7469. goto gbp_out
  7470. }
  7471.  
  7472. if shirt in !Property && fancy notin !Property
  7473. {
  7474. set % . !Category 3
  7475. set % . !Piece 2
  7476. set % . !Cloth 8
  7477. set % . !Type FCI
  7478. goto gbp_out
  7479. }
  7480.  
  7481. if shirt in !Property && fancy in !Property
  7482. {
  7483. set % . !Category 3
  7484. set % . !Piece 3
  7485. set % . !Cloth 8
  7486. set % . !Type TQL
  7487. goto gbp_out
  7488. }
  7489.  
  7490. if tunic in !Property && leather notin !Property && studded notin !Property
  7491. {
  7492. set % . !Category 3
  7493. set % . !Piece 4
  7494. set % . !Cloth 12
  7495. set % . !Type HCM
  7496. goto gbp_out
  7497. }
  7498.  
  7499. if surcoat in !Property
  7500. {
  7501. set % . !Category 3
  7502. set % . !Piece 5
  7503. set % . !Cloth 14
  7504. set % . !Type PAM
  7505. goto gbp_out
  7506. }
  7507.  
  7508. if dress in !Property
  7509. {
  7510. if plain in !Property
  7511. {
  7512. set % . !Category 3
  7513. set % . !Piece 6
  7514. set % . !Cloth 10
  7515. set % . !Type DWL
  7516. goto gbp_out
  7517. }
  7518.  
  7519. if fancy in !Property
  7520. {
  7521. set % . !Category 3
  7522. set % . !Piece 7
  7523. set % . !Cloth 12
  7524. set % . !Type VQL_EWL
  7525. goto gbp_out
  7526. }
  7527. }
  7528.  
  7529. if cloak in !Property
  7530. {
  7531. set % . !Category 3
  7532. set % . !Piece 8
  7533. set % . !Cloth 14
  7534. set % . !Type DCI
  7535. goto gbp_out
  7536. }
  7537.  
  7538. if robe in !Property
  7539. {
  7540. set % . !Category 3
  7541. set % . !Piece 9
  7542. set % . !Cloth 16
  7543. set % . !Type FWL
  7544. goto gbp_out
  7545. }
  7546.  
  7547. if suit in !Property
  7548. {
  7549. set % . !Category 3
  7550. set % . !Piece 10
  7551. set % . !Cloth 24
  7552. set % . !Type XBM
  7553. goto gbp_out
  7554. }
  7555.  
  7556. if pants in !Property
  7557. {
  7558. if short in !Property
  7559. {
  7560. set % . !Category 3
  7561. set % . !Piece 26
  7562. set % . !Cloth 6
  7563. set % . !Type EDI
  7564. goto gbp_out
  7565. }
  7566.  
  7567. if long in !Property
  7568. {
  7569. set % . !Category 3
  7570. set % . !Piece 27
  7571. set % . !Cloth 8
  7572. set % . !Type VDI
  7573. goto gbp_out
  7574. }
  7575. }
  7576.  
  7577. if kilt in !Property
  7578. {
  7579. set % . !Category 3
  7580. set % . !Piece 28
  7581. set % . !Cloth 8
  7582. set % . !Type LDI
  7583. goto gbp_out
  7584. }
  7585.  
  7586. if skirt in !Property && leather notin !Property
  7587. {
  7588. set % . !Category 3
  7589. set % . !Piece 29
  7590. set % . !Cloth 10
  7591. set % . !Type GCI
  7592. goto gbp_out
  7593. }
  7594.  
  7595. if body in !Property
  7596. {
  7597. set % . !Category 4
  7598. set % . !Piece 1
  7599. set % . !Cloth 4
  7600. set % . !Type FZH
  7601. goto gbp_out
  7602. }
  7603.  
  7604. if apron in !Property
  7605. {
  7606. if half in !Property
  7607. {
  7608. set % . !Category 4
  7609. set % . !Piece 2
  7610. set % . !Cloth 6
  7611. set % . !Type XDI
  7612. goto gbp_out
  7613. }
  7614.  
  7615. if full in !Property
  7616. {
  7617. set % . !Category 4
  7618. set % . !Piece 3
  7619. set % . !Cloth 10
  7620. set % . !Type RDI
  7621. goto gbp_out
  7622. }
  7623. }
  7624.  
  7625. if leather in !Property && studded notin !Property && bone notin !Property
  7626. {
  7627. if gorget in !Property
  7628. {
  7629. set % . !Category 6
  7630. set % . !Piece 4
  7631. set % . !Hides 4
  7632. set % . !Type JKH
  7633. goto gbp_out
  7634. }
  7635.  
  7636. if cap in !Property
  7637. {
  7638. set % . !Category 6
  7639. set % . !Piece 5
  7640. set % . !Hides 2
  7641. set % . !Type NJL
  7642. goto gbp_out
  7643. }
  7644.  
  7645. if gloves in !Property
  7646. {
  7647. set % . !Category 6
  7648. set % . !Piece 6
  7649. set % . !Hides 3
  7650. set % . !Type KKH
  7651. goto gbp_out
  7652. }
  7653.  
  7654. if sleeves in !Property
  7655. {
  7656. set % . !Category 6
  7657. set % . !Piece 7
  7658. set % . !Hides 4
  7659. set % . !Type HKH
  7660. goto gbp_out
  7661. }
  7662.  
  7663. if leggings in !Property
  7664. {
  7665. set % . !Category 6
  7666. set % . !Piece 8
  7667. set % . !Hides 10
  7668. set % . !Type VKH
  7669. goto gbp_out
  7670. }
  7671.  
  7672. if tunic in !Property
  7673. {
  7674. set % . !Category 6
  7675. set % . !Piece 9
  7676. set % . !Hides 12
  7677. set % . !Type QKH
  7678. goto gbp_out
  7679. }
  7680.  
  7681. if shorts in !Property
  7682. {
  7683. set % . !Category 9
  7684. set % . !Piece 1
  7685. set % . !Hides 8
  7686. set % . !Type QSK
  7687. goto gbp_out
  7688. }
  7689.  
  7690. if skirt in !Property
  7691. {
  7692. set % . !Category 9
  7693. set % . !Piece 2
  7694. set % . !Hides 6
  7695. set % . !Type YSK
  7696. goto gbp_out
  7697. }
  7698.  
  7699. if bustier in !Property
  7700. {
  7701. set % . !Category 9
  7702. set % . !Piece 3
  7703. set % . !Hides 6
  7704. set % . !Type ATK
  7705. goto gbp_out
  7706. }
  7707.  
  7708. if female in !Property
  7709. {
  7710. set % . !Category 9
  7711. set % . !Piece 5
  7712. set % . !Hides 8
  7713. set % . !Type OSK
  7714. goto gbp_out
  7715. }
  7716. }
  7717.  
  7718. if studded in !Property
  7719. {
  7720. if gorget in !Property
  7721. {
  7722. set % . !Category 8
  7723. set % . !Piece 1
  7724. set % . !Hides 6
  7725. set % . !Type ALH
  7726. goto gbp_out
  7727. }
  7728.  
  7729. if gloves in !Property
  7730. {
  7731. set % . !Category 8
  7732. set % . !Piece 2
  7733. set % . !Hides 8
  7734. set % . !Type XKH
  7735. goto gbp_out
  7736. }
  7737.  
  7738. if sleeves in !Property
  7739. {
  7740. set % . !Category 8
  7741. set % . !Piece 3
  7742. set % . !Hides 10
  7743. set % . !Type YKH
  7744. goto gbp_out
  7745. }
  7746.  
  7747. if leggings in !Property
  7748. {
  7749. set % . !Category 8
  7750. set % . !Piece 4
  7751. set % . !Hides 12
  7752. set % . !Type MLH
  7753. goto gbp_out
  7754. }
  7755.  
  7756. if tunic in !Property
  7757. {
  7758. set % . !Category 8
  7759. set % . !Piece 5
  7760. set % . !Hides 14
  7761. set % . !Type LLH
  7762. goto gbp_out
  7763. }
  7764.  
  7765. if bustier in !Property
  7766. {
  7767. set % . !Category 9
  7768. set % . !Piece 4
  7769. set % . !Hides 8
  7770. set % . !Type USK
  7771. goto gbp_out
  7772. }
  7773.  
  7774. if armor in !Property
  7775. {
  7776. set % . !Category 9
  7777. set % . !Piece 6
  7778. set % . !Hides 10
  7779. set % . !Type SSK
  7780. goto gbp_out
  7781. }
  7782. }
  7783.  
  7784. if bone in !Property
  7785. {
  7786. if helmet in !Property
  7787. {
  7788. set % . !Category 10
  7789. set % . !Piece 1
  7790. set % . !Hides 4
  7791. set % . !Bones 2
  7792. set % . !Type ZPH
  7793. goto gbp_out
  7794. }
  7795.  
  7796. if gloves in !Property
  7797. {
  7798. set % . !Category 10
  7799. set % . !Piece 2
  7800. set % . !Hides 6
  7801. set % . !Bones 2
  7802. set % . !Type VPH
  7803. goto gbp_out
  7804. }
  7805.  
  7806. if arms in !Property
  7807. {
  7808. set % . !Category 10
  7809. set % . !Piece 3
  7810. set % . !Hides 8
  7811. set % . !Bones 4
  7812. set % . !Type BQH
  7813. goto gbp_out
  7814. }
  7815.  
  7816. if leggings in !Property
  7817. {
  7818. set % . !Category 10
  7819. set % . !Piece 4
  7820. set % . !Hides 10
  7821. set % . !Bones 6
  7822. set % . !Type CQH
  7823. goto gbp_out
  7824. }
  7825.  
  7826. if armor in !Property
  7827. {
  7828. set % . !Category 10
  7829. set % . !Piece 5
  7830. set % . !Hides 12
  7831. set % . !Bones 10
  7832. set % . !Type PPH
  7833. goto gbp_out
  7834. }
  7835. }
  7836.  
  7837. if boots in !Property && thigh notin !Property
  7838. {
  7839. set % . !Category 5
  7840. set % . !Piece 7
  7841. set % . !Hides 8
  7842. set % . !Type TVI
  7843. goto gbp_out
  7844. }
  7845.  
  7846. if boots in !Property && thigh in !Property
  7847. {
  7848. set % . !Category 5
  7849. set % . !Piece 8
  7850. set % . !Hides 10
  7851. set % . !Type ZVI
  7852. goto gbp_out
  7853. }
  7854.  
  7855. if shoes in !Property
  7856. {
  7857. set % . !Category 5
  7858. set % . !Piece 6
  7859. set % . !Hides 6
  7860. set % . !Type PVI
  7861. goto gbp_out
  7862. }
  7863.  
  7864. if sandals in !Property
  7865. {
  7866. set % . !Category 5
  7867. set % . !Piece 5
  7868. set % . !Hides 4
  7869. set % . !Type NVI
  7870. goto gbp_out
  7871. }
  7872.  
  7873. gbp_out:
  7874. set #lpc !lpc
  7875.  
  7876. if % . !Category = N/A
  7877. {
  7878. display ok Impossible to recognize the bod. Please report the problem to Boydon! $Script will be halted!
  7879. halt
  7880. }
  7881.  
  7882. nameSpace Clear
  7883. nameSpace Pop
  7884. return
  7885. ;==================
  7886. ;**
  7887. ;* @name GetSmithyBodParameters
  7888. ;* @ver 1.0 beta 07Oct05
  7889. ;***** REVISION DATE 27/03/2011 by Aeron **********
  7890. ;* @author Boydon
  7891. ;* @purpose Get info about the piece that is needed to fill the BOD
  7892. ;*
  7893. ;* @params %1 req #property of the bod
  7894. ;* %2 opt name of the variable containing the category without the "%" symbol (default is "category")
  7895. ;* %3 opt name of the variable containing the piece without the "%" symbol (default is "piece")
  7896. ;* %4 opt name of the variable containing the required ingots without the "%" symbol (default is "ingots")
  7897. ;* %5 opt name of the variable containing the item type without the "%" symbol (default is "type")
  7898. ;*
  7899. ;* @returns
  7900. ;* @example call GetBodParameters.euo GetSmithyBodParameters #property
  7901. ;* this is the standar call
  7902. ;* call GetBodParameters.euo GetSmithyBodParameters #property selection piece_number ing item_type
  7903. ;* this is a call wich will return infos in %selection, %piece_number, %ing and %item_type variables
  7904. ;* @status need to be tested
  7905.  
  7906. sub GetSmithyBodParameters ; MANCANO I CRAFT PER STAGYON ABBYS
  7907.  
  7908. if %0 < 1 || %1 = N/A
  7909. {
  7910. display ok Wrong use of Sub GetTailorBodParameters: some required arguments are missing!
  7911. +$Script will be halted.
  7912. halt
  7913. }
  7914.  
  7915. if %2 = N/A || %0 = 1
  7916. set %2 category
  7917. if %3 = N/A || %0 <= 2
  7918. set %3 piece
  7919. if %4 = N/A || %0 <= 3
  7920. set %4 ingots
  7921. if %5 = N/A || %0 <= 4
  7922. set %5 Type
  7923.  
  7924.  
  7925. nameSpace Push
  7926. nameSpace Local GetTailorBodParameters , #time , #random , #scnt2
  7927.  
  7928. set !Property %1
  7929. set !Category %2
  7930. set !Piece %3
  7931. set !Ingots %4
  7932. set !Type %5
  7933.  
  7934. set !lpc #lpc
  7935. set #lpc 500
  7936.  
  7937. set % . !Category N/A
  7938. set % . !Ingots 0
  7939.  
  7940. if plate in #property ; PLATEMAIL
  7941. {
  7942. if Arms in #property ; platemail arms
  7943. {
  7944. set % . !Category 1
  7945. set % . !Piece 8
  7946. set % . !Ingots 18
  7947. set % . !Type MSH
  7948. goto gbbp_out
  7949. }
  7950.  
  7951. if female in #property ;platemail (famele)
  7952. {
  7953. set % . !Category 1
  7954. set % . !Piece 13
  7955. set % . !Ingots 20
  7956. set % . !Type MSK
  7957. goto gbbp_out
  7958. }
  7959.  
  7960. if legs in #property ;platemail legs
  7961. {
  7962. set % . !Category 1
  7963. set % . !Piece 11
  7964. set % . !Ingots 20
  7965. set % . !Type LSH
  7966. goto gbbp_out
  7967. }
  7968.  
  7969. if gorget in #property ;platemail gorget
  7970. {
  7971. set % . !Category 1
  7972. set % . !Piece 10
  7973. set % . !Ingots 10
  7974. set % . !Type NSH
  7975. goto gbbp_out
  7976. }
  7977.  
  7978. if tunic in #property ; platemail tunic
  7979. {
  7980. set % . !Category 1
  7981. set % . !Piece 12
  7982. set % . !Ingots 25
  7983. set % . !Type HSH
  7984. goto gbbp_out
  7985. }
  7986.  
  7987. if gloves in #property ;platemail gloves
  7988. {
  7989. set % . !Category 1
  7990. set % . !Piece 9
  7991. set % . !Ingots 12
  7992. set % . !Type ISH
  7993. goto gbbp_out
  7994. }
  7995.  
  7996. if helm in #property ; plate helm - categoria
  7997. {
  7998. set % . !Category 2
  7999. set % . !Piece 5
  8000. set % . !Ingots 15
  8001. set % . !Type OSH
  8002. goto gbbp_out
  8003. }
  8004. }
  8005.  
  8006. if ringmail in #property
  8007. {
  8008. if Leggings in #property
  8009. {
  8010. set % . !Category 1
  8011. set % . !Piece 2
  8012. set % . !Ingots 16
  8013. set % . !Type IMH
  8014. goto gbbp_out
  8015. }
  8016.  
  8017. if Gloves in #property
  8018. {
  8019. set % . !Category 1
  8020. set % . !Piece 1
  8021. set % . !Ingots 10
  8022. set % . !Type BMH
  8023. goto gbbp_out
  8024. }
  8025.  
  8026. if Tunic in #property
  8027. {
  8028. set % . !Category 1
  8029. set % . !Piece 4
  8030. set % . !Ingots 18
  8031. set % . !Type WLH
  8032. goto gbbp_out
  8033. }
  8034.  
  8035. if Sleeves in #property
  8036. {
  8037. set % . !Category 1
  8038. set % . !Piece 3
  8039. set % . !Ingots 14
  8040. set % . !Type XLH
  8041. goto gbbp_out
  8042. }
  8043. }
  8044.  
  8045. if chainmail in #property ; CHAIMAIL
  8046. {
  8047. if Leggings in #property
  8048. {
  8049. set % . !Category 1
  8050. set % . !Piece 6
  8051. set % . !Ingots 18
  8052. set % . !Type APH
  8053. goto gbbp_out
  8054. }
  8055.  
  8056. if coif in #property
  8057. {
  8058. set % . !Category 1
  8059. set % . !Piece 5
  8060. set % . !Ingots 10
  8061. set % . !Type DPH
  8062. goto gbbp_out
  8063. }
  8064.  
  8065. if Tunic in #property
  8066. {
  8067. set % . !Category 1
  8068. set % . !Piece 7
  8069. set % . !Ingots 20
  8070. set % . !Type ZOH
  8071. goto gbbp_out
  8072. }
  8073.  
  8074. }
  8075.  
  8076. if axe in #property && war notin #property ;AXE
  8077. {
  8078. if two in #property
  8079. {
  8080. set % . !Category 6
  8081. set % . !Piece 6
  8082. set % . !Ingots 16
  8083. set % . !Type LPH
  8084. goto gbbp_out
  8085. }
  8086.  
  8087. if Executioner in #property
  8088. {
  8089. set % . !Category 6
  8090. set % . !Piece 4
  8091. set % . !Ingots 14
  8092. set % . !Type ZRF
  8093. goto gbbp_out
  8094. }
  8095.  
  8096. if Large in #property
  8097. {
  8098. set % . !Category 6
  8099. set % . !Piece 5
  8100. set % . !Ingots 12
  8101. set % . !Type RMH
  8102. goto gbbp_out
  8103. }
  8104.  
  8105. if Double in #property
  8106. {
  8107. set % . !Category 6
  8108. set % . !Piece 3
  8109. set % . !Ingots 12
  8110. set % . !Type NSF
  8111. goto gbbp_out
  8112. }
  8113.  
  8114. if Battle in #property
  8115. {
  8116. set % . !Category 6
  8117. set % . !Piece 2
  8118. set % . !Ingots 14
  8119. set % . !Type BSF
  8120. goto gbbp_out
  8121. }
  8122.  
  8123. if two notin #property && Executioner notin #property && Large notin #property && Double notin #property && Battle notin #property && war notin #property
  8124. {
  8125. set % . !Category 6
  8126. set % . !Piece 1
  8127. set % . !Ingots 14
  8128. set % . !Type LSF
  8129. goto gbbp_out
  8130. }
  8131. }
  8132.  
  8133. if Spear in #property && short notin #property ; Polearms
  8134. {
  8135. set % . !Category 7
  8136. set % . !Piece 8
  8137. set % . !Ingots 12
  8138. set % . !Type MTF
  8139. goto gbbp_out
  8140. }
  8141.  
  8142. if Spear in #property && short in #property ; Polearms
  8143. {
  8144. set % . !Category 7
  8145. set % . !Piece 6
  8146. set % . !Ingots 6
  8147. set % . !Type XRH
  8148. goto gbbp_out
  8149. }
  8150.  
  8151. if war in #property ; Bashing
  8152. {
  8153. if mace in #property
  8154. {
  8155. set % . !Category 8
  8156. set % . !Piece 5
  8157. set % . !Ingots 14
  8158. set % . !Type TRH
  8159. goto gbbp_out
  8160. }
  8161.  
  8162. if axe in #property ;Axes
  8163. {
  8164. set % . !Category 6
  8165. set % . !Piece 7
  8166. set % . !Ingots 16
  8167. set % . !Type UOH
  8168. goto gbbp_out
  8169. }
  8170. if fork in #property ; Polearmes
  8171. {
  8172. set % . !Category 7
  8173. set % . !Piece 9
  8174. set % . !Ingots 12
  8175. set % . !Type RRH
  8176. goto gbbp_out
  8177. }
  8178.  
  8179. if Hammer in #property ; Bashing
  8180. {
  8181. set % . !Category 8
  8182. set % . !Piece 6
  8183. set % . !Ingots 16
  8184. set % . !Type ZTH
  8185. goto gbbp_out
  8186. }
  8187. }
  8188.  
  8189. if helmet in #property ;HELMET
  8190. {
  8191. if close in #property
  8192. {
  8193. set % . !Category 2
  8194. set % . !Piece 2
  8195. set % . !Ingots 15
  8196. set % . !Type ESH
  8197. goto gbbp_out
  8198. }
  8199.  
  8200. if ! ( close in #property )
  8201. {
  8202. set % . !Category 2
  8203. set % . !Piece 3
  8204. set % . !Ingots 15
  8205. set % . !Type GSH
  8206. goto gbbp_out
  8207. }
  8208. }
  8209.  
  8210. if Shield in #property ;Shield
  8211. {
  8212. if Bronze , #SPC , Shield in #property
  8213. {
  8214. set % . !Category 3
  8215. set % . !Piece 2
  8216. set % . !Ingots 12
  8217. set % . !Type GIK
  8218. goto gbbp_out
  8219. }
  8220.  
  8221. if Tear in #property && Kite in #property
  8222. {
  8223. set % . !Category 3
  8224. set % . !Piece 6
  8225. set % . !Ingots 16
  8226. set % . !Type MIK_LIK
  8227. goto gbbp_out
  8228. }
  8229.  
  8230. if Metal in #property && Kite in #property
  8231. {
  8232. set % . !Category 3
  8233. set % . !Piece 5
  8234. set % . !Ingots 16
  8235. set % . !Type AIK
  8236. goto gbbp_out
  8237. }
  8238.  
  8239. if Metal in #property && Kite notin #property
  8240. {
  8241. set % . !Category 3
  8242. set % . !Piece 4
  8243. set % . !Ingots 14
  8244. set % . !Type NIK
  8245. goto gbbp_out
  8246. }
  8247.  
  8248. if Heater in #property
  8249. {
  8250. set % . !Category 3
  8251. set % . !Piece 3
  8252. set % . !Ingots 18
  8253. set % . !Type CIK
  8254. goto gbbp_out
  8255. }
  8256. }
  8257.  
  8258. if Bascinet in #property
  8259. {
  8260. set % . !Category 2
  8261. set % . !Piece 1
  8262. set % . !Ingots 15
  8263. set % . !Type ASH
  8264. goto gbbp_out
  8265. }
  8266.  
  8267. if Norse in #property
  8268. {
  8269. set % . !Category 2
  8270. set % . !Piece 4
  8271. set % . !Ingots 15
  8272. set % . !Type CSH
  8273. goto gbbp_out
  8274. }
  8275.  
  8276. if Buckler in #property
  8277. {
  8278. set % . !Category 3
  8279. set % . !Piece 1
  8280. set % . !Ingots 10
  8281. set % . !Type FIK
  8282. goto gbbp_out
  8283. }
  8284.  
  8285. if sword in #property ;BLADE
  8286. {
  8287. if Viking in #property
  8288. {
  8289. set % . !Category 5
  8290. set % . !Piece 10
  8291. set % . !Ingots 14
  8292. set % . !Type BPH
  8293. goto gbbp_out
  8294. }
  8295.  
  8296. if Long in #property
  8297. {
  8298. set % . !Category 5
  8299. set % . !Piece 8
  8300. set % . !Ingots 12
  8301. set % . !Type JTF
  8302. goto gbbp_out
  8303. }
  8304.  
  8305. if Broad in #property
  8306. {
  8307. set % . !Category 5
  8308. set % . !Piece 2
  8309. set % . !Ingots 10
  8310. set % . !Type ATF
  8311. goto gbbp_out
  8312. }
  8313. }
  8314.  
  8315. if Scimitar in #property
  8316. {
  8317. set % . !Category 5
  8318. set % . !Piece 9
  8319. set % . !Ingots 10
  8320. set % . !Type SOH
  8321. goto gbbp_out
  8322. }
  8323.  
  8324. if Katana in #property
  8325. {
  8326. set % . !Category 5
  8327. set % . !Piece 6
  8328. set % . !Ingots 8
  8329. set % . !Type NMH
  8330. goto gbbp_out
  8331. }
  8332.  
  8333. if Cutlass in #property
  8334. {
  8335. set % . !Category 5
  8336. set % . !Piece 4
  8337. set % . !Ingots 8
  8338. set % . !Type JPH
  8339. goto gbbp_out
  8340. }
  8341.  
  8342. if Kryss in #property
  8343. {
  8344. set % . !Category 5
  8345. set % . !Piece 7
  8346. set % . !Ingots 8
  8347. set % . !Type VRH
  8348. goto gbbp_out
  8349. }
  8350.  
  8351. if Bardiche in #property ; Polearms
  8352. {
  8353. set % . !Category 7
  8354. set % . !Piece 1
  8355. set % . !Ingots 18
  8356. set % . !Type HSF
  8357. goto gbbp_out
  8358. }
  8359.  
  8360. if Halberd in #property
  8361. {
  8362. set % . !Category 7
  8363. set % . !Piece 3
  8364. set % . !Ingots 20
  8365. set % . !Type XTH
  8366. goto gbbp_out
  8367. }
  8368.  
  8369. if Hammer , #SPC , Pick in #property
  8370. {
  8371. set % . !Category 8
  8372. set % . !Piece 1
  8373. set % . !Ingots 16
  8374. set % . !Type VTH
  8375. goto gbbp_out
  8376. }
  8377.  
  8378. if Mace in #property && war notin #property
  8379. {
  8380. set % . !Category 8
  8381. set % . !Piece 2
  8382. set % . !Ingots 6
  8383. set % . !Type YSF
  8384. goto gbbp_out
  8385. }
  8386.  
  8387. if Maul in #property
  8388. {
  8389. set % . !Category 8
  8390. set % . !Piece 3
  8391. set % . !Ingots 10
  8392. set % . !Type BUH
  8393. goto gbbp_out
  8394. }
  8395.  
  8396. if dagger in #property
  8397. {
  8398. set % . !Category 5
  8399. set % . !Piece 5
  8400. set % . !Ingots 3
  8401. set % . !Type TSF
  8402. goto gbbp_out
  8403. }
  8404.  
  8405. gbbp_out:
  8406. set #lpc !lpc
  8407.  
  8408. if % . !Category = N/A
  8409. {
  8410. display ok Impossible to recognize the bod. Please report the problem to Boydon! $Script will be halted!
  8411. halt
  8412. }
  8413.  
  8414. nameSpace Clear
  8415. nameSpace Pop
  8416. return
  8417. ;==================
  8418. ;**
  8419. ;* @name GetBodMaterial
  8420. ;* @ver 1.2 07Oct05
  8421. ;* @author Boydon
  8422. ;* @purpose This sub will tell you wich material is required by the BOD
  8423. ;* The material will be returned in a var defined by the user without the "%" symbol.
  8424. ;* Default variable name is "material"
  8425. ;*
  8426. ;* @params %1 req bod type (tailor|smithy) or the #findcol of the bod (1155|1102)
  8427. ;* %2 req bod #property
  8428. ;* %3 opt name of the var containing the material without the "%" symbol (default is "material")
  8429. ;*
  8430. ;* @returns
  8431. ;*
  8432. ;* @example call GetBodParameters.euo GetBodMaterial tailor #property
  8433. ;* this is the standar call
  8434. ;* call GetBodParameters.euo GetBodMaterial tailor #property material_needed
  8435. ;* this is a call with the material being returned to %material_needed
  8436. ;* @status BlackSmithy support needs to be tested
  8437.  
  8438. sub GetBodMaterial
  8439.  
  8440. if %0 < 2 || %1 = N/A || %2 = N/A
  8441. {
  8442. display ok Wrong use of Sub GetBodParameters: some required arguments are missing!
  8443. +$Script will be halted.
  8444. halt
  8445. }
  8446.  
  8447. if %1 <> tailor && %1 <> smithy && %1 <> 1155 && %1 <> 1102
  8448. {
  8449. display ok Wrong value for parameter 1 in sub GetBodParameters!
  8450. +$Script will be halted!
  8451. halt
  8452. }
  8453.  
  8454. if %3 = N/A || %0 <= 2
  8455. set %3 material
  8456.  
  8457. nameSpace Push
  8458. nameSpace Local GetBodMaterial , #time , #random , #scnt2
  8459.  
  8460. set !lpc #lpc
  8461. set #lpc 500
  8462.  
  8463. set !BodType %1
  8464. set !Property %2
  8465. set !Material %3
  8466.  
  8467. if !BodType = tailor || !BodType = 1155
  8468. {
  8469. if leather notin !Property && studded notin !Property && bone notin !Property && boots notin !Property && shoes notin !Property && sandals notin !Property
  8470. set % . !Material cloth
  8471.  
  8472. if leather in !Property || studded in !Property || bone in !Property || boots in !Property || shoes in !Property || sandals in !Property
  8473. {
  8474. if Large , #spc , Bulk in !property && ( #spc , Hat in !property || Bandana in !property || Bonnet in !property || Skullcap in !property )
  8475. set % . !Material cloth
  8476. else
  8477. set % . !Material 0
  8478. }
  8479.  
  8480. if All , #SPC , Items , #SPC , Must , #SPC , Be , #SPC , Made , #SPC , With in #property
  8481. {
  8482. if spined , #SPC , Leather in !Property
  8483. set % . !Material 2220
  8484. if horned , #SPC , Leather in !Property
  8485. set % . !Material 2117
  8486. if barbed , #SPC , Leather in !Property
  8487. set % . !Material 2129
  8488. }
  8489. }
  8490.  
  8491. if !BodType = smithy || !BodType = 1102
  8492. {
  8493. set % . !Material 0
  8494.  
  8495. if All , #SPC , Items , #SPC , Must , #SPC , Be , #SPC , Made , #SPC , With in #property
  8496. {
  8497. if Dull , #SPC , Copper , #SPC , Ingots in #property
  8498. set % . !Material 2419
  8499. if Shadow , #SPC , Iron , #SPC , Ingots in #property
  8500. set % . !Material 2406
  8501. if Copper , #SPC , Ingots in #property && Dull notin #property
  8502. set % . !Material 2413
  8503. if Bronze , #SPC , Ingots in #property
  8504. set % . !Material 2418
  8505. if Gold , #SPC , Ingots in #property
  8506. set % . !Material 2213
  8507. if Agapite , #SPC , Ingots in #property
  8508. set % . !Material 2425
  8509. if Verite , #SPC , Ingots in #property
  8510. set % . !Material 2207
  8511. if Valorite , #SPC , Ingots in #property
  8512. set % . !Material 2219
  8513. }
  8514.  
  8515. }
  8516.  
  8517. set #lpc !lpc
  8518.  
  8519. namespace Clear
  8520. namespace Pop
  8521.  
  8522. return
  8523.  
  8524. ;==================
  8525. ;**
  8526. ;* @name GetBodQuantity
  8527. ;* @ver 1.0 11May05
  8528. ;* @author Boydon
  8529. ;* @purpose This sub will tell you how many items are totaly needed to
  8530. ;* fill a bod.
  8531. ;*
  8532. ;* @params %1 req #property of the bod
  8533. ;*
  8534. ;* @returns This sub will return the number of item needed to accomplish the Bod.
  8535. ;* Result can be 10|15|20. Other value will return an error.
  8536. ;* @example call GetBodParameters.euo GetBodQuantity #property
  8537. ;* @status Tested and working fine.
  8538.  
  8539. sub GetBodQuantity
  8540.  
  8541. if %0 < 1 || %1 = N/A
  8542. {
  8543. display ok Wrong use of Sub GetBodQuantity: some required arguments are missing!
  8544. +$Script will be halted.
  8545. halt
  8546. }
  8547.  
  8548. nameSpace Push
  8549. nameSpace Local GetBodQuantity , #time , #random , #scnt2
  8550.  
  8551. set !Property %1
  8552.  
  8553. set !lpc #lpc
  8554. set #lpc 500
  8555.  
  8556. str pos !Property Make
  8557. set !Quantity #strres + 5
  8558. str del !Property 1 !Quantity
  8559. set !quantity #strres
  8560. str left !Quantity 2
  8561. ;set !Quantity #strres
  8562.  
  8563. set #lpc !lpc
  8564.  
  8565. nameSpace Clear
  8566. nameSpace Pop
  8567.  
  8568. if #strres <> 10 && #strres <> 15 && #strres <> 20
  8569. {
  8570. display ok Unexpected value returned from sub GetBodQuantity! Please check!
  8571. +$Script will be halted!
  8572. halt
  8573. }
  8574.  
  8575. return #strres
  8576.  
  8577. ;==================
  8578. ;**
  8579. ;* @name GetBodAlredyMadeQuantity
  8580. ;* @ver 1.1 26May06
  8581. ;* @author Boydon
  8582. ;* @purpose If a bod is partially filled this sub will let you how many
  8583. ;* items have been already added inside it.
  8584. ;*
  8585. ;* @params %1 req #property of the bod
  8586. ;*
  8587. ;* @returns This sub will return the number of item alredy added to the Bod
  8588. ;* @example call GetBodParameters.euo GetBodAlredyMadeQuantity #property
  8589. ;* @status Tested and working fine.
  8590.  
  8591. ; @ag: spelling fix by AG
  8592. sub GetBodAlreadyMadeQuantity
  8593. gosub GetBodAlredyMadeQuantity %1
  8594. return #result
  8595.  
  8596. sub GetBodAlredyMadeQuantity
  8597. if %0 < 1 || %1 = N/A
  8598. {
  8599. display ok Wrong use of Sub GetBodAlreadyMadeQuantity: some required arguments are missing!
  8600. +$Script will be halted.
  8601. halt
  8602. }
  8603.  
  8604. nameSpace Push
  8605. nameSpace Local GetBodAlredyMadeQuantity , #time , #random , #scnt2
  8606.  
  8607. set !Property %1
  8608.  
  8609. set !lpc #lpc
  8610. set #lpc 500
  8611.  
  8612. ;Fix for UO ML
  8613. if weight: in #property
  8614. {
  8615. str pos !Property weight:
  8616. str del !Property #strres 7
  8617. set !Property #strres
  8618. }
  8619.  
  8620. str pos !Property :
  8621. str del !Property #strres 1
  8622. set !MadeQuantity #strres
  8623. str pos !MadeQuantity :
  8624. set #strres ( #strres + 1 )
  8625. str del !MadeQuantity 1 #strres
  8626. set !MadeQuantity #strres
  8627. str pos !MadeQuantity $
  8628. str del !MadeQuantity #strres 1
  8629. ;set !MadeQuantity #strres
  8630.  
  8631. set #lpc !lpc
  8632.  
  8633. nameSpace Clear
  8634. nameSpace Pop
  8635. return #strres
  8636.  
  8637. ;==================
  8638. ;**
  8639. ;* @name BodIsLarge
  8640. ;* @ver 1.0 11May05
  8641. ;* @author Boydon, AG
  8642. ;* @purpose Identify Large bods
  8643. ;*
  8644. ;* @params %1 req #property of the bod
  8645. ;*
  8646. ;* @returns This sub will return #true if a bod IS a large bod or #false if it IS NOT a large bod
  8647. ;* @example call GetBodParameters.euo BodIsLarge #property
  8648. ;* @status working fine, no test needed
  8649. ;* by AG: A test was needed! What about "Large Battle Axes"? I fixed it.
  8650.  
  8651. sub BodIsLarge
  8652. if %0 < 1 || %1 = N/A
  8653. {
  8654. display ok Wrong use of Sub BodIsLarge: some required arguments are missing!
  8655. +$Script will be halted.
  8656. halt
  8657. }
  8658. return large , #spc , bulk in %1
  8659.  
  8660. ;==================
  8661. ;**
  8662. ;* @name BodIsSmall
  8663. ;* @ver 2.0 14Oct05
  8664. ;* @author Boydon
  8665. ;* @purpose Identify Small bods
  8666. ;*
  8667. ;* @params %1 req #property of the bod
  8668. ;*
  8669. ;* @returns This sub will return #true if a bod IS a small bod or #false if it IS NOT a small bod
  8670. ;* @example call GetBodParameters.euo BodIsSmall #property
  8671. ;* @status working fine, no test needed
  8672.  
  8673. sub BodIsSmall
  8674. if %0 < 1 || %1 = N/A
  8675. {
  8676. display ok Wrong use of Sub BodIsLarge: some required arguments are missing!
  8677. +$Script will be halted.
  8678. halt
  8679. }
  8680. return large , #SPC , Bulk notin %1
  8681.  
  8682. ;==================
  8683. ;**
  8684. ;* @name BodIsEceptional
  8685. ;* @ver 1.0 11May05
  8686. ;* @author Boydon
  8687. ;* @purpose Identify Exceptional bods
  8688. ;*
  8689. ;* @params %1 req #property of the bod
  8690. ;*
  8691. ;* @returns This sub will return #true if a bod IS an exceptional bod or #false if it IS NOT an exceptional bod
  8692. ;* @example call GetBodParameters.euo BodIsExceptional #property
  8693. ;* @status working fine, no test needed
  8694.  
  8695. sub BodIsExceptional
  8696. if %0 < 1 || %1 = N/A
  8697. {
  8698. display ok Wrong use of Sub BodIsExceptional: some required arguments are missing!
  8699. +$Script will be halted.
  8700. halt
  8701. }
  8702. return exceptional in %1
  8703.  
  8704. ;==================
  8705. ;**
  8706. ;* @name BodIsNormal
  8707. ;* @ver 1.0 11May05
  8708. ;* @author Boydon
  8709. ;* @purpose Identify Normal bods
  8710. ;*
  8711. ;* @params %1 req #property of the bod
  8712. ;*
  8713. ;* @returns This sub will return #true if a bod IS a normal bod or #false if it IS NOT a normal bod
  8714. ;* @example call GetBodParameters.euo BodIsNormal #property
  8715. ;* @status working fine, no test needed
  8716.  
  8717. sub BodIsNormal
  8718. if %0 < 1 || %1 = N/A
  8719. {
  8720. display ok Wrong use of Sub BodIsNormal: some required arguments are missing!
  8721. +$Script will be halted.
  8722. halt
  8723. }
  8724. return exceptional notin %1
  8725.  
  8726. ;==================
  8727. ;**
  8728. ;* @name BodIsTailor
  8729. ;* @ver 1.0 11May05
  8730. ;* @author Boydon
  8731. ;* @purpose Identify Tailoring bods
  8732. ;*
  8733. ;* @params %1 req #findcol of the bod
  8734. ;*
  8735. ;* @returns This sub will return #true if a bod IS a tailoring bod or #false if it IS NOT a tailoring bod
  8736. ;* @example call GetBodParameters.euo BodIsTailor #findcol
  8737. ;* @status working fine, no test needed
  8738.  
  8739. sub BodIsTailor
  8740. if %0 < 1 || %1 = N/A
  8741. {
  8742. display ok Wrong use of Sub BodIsTailor: some required arguments are missing!
  8743. +$Script will be halted.
  8744. halt
  8745. }
  8746. return %1 = 1155
  8747.  
  8748. ;==================
  8749. ;**
  8750. ;* @name BodIsSmithy
  8751. ;* @ver 1.0 11May05
  8752. ;* @author Boydon
  8753. ;* @purpose Identify Blacksmithy bods
  8754. ;*
  8755. ;* @params %1 req #findcol of the bod
  8756. ;*
  8757. ;* @returns This sub will return #true if a bod IS a blacksmithy bod or #false if it IS NOT a blacksmithy bod
  8758. ;* @example call GetBodParameters.euo BodIsSmithy #findcol
  8759. ;* @status working fine, no test needed
  8760.  
  8761. sub BodIsSmithy
  8762. if %0 < 1 || %1 = N/A
  8763. {
  8764. display ok Wrong use of Sub BodIsSmithy: some required arguments are missing!
  8765. +$Script will be halted.
  8766. halt
  8767. }
  8768. return %1 = 1102
  8769.  
  8770. ;==================
  8771. ;**
  8772. ;* @name Initialize
  8773. ;* @ver 1.2 03Apr09
  8774. ;* @author Boydon / AG
  8775. ;* @purpose This function is for internal purpose only. If you plan to use this
  8776. ;* library inside one of your script, running this will ensure you,
  8777. ;* returning the version number of the library, that you are calling
  8778. ;* the library in the right way.
  8779. ;*
  8780. ;* @params
  8781. ;*
  8782. ;* @returns Version of the library with no float
  8783. ;* @example call GetBodParameters.euo Initialize
  8784. ;* @status tested and working properly
  8785.  
  8786. Sub Initialize
  8787. return 300 ; version by Boydon: 200; version by AG: 300.
  8788.  
  8789. Sub Inizialize ; misspelled, but required for backward compatibility
  8790. gosub Initialize
  8791. return #result
  8792.  
  8793. ;=========================
  8794. ;=========================
  8795. ; Version 3.0 (by AG)
  8796. ;=========================
  8797. ;=========================
  8798.  
  8799. ;==================
  8800. ;**
  8801. ;* @name GetMaterialName
  8802. ;* @ver 1.0 06Apr09
  8803. ;* @author ag
  8804. ;* @purpose Returns the name of a material from its #findcol
  8805. ;* @params %1 req #findcol of the material
  8806. ;* %2 req #true if the given material is a tailoring material
  8807. ;* @returns The human name of the given material
  8808. ;* @example call BodFunctions.euo GetMaterialName #findcol
  8809. ;* @status beta
  8810.  
  8811. sub GetMaterialName ; %colorCode %tailor
  8812. if %1 = cloth
  8813. return Cloth
  8814. if %1 = 2220
  8815. return Spined , #spc , Leather
  8816. if %1 = 2117
  8817. return Horned , #spc , Leather
  8818. if %1 = 2129
  8819. return Barbed , #spc , Leather
  8820.  
  8821. if %1 = 2419
  8822. return Dull , #spc , Copper
  8823. if %1 = 2406
  8824. return Shadow , #spc , Iron
  8825. if %1 = 2413
  8826. return Copper
  8827. if %1 = 2418
  8828. return Bronze
  8829. if %1 = 2213
  8830. return Gold
  8831. if %1 = 2425
  8832. return Agapite
  8833. if %1 = 2207
  8834. return Verite
  8835. if %1 = 2219
  8836. return Valorite
  8837.  
  8838. if %1 = 0
  8839. {
  8840. if %2
  8841. return Leather
  8842. else
  8843. return Iron
  8844. }
  8845. return Unknown
  8846.  
  8847. ;==================
  8848. ;**
  8849. ;* @name GetLargeBodQuantity
  8850. ;* @ver 1.0 03Apr09
  8851. ;* @author ag
  8852. ;* @purpose This sub will tell you how many small BODs are needed to fill a large BOD.
  8853. ;*
  8854. ;* @params %1 req #property of the bod
  8855. ;*
  8856. ;* @returns This sub will tell you how many small BODs are needed to fill a large BOD.
  8857. ;* Result can be 4|5|6. Result on a small BOD is unpredictable.
  8858. ;* @example call BodFunctions.euo GetLargeBodQuantity #property
  8859. ;* @status tested and working
  8860.  
  8861. sub GetLargeBodQuantity
  8862. if %0 < 1 || %1 = N/A
  8863. {
  8864. display ok Wrong use of Sub GetBodCardinality: some required arguments are missing!
  8865. +$Script will be halted.
  8866. halt
  8867. }
  8868. nameSpace Push
  8869. nameSpace Local GetLargeBodQuantity , #time , #random , #scnt2
  8870. set !property %1
  8871. set !lpc #lpc
  8872. set #lpc 500
  8873.  
  8874. str len !property
  8875. set !propertyLength #strres
  8876.  
  8877. set !search amount , #spc , to , #spc , make
  8878. str pos !property !search
  8879. set !interestingLength ( !propertyLength - #strres - 20 )
  8880.  
  8881. str right !property !interestingLength
  8882. set !interesting #strres
  8883.  
  8884. str count !interesting $ ; quante linee nella stringa?
  8885. set !quantity #strres
  8886.  
  8887. set #result !quantity
  8888. set #lpc !lpc
  8889. nameSpace Clear
  8890. nameSpace Pop
  8891. return #result
  8892.  
  8893. ;==================
  8894. ;**
  8895. ;* @name GetLargeBodAlreadyMadeQuantity
  8896. ;* @ver 1.0 03Apr09
  8897. ;* @author ag
  8898. ;* @purpose This sub will tell you how many small BODs are contained into a large BOD.
  8899. ;*
  8900. ;* @params %1 req #property of the bod
  8901. ;*
  8902. ;* @returns This sub will tell you how many small BODs are contained into the large BOD.
  8903. ;* Result on a small BOD is unpredictable.
  8904. ;* @example call BodFunctions.euo GetLargeBodAlreadyMadeQuantity #property
  8905. ;* @status Tested
  8906.  
  8907. sub GetLargeBodAlreadyMadeQuantity
  8908. if %0 < 1 || %1 = N/A
  8909. {
  8910. display ok Wrong use of Sub GetBodCardinality: some required arguments are missing!
  8911. +$Script will be halted.
  8912. halt
  8913. }
  8914. nameSpace Push
  8915. nameSpace Local GetLargeBodAlreadyMadeQuantity , #time , #random , #scnt2
  8916. set !property %1
  8917. set !lpc #lpc
  8918. set #lpc 500
  8919.  
  8920. set !quantity -1 ; escludi il campo "amount to make"
  8921. str count !property 10
  8922. set !quantity ( !quantity + #strres )
  8923. str count !property 15
  8924. set !quantity ( !quantity + #strres )
  8925. str count !property 20
  8926. set !quantity ( !quantity + #strres )
  8927.  
  8928. set #result !quantity
  8929. set #lpc !lpc
  8930. nameSpace Clear
  8931. nameSpace Pop
  8932. return #result
  8933.  
  8934. ;=========================================================
  8935. ;**
  8936. ;* @name GetLargeBodItemSet
  8937. ;* @ver 2.0
  8938. ;* @author AG (converted from a script by snicker7)
  8939. ;* @purpose Returns the identifier associated with the item set of a large BOD.
  8940. ;*
  8941. ;* @params %1 req #property of the large bod
  8942. ;* @returns The identifier of the item set needed to fill the large BOD.
  8943. ;* Result is unpredictable if the bod is small.
  8944. ;*
  8945. ;* @example call BodFunctions.euo GetLargeBodItemSet %bodProperty
  8946. ;* @status Tested and debugged
  8947.  
  8948. sub GetLargeBodItemSet ; %property
  8949. namespace push
  8950. namespace local GetLargeBodItemSet , #systime , #random
  8951. set !lpc #lpc
  8952. set #lpc 500
  8953. gosub GetLargeBodItemSet_Core %1
  8954. set #lpc !lpc
  8955. namespace clear
  8956. namespace pop
  8957. return #result
  8958.  
  8959. sub GetLargeBodItemSet_core ; %property
  8960. set !property %1
  8961. if large , #spc , bulk notin !property
  8962. return error
  8963.  
  8964. ; extract the name of the first item
  8965. str pos !property make:
  8966. set !pos #strRes + 8
  8967. str del !property 1 !pos
  8968. set !item1 #strRes
  8969. str pos !item1 :
  8970. set !len #strres - 1
  8971. str left !item1 !len
  8972. set !item1 #strres
  8973.  
  8974. if cutlass in !item1 || katana in !item1 || scimitar in !item1 || broad in !item1 || longsword in !item1 || viking in !item1
  8975. return Swords
  8976. if kryss in !item1 || spear in !item1 || warfork in !item1 || dagger in !item1
  8977. return Fencing
  8978. if axe in !item1 && war notin !item1
  8979. return Axes
  8980. if mace in !item1 || maul in !item1 || hammer in !item1 || war , #spc , axe in !item1
  8981. return Maces
  8982. if bardiche in !item1 || halberd in !item1
  8983. return Polearms
  8984. if chainmail in !item1
  8985. return Chainmail
  8986. if ringmail in !item1
  8987. return Ringmail
  8988. if studded in !item1
  8989. return Studded
  8990. if plate in !item1
  8991. return Platemail
  8992. if sandals in !item1
  8993. return Footwear
  8994. if gorget in !item1 && studded notin !item1
  8995. return Leather
  8996. if skirt in !item1
  8997. return LeatherFemale
  8998. if bone in !item1
  8999. return Bone
  9000. if bandana in !item1
  9001. return Gypsy
  9002. if skullcap in !item1
  9003. return Pirate
  9004. if straw in !item1
  9005. return Farmer
  9006. if wizard in !item1
  9007. return Wizard
  9008. if floppy in !item1
  9009. return Girl
  9010. if feathered in !item1
  9011. return TownCrier
  9012. if bonnet in !item1
  9013. return Lady
  9014. if jester in !item1
  9015. return Jester
  9016. if tricorne in !item1
  9017. return Hats
  9018. return unknown
  9019.  
  9020. ;=========================================================
  9021. ;* @name GetSmallBodItemName
  9022. ;* @ver 1.0 03Apr09
  9023. ;* @author ag (converted from a script by snicker7)
  9024. ;* @purpose Returns the name of the item associated with a small BOD.
  9025. ;*
  9026. ;* @params %1 req #property of the small bod
  9027. ;* @returns Name of the item needed to fill the small BOD.
  9028. ;* Result is unpredictable if the bod is large.
  9029. ;*
  9030. ;* @example call BodFunctions.euo GetSmallBodItemName %bodProperty
  9031. ;* @status Tested
  9032. ;*
  9033.  
  9034. sub GetSmallBodItemName ; %property
  9035. namespace push
  9036. namespace local GetSmallBodItemName , #systime , #random
  9037. set !property %1
  9038. set !lpc #lpc
  9039. set #lpc 500
  9040.  
  9041. str pos !property make:
  9042. set !pos #strRes + 3
  9043. str del !property 1 !pos
  9044. set !s7BFItemString #strRes
  9045. str pos !s7BFItemString :
  9046. set !pos #strRes + 1
  9047. str pos !s7BFItemString $
  9048. set !len #strRes - !pos
  9049. str mid !s7BFItemString !pos !len
  9050. str del !s7BFItemString 1 5
  9051. set !s7BFItemString #strRes
  9052. str pos !s7BFItemString :
  9053. set #strres #strres - 1
  9054. str left !s7BFItemString #strRes
  9055. set !gbi_item1 #strRes
  9056. set #result !gbi_item1
  9057.  
  9058. set #lpc !lpc
  9059. namespace clear
  9060. namespace pop
  9061. return #result
  9062.  
  9063. ;========================================================================
  9064. ;* @name GetLargeBodData
  9065. ;* @ver 1.0 01Mag09
  9066. ;* @author ag
  9067. ;* @purpose
  9068. ;* @params none
  9069. ;* @returns Some important data bound to a certain Large BOD.
  9070. ;* @status Testing.
  9071.  
  9072. sub GetLargeBodData
  9073. namespace push
  9074. namespace local GetLargeBodData , #systime , #random
  9075. gosub GetLargeBodData_Core %1
  9076. namespace clear
  9077. namespace pop
  9078. return #result
  9079.  
  9080. sub GetLargeBodData_Core ; %setId
  9081. set !key %1
  9082. if !key >= 1 && !key <= 22
  9083. goto BodItemSetDb_ , !key
  9084. set !index _Swords_Fencing_Axes_Maces_Polearms_Chainmail_Ringmail_Platemail_
  9085. +Footwear_Bone_Studded_LeatherFemale_Leather_Farmer_Girl_Gypsy_Hats_Jester_Lady_Pirate_Wizard_TownCrier_
  9086. set !key !key , _
  9087. if !key notin !index
  9088. return !null
  9089. str pos !index !key
  9090. str left !index #strres
  9091. str count #strres _
  9092. set !key #strres
  9093.  
  9094. goto BodItemSetDb_ , !key
  9095. return !null
  9096.  
  9097. BodItemSetDb_1: ; cutlass, broadsword, katana, longsword, scimitar, viking sword
  9098. return Swords__KPH_JPH__ATF_ZSF__OMH_NMH__KTF_JTF_TCO__POH_SOH__BPH_EPH_
  9099. BodItemSetDb_2: ; dagger, kryss, short spear, war fork
  9100. return Fencing__TSF_WSF__WRH_VRH__YRH_XRH__SRH_RRH_
  9101. BodItemSetDb_3: ; axe, battle axe, double axe, executioner's axe, large battle axe, two-handed axe
  9102. return Axes__LSF_OSF__BSF_MSF__NSF_ISF__ZRF_CSF__SMH_RMH__MPH_LPH_
  9103. BodItemSetDb_4: ; hammer pick, mace, maul, war axe, war hammer, war mace
  9104. return Maces__WTH_VTH__YSF_XSF__CUH_BUH__DUG_JOH__AUH_ZTH__URH_TRH_
  9105. BodItemSetDb_5: ; bardiche, halberd
  9106. return Polearms__HSF_KSF__YTH_XTH_
  9107. BodItemSetDb_6: ; chainmail coif, chainmail leggings, chainmail tunic
  9108. return Chainmail__DPH_MKH__YOH_APH_LKH_NKH__XOH_ZOH_OKH_IKH_
  9109. BodItemSetDb_7: ; ringmail gloves, ringmail leggings, ringmail sleeves, ringmail tunic
  9110. return Ringmail__BMH_KMH__IMH_HMH_NLH_QLH__ZLH_CMH_YLH_XLH__WLH_VLH_
  9111. BodItemSetDb_8: ; platemail arms, platemail legs, plate helm, platemail gorget, platemail gloves, platemail tunic
  9112. return Platemail__MSH_JSH__LSH_WSH__OSH_TSH__NSH__ISH_USH__HSH_KSH_
  9113. BodItemSetDb_9: ; sandals, shoes, boots, thigh boots
  9114. return Footwear__NVI_QVI__PVI_AWI__TVI_OVI__ZVI_CWI_
  9115. BodItemSetDb_10: ; Bone Armor, Bone Arms, Bone Gloves, Bone Helmet, Bone Leggings
  9116. return Bone__PPH_WPH__QPH_BQH__AQH_VPH__ZPH_YPH__CQH_
  9117. BodItemSetDb_11: ; Studded Gloves, Studded Gorget, Studded Leggings, Studded Sleeves, Studded Tunic
  9118. return Studded__XKH_FLH__ALH__KLH_MLH_HLH_RLH__YKH_ZKH_GLH_ILH__JLH_LLH_SLH_ULH_
  9119. BodItemSetDb_12: ; Female Leather Armor, Leather Bustier, Leather Shorts, Leather Skirt, Studded Armor, Studded Bustier
  9120. return LeatherFemale__OSK__ATK_ZSK__QSK_PSK__YSK_XSK__SSK_RSK__USK_TSK_
  9121. BodItemSetDb_13: ; Leather Cap, Leather Gloves, Leather Gorget, Leather Leggings, Leather Sleeves, Leather Tunic
  9122. return Leather__NJL_QJL_PSO_SSO__KKH_SKH__JKH__TKH_VKH_CLH_ELH__HKH_UKH_PKH_RKH__WKH_QKH_BLH_DLH_
  9123. BodItemSetDb_14: ; Straw Hat, Tunic, Long Pants, Boots
  9124. return Farmer__YVI_XVI__HCM_KCM__VDI_YDI__TVI_OVI_
  9125. BodItemSetDb_15: ; Floppy Hat, Full Apron, Plain Dress, Sandals
  9126. return Girl__BWI__RDI_UDI__DWL_GWL__NVI_QVI_
  9127. BodItemSetDb_16: ; Bandana, Shirt, Skirt, Thigh Boots
  9128. return Gypsy__TDI_GZH__FCI_QCI__GCI_NDI__ZVI_CWI_
  9129. BodItemSetDb_17: ; Tricorne Hat, Cap, Wide-Brim Hat, Tall Straw Hat
  9130. return Hats__JWI__VVI__WVI__YVI_
  9131. BodItemSetDb_18: ; Jester Hat, Jester Suit, Cloack, Shoes (jester's?)
  9132. return Jester__EWI__XBM_ICM__DCI_ODI__PVI_AWI_
  9133. BodItemSetDb_19: ; Bonnet, Half Apron, Fancy Dress, Sandals
  9134. return Lady__HWI__XDI_SDI__VQL_EWL_VMO_QMO_PMO_SMO__NVI_QVI_
  9135. BodItemSetDb_20: ; Skullcap, Doublet, Kilt, Shoes
  9136. return Pirate__HZH_CZH__XVL_SVL__LDI_WDI__PVI_AWI_
  9137. BodItemSetDb_21: ; Wizard's Hat, Body Sash, Robe, Boots
  9138. return Wizard__IWI__FZH_IZH__FWL_AWL_CHO_BHO_EHO_DHO__TVI_OVI_
  9139. BodItemSetDb_22: ; Feathered Hat, Surcoat, Fancy Shirt, Short Pants, Thigh Boots
  9140. return TownCrier__KWI__PAM_SAM__TQL_WQL__EDI_DDI__ZVI_CWI_
  9141. return
  9142.  
  9143. sub getLargeBodLinkedItems ; %setId
  9144. namespace push
  9145. namespace local getLargeBodLinkedItems , #systime , #random
  9146. set !setId %1
  9147. gosub getLargeBodData !setId
  9148. set !data #result
  9149. str pos !data _
  9150. str del !data 1 #strres
  9151. set #result #strres
  9152. namespace clear
  9153. namespace pop
  9154. return #result
  9155.  
  9156. sub getLargeBodSetName ; %setIndex
  9157. namespace push
  9158. namespace local getLargeBodLinkedItems , #systime , #random
  9159. set !setId %1
  9160. gosub getLargeBodData !setId
  9161. set !data #result
  9162. str pos !data _
  9163. set !len #strres - 1
  9164. str left !data !len
  9165. set #result #strres
  9166. namespace clear
  9167. namespace pop
  9168. return #result
  9169.  
  9170. ; @todo aggiungere commenti descrittivi
  9171. sub getSmallBodLinkedItems ; %bodItemId
  9172. namespace push
  9173. namespace local getSmallBodLinkedItems , #systime , #random
  9174. set !lpc #lpc
  9175. set #lpc 500
  9176. set !itemId _ , %1 , _
  9177. set !largeBods _
  9178.  
  9179. for !i 1 22
  9180. {
  9181. gosub GetLargeBodLinkedItems !i
  9182. if !itemId in #result
  9183. {
  9184. gosub GetLargeBodSetName !i
  9185. set !largeBods !largeBods , #result , _
  9186. }
  9187. }
  9188.  
  9189. set #result !largeBods
  9190. set #lpc !lpc
  9191. namespace clear
  9192. namespace pop
  9193. return #result
  9194.  
  9195. ; @todo aggiungere commenti descrittivi
  9196. sub getBodReward ; setId %materialName %quantity %quality
  9197. namespace push
  9198. namespace local getBodReward , #systime , #random
  9199. set !set %1
  9200. set !material %2
  9201. set !quantity %3
  9202. if %0 < 4 || %4 <> #true
  9203. set !quality r
  9204. else
  9205. set !quality e
  9206. if !set in _Swords_Fencing_Axes_Maces_Polearms_
  9207. {
  9208. set !material sm
  9209. }
  9210. else
  9211. {
  9212. str left !material 2
  9213. set !material #strres
  9214. }
  9215. gosub getBodReward_NameToId !set
  9216. gosub getBodReward_Core #result !material !quantity !quality
  9217.  
  9218. namespace clear
  9219. namespace pop
  9220. return #result
  9221.  
  9222. sub getBodReward_NameToId ; %setname
  9223. goto BodRewardDatabase_ , %1
  9224. return !null
  9225.  
  9226. BodRewardDatabase_SmithSmall:
  9227. return SS
  9228. BodRewardDatabase_TailorSmall:
  9229. return TS
  9230. BodRewardDatabase_Polearms:
  9231. return S2
  9232. BodRewardDatabase_Fencing:
  9233. return S5
  9234. BodRewardDatabase_Swords:
  9235. BodRewardDatabase_Maces:
  9236. BodRewardDatabase_Axes:
  9237. return S6
  9238. BodRewardDatabase_Chainmail:
  9239. return SC
  9240. BodRewardDatabase_Ringmail:
  9241. return SR
  9242. BodRewardDatabase_Platemail:
  9243. return SP
  9244. BodRewardDatabase_Footwear:
  9245. BodRewardDatabase_Farmer:
  9246. BodRewardDatabase_Girl:
  9247. BodRewardDatabase_Gypsy:
  9248. BodRewardDatabase_Hats:
  9249. BodRewardDatabase_Jester:
  9250. BodRewardDatabase_Lady:
  9251. BodRewardDatabase_Pirate:
  9252. BodRewardDatabase_Wizard:
  9253. return T4
  9254. BodRewardDatabase_Bone:
  9255. BodRewardDatabase_Studded:
  9256. BodRewardDatabase_TownCrier:
  9257. return T5
  9258. BodRewardDatabase_LeatherFemale:
  9259. BodRewardDatabase_Leather:
  9260. return T6
  9261. return
  9262.  
  9263. sub getBodReward_Core ; setId %materialName %quantity %quality
  9264. goto BodRewardDatabase_ , %1 , %4 , %3 , %2
  9265. return !null
  9266.  
  9267. BodRewardDatabase_SSr10ir:
  9268. return _Sturdy:100_
  9269. BodRewardDatabase_SSr15ir:
  9270. return _Sturdy:100_
  9271. BodRewardDatabase_SSr20ir:
  9272. return _Sturdy:90_MiningGloves1:10_
  9273. BodRewardDatabase_SSr10du:
  9274. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9275. BodRewardDatabase_SSr15du:
  9276. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9277. BodRewardDatabase_SSr20du:
  9278. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9279. BodRewardDatabase_SSr10sh:
  9280. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9281. BodRewardDatabase_SSr15sh:
  9282. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9283. BodRewardDatabase_SSr20sh:
  9284. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9285. BodRewardDatabase_SSr10co:
  9286. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9287. BodRewardDatabase_SSr15co:
  9288. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9289. BodRewardDatabase_SSr20co:
  9290. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9291. BodRewardDatabase_SSr10br:
  9292. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9293. BodRewardDatabase_SSr15br:
  9294. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9295. BodRewardDatabase_SSr20br:
  9296. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9297. BodRewardDatabase_SSr10go:
  9298. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9299. BodRewardDatabase_SSr15go:
  9300. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9301. BodRewardDatabase_SSr20go:
  9302. return _MiningGloves5:10_POF:90_
  9303. BodRewardDatabase_SSr10ag:
  9304. return _MiningGloves5:10_POF:90_
  9305. BodRewardDatabase_SSr15ag:
  9306. return _MiningGloves5:10_POF:90_
  9307. BodRewardDatabase_SSr20ag:
  9308. return _DullHammer:100_
  9309. BodRewardDatabase_SSr10ve:
  9310. return _DullHammer:100_
  9311. BodRewardDatabase_SSr15ve:
  9312. return _DullHammer:100_
  9313. BodRewardDatabase_SSr20ve:
  9314. return _DullHammer:60_ShadowHammer:40_
  9315. BodRewardDatabase_SSr10va:
  9316. return _DullHammer:60_ShadowHammer:40_
  9317. BodRewardDatabase_SSr15va:
  9318. return _DullHammer:60_ShadowHammer:40_
  9319. BodRewardDatabase_SSr20va:
  9320. return _ShadowHammer:100_
  9321.  
  9322. BodRewardDatabase_SSe10ir:
  9323. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9324. BodRewardDatabase_SSe15ir:
  9325. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9326. BodRewardDatabase_SSe20ir:
  9327. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9328. BodRewardDatabase_SSe10du:
  9329. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9330. BodRewardDatabase_SSe15du:
  9331. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9332. BodRewardDatabase_SSe20du:
  9333. return _MiningGloves5:10_POF:90_
  9334. BodRewardDatabase_SSe10sh:
  9335. return _MiningGloves5:10_POF:90_
  9336. BodRewardDatabase_SSe15sh:
  9337. return _MiningGloves5:10_POF:90_
  9338. BodRewardDatabase_SSe20sh:
  9339. return _DullHammer:100_
  9340. BodRewardDatabase_SSe10co:
  9341. return _DullHammer:100_
  9342. BodRewardDatabase_SSe15co:
  9343. return _DullHammer:100_
  9344. BodRewardDatabase_SSe20co:
  9345. return _DullHammer:60_ShadowHammer:40_
  9346. BodRewardDatabase_SSe10br:
  9347. return _DullHammer:60_ShadowHammer:40_
  9348. BodRewardDatabase_SSe15br:
  9349. return _DullHammer:60_ShadowHammer:40_
  9350. BodRewardDatabase_SSe20br:
  9351. return _ShadowHammer:100_
  9352. BodRewardDatabase_SSe10go:
  9353. return _ShadowHammer:100_
  9354. BodRewardDatabase_SSe15go:
  9355. return _ColoredAnvil:10_Blacksmithy5:60_ShadowHammer:30_
  9356. BodRewardDatabase_SSe20go:
  9357. return _CopperHammer:100_
  9358. BodRewardDatabase_SSe10ag:
  9359. return _CopperHammer:100_
  9360. BodRewardDatabase_SSe15ag:
  9361. return _ColoredAnvil:10_Blacksmithy10:60_CopperHammer:30_
  9362. BodRewardDatabase_SSe20ag:
  9363. return _BronzeHammer:100_
  9364. BodRewardDatabase_SSe10ve:
  9365. return _BronzeHammer:100_
  9366. BodRewardDatabase_SSe15ve:
  9367. return _BronzeHammer:100_
  9368. BodRewardDatabase_SSe20ve:
  9369. return _AncientHammer10:100_
  9370. BodRewardDatabase_SSe10va:
  9371. return _AncientHammer10:100_
  9372. BodRewardDatabase_SSe15va:
  9373. return _AncientHammer10:100_
  9374. BodRewardDatabase_SSe20va:
  9375. return _Blacksmithy15:100_
  9376.  
  9377. BodRewardDatabase_SRr10ir:
  9378. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9379. BodRewardDatabase_SRr15ir:
  9380. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9381. BodRewardDatabase_SRr20ir:
  9382. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9383. BodRewardDatabase_SRr10du:
  9384. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9385. BodRewardDatabase_SRr15du:
  9386. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9387. BodRewardDatabase_SRr20du:
  9388. return _MiningGloves5:10_POF:90_
  9389. BodRewardDatabase_SRr10sh:
  9390. return _MiningGloves5:10_POF:90_
  9391. BodRewardDatabase_SRr15sh:
  9392. return _MiningGloves5:10_POF:90_
  9393. BodRewardDatabase_SRr20sh:
  9394. return _DullHammer:100_
  9395. BodRewardDatabase_SRr10co:
  9396. return _DullHammer:100_
  9397. BodRewardDatabase_SRr15co:
  9398. return _DullHammer:100_
  9399. BodRewardDatabase_SRr20co:
  9400. return _DullHammer:60_ShadowHammer:40_
  9401. BodRewardDatabase_SRr10br:
  9402. return _DullHammer:60_ShadowHammer:40_
  9403. BodRewardDatabase_SRr15br:
  9404. return _DullHammer:60_ShadowHammer:40_
  9405. BodRewardDatabase_SRr20br:
  9406. return _ShadowHammer:100_
  9407. BodRewardDatabase_SRr10go:
  9408. return _ShadowHammer:100_
  9409. BodRewardDatabase_SRr15go:
  9410. return _ColoredAnvil:10_Blacksmithy5:60_ShadowHammer:30_
  9411. BodRewardDatabase_SRr20go:
  9412. return _CopperHammer:100_
  9413. BodRewardDatabase_SRr10ag:
  9414. return _CopperHammer:100_
  9415. BodRewardDatabase_SRr15ag:
  9416. return _ColoredAnvil:10_Blacksmithy10:60_CopperHammer:30_
  9417. BodRewardDatabase_SRr20ag:
  9418. return _BronzeHammer:100_
  9419. BodRewardDatabase_SRr10ve:
  9420. return _BronzeHammer:100_
  9421. BodRewardDatabase_SRr15ve:
  9422. return _BronzeHammer:100_
  9423. BodRewardDatabase_SRr20ve:
  9424. return _AncientHammer10:100_
  9425. BodRewardDatabase_SRr10va:
  9426. return _AncientHammer10:100_
  9427. BodRewardDatabase_SRr15va:
  9428. return _AncientHammer10:100_
  9429. BodRewardDatabase_SRr20va:
  9430. return _Blacksmithy15:100_
  9431.  
  9432. BodRewardDatabase_SRe10ir:
  9433. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9434. BodRewardDatabase_SRe15ir:
  9435. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9436. BodRewardDatabase_SRe20ir:
  9437. return _MiningGloves5:10_POF:90_
  9438. BodRewardDatabase_SRe10du:
  9439. return _ShadowHammer:100_
  9440. BodRewardDatabase_SRe15du:
  9441. return _ColoredAnvil:10_Blacksmithy5:60_ShadowHammer:30_
  9442. BodRewardDatabase_SRe20du:
  9443. return _CopperHammer:100_
  9444. BodRewardDatabase_SRe10sh:
  9445. return _CopperHammer:100_
  9446. BodRewardDatabase_SRe15sh:
  9447. return _ColoredAnvil:10_Blacksmithy10:60_CopperHammer:30_
  9448. BodRewardDatabase_SRe20sh:
  9449. return _BronzeHammer:100_
  9450. BodRewardDatabase_SRe10co:
  9451. return _BronzeHammer:100_
  9452. BodRewardDatabase_SRe15co:
  9453. return _BronzeHammer:100_
  9454. BodRewardDatabase_SRe20co:
  9455. return _AncientHammer10:100_
  9456. BodRewardDatabase_SRe10br:
  9457. return _AncientHammer10:100_
  9458. BodRewardDatabase_SRe15br:
  9459. return _AncientHammer10:100_
  9460. BodRewardDatabase_SRe20br:
  9461. return _Blacksmithy15:100_
  9462. BodRewardDatabase_SRe10go:
  9463. return _Blacksmithy15:100_
  9464. BodRewardDatabase_SRe15go:
  9465. return _Blacksmithy15:100_
  9466. BodRewardDatabase_SRe20go:
  9467. return _AncientHammer15:100_
  9468. BodRewardDatabase_SRe10ag:
  9469. return _AncientHammer15:100_
  9470. BodRewardDatabase_SRe15ag:
  9471. return _AncientHammer15:100_
  9472. BodRewardDatabase_SRe20ag:
  9473. return _Blacksmithy20:100_
  9474. BodRewardDatabase_SRe10ve:
  9475. return _Blacksmithy20:100_
  9476. BodRewardDatabase_SRe15ve:
  9477. return _Blacksmithy20:100_
  9478. BodRewardDatabase_SRe20ve:
  9479. return _GoldHammer:100_
  9480. BodRewardDatabase_SRe10va:
  9481. return _GoldHammer:100_
  9482. BodRewardDatabase_SRe15va:
  9483. return _GoldHammer:100_
  9484. BodRewardDatabase_SRe20va:
  9485. return _AncientHammer30:100_
  9486.  
  9487. BodRewardDatabase_SCr10ir:
  9488. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9489. BodRewardDatabase_SCr15ir:
  9490. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9491. BodRewardDatabase_SCr20ir:
  9492. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9493. BodRewardDatabase_SCr10du:
  9494. return _DullHammer:100_
  9495. BodRewardDatabase_SCr15du:
  9496. return _DullHammer:100_
  9497. BodRewardDatabase_SCr20du:
  9498. return _DullHammer:60_ShadowHammer:40_
  9499. BodRewardDatabase_SCr10sh:
  9500. return _DullHammer:60_ShadowHammer:40_
  9501. BodRewardDatabase_SCr15sh:
  9502. return _DullHammer:60_ShadowHammer:40_
  9503. BodRewardDatabase_SCr20sh:
  9504. return _ShadowHammer:100_
  9505. BodRewardDatabase_SCr10co:
  9506. return _ShadowHammer:100_
  9507. BodRewardDatabase_SCr15co:
  9508. return _ColoredAnvil:10_Blacksmithy5:60_ShadowHammer:30_
  9509. BodRewardDatabase_SCr20co:
  9510. return _CopperHammer:100_
  9511. BodRewardDatabase_SCr10br:
  9512. return _CopperHammer:100_
  9513. BodRewardDatabase_SCr15br:
  9514. return _ColoredAnvil:10_Blacksmithy10:60_CopperHammer:30_
  9515. BodRewardDatabase_SCr20br:
  9516. return _BronzeHammer:100_
  9517. BodRewardDatabase_SCr10go:
  9518. return _BronzeHammer:100_
  9519. BodRewardDatabase_SCr15go:
  9520. return _BronzeHammer:100_
  9521. BodRewardDatabase_SCr20go:
  9522. return _AncientHammer10:100_
  9523. BodRewardDatabase_SCr10ag:
  9524. return _AncientHammer10:100_
  9525. BodRewardDatabase_SCr15ag:
  9526. return _AncientHammer10:100_
  9527. BodRewardDatabase_SCr20ag:
  9528. return _Blacksmithy15:100_
  9529. BodRewardDatabase_SCr10ve:
  9530. return _Blacksmithy15:100_
  9531. BodRewardDatabase_SCr15ve:
  9532. return _Blacksmithy15:100_
  9533. BodRewardDatabase_SCr20ve:
  9534. return _AncientHammer15:100_
  9535. BodRewardDatabase_SCr10va:
  9536. return _AncientHammer15:100_
  9537. BodRewardDatabase_SCr15va:
  9538. return _AncientHammer15:100_
  9539. BodRewardDatabase_SCr20va:
  9540. return _Blacksmithy20:100_
  9541.  
  9542. BodRewardDatabase_SCe10ir:
  9543. return _DullHammer:100_
  9544. BodRewardDatabase_SCe15ir:
  9545. return _DullHammer:100_
  9546. BodRewardDatabase_SCe20ir:
  9547. return _DullHammer:60_ShadowHammer:40_
  9548. BodRewardDatabase_SCe10du:
  9549. return _BronzeHammer:100_
  9550. BodRewardDatabase_SCe15du:
  9551. return _BronzeHammer:100_
  9552. BodRewardDatabase_SCe20du:
  9553. return _AncientHammer10:100_
  9554. BodRewardDatabase_SCe10sh:
  9555. return _AncientHammer10:100_
  9556. BodRewardDatabase_SCe15sh:
  9557. return _AncientHammer10:100_
  9558. BodRewardDatabase_SCe20sh:
  9559. return _Blacksmithy15:100_
  9560. BodRewardDatabase_SCe10co:
  9561. return _Blacksmithy15:100_
  9562. BodRewardDatabase_SCe15co:
  9563. return _Blacksmithy15:100_
  9564. BodRewardDatabase_SCe20co:
  9565. return _AncientHammer15:100_
  9566. BodRewardDatabase_SCe10br:
  9567. return _AncientHammer15:100_
  9568. BodRewardDatabase_SCe15br:
  9569. return _AncientHammer15:100_
  9570. BodRewardDatabase_SCe20br:
  9571. return _Blacksmithy20:100_
  9572. BodRewardDatabase_SCe10go:
  9573. return _Blacksmithy20:100_
  9574. BodRewardDatabase_SCe15go:
  9575. return _Blacksmithy20:100_
  9576. BodRewardDatabase_SCe20go:
  9577. return _GoldHammer:100_
  9578. BodRewardDatabase_SCe10ag:
  9579. return _GoldHammer:100_
  9580. BodRewardDatabase_SCe15ag:
  9581. return _GoldHammer:100_
  9582. BodRewardDatabase_SCe20ag:
  9583. return _AncientHammer30:100_
  9584. BodRewardDatabase_SCe10ve:
  9585. return _AncientHammer30:100_
  9586. BodRewardDatabase_SCe15ve:
  9587. return _AncientHammer30:100_
  9588. BodRewardDatabase_SCe20ve:
  9589. return _AgapiteHammer:100_
  9590. BodRewardDatabase_SCe10va:
  9591. return _AgapiteHammer:100_
  9592. BodRewardDatabase_SCe15va:
  9593. return _AgapiteHammer:100_
  9594. BodRewardDatabase_SCe20va:
  9595. return _AncientHammer60:100_
  9596.  
  9597. BodRewardDatabase_SPr10ir:
  9598. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9599. BodRewardDatabase_SPr15ir:
  9600. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9601. BodRewardDatabase_SPr20ir:
  9602. return _MiningGloves5:10_POF:90_
  9603. BodRewardDatabase_SPr10du:
  9604. return _ShadowHammer:100_
  9605. BodRewardDatabase_SPr15du:
  9606. return _ColoredAnvil:10_Blacksmithy5:60_ShadowHammer:30_
  9607. BodRewardDatabase_SPr20du:
  9608. return _CopperHammer:100_
  9609. BodRewardDatabase_SPr10sh:
  9610. return _CopperHammer:100_
  9611. BodRewardDatabase_SPr15sh:
  9612. return _ColoredAnvil:10_Blacksmithy10:60_CopperHammer:30_
  9613. BodRewardDatabase_SPr20sh:
  9614. return _BronzeHammer:100_
  9615. BodRewardDatabase_SPr10co:
  9616. return _BronzeHammer:100_
  9617. BodRewardDatabase_SPr15co:
  9618. return _BronzeHammer:100_
  9619. BodRewardDatabase_SPr20co:
  9620. return _AncientHammer10:100_
  9621. BodRewardDatabase_SPr10br:
  9622. return _AncientHammer10:100_
  9623. BodRewardDatabase_SPr15br:
  9624. return _AncientHammer10:100_
  9625. BodRewardDatabase_SPr20br:
  9626. return _Blacksmithy15:100_
  9627. BodRewardDatabase_SPr10go:
  9628. return _Blacksmithy15:100_
  9629. BodRewardDatabase_SPr15go:
  9630. return _Blacksmithy15:100_
  9631. BodRewardDatabase_SPr20go:
  9632. return _AncientHammer15:100_
  9633. BodRewardDatabase_SPr10ag:
  9634. return _AncientHammer15:100_
  9635. BodRewardDatabase_SPr15ag:
  9636. return _AncientHammer15:100_
  9637. BodRewardDatabase_SPr20ag:
  9638. return _Blacksmithy20:100_
  9639. BodRewardDatabase_SPr10ve:
  9640. return _Blacksmithy20:100_
  9641. BodRewardDatabase_SPr15ve:
  9642. return _Blacksmithy20:100_
  9643. BodRewardDatabase_SPr20ve:
  9644. return _GoldHammer:100_
  9645. BodRewardDatabase_SPr10va:
  9646. return _GoldHammer:100_
  9647. BodRewardDatabase_SPr15va:
  9648. return _GoldHammer:100_
  9649. BodRewardDatabase_SPr20va:
  9650. return _AncientHammer30:100_
  9651.  
  9652. BodRewardDatabase_SPe10ir:
  9653. return _ShadowHammer:100_
  9654. BodRewardDatabase_SPe15ir:
  9655. return _ColoredAnvil:10_Blacksmithy5:60_ShadowHammer:30_
  9656. BodRewardDatabase_SPe20ir:
  9657. return _CopperHammer:100_
  9658. BodRewardDatabase_SPe10du:
  9659. return _Blacksmithy15:100_
  9660. BodRewardDatabase_SPe15du:
  9661. return _Blacksmithy15:100_
  9662. BodRewardDatabase_SPe20du:
  9663. return _AncientHammer15:100_
  9664. BodRewardDatabase_SPe10sh:
  9665. return _AncientHammer15:100_
  9666. BodRewardDatabase_SPe15sh:
  9667. return _AncientHammer15:100_
  9668. BodRewardDatabase_SPe20sh:
  9669. return _Blacksmithy20:100_
  9670. BodRewardDatabase_SPe10co:
  9671. return _Blacksmithy20:100_
  9672. BodRewardDatabase_SPe15co:
  9673. return _Blacksmithy20:100_
  9674. BodRewardDatabase_SPe20co:
  9675. return _GoldHammer:100_
  9676. BodRewardDatabase_SPe10br:
  9677. return _GoldHammer:100_
  9678. BodRewardDatabase_SPe15br:
  9679. return _GoldHammer:100_
  9680. BodRewardDatabase_SPe20br:
  9681. return _AncientHammer30:100_
  9682. BodRewardDatabase_SPe10go:
  9683. return _AncientHammer30:100_
  9684. BodRewardDatabase_SPe15go:
  9685. return _AncientHammer30:100_
  9686. BodRewardDatabase_SPe20go:
  9687. return _AgapiteHammer:100_
  9688. BodRewardDatabase_SPe10ag:
  9689. return _AgapiteHammer:100_
  9690. BodRewardDatabase_SPe15ag:
  9691. return _AgapiteHammer:100_
  9692. BodRewardDatabase_SPe20ag:
  9693. return _AncientHammer60:100_
  9694. BodRewardDatabase_SPe10ve:
  9695. return _AncientHammer60:100_
  9696. BodRewardDatabase_SPe15ve:
  9697. return _AncientHammer60:100_
  9698. BodRewardDatabase_SPe20ve:
  9699. return _VeriteHammer:100_
  9700. BodRewardDatabase_SPe10va:
  9701. return _VeriteHammer:100_
  9702. BodRewardDatabase_SPe15va:
  9703. return _VeriteHammer:100_
  9704. BodRewardDatabase_SPe20va:
  9705. return _ValoriteHammer:100_
  9706.  
  9707. BodRewardDatabase_S2r10sm:
  9708. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9709. BodRewardDatabase_S2r15sm:
  9710. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9711. BodRewardDatabase_S2r20sm:
  9712. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9713. BodRewardDatabase_S5r10sm:
  9714. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9715. BodRewardDatabase_S5r15sm:
  9716. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9717. BodRewardDatabase_S5r20sm:
  9718. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9719. BodRewardDatabase_S6r10sm:
  9720. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9721. BodRewardDatabase_S6r15sm:
  9722. return _MiningGloves3:10_GargoylesPickaxe:45_ProspectorsTools:45_
  9723. BodRewardDatabase_S6r20sm:
  9724. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9725. BodRewardDatabase_S2e10sm:
  9726. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9727. BodRewardDatabase_S2e15sm:
  9728. return _GargoylesPickaxe:40_ProspectorsTools:40_POF:20_
  9729. BodRewardDatabase_S2e20sm:
  9730. return _MiningGloves5:10_POF:90_
  9731. BodRewardDatabase_S5e10sm:
  9732. return _DullHammer:100_
  9733. BodRewardDatabase_S5e15sm:
  9734. return _DullHammer:100_
  9735. BodRewardDatabase_S5e20sm:
  9736. return _DullHammer:60_ShadowHammer:40_
  9737. BodRewardDatabase_S6e10sm:
  9738. return _DullHammer:60_ShadowHammer:40_
  9739. BodRewardDatabase_S6e15sm:
  9740. return _DullHammer:60_ShadowHammer:40_
  9741. BodRewardDatabase_S6e20sm:
  9742. return _ShadowHammer:100_
  9743.  
  9744. BodRewardDatabase_T4r10cl:
  9745. return _MediumStretchedHide:50_LargeStretchedHide:50_
  9746. BodRewardDatabase_T4r15cl:
  9747. return _MediumStretchedHide:50_LargeStretchedHide:50_
  9748. BodRewardDatabase_T4r20cl:
  9749. return _SpinedKit:100_
  9750. BodRewardDatabase_T4r10le:
  9751. return _MediumStretchedHide:50_LargeStretchedHide:50_
  9752. BodRewardDatabase_T4r15le:
  9753. return _MediumStretchedHide:50_LargeStretchedHide:50_
  9754. BodRewardDatabase_T4r20le:
  9755. return _SpinedKit:100_
  9756. BodRewardDatabase_T4r10sp:
  9757. return _SpinedKit:100_
  9758. BodRewardDatabase_T4r15sp:
  9759. return _SpinedKit:100_
  9760. BodRewardDatabase_T4r20sp:
  9761. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9762. BodRewardDatabase_T4r10ho:
  9763. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9764. BodRewardDatabase_T4r15ho:
  9765. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9766. BodRewardDatabase_T4r20ho:
  9767. return _BrownBearRug:50_PolarBearRug:50_
  9768. BodRewardDatabase_T4r10ba:
  9769. return _BrownBearRug:50_PolarBearRug:50_
  9770. BodRewardDatabase_T4r15ba:
  9771. return _BrownBearRug:50_PolarBearRug:50_
  9772. BodRewardDatabase_T4r20ba:
  9773. return _Tailoring10:100_
  9774. BodRewardDatabase_T4e10cl:
  9775. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9776. BodRewardDatabase_T4e15cl:
  9777. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9778. BodRewardDatabase_T4e20cl:
  9779. return _BrownBearRug:50_PolarBearRug:50_
  9780. BodRewardDatabase_T4e10le:
  9781. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9782. BodRewardDatabase_T4e15le:
  9783. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9784. BodRewardDatabase_T4e20le:
  9785. return _BrownBearRug:50_PolarBearRug:50_
  9786. BodRewardDatabase_T4e10sp:
  9787. return _BrownBearRug:50_PolarBearRug:50_
  9788. BodRewardDatabase_T4e15sp:
  9789. return _BrownBearRug:50_PolarBearRug:50_
  9790. BodRewardDatabase_T4e20sp:
  9791. return _Tailoring10:100_
  9792. BodRewardDatabase_T4e10ho:
  9793. return _Tailoring10:100_
  9794. BodRewardDatabase_T4e15ho:
  9795. return _Tailoring10:100_
  9796. BodRewardDatabase_T4e20ho:
  9797. return _BlessDeed:100_
  9798. BodRewardDatabase_T4e10ba:
  9799. return _BlessDeed:100_
  9800. BodRewardDatabase_T4e15ba:
  9801. return _Tailoring15:100_
  9802. BodRewardDatabase_T4e20ba:
  9803. return _HornedKit:100_
  9804.  
  9805. BodRewardDatabase_T5r10cl:
  9806. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9807. BodRewardDatabase_T5r15cl:
  9808. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9809. BodRewardDatabase_T5r20cl:
  9810. return _BrownBearRug:50_PolarBearRug:50_
  9811. BodRewardDatabase_T5r10le:
  9812. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9813. BodRewardDatabase_T5r15le:
  9814. return _Tailoring5:40_LightTapestry:30_DarkTapestry:30_
  9815. BodRewardDatabase_T5r20le:
  9816. return _BrownBearRug:50_PolarBearRug:50_
  9817. BodRewardDatabase_T5r10sp:
  9818. return _BrownBearRug:50_PolarBearRug:50_
  9819. BodRewardDatabase_T5r15sp:
  9820. return _BrownBearRug:50_PolarBearRug:50_
  9821. BodRewardDatabase_T5r20sp:
  9822. return _Tailoring10:100_
  9823. BodRewardDatabase_T5r10ho:
  9824. return _Tailoring10:100_
  9825. BodRewardDatabase_T5r15ho:
  9826. return _Tailoring10:100_
  9827. BodRewardDatabase_T5r20ho:
  9828. return _BlessDeed:100_
  9829. BodRewardDatabase_T5r10ba:
  9830. return _BlessDeed:100_
  9831. BodRewardDatabase_T5r15ba:
  9832. return _Tailoring15:100_
  9833. BodRewardDatabase_T5r20ba:
  9834. return _HornedKit:100_
  9835. BodRewardDatabase_T5e10cl:
  9836. return _Tailoring10:100_
  9837. BodRewardDatabase_T5e15cl:
  9838. return _Tailoring10:100_
  9839. BodRewardDatabase_T5e20cl:
  9840. return _BlessDeed:100_
  9841. BodRewardDatabase_T5e10le:
  9842. return _Tailoring10:100_
  9843. BodRewardDatabase_T5e15le:
  9844. return _Tailoring10:100_
  9845. BodRewardDatabase_T5e20le:
  9846. return _BlessDeed:100_
  9847. BodRewardDatabase_T5e10sp:
  9848. return _BlessDeed:100_
  9849. BodRewardDatabase_T5e15sp:
  9850. return _Tailoring15:100_
  9851. BodRewardDatabase_T5e20sp:
  9852. return _HornedKit:100_
  9853. BodRewardDatabase_T5e10ho:
  9854. return _HornedKit:100_
  9855. BodRewardDatabase_T5e15ho:
  9856. return _HornedKit:100_
  9857. BodRewardDatabase_T5e20ho:
  9858. return _Tailoring20:100_
  9859. BodRewardDatabase_T5e10ba:
  9860. return _Tailoring20:100_
  9861. BodRewardDatabase_T5e15ba:
  9862. return _Tailoring20:100_
  9863. BodRewardDatabase_T5e20ba:
  9864. return _BarbedKit:100_
  9865.  
  9866. BodRewardDatabase_T6r10le:
  9867. return _Tailoring10:100_
  9868. BodRewardDatabase_T6r15le:
  9869. return _Tailoring10:100_
  9870. BodRewardDatabase_T6r20le:
  9871. return _BlessDeed:100_
  9872. BodRewardDatabase_T6r10sp:
  9873. return _BlessDeed:100_
  9874. BodRewardDatabase_T6r15sp:
  9875. return _Tailoring15:100_
  9876. BodRewardDatabase_T6r20sp:
  9877. return _HornedKit:100_
  9878. BodRewardDatabase_T6r10ho:
  9879. return _HornedKit:100_
  9880. BodRewardDatabase_T6r15ho:
  9881. return _HornedKit:100_
  9882. BodRewardDatabase_T6r20ho:
  9883. return _Tailoring20:100_
  9884. BodRewardDatabase_T6r10ba:
  9885. return _Tailoring20:100_
  9886. BodRewardDatabase_T6r15ba:
  9887. return _Tailoring20:100_
  9888. BodRewardDatabase_T6r20ba:
  9889. return _BarbedKit:100_
  9890. BodRewardDatabase_T6e10le:
  9891. return _HornedKit:100_
  9892. BodRewardDatabase_T6e15le:
  9893. return _HornedKit:100_
  9894. BodRewardDatabase_T6e20le:
  9895. return _Tailoring20:100_
  9896. BodRewardDatabase_T6e10sp:
  9897. return _Tailoring20:100_
  9898. BodRewardDatabase_T6e15sp:
  9899. return _Tailoring20:100_
  9900. BodRewardDatabase_T6e20sp:
  9901. return _BarbedKit:100_
  9902. BodRewardDatabase_T6e10ho:
  9903. return _BarbedKit:100_
  9904. BodRewardDatabase_T6e15ho:
  9905. return _BarbedKit:100_
  9906. BodRewardDatabase_T6e20ho:
  9907. return _BarbedKit:100_
  9908. BodRewardDatabase_T6e10ba:
  9909. return _BarbedKit:100_
  9910. BodRewardDatabase_T6e15ba:
  9911. return _BarbedKit:100_
  9912. BodRewardDatabase_T6e20ba:
  9913. return _BarbedKit:100_
  9914. return !null
  9915.  
  9916. ;===========================================================================
  9917. ;**
  9918. ;* @name analyzeBod
  9919. ;* @ver 1.0
  9920. ;* @author AG
  9921. ;* @purpose Analizza un BOD e riempie una serie di variabili con lo stesso prefisso.
  9922. ;* L'effetto è simile al riempimento di una STRUCT!
  9923. ;* Sistema molto primordiale per programmare AD OGGETTI!
  9924. ;* La struct è organizzata come segue:
  9925. ;*
  9926. ;* struct BOD_DATA
  9927. ;* {
  9928. ;* ; Dati oggetto (flag 'o')
  9929. ;* Id ; memorizza l'id del BOD analizzato
  9930. ;* Property ; memorizza la #property del BOD analizzato
  9931. ;* Color ; memorizza il #findcol del BOD analizzato
  9932. ;*
  9933. ;* ; Informazioni di base (flag: 'b')
  9934. ;* Tailor ; #true se il BOD è di tailoring, #false se è di blacksmith
  9935. ;* Large ; #true se il BOD è large, #false se è small
  9936. ;* Exceptional ; #true se il BOD è exceptional, #false se è normal
  9937. ;*
  9938. ;* ; Materiale (flag: 'm')
  9939. ;* MaterialName ; nome del materiale richiesto per il BOD (oppure "cloth" in caso di stoffa)
  9940. ;* MaterialId ; id del tipo di materiale richiesto per il BOD
  9941. ;* MaterialColor ; codice di colore del materiale richiesto per il BOD
  9942. ;*
  9943. ;* ; Quantità (flag: 'q')
  9944. ;* Quantity ; quantità TOTALE di items necessari per fillare il BOD
  9945. ;* Cardinality ; 1 se il BOD è small; 4, 5 o 6 se il BOD è large, a seconda di quanti small BODs richiede
  9946. ;* FillCount ; quantità di item (o di small BODs) GIA' INSERITI nel BOD
  9947. ;* Filled ; indica se il BOD è completo
  9948. ;*
  9949. ;* ; Crafting (flag: 'c')
  9950. ;* CraftButton1 ; indice del pulsante rappresentante la "categoria" del BOD nel menu di crafting
  9951. ;* CraftButton2 ; indice del pulsante rappresentante il pezzo da craftare all'interno della categoria
  9952. ;* Cloth ; quantità di cloth necessaria per craftare UN SOLO pezzo
  9953. ;* Leather ; quantità di leather necessaria per craftare UN SOLO pezzo
  9954. ;* Hides ; sinonimo di "Leather" (backward compatibility)
  9955. ;* Bones ; quantità di bones necessarie per craftare UN SOLO pezzo
  9956. ;* Ingots ; quantità di ingots necessari per craftare UN SOLO pezzo
  9957. ;* ItemId ; identificatore del tipo di oggetto da craftare per fillare il BOD (solo se small)
  9958. ;* ItemName ; nome (human readable) del tipo di oggetto da craftare per fillare il BOD (solo se small)
  9959. ;*
  9960. ;* ; BODset (flag 's')
  9961. ;* SetId ; identificatore univoco del BODset cui appartiene questo BOD
  9962. ;* SetName ; nome del BODset cui appartiene questo BOD
  9963. ;* LinkedSets ; lista dei BODsets collegati a questo BOD (small->large o large->small)
  9964. ;*
  9965. ;* ; Premi (flag 'r')
  9966. ;* SmallRewards ; lista dei premi che si possono ottenere consegnando questo small bod
  9967. ;* LargeRewards ; lista dei premi che si possono ottenere consegnando questo large bod (o i large bods a cui questo small bod è collegato)
  9968. ;* }
  9969. ;*
  9970. ;* @params %1 req Bod identifier
  9971. ;* %2 req Name of the struct where to store results
  9972. ;* %3 opt Analysis flags
  9973. ;*
  9974. ;* @returns #true if no error occurs, or an error code otherwise
  9975. ;* @example call BodFunctions.euo analyzeBod %bod mybod e
  9976. ;* @status under development
  9977.  
  9978. sub analyzeBod ; %bodId %structName %flags
  9979. namespace push
  9980. namespace local analyzeBod , #random , #systime
  9981. set !lpc #lpc
  9982. set #lpc 500
  9983. set !bod %1
  9984. set !structName %2
  9985. if %0 < 3 || %3 = !null
  9986. set !flags abcdefghijklmnopqrstuvwxyz
  9987. else
  9988. set !flags %3
  9989.  
  9990. ; get bod color
  9991. ignoreitem reset
  9992. finditem !bod C ; search all opened containers
  9993. if #findkind = -1
  9994. {
  9995. finditem !bod G ; search nearby on the ground
  9996. if #findkind = -1
  9997. {
  9998. event exmsg #charid 3 0 analyzeBod: cannot find indicated BOD.
  9999. set #result err_cannot_find_bod
  10000. goto analyzeBod_return
  10001. }
  10002. }
  10003. if #findtype <> EYM
  10004. {
  10005. event exmsg #charid 3 0 analyzeBod: this object is not a BOD!
  10006. set #result err_invalid_type
  10007. goto analyzeBod_return
  10008. }
  10009. set !color #findcol
  10010.  
  10011. ; safe readProperty
  10012. set !timeout ( #systime + 1000 )
  10013. set #property 0
  10014. event property !bod
  10015. while #systime < !timeout && #property = 0
  10016. {
  10017. }
  10018. if Bulk notin #property || Amount notin #property
  10019. {
  10020. event exmsg #charid 3 0 analyzeBod: cannot read property for indicated BOD.
  10021. set #result err_cannot_read_property
  10022. goto analyzeBod_return
  10023. }
  10024. set !property #property
  10025.  
  10026. gosub analyzeBod_Explicit !bod !color !property !structName !flags
  10027.  
  10028. analyzeBod_return:
  10029. set #lpc !lpc
  10030. namespace clear
  10031. namespace pop
  10032. return #result
  10033.  
  10034. sub analyzeBod_Explicit ; %bodId %bodColor %bodProperty %structName %flags
  10035. namespace push
  10036. namespace local analyzeBod_Explicit , #random , #systime
  10037. set !lpc #lpc
  10038. set #lpc 500
  10039. set !bod %1
  10040. set !color %2
  10041. set !property %3
  10042. set !struct %4
  10043. if %0 < 5 || %5 = !null
  10044. set !flags abcdefghijklmnopqrstuvwxyz
  10045. else
  10046. set !flags %5
  10047.  
  10048. ; Dati indispensabili: calcolati in ogni caso (eventualmente non memorizzati in struttura)
  10049. gosub BodIsTailor !color
  10050. set !isTailor #result
  10051. gosub BodIsLarge !property
  10052. set !isLarge #result
  10053. gosub BodIsExceptional !property
  10054. set !isExceptional #result
  10055.  
  10056. if o in !flags ; Dati oggetto
  10057. {
  10058. gosub setStructField !struct Id !bod
  10059. gosub setStructField !struct Color !color
  10060. gosub setStructField !struct Property !property
  10061. }
  10062. if b in !flags ; Dati di base
  10063. {
  10064. gosub setStructField !struct Tailor !isTailor
  10065. gosub setStructField !struct Large !isLarge
  10066. gosub setStructField !struct Exceptional !isExceptional
  10067. }
  10068. if q in !flags ; Dati sulle quantità
  10069. {
  10070. gosub GetBodQuantity !property
  10071. set !quantity #result
  10072. gosub setStructField !struct Quantity #result
  10073.  
  10074. gosub GetLargeBodQuantity !property
  10075. set !cardinality #result
  10076. gosub setStructField !struct Cardinality #result
  10077.  
  10078. if !isLarge
  10079. gosub GetLargeBodAlreadyMadeQuantity !property
  10080. else
  10081. gosub GetBodAlreadyMadeQuantity !property
  10082. set !fillCount #result
  10083. gosub setStructField !struct FillCount !fillCount
  10084.  
  10085. if !isLarge
  10086. set !filled ( !fillCount = !cardinality )
  10087. else
  10088. set !filled ( !fillCount = !quantity )
  10089. gosub setStructField !struct Filled !filled
  10090. }
  10091. if m in !flags ; Dati sul materiale
  10092. {
  10093. gosub GetBodMaterial !color !property analyzeBod_material
  10094. set !materialColor %analyzeBod_material
  10095. gosub GetMaterialName !materialColor !isTailor
  10096. set !materialName #result
  10097.  
  10098. if !isTailor
  10099. set !materialId JJG
  10100. else
  10101. set !materialId ENK
  10102.  
  10103. if !materialColor = cloth
  10104. {
  10105. set !materialColor 0
  10106. set !materialId BUI
  10107. }
  10108. gosub setStructField !struct MaterialName !materialName
  10109. gosub setStructField !struct MaterialId !materialId
  10110. gosub setStructField !struct MaterialColor !materialColor
  10111. }
  10112. if c in !flags ; Crafting informations
  10113. {
  10114. if !isLarge
  10115. {
  10116. gosub setStructField !struct CraftButton1 0
  10117. gosub setStructField !struct CraftButton2 0
  10118. gosub setStructField !struct Cloth 0
  10119. gosub setStructField !struct Leather 0
  10120. gosub setStructField !struct Hides 0
  10121. gosub setStructField !struct Bones 0
  10122. gosub setStructField !struct Ingots 0
  10123. gosub setStructField !struct ItemId !null
  10124. gosub setStructField !struct ItemName !null
  10125. }
  10126. else
  10127. {
  10128. set %analyzeBod_ingots 0
  10129. set %analyzeBod_cloth 0
  10130. set %analyzeBod_hides 0
  10131. set %analyzeBod_bones 0
  10132. set %analyzeBod_category 0
  10133. set %analyzeBod_piece 0
  10134. if !isTailor
  10135. gosub GetTailorBodParameters !property analyzeBod_category analyzeBod_piece analyzeBod_cloth analyzeBod_hides analyzeBod_bones analyzeBod_type
  10136. else
  10137. gosub GetSmithyBodParameters !property analyzeBod_category analyzeBod_piece analyzeBod_ingots analyzeBod_type
  10138.  
  10139. gosub setStructField !struct CraftButton1 %analyzeBod_category
  10140. gosub setStructField !struct CraftButton2 %analyzeBod_piece
  10141. gosub setStructField !struct Cloth %analyzeBod_cloth
  10142. gosub setStructField !struct Hides %analyzeBod_hides
  10143. gosub setStructField !struct Leather %analyzeBod_hides
  10144. gosub setStructField !struct Bones %analyzeBod_bones
  10145. gosub setStructField !struct Ingots %analyzeBod_ingots
  10146. gosub setStructField !struct ItemId %analyzeBod_type
  10147. set !itemId %analyzeBod_type
  10148.  
  10149. gosub GetSmallBodItemName !property
  10150. gosub setStructField !struct ItemName #result
  10151. }
  10152. }
  10153. if s in !flags || r in !flags ; BODset informations (compute also if r flag is present; write only if s flag is present)
  10154. {
  10155. if !isLarge
  10156. {
  10157. gosub GetLargeBodItemSet !property
  10158. set !setId #result
  10159. set !setName #result
  10160.  
  10161. gosub GetLargeBodLinkedItems !setId
  10162. set !linkedSets #result
  10163. }
  10164. else
  10165. {
  10166. if !itemId = !null
  10167. {
  10168. if !isTailor
  10169. gosub GetTailorBodParameters !property analyzeBod_null analyzeBod_null analyzeBod_null analyzeBod_null analyzeBod_null analyzeBod_type
  10170. else
  10171. gosub GetSmithyBodParameters !property analyzeBod_null analyzeBod_null analyzeBod_null analyzeBod_type
  10172. set !itemId %analyzeBod_type
  10173. }
  10174. set !setId !itemId
  10175.  
  10176. gosub GetSmallBodItemName !property
  10177. set !setName #result
  10178.  
  10179. gosub GetSmallBodLinkedItems !itemId
  10180. set !linkedSets #result
  10181. }
  10182. if s in !flags
  10183. {
  10184. gosub setStructField !struct SetId !setId
  10185. gosub setStructField !struct SetName !setName
  10186. gosub setStructField !struct LinkedSets !linkedSets
  10187. }
  10188. }
  10189. if r in !flags ; Reward informations
  10190. {
  10191. if !materialName = !null
  10192. {
  10193. gosub GetBodMaterial !color !property analyzeBod_material
  10194. gosub GetMaterialName %analyzeBod_material !isTailor
  10195. set !materialName #result
  10196. }
  10197. if !quantity = !null
  10198. {
  10199. gosub GetBodQuantity !property
  10200. set !quantity #result
  10201. }
  10202. if !isLarge
  10203. {
  10204. gosub GetBodReward !setName !materialName !quantity !isExceptional
  10205. gosub setStructField !struct LargeRewards #result
  10206. }
  10207. else
  10208. {
  10209. if !isTailor
  10210. gosub GetBodReward TailorSmall !materialName !quantity !isExceptional
  10211. else
  10212. gosub GetBodReward SmithSmall !materialName !quantity !isExceptional
  10213. gosub setStructField !struct SmallRewards #result
  10214.  
  10215. gosub AG_Tokenize !linkedSets _ AnalyzeBod_Temp_
  10216. set !linkedRewards _
  10217. if #result > 0
  10218. {
  10219. for !i 1 #result
  10220. {
  10221. set !set %AnalyzeBod_Temp_ . !i
  10222. gosub GetBodReward !set !materialName !quantity !isExceptional
  10223. set !linkedRewards !linkedRewards , #result , _
  10224. }
  10225. }
  10226. gosub setStructField !struct LargeRewards !linkedRewards
  10227. }
  10228. }
  10229.  
  10230. analyzeBod_skipExtended:
  10231. set #result #true
  10232. analyzeBodEx_return:
  10233. set #lpc !lpc
  10234. namespace clear
  10235. namespace pop
  10236. return #result
  10237.  
  10238. ; INTERNAL USE ONLY!
  10239. sub setStructField ; %structName %structField %fieldValue
  10240. set !structAndField %1 , %2
  10241. set % . !structAndField %3
  10242. return
  10243.  
  10244. ; INTERNAL USE ONLY!
  10245. sub getStructField ; %structName %structField %fieldValue
  10246. set !structAndField %1 , %2
  10247. set #result % . !structAndField
  10248. return #result
  10249.  
  10250. ;===========================================================================
  10251. ;* @name showBodPanel
  10252. ;* @author AG
  10253. ;* @purpose Displays an informative dialog about the specified bod.
  10254. ;* Field names into the dialog box are the same as BOD structure field names.
  10255. ;* @params %1 req Bod identifier
  10256. ;*
  10257. ;* @example call BodFunctions.euo showBodPanel
  10258. ;* @status Tested
  10259.  
  10260. sub showBodPanel
  10261. namespace push
  10262. namespace local showBodPanel , #systime , #random
  10263. set !bod %1
  10264.  
  10265. gosub analyzeBod !bod showBodPanel_
  10266. if #result <> #true
  10267. {
  10268. event exmsg #charid 3 0 Errore nel parsing del BOD!
  10269. goto showBodPanel_return
  10270. }
  10271.  
  10272. ;---------------------
  10273. ; Costruzione Menu
  10274. ;---------------------
  10275.  
  10276. menu Clear
  10277. menu Window Title BOD Information Panel
  10278. menu Window Color Black
  10279. menu Window Size 547 420
  10280. menu Font Transparent #true
  10281. menu Font Align Right
  10282. menu Shape EUOShape5 376 16 165 145 3 7 2 Lime 7 Black
  10283. menu Shape EUOShape4 204 176 165 81 3 7 2 Lime 7 Black
  10284. menu Shape EUOShape3 204 96 165 65 3 7 2 Lime 7 Black
  10285. menu Shape EUOShape1 8 16 189 241 3 7 2 Lime 7 Black
  10286. menu Shape EUOShape6 8 52 189 1 3 7 1 Lime 7 White
  10287. menu Shape EUOShape2 204 16 165 65 3 7 2 Lime 7 Black
  10288. menu Font Name MS Sans Serif
  10289. menu Font Size 8
  10290. menu Font Style
  10291. menu Font Color Lime
  10292. menu Font Align Left
  10293. menu Font BGColor Black
  10294. menu Text EUOLabel1 16 28 ID:
  10295. menu Font Transparent #false
  10296. menu Text EUOLabel90 16 44 Property:
  10297. menu Font Transparent #true
  10298. menu Text EUOLabel3 100 28 Color:
  10299. menu Text EUOLabel4 212 28 Tailor
  10300. menu Text EUOLabel5 212 60 Exceptional
  10301. menu Text EUOLabel6 212 44 Large
  10302. menu Text EUOLabel7 212 108 MaterialID
  10303. menu Text EUOLabel8 212 188 Quantity
  10304. menu Text EUOLabel9 212 204 Cardinality
  10305. menu Text EUOLabel10 212 220 FillCount
  10306. menu Text EUOLabel11 212 236 Filled
  10307. menu Text EUOLabel12 384 28 CraftButton1
  10308. menu Text EUOLabel13 384 44 CraftButton2
  10309. menu Text EUOLabel14 384 60 Cloth
  10310. menu Text EUOLabel15 384 76 Leather
  10311. menu Text EUOLabel16 384 92 Bones
  10312. menu Text EUOLabel17 384 108 Ingots
  10313. menu Text EUOLabel18 384 124 ItemID
  10314. menu Text EUOLabel19 384 140 ItemName
  10315. menu Font Style b
  10316. menu Text ID 32 28 ID
  10317. menu Text Color 128 28 Color
  10318. menu Text Tailor 284 28 Tailor
  10319. menu Text Large 284 44 Large
  10320. menu Text Exceptional 284 60 Exceptional
  10321. menu Text MaterialID 284 108 MaterialID
  10322. menu Text Cardinality 284 204 Cardinality
  10323. menu Text FillCount 284 220 FillCount
  10324. menu Text Filled 284 236 Filled
  10325. menu Text CraftButton1 456 28 CraftButton1
  10326. menu Text CraftButton2 456 44 CraftButton2
  10327. menu Text Quantity 284 188 Quantity
  10328. menu Text Cloth 456 60 Cloth
  10329. menu Text Leather 456 76 Leather
  10330. menu Text Bones 456 92 Bones
  10331. menu Text Ingots 456 108 Ingots
  10332. menu Text ItemID 456 124 ItemID
  10333. menu Text ItemName 456 140 ItemName
  10334. menu Font Color White
  10335. menu Font Align Center
  10336. menu Text Property2 16 76 Property2
  10337. menu Text Property3 16 92 Property3
  10338. menu Text Property4 16 108 Property4
  10339. menu Text Property5 16 124 Property5
  10340. menu Text Property6 16 140 Property6
  10341. menu Text Property7 16 156 Property7
  10342. menu Text Property8 16 172 Property8
  10343. menu Text Property9 16 188 Property9
  10344. menu Text Property10 16 204 Property10
  10345. menu Text Property11 16 220 Property11
  10346. menu Font Style
  10347. menu Font Color Lime
  10348. menu Font Transparent #false
  10349. menu Font Align Left
  10350. menu Text EUOLabel2 12 9 Object (flag = O)
  10351. menu Font Style b
  10352. menu Font Color Yellow
  10353. menu Font Transparent #true
  10354. menu Font Align Center
  10355. menu Text Property1 16 60 Property1
  10356. menu Font Color White
  10357. menu Font Align Left
  10358. menu Text Property12 16 236 Property12
  10359. menu Font Style
  10360. menu Font Color Lime
  10361. menu Text EUOLabel21 212 124 MaterialColor
  10362. menu Font Style b
  10363. menu Text MaterialColor 284 124 MaterialColor
  10364. menu Font Style
  10365. menu Text EUOLabel25 212 140 MaterialName
  10366. menu Font Style b
  10367. menu Text MaterialName 284 140 MaterialName
  10368. menu Font Style
  10369. menu Font Transparent #false
  10370. menu Text EUOLabel27 208 9 Basic (flag = B)
  10371. menu Text EUOLabel28 208 89 Material (flag = M)
  10372. menu Text EUOLabel29 208 169 Quantity (flag = Q)
  10373. menu Text EUOLabel30 380 9 Crafting (flag = C)
  10374. menu Shape EUOShape7 8 352 533 65 3 7 2 Lime 7 Black
  10375. menu Font Transparent #true
  10376. menu Text EUOLabel20 16 364 RewardCodes
  10377. menu Font Style b
  10378. menu Text RewardCodes 92 364 RewardCodes
  10379. menu Font Style
  10380. menu Text EUOLabel23 16 380 SmallRewards
  10381. menu Font Style b
  10382. menu Text SmallRewards 92 380 SmallRewards
  10383. menu Font Style
  10384. menu Text EUOLabel26 16 396 LargeRewards
  10385. menu Font Style b
  10386. menu Text LargeRewards 92 396 LargeRewards
  10387. menu Font Style
  10388. menu Font Transparent #false
  10389. menu Text EUOLabel32 12 345 Rewards (flag = R)
  10390. menu Shape EUOShape8 8 272 533 65 3 7 2 Lime 7 Black
  10391. menu Font Transparent #true
  10392. menu Text EUOLabel22 16 284 SetID
  10393. menu Font Style b
  10394. menu Text SetID 92 284 SetID
  10395. menu Font Style
  10396. menu Text EUOLabel31 16 300 SetName
  10397. menu Font Style b
  10398. menu Text SetName 92 300 SetName
  10399. menu Font Style
  10400. menu Text EUOLabel34 16 316 LinkedSets
  10401. menu Font Style b
  10402. menu Text LinkedSets 92 316 LinkedSets
  10403. menu Font Style
  10404. menu Font Transparent #false
  10405. menu Text EUOLabel36 12 265 BOD Set (flag = S)
  10406.  
  10407. ;------------------------
  10408. ; Assegnazione variabili
  10409. ;------------------------
  10410.  
  10411. menu set ID %showBodPanel_ID
  10412. menu set Color %showBodPanel_Color
  10413.  
  10414. if %showBodPanel_Tailor
  10415. menu set Tailor true
  10416. else
  10417. menu set Tailor false
  10418.  
  10419. if %showBodPanel_Exceptional
  10420. menu set Exceptional true
  10421. else
  10422. menu set Exceptional false
  10423.  
  10424. if %showBodPanel_Large
  10425. menu set Large true
  10426. else
  10427. menu set Large false
  10428.  
  10429. if %showBodPanel_Filled
  10430. menu set Filled true
  10431. else
  10432. menu set Filled false
  10433.  
  10434. menu set MaterialID %showBodPanel_MaterialID
  10435. menu set MaterialName %showBodPanel_MaterialName
  10436. menu set MaterialColor %showBodPanel_MaterialColor
  10437. menu set Quantity %showBodPanel_Quantity
  10438. menu set Cardinality %showBodPanel_Cardinality
  10439. menu set FillCount %showBodPanel_FillCount
  10440. menu set CraftButton1 %showBodPanel_CraftButton1
  10441. menu set CraftButton2 %showBodPanel_CraftButton2
  10442. menu set Cloth %showBodPanel_Cloth
  10443. menu set Leather %showBodPanel_Leather
  10444. menu set Bones %showBodPanel_Bones
  10445. menu set Ingots %showBodPanel_Ingots
  10446. menu set ItemID %showBodPanel_ItemID
  10447. menu set ItemName %showBodPanel_ItemName
  10448. menu set SetId %showBodPanel_SetID
  10449. menu set SetName %showBodPanel_SetName
  10450. menu set LinkedSets %showBodPanel_LinkedSets
  10451. menu set RewardCodes %showBodPanel_RewardCodes
  10452. menu set SmallRewards %showBodPanel_SmallRewards
  10453. menu set LargeRewards %showBodPanel_LargeRewards
  10454.  
  10455. set !property %showBodPanel_Property
  10456. for !i 1 12
  10457. {
  10458. str pos !property $
  10459. set !length #strres - 1
  10460. str left !property !length
  10461. set !line #strres
  10462. if !line = !null
  10463. set !line #spc
  10464. menu set Property , !i !line
  10465. set !length !length + 1
  10466. str del !property 1 !length
  10467. set !property #strres
  10468. }
  10469.  
  10470. menu Show
  10471.  
  10472. showBodPanel_return:
  10473. namespace clear
  10474. namespace pop
  10475. return
  10476.  
  10477. ;===========================================================================
  10478. ;* @name setBodbookFilter
  10479. ;* @version 2.0
  10480. ;* @author AG
  10481. ;* @purpose Imposta il filtro del bodbook specificato.
  10482. ;* La versione 2.0 è molto più veloce e anche molto più affidabile della versione 1.0.
  10483. ;* L'ordine dei parametri è stato cambiato, per rispecchiare la disposizione nel gump.
  10484. ;* E' stato inoltre aggiunto il parametro "bodbook" (%1), che apre il bodbook specificato.
  10485. ;*
  10486. ;* @params %1 opt Identificatore del bodbook per l quale settare il filtro.
  10487. ;* Se questo campo è last oppure N/A, la sub assumerà che il gump del bodbook sia già aperto.
  10488. ;* %2 opt Filtro per dimensione. Può essere: all, small, large, last, N/A.
  10489. ;* Se questo campo è last oppure N/A, nessun pulsante di questa categoria sarà premuto.
  10490. ;* %3 opt Filtro per qualità. Può essere: all, normal, exceptional, last, N/A.
  10491. ;* Se questo campo è last oppure N/A, nessun pulsante di questa categoria sarà premuto.
  10492. ;* %4 opt Filtro per materiale. Può essere:
  10493. ;* all, clear, last, N/A,
  10494. ;* smithy|blacksmithy, iron, dull, shadow, copper, bronze, gold|golden, agapite, verite, valorite,
  10495. ;* tailor|tailoring, cloth, leather, spined, horned, barbed
  10496. ;* Se questo campo è clear oppure all, il filtro sarà resettato (includendo, quindi, sia blacksmith che tailoring).
  10497. ;* Se questo campo è last oppure N/A, nessun pulsante di questa categoria sarà premuto.
  10498. ;* NB: "clear" e "all" possono influenzare gli altri parametri della sub, se questi hanno valore last oppure N/A.
  10499. ;* %5 opt Filtro per ammontare. Può essere: all, 10, 15, 20.
  10500. ;* Se questo campo è last oppure N/A, nessun pulsante di questa categoria sarà premuto.
  10501. ;*
  10502. ;* @returns #true se l'operazione è andata completamente a buon fine. #false se si sono verificati errori.
  10503. ;* @example call safecall BodFunctions.euo setBodbookFilter %bodbook %size &quality %material %amount
  10504. ;* call safecall BodFunctions.euo setBodbookFilter %bodbook small exceptional iron 20
  10505. ;* @status Tested and working.
  10506. ;* @note Uses safecall convention!!!!
  10507.  
  10508. sub setBodbookFilter ; %bodbook %size &quality %material %amount
  10509. set !bodbook %1
  10510. set !size %2
  10511. set !quality %3
  10512. set !material %4
  10513. set !quantity %5
  10514.  
  10515. ; apertura del bodbook
  10516. if !bodbook <> !null
  10517. {
  10518. ; assicurati che il gump sia chiuso!
  10519. if #contsize = 615_454
  10520. {
  10521. set !timeout #systime + 2000
  10522. while #systime < !timeout ; clicca con il destro a ripetizione ogni volta che il gump è aperto
  10523. {
  10524. if #contsize = 615_454
  10525. {
  10526. set !x #contposx + 50
  10527. set !y #contposy + 50
  10528. click !x !y r
  10529. }
  10530. }
  10531. }
  10532.  
  10533. ; usa bodbook
  10534. set #lobjectid !bodbook
  10535. event macro 17 ; LastObject
  10536.  
  10537. ; attendi comparsa del gump
  10538. set !timeout #systime + 2000
  10539. while #systime < !timeout && #contsize <> 615_454
  10540. {
  10541. }
  10542. if #contsize <> 615_454 ; secondo tentativo
  10543. {
  10544. ; usa bodbook
  10545. set #lobjectid !bodbook
  10546. event macro 17 ; LastObject
  10547.  
  10548. ; attendi comparsa del gump
  10549. set !timeout #systime + 2000
  10550. while #systime < !timeout && #contsize <> 615_454
  10551. {
  10552. }
  10553. }
  10554. }
  10555. if #contsize <> 615_454
  10556. return #false
  10557.  
  10558. ; Premi "Set Filter"
  10559. gosub setBodbookFilter_pushButton 45 40
  10560. if #result = #false
  10561. return #false
  10562.  
  10563. ; filtro materiale
  10564. gosub setBodbookFilter_getButtonPosition !material
  10565. set !buttonPos #result
  10566. str pos !buttonPos _
  10567. set !sepIndex #strres
  10568. str del !buttonPos 1 !sepIndex
  10569. set !y #strres
  10570. set !sepIndex !sepIndex - 1
  10571. str left !buttonPos !sepIndex
  10572. set !x #strres
  10573. if !x <> 0 && !y <> 0
  10574. {
  10575. gosub setBodbookFilter_pushButton !x !y
  10576. if #result = #false
  10577. return #false
  10578. }
  10579.  
  10580. ; filtro dimensione
  10581. set !y 105
  10582. set !x 0
  10583. if !size = all
  10584. set !x 35
  10585. if !size = small
  10586. set !x 110
  10587. if !size = large
  10588. set !x 205
  10589. if !size = all && !material in all_clear ; ottimizzazione in caso di clear
  10590. set !x 0
  10591. if !x <> 0
  10592. {
  10593. gosub setBodbookFilter_pushButton !x !y
  10594. if #result = #false
  10595. return #false
  10596. }
  10597.  
  10598. ; filtro qualità
  10599. set !y 105
  10600. set !x 0
  10601. if !quality = all
  10602. set !x 330
  10603. if !quality = normal
  10604. set !x 405
  10605. if !quality = exceptional
  10606. set !x 500
  10607. if !quality = all && !material in all_clear ; ottimizzazione in caso di clear
  10608. set !x 0
  10609. if !x <> 0
  10610. {
  10611. gosub setBodbookFilter_pushButton !x !y
  10612. if #result = #false
  10613. return #false
  10614. }
  10615.  
  10616. ; filtro quantità
  10617. set !y 360
  10618. set !x 0
  10619. if !quantity = all
  10620. set !x 35
  10621. if !quantity = 10
  10622. set !x 110
  10623. if !quantity = 15
  10624. set !x 215
  10625. if !quantity = 20
  10626. set !x 310
  10627. if !quantity = all && !material in all_clear ; ottimizzazione in caso di clear
  10628. set !x 0
  10629. if !x <> 0
  10630. {
  10631. gosub setBodbookFilter_pushButton !x !y
  10632. if #result = #false
  10633. return #false
  10634. }
  10635.  
  10636. ; Premi "Apply"
  10637. gosub setBodbookFilter_pushButton 515 425
  10638. if #result = #false
  10639. return #false
  10640.  
  10641. ; Premi "Exit" (oppure lascia il gump aperto se lo era già)
  10642. if !bodbook <> !null
  10643. gosub setBodbookFilter_pushButton 385 425
  10644. return #true
  10645.  
  10646. sub setBodbookFilter_pushButton ; %x %y
  10647. ; attendi comparsa del gump
  10648. set !timeout #systime + 2000
  10649. while #systime < !timeout && #contsize <> 615_454
  10650. {
  10651. }
  10652. if #contsize <> 615_454
  10653. return #false
  10654.  
  10655. set !x #contposx + %1
  10656. set !y #contposy + %2
  10657. click !x !y
  10658.  
  10659. ; attendi scomparsa del gump
  10660. set !timeout #systime + 2000
  10661. while #systime < !timeout && #contsize = 615_454
  10662. {
  10663. }
  10664. if #contsize = 615_454
  10665. return #false
  10666. return #true
  10667.  
  10668. sub setBodbookFilter_getButtonPosition ; %material
  10669. set !m %1
  10670. if all in !m || clear in !m
  10671. return 385_425
  10672. if smith in !m
  10673. return 35_200
  10674. if dull in !m
  10675. return 245_200
  10676. if shadow in !m
  10677. return 340_200
  10678. if copper in !m
  10679. return 425_200
  10680. if bronze in !m
  10681. return 520_200
  10682. if gold in !m
  10683. return 140_240
  10684. if agapite in !m
  10685. return 245_240
  10686. if verite in !m
  10687. return 340_240
  10688. if valorite in !m
  10689. return 425_240
  10690. if iron in !m
  10691. return 140_200
  10692. if tailor in !m
  10693. return 35_280
  10694. if cloth in !m
  10695. return 140_280
  10696. if spined in !m
  10697. return 340_280
  10698. if horned in !m
  10699. return 425_280
  10700. if barbed in !m
  10701. return 520_280
  10702. if leather in !m
  10703. return 245_280
  10704. return 0_0
  10705.  
  10706.  
  10707.  
  10708.  
  10709.  
  10710.  
  10711.  
  10712. ;================================================
  10713. ;=
  10714. ;= Funzioni BodGathering (sperimentali)
  10715. ;=
  10716. ;================================================
  10717.  
  10718. sub Std_Logout
  10719. event Macro 8 1 ; Open Paperdoll
  10720. set !timeout #systime + 5000
  10721. while #systime < !timeout && #contname <> paperdoll_gump
  10722. {
  10723. }
  10724. if #contname <> paperdoll_gump
  10725. return #false
  10726.  
  10727. set !x #contposx + 215
  10728. set !y #contposy + 105
  10729. click !x !y
  10730.  
  10731. while #systime < !timeout && #contname <> YesNo_gump
  10732. {
  10733. }
  10734. if #contname <> YesNo_gump
  10735. return #false
  10736.  
  10737. set !x #contposx + 115
  10738. set !y #contposy + 85
  10739. click !x !y
  10740.  
  10741. while #systime < !timeout && #contname <> MainMenu_gump
  10742. {
  10743. }
  10744. return #contname = MainMenu_gump
  10745.  
  10746. ; @author: Original code by Kal In Ex; modified by AG.
  10747. sub Std_Login ; %account %password %charnum
  10748. set !account %1
  10749. set !password %2
  10750. set !charnum %3
  10751. set %1 !null ; Gli argomenti potrebbero essere letti dall'esterno! Meglio cancellarli subito!
  10752. set %2 !null
  10753.  
  10754. while #true ; @todo Introdurre timeout
  10755. {
  10756. wait 20
  10757. ;if #contkind = GRI ; main login gump
  10758. if #contname = MainMenu_gump ; main login gump
  10759. {
  10760. if !account <> !null
  10761. {
  10762. set !x #contposx + 521
  10763. set !y #contposy + 356
  10764. click !x !y
  10765. gosub Kal_sendstring !account
  10766. }
  10767. if !password <> !null
  10768. {
  10769. set !x #contposx + 521
  10770. set !y #contposy + 396
  10771. click !x !y
  10772. gosub Kal_sendstring !password
  10773. }
  10774. set !x #contposx + 618
  10775. set !y #contposy + 444
  10776. click !x !y ; click the green arrow
  10777. gosub Kal_waitgump notfor MainMenu_gump 640_480 10
  10778. gosub Kal_waitgump notfor waiting_gump 408_288 60 ; verifying can take a while
  10779. continue
  10780. }
  10781. ;if #contkind = AAG ; shard selection gump
  10782. if #contname = normal_gump ; shard selection gump
  10783. {
  10784. set !x #contposx + 260
  10785. set !y #contposy + 115
  10786. click !x !y g ; click topmost shard not sure why need g
  10787. gosub Kal_waitgump notfor normal_gump 640_480 10
  10788. continue
  10789. }
  10790. ;if #contkind = GXJC ; char login gump
  10791. if #contname = normal_gump ; char login gump
  10792. {
  10793. set !x #contposx + 360
  10794. ;set %y %mycharnum * 40 + 100
  10795. set !y #contposy + 100 + !charnum * 40
  10796. click !x !y ; click char name (changed from d as sometimes seemed to fail)
  10797. set !x #contposx + 618
  10798. set !y #contposy + 444
  10799. click !x !y ; click the green arrow
  10800. gosub Kal_waitgump notfor login_gump 640_480 1
  10801. continue
  10802. }
  10803. ;if #contkind = EKEC
  10804. if #contname = waiting_gump
  10805. {
  10806. if #contsize = 203_121 ; disconnection
  10807. {
  10808. set !x #contposx + 100
  10809. set !y #contposy + 95
  10810. click !x !y
  10811. }
  10812. if #contsize = 408_288 ; no connection avail, or timeout
  10813. {
  10814. set !x #contposx + 202
  10815. set !y #contposy + 254
  10816. click !x !y ; try again
  10817. }
  10818. continue
  10819. }
  10820. break
  10821. }
  10822. return #result
  10823. ;-------------------------------------------
  10824. sub Kal_sendstring
  10825. str Len %1
  10826. set !len #strRes
  10827. for !i 1 16
  10828. {
  10829. key back ; delete current if any
  10830. }
  10831. for !i 1 !len
  10832. {
  10833. str Mid %1 !i 1
  10834. key #strRes
  10835. }
  10836. return
  10837. ;-------------------------------------------------
  10838. sub Kal_waitgump
  10839. ;%1 = for or notfor %2 = kind of gump %3 = size %4= timeout
  10840. set %timout #scnt + %4
  10841. _wfgloop:
  10842. if #scnt > %timout
  10843. return
  10844. wait 10
  10845. if %1 = for && ( #contname <> %2 || #contsize <> %3 )
  10846. goto _wfgloop
  10847. if %1 = notfor && #contname = %2 && #contsize = %3
  10848. goto _wfgloop
  10849. return
  10850.  
  10851.  
  10852.  
  10853. ;===========================================================================================================
  10854. ;* FUNZIONI RAIL
  10855. ;*
  10856. ;* Un "oggetto rail" è una stringa formattata come segue: |x1_y1_z1|x2_y2_z2|...|xN_yN_zN|
  10857. ;* "x1", "y1", "z1", eccetera rappresentano le coordinate di ogni punto della rail.
  10858. ;* Notare che il separatore "|" viene posto anche all'inizio e alla fine della rail.
  10859. ;* Ciascuna coordinata può essere dotata di segno "-", ma non di segno "+".
  10860. ;* La coordinata z può essere omessa.
  10861. ;* E' responsabilità del programmatore assicurarsi che la rail sia formattata correttamente; per motivi di
  10862. ;* efficienza, infatti, si escludono tutta una serie di controlli che avrebbero reso le sub più tolleranti.
  10863. ;*
  10864. ;* Esempi di rail corrette:
  10865. ;* |7890_213_-50|7880_220_-30|7870_230_0|7870_230_41|
  10866. ;* |-7890_213|-7880_220|-7870_230|-7870_230|
  10867. ;* Esempi di rail errate:
  10868. ;* 7890_213_-50|7880_220_-30|7870_230_0|7870_230_41| ; manca separatore iniziale
  10869. ;* |7890_213_-50|7880_220_-30|7870_230_0|7870_230_41 ; manca separatore finale
  10870. ;* |+7890_213_-50|7880_220_-30|7870_230_0|7870_230_41| ; presente un segno "+" per un numero positivo
  10871. ;* |7890__213_-50|7880|_7870_230_0_|%7870_$230_#41| ; vari errori di formattazione
  10872. ;*
  10873. ;* Ciascun elemento della rail viene detto "punto".
  10874. ;* Ogni punto è rappresentato da una stringa del tipo x_y_z, oppure x_y se z non è specificato.
  10875. ;* Per i punti valgono le stesse regole di formattazione indicate sopra (ad esempio: niente segni "+").
  10876. ;* La stringa che rappresenta un punto NON contiene il carattere separatore "|".
  10877. ;*
  10878. ;* Esempi di punti corretti:
  10879. ;* 123_432_-40
  10880. ;* -123_-432_-40
  10881. ;* 123_-432
  10882. ;*
  10883. ;* E' importante far notare che TUTTE le funzioni Rail operano sempre con singole variabili punto,
  10884. ;* e NON con coppie di variabili x y oppure triplette di variabili x y z.
  10885. ;*
  10886. ;*
  10887. ;* ELENCO DELLE FUNZIONI (non tutte sono implementate)
  10888. ;*
  10889. ;* Rail_GetPoint %rail %index : x_y_z
  10890. ;* Rail_GetPointIndex %rail %point : int
  10891. ;* Rail_GetLength %rail : int
  10892. ;* Rail_SetPoint %rail %index : x_y_z
  10893. ;* Rail_SubRail %in %start %end : RailObject
  10894. ;* Rail_ReverseRail %rail : RailObject
  10895. ;* Rail_Create %varname %startindex %endindex : RailObject
  10896. ;* Rail_Create |x_y_z|x_y_z|
  10897. ;* Rail_Contains %rail %point : boolean
  10898. ;* Rail_Insert %rail %index
  10899. ;*
  10900. ;* Rail_GetNearestPoint %rail %x_y_z : x_y_z
  10901. ;* Rail_GetNearestPointIndex %rail %x_y_z : int
  10902. ;* Rail_Follow %rail %startindex %endindex
  10903. ;*
  10904. ;* Rail_GetPointX %point : int
  10905. ;* Rail_GetPointY %point : int
  10906. ;* Rail_GetPointZ %point : int
  10907.  
  10908. ;===========================================================================
  10909. ;* @name Rail_GetPoint
  10910. ;* @author AG
  10911. ;* @purpose Restituisce un punto della rail, a partire dal suo indice nella rail stessa.
  10912. ;* @params %1 req Oggetto rail.
  10913. ;* %2 req Indice (1-based) del punto da restituire.
  10914. ;* @returns Punto della rail nella posizione indicata, oppure !null in caso di errore.
  10915. ;* @example gosub safecall Rail_GetPoint %rail 10
  10916.  
  10917. sub Rail_GetPoint ; %rail %index
  10918. set !rail %1
  10919. set !index %2
  10920.  
  10921. str pos !rail | !index
  10922. if #strres = 0
  10923. return !null
  10924. set !start #strres + 1
  10925.  
  10926. set !index !index + 1
  10927. str pos !rail | !index
  10928. if #strres = 0
  10929. return !null
  10930. set !len #strres - !start
  10931.  
  10932. str mid !rail !start !len
  10933. return #strres
  10934.  
  10935. ; old version
  10936. ; strip right
  10937. str pos !temp |
  10938. if #strres = 0
  10939. return !null
  10940. set !x #strres - 1
  10941. str left !temp #strres
  10942.  
  10943. ; strip left
  10944. str pos !temp | !index
  10945. if #strres = 0
  10946. return !null
  10947. str del !temp 1 #strres
  10948. set !temp #strres
  10949.  
  10950. ; strip right
  10951. str pos !temp |
  10952. if #strres = 0
  10953. return !null
  10954. set !x #strres - 1
  10955. str left !temp #strres
  10956. return #strres
  10957.  
  10958. ;===========================================================================
  10959. ;* @name Rail_GetPointIndex
  10960. ;* @author AG
  10961. ;* @purpose Restituisce l'indice di un punto della rail.
  10962. ;* @params %1 req Oggetto rail.
  10963. ;* %2 req Punto di cui restituire l'indice.
  10964. ;* @returns Indice del punto nella rail, oppure !null se la rail non contiene il punto.
  10965. ;* @example gosub safecall Rail_GetPointIndex %rail 1234_4567_78
  10966.  
  10967. sub Rail_GetPointIndex ; %rail %point
  10968. set !rail %1
  10969. set !point | , %2 , |
  10970.  
  10971. str pos !rail | !point
  10972. if #strres = 0
  10973. return !null
  10974. str left !rail #strres
  10975. str count #strres |
  10976. return #strres
  10977.  
  10978. ;===========================================================================
  10979. ;* @name Rail_GetLength
  10980. ;* @author AG
  10981. ;* @purpose Restituisce il numero di punti nella rail.
  10982. ;* @params %1 req Oggetto rail.
  10983. ;* @returns Numero di punti nella rail.
  10984. ;* @example gosub safecall Rail_GetLength %rail
  10985.  
  10986. sub Rail_GetLength %1
  10987. str count %1 |
  10988. return #strres - 1
  10989.  
  10990. ;===========================================================================
  10991. ;* @name Rail_ReverseRail
  10992. ;* @author AG
  10993. ;* @purpose Restituisce una rail invertita rispetto a quella passata come argomento.
  10994. ;* Tale rail contiene gli stessi punti della rail sorgente, ma in ordine inverso.
  10995. ;* @params %1 req Oggetto rail.
  10996. ;* @returns Rail invertita.
  10997. ;* @example gosub safecall Rail_ReverseRail %rail
  10998. ;* @todo Questa sub è molto lenta. Ottimizzare.
  10999.  
  11000. sub Rail_ReverseRail ; %1
  11001. set !in %1
  11002. set !out |
  11003. gosub safecall Rail_GetLength !in
  11004. set !count #result
  11005. for !i !count 1
  11006. {
  11007. gosub safecall Rail_GetPoint !in !i
  11008. set !out !out , #result , |
  11009. }
  11010. return !out
  11011.  
  11012. ;===========================================================================
  11013. ;* @name Rail_GetPointX
  11014. ;* @author AG
  11015. ;* @purpose Restituisce la coordinata X di un oggetto punto.
  11016. ;* @params %1 req Oggetto punto.
  11017. ;* @returns Coordinata X del punto.
  11018. ;* @example gosub safecall Rail_GetPointX 0132_-2132_34
  11019.  
  11020. sub Rail_GetPointX ; %point
  11021. str pos %1 _
  11022. set !pos #strres - 1
  11023. str left %1 !pos
  11024. return #strres
  11025.  
  11026. ;===========================================================================
  11027. ;* @name Rail_GetPointY
  11028. ;* @author AG
  11029. ;* @purpose Restituisce la coordinata Y di un oggetto punto.
  11030. ;* @params %1 req Oggetto punto.
  11031. ;* @returns Coordinata Y del punto.
  11032. ;* @example gosub safecall Rail_GetPointY 0132_-2132_34
  11033.  
  11034. sub Rail_GetPointY ; %point
  11035. set !string %1 , _
  11036. str pos !string _ 1
  11037. set !start #strres + 1
  11038. str pos !string _ 2
  11039. set !len #strres - !start
  11040. str mid !string !start !len
  11041. return #strres
  11042.  
  11043. ;===========================================================================
  11044. ;* @name Rail_GetPointZ
  11045. ;* @author AG
  11046. ;* @purpose Restituisce la coordinata Z di un oggetto punto.
  11047. ;* @params %1 req Oggetto punto.
  11048. ;* @returns Coordinata Z del punto.
  11049. ;* @example gosub safecall Rail_GetPointZ 0132_-2132_34
  11050.  
  11051. sub Rail_GetPointZ ; %point
  11052. set !string %1 , _
  11053. str pos !string _ 2
  11054. set !start #strres + 1
  11055. str pos !string _ 3
  11056. if #strres = 0
  11057. return !null
  11058. set !len #strres - !start
  11059. str mid !string !start !len
  11060. return #strres
  11061.  
  11062. ; prende un Bod con il PG corrente.
  11063. sub Model_BodGather_Cycle
  11064. set !smithBodGathered #false
  11065. set !tailorBodGathered #false
  11066.  
  11067. while #true
  11068. {
  11069. if %Location_Name = home
  11070. {
  11071. }
  11072.  
  11073. if runa fabbro { recall, continue }
  11074. if runa sarto { recall, continue }
  11075. { recall home }
  11076. }
  11077. return
  11078.  
  11079. sub Model_BodGather ; %type (smith|tailor)
  11080. set !bodType %1
  11081.  
  11082. gosub safecall Model_DetectLocation
  11083. if %Location_Name = !bodType
  11084. {
  11085. ; @todo
  11086. continue
  11087. }
  11088. if runa fabbro
  11089. {
  11090. }
  11091.  
  11092. gosub safecall Model_GetNearestRail !bodType
  11093. if #result <> !null
  11094. {
  11095. }
  11096. return
  11097.  
  11098. sub Model_GetNearestRail ; %railType (smith|tailor|inn)
  11099. set !railType %1
  11100. set !charPoint #charposx , _ , #charposy , _ , #charposz
  11101. set !varname Rails_ , !railType , _Count
  11102. set !count % . !varname
  11103. set !nearestRail !null
  11104. set !nearestDist 10
  11105.  
  11106. for !i 1 !count
  11107. {
  11108. set !varname Rails_ , !railType , _ , !i
  11109. set !rail % . !varname
  11110. gosub safecall Rail_GetNearestPoint !rail !charPoint
  11111. set !point #result
  11112. gosub safecall Rail_GetPointX !point
  11113. set !point_x #result
  11114. gosub safecall Rail_GetPointY !point
  11115. set !point_y #result
  11116. gosub safecall Rail_GetPointZ !point
  11117. set !point_z #result
  11118.  
  11119. set !distX abs ( !point_x - #charposx )
  11120. set !distY abs ( !point_y - #charposy )
  11121. if !distX > !distY
  11122. set !dist !distX
  11123. else
  11124. set !dist !distY
  11125.  
  11126. if !dist < !nearestDist
  11127. {
  11128. set !nearestRail !rail
  11129. set !nearestDist !dist
  11130. }
  11131. }
  11132. return !nearestRail
  11133.  
  11134. sub Model_ChangeChar ; %charNumber
  11135. set !charNumber %1
  11136.  
  11137. ; rail to inn
  11138. ; - se fallisce: recall home
  11139. ; - se fallisce: return #false
  11140.  
  11141. gosub safecall Std_Logout
  11142. call AG_Routines.txt getPassword
  11143. set !password #result
  11144. gosub safecall Std_Login !null !password !charNumber
  11145. return
  11146.  
  11147. sub Model_BodGatherCycle
  11148. return
  11149.  
  11150. sub Model_InitRails
  11151. ; Umbra rails
  11152. set !Rail_1 |tailor|2080_1329_-78|2079_1336_-75|2077_1340_-85|2065_1329_-90|2057_1321_-90|2048_1313_-90|2044_1314_-85|inn|
  11153. set !Rail_2 |smith|1982_1359_-80|1986_1365_-80|1992_1367_-75|1995_1367_-83|1996_1367_-87|2003_1367_-90|2008_1362_-90|
  11154. +2008_1356_-90|2008_1350_-90|2015_1346_-90|2022_1344_-90|2028_1344_-90|2033_1344_-85|2040_1337_-86|2048_1329_-85|
  11155. +2050_1326_-90|2050_1320_-90|2045_1315_-85|inn|
  11156. set !Rail_3 |tailor|2080_1325_-80|2080_1330_-78|2080_1335_-75|2080_1338_-81|2079_1340_-86|2077_1342_-90|2070_1345_-90|
  11157. +2064_1345_-90|2061_1345_-85|2055_1345_-83|2047_1345_-85|2041_1345_-80|2038_1345_-85|2033_1345_-85|2029_1345_-90|
  11158. +2023_1345_-90|2015_1345_-90|2008_1350_-90|2008_1357_-90|2004_1363_-90|1997_1367_-88|1994_1367_-80|1988_1367_-80|
  11159. +1981_1363_-80|smith|
  11160.  
  11161. event exmsg #charid 3 0 Preparing rails, please wait.
  11162. set !i 0
  11163. while #true
  11164. {
  11165. set !i !i + 1
  11166. set !rail !Rail_ . !i
  11167. if | notin !rail
  11168. return
  11169.  
  11170. for !j 1 2
  11171. {
  11172. if !j = 2
  11173. {
  11174. gosub safecall Rail_ReverseRail !rail
  11175. set !rail #result
  11176. }
  11177. str right !rail 10
  11178. if |smith| in !rail
  11179. set !dest smith
  11180. if |tailor| in !rail
  11181. set !dest tailor
  11182. if |inn| in !rail
  11183. set !dest inn
  11184.  
  11185. ; strip header
  11186. str pos !rail | 2
  11187. set !pos #strres - 1
  11188. str del !rail 1 !pos
  11189. set !rail #strres
  11190.  
  11191. ; strip footer
  11192. str count !rail |
  11193. set !footerIndex #strres - 1
  11194. str pos !rail | !footerIndex
  11195. set !pos #strres + 1
  11196. str left !rail !pos
  11197. set !rail #strres
  11198.  
  11199. set !varname Rails_ , !dest , _count
  11200. set !count % . !varname
  11201. set !count !count + 1
  11202. set % . !varname !count
  11203.  
  11204. set !varname Rails_ , !dest , _ , !count
  11205. set % . !varname !rail
  11206. }
  11207. }
  11208. return
  11209.  
  11210. sub Std_CheckConnection
  11211. while #contsize = 203_121 ; connection lost
  11212. {
  11213. set !x #contposx + 100
  11214. set !y #contposy + 85
  11215. click !x !y
  11216. }
  11217. return #contname <> MainMenu_gump
  11218.  
  11219. ;=======================================
  11220. ; RILOGIN DRAEL
  11221. ;=======================================
  11222. ;---------------------------
  11223. Sub CheckForConnectionLost
  11224. If #ContSize = 203_121
  11225. GoSub RiloginDrael
  11226. ;{
  11227. ;set %clostx #contposx + 100
  11228. ;set %closty #contposy + 95
  11229. ;click %clostx %closty
  11230. ;GoSub RiloginDrael
  11231. ;}
  11232. return
  11233.  
  11234. ;----------------------------------------------------
  11235. Sub RiloginDrael
  11236. _mmloop:
  11237. gosub timecheck
  11238. if #contname = MainMenu_gump ; main login gump
  11239. {
  11240.  
  11241. KEY ENTER
  11242. wait 3s
  11243. ; gosub sendstring %mypass
  11244. ; gosub clickgreen
  11245. gosub waitgump notfor MainMenu_gump 640_480 10
  11246. gosub waitgump notfor waiting_gump 408_288 60 ; verifying can take a while
  11247. set %logincount %logincount + 1
  11248. ; menu set txtlogin %logincount
  11249. goto _mmloop
  11250. }
  11251. if #contname = normal_gump ; shard selection gump
  11252. {
  11253. if %shardid = #result
  11254. {
  11255. KEY ENTER
  11256. wait 3s; click topmost shard not sure why need g
  11257. gosub waitgump notfor normal_gump 640_480 10
  11258. goto _mmloop
  11259. }
  11260. }
  11261. if #contname = normal_gump ; char login gump
  11262. {
  11263. ;if * . %global_2 <> 0 ; override charnum with global setting
  11264. ; set %mycharnum * . %global_2
  11265. KEY ENTER
  11266. wait 5s
  11267. if #contname = normal_gump; no char?
  11268. gosub clickgreen
  11269. gosub clickgreen ; click here as well cos sometimes the gump is misnamed (existing char)
  11270. gosub waitgump notfor normal_gump 640_480 10
  11271. goto _mmloop
  11272. }
  11273. if #contname = waiting_gump
  11274. {
  11275. if #contsize = 203_121 ; disconnection
  11276. {
  11277. set %x #contposx + 100
  11278. set %y #contposy + 90 ; 95
  11279. click %x %y
  11280. }
  11281. if #contsize = 408_288 ; no connection avail, or timeout
  11282. {
  11283. set %x #contposx + 206
  11284. set %y #contposy + 256
  11285. click %x %y ; try again
  11286. }
  11287. goto _mmloop
  11288. }
  11289. return
  11290. sub clickgreen
  11291. set %x #contposx + 618
  11292. set %y #contposy + 444
  11293. click %x %y ; the green arrow
  11294. wait 5
  11295. return
  11296.  
  11297. ;-------------------------------------------
  11298. sub clickred
  11299. set %x1 #contposx + 595
  11300. set %y1 #contposy + 444
  11301. click %x1 %y1 ; the red arrow
  11302. wait 5
  11303. return
  11304. ;-------------------------------------------
  11305. sub sendstring
  11306. Wait 300s ;<-- tanto per essere sicuri aspetta 900 secondi (15 minuti)
  11307. GoSub account . !account
  11308. WaitForGump1:
  11309. If #ContName = waiting_gump
  11310. {
  11311. ;msg ;<-- NickName dell'account
  11312. ;wait 10
  11313. click 530 400
  11314. call C:\password.txt ;<-- Password dell'account
  11315. msg %password
  11316. ;wait 20
  11317. msg $
  11318. return
  11319. ;-------------------------------------------------
  11320. sub waitgump
  11321. ;%1 = for or notfor %2 = kind of gump %3 = size %4= timeout
  11322. set %timout #scnt + %4
  11323. _wfgloop:
  11324. if #scnt > %timout
  11325. return
  11326. wait 10
  11327. if %1 = for && ( #contname <> %2 || #contsize <> %3 )
  11328. goto _wfgloop
  11329. if %1 = notfor && #contname = %2 && #contsize = %3
  11330. goto _wfgloop
  11331. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement