2 id
= "ui:interface:webig_ryzhome_toolbar",
3 saveuri
= "https://app.ryzom.com/app_ryzhome/index.php?action=toolbar_save",
7 function RyzhomeBar
:close()
8 getUI("ui:interface:webig_ryzhome_toolbar").active
=false
13 function RyzhomeBar
:addItems()
14 local url
= "https://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_LuaListItems&command=add"
15 getUI("ui:interface:web_transactions:content:html"):browse(url
)
18 function RyzhomeBar
:moveItems()
19 local url
= "https://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_LuaListItems&command=move"
20 getUI("ui:interface:web_transactions:content:html"):browse(url
)
23 function RyzhomeBar
:removeItems()
24 local url
= "https://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_LuaListItems&command=remove"
25 getUI("ui:interface:web_transactions:content:html"):browse(url
)
28 function RyzhomeBar
:inviteFriend()
29 local url
= "https://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_InviteFriend"
30 getUI("ui:interface:web_transactions:content:html"):browse(url
)
33 function RyzhomeBar
:listFriends()
34 getUI("ui:interface:web_transactions:content:html"):browse(RyzhomeBar
.listFriendsUrl
)
35 getUI("ui:interface:web_transactions:header_opened:browse_undo").active
=false
36 getUI("ui:interface:web_transactions:header_opened:browse_redo").active
=false
37 getUI("ui:interface:web_transactions:header_opened:browse_refresh").active
=false
38 getUI("ui:interface:web_transactions:header_opened:browse_home").active
=false
39 local wt
= getUI("ui:interface:web_transactions")
47 local framewin
= getUI("ui:interface:webig_ryzhome_list_item")
48 if framewin
~= nil then
54 getUI("ui:interface:web_transactions").active
=true
56 setOnDraw(getUI("ui:interface:web_transactions"), "RyzhomeBar:autocloseWebTransactions()")
59 function RyzhomeBar
:autocloseWebTransactions()
60 local current_url
= getUI("ui:interface:web_transactions:content:html").url
61 if (current_url
~= RyzhomeBar
.listFriendsUrl
and current_url
~= inviteFriendsUrl
) then
62 local framewin
= getUI("ui:interface:webig_ryzhome_list_item")
63 framewin
.x
= getUI("ui:interface:web_transactions").x
64 framewin
.y
= getUI("ui:interface:web_transactions").y
65 getUI("ui:interface:web_transactions").active
=false
66 setOnDraw(getUI("ui:interface:web_transactions"), "")
71 function RyzhomeBar
:serialize()
72 local ui
= getUI(self
.id
)
73 local url
= "&posx=" .. tostring(ui
.x
) .. "&posy=" .. tostring(ui
.y
)
77 function RyzhomeBar
:updateNbrItems(offset
)
78 RyzhomeBar
.nbrItems
= RyzhomeBar
.nbrItems
+ offset
79 if RyzhomeBar
.nbrItems
== 0 then
80 getUI("ui:interface:webig_ryzhome_toolbar:content:new_items_quantity").hardtext
=""
82 getUI("ui:interface:webig_ryzhome_toolbar:content:new_items_quantity").hardtext
=tostring(RyzhomeBar
.nbrItems
)
86 function RyzhomeBar
:saveConfig()
87 local url
= self
.saveuri
.. self
:serialize()
88 getUI("ui:interface:web_transactions:content:html"):browse(url
)
91 function RyzhomeBar
:movePage(offset
)
92 RyzhomeBar
.selectedPage
= RyzhomeBar
.selectedPage
+ offset
93 if RyzhomeBar
.selectedPage
<= 0 then
94 RyzhomeBar
.selectedPage
= 1
95 elseif RyzhomeBar
.selectedPage
> RyzhomeBar
.nbrPages
then
96 RyzhomeBar
.selectedPage
= RyzhomeBar
.nbrPages
98 getUI("ui:interface:webig_ryzhome_list_item:header_opened:page").hardtext
=tostring(RyzhomeBar
.selectedPage
).." / "..tostring(RyzhomeBar
.nbrPages
)
99 RyzhomeBar
:setupItems()
102 function RyzhomeBar
:listItems()
103 RyzhomeBar
.recently_removed_item
= false
105 local framewin
= getUI("ui:interface:webig_ryzhome_list_item")
106 --framewin.opened=true
108 if framewin
.x
== 0 and framewin
.y
== 0 then
109 local ui
= getUI("ui:interface")
110 framewin
.x
= (ui
.w
- framewin
.w
) / 2
111 framewin
.y
= (ui
.h
+ framewin
.h
) / 2
114 if RyzhomeBar
.Items
== nil then
115 RyzhomeBar
.Items
= {}
119 function RyzhomeBar
:useItem(id
)
120 id
= tostring(RyzhomeBar
.Items
[RyzhomeBar
.selectedPage
][id
][1])
121 if RyzhomeBar
.itemCommand
== "add" then
122 RyzhomeBar
:addItem(id
)
123 elseif RyzhomeBar
.itemCommand
== "remove" then
124 RyzhomeBar
:removeItem(id
)
125 elseif RyzhomeBar
.itemCommand
== "move" then
126 RyzhomeBar
:moveItem(id
)
130 function RyzhomeBar
:addItem(id
)
131 local url
= "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_Place&command=add&id="..id
132 getUI("ui:interface:web_transactions:content:html"):browse(url
)
135 function RyzhomeBar
:removeItem(id
)
136 RyzhomeBar
.recently_removed_item
= true
137 RyzhomeBar
:spawnItems()
138 local v
= RyzhomeBar
.spawnedItems
[id
]
139 runAH(nil,"add_shape", "shape=sp_mort.ps|x="..v
[2].."|y="..v
[3].."|z="..v
[4].."|angle="..v
[5].."|scale="..tostring(tonumber(v
[6])*4)..v
[7]..v
[8]..v
[9])
140 local url
= "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_Remove&id="..id
141 getUI("ui:interface:web_transactions:content:html"):browse(url
)
144 function RyzhomeBar
:moveItem(id
)
145 local url
= "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_Place&command=move&id="..id
146 getUI("ui:interface:web_transactions:content:html"):browse(url
)
149 function RyzhomeBar
:highlightItem(id
)
150 if RyzhomeBar
.itemCommand
== "add" then
153 if RyzhomeBar
.recently_removed_item
then
154 RyzhomeBar
.recently_removed_item
= false
156 RyzhomeBar
:spawnItems()
157 local v
= RyzhomeBar
.spawnedItems
[tostring(RyzhomeBar
.Items
[RyzhomeBar
.selectedPage
][id
][1])]
159 runAH(nil, "add_shape", "shape=ma_acc_ascenseur.ps|x="..v
[2].."|y="..v
[3].."|z="..v
[4].."|angle="..v
[5].."|scale="..tostring(tonumber(v
[6])*2)..v
[7]..v
[8]..v
[9])
164 function RyzhomeBar
:callFriendUrl(action
, target
)
165 local url
= "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_"..action
.."&target="..target
166 getUI("ui:interface:web_transactions:content:html"):browse(url
)
169 function RyzhomeBar
:spawnItems()
170 runAH(nil, "remove_shapes", "")
171 for k
,v
in pairs(RyzhomeBar
.spawnedItems
) do
172 runAH(nil, "add_shape", "shape="..v
[1].."|x="..v
[2].."|y="..v
[3].."|z="..v
[4].."|angle="..v
[5].."|scale="..v
[6]..v
[7]..v
[8]..v
[9])
177 function RyzhomeBar
:setupItems()
179 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":but"..tostring(k
)).active
=false
180 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":icon"..tostring(k
)).active
=false
181 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":text"..tostring(k
)).uc_hardtext
=""
182 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":info"..tostring(k
)).uc_hardtext
=""
184 for k
,v
in pairs(RyzhomeBar
.Items
[RyzhomeBar
.selectedPage
]) do
186 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":icon"..tostring(k
)).active
=true
187 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":but"..tostring(k
)).active
=true
188 local text
= ucstring()
190 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":text"..tostring(k
)).uc_hardtext
=text
192 getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":info"..tostring(k
)).uc_hardtext
=text
197 if RyzhomePlace
== nil then
203 function RyzhomePlace
:move(x
, y
, z
)
207 RyzhomePlace
:update()
210 function RyzhomePlace
:rot(a
)
212 RyzhomePlace
:update()
215 function RyzhomePlace
:reset()
216 --Ryzhome:addShapes()
217 pos_x
, pos_y
, pos_z
= getPlayerPos()
218 pos_a
= (3.14*getUI("ui:interface:compass:arrow3d:arrow").rotz
)/18
219 RyzhomePlace
:addShape()
220 RyzhomeBar
:spawnItems()
223 function RyzhomePlace
:update()
224 RyzhomePlace
:addShapes()
225 RyzhomePlace
:addShape()
226 RyzhomeBar
:spawnItems()
229 function RyzhomePlace
:apply()
230 getUI("ui:interface:web_transactions:content:html"):browse(RyzhomePlace
.saveuri
.."&pos_x="..pos_x
.."&pos_y="..pos_y
.."&pos_z="..pos_z
.."&pos_a="..pos_a
)
233 function RyzhomePlace
:close()
234 --runAH(nil, "remove_shapes", "")
235 getUI("ui:interface:webig_ryzhome_place_item").active
=false
239 RYZOM_RYZHOME_TOOLBAR_VERSION
= 324