Update lua versions
[ryzomcore.git] / ryzom / client / data / gamedev / interfaces_v3 / player_trade.lua
blobf29f6ca55a3e3acf5a0d590a33711eebabb47bf2
1 -- In this file we define functions that serves for player windows
2 local base = "ui:interface:player_trade:header_opened";
3 local slots = 10; -- Change in local_database.xml, database.xml and NbExchangeSlots on server
5 ------------------------------------------------------------------------------------------------------------
6 -- create the game namespace without reseting if already created in an other file.
7 if (game==nil) then
8 game= {};
9 end
11 ------------------------------------------------------------------------------------------------------------
12 -- Update weight and bulk indicator in trade window for receive side
13 function game:updateReceiveBulkAndWeight()
14 getUI(base .. ":receive:bulk_txt").hardtext = tostring(getBulk("RECEIVE"));
15 getUI(base .. ":receive:weight_txt").hardtext = tostring(getWeight("RECEIVE"));
16 end
18 -- Update weight and bulk indicator in trade window for give side
19 function game:updateGiveBulkAndWeight()
20 getUI(base .. ":give:bulk_txt").hardtext = tostring(getBulk("GIVE"));
21 getUI(base .. ":give:weight_txt").hardtext = tostring(getWeight("GIVE"));
22 end
24 function getWeight(inventory)
25 local weight = runExpr("getItemsWeight('LOCAL:EXCHANGE:"..inventory.."', 0," .. slots .. ")");
26 return math.floor(weight * 100) / 100;
27 end
29 function getBulk(inventory)
30 local bulk = runExpr("getItemsBulk('LOCAL:EXCHANGE:"..inventory.."', 0," .. slots .. ")");
31 return math.floor(bulk * 100) / 100;
32 end
34 -- VERSION --
35 RYZOM_PLAYER_TRADE_VERSION = 10469