Add infos into target window
[ryzomcore.git] / ryzom / client / data / gamedev / interfaces_v3 / guild.lua
blobe37e5f1862d69630f9262a91eb607aebdba839d3
1 -- In this file we define functions that serves for guild windows (info, inv, forum ...)
3 -- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4 -- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
6 -- This file is not used !!! It can be plugged easily but to avoid test we do not plug it !
7 -- When plugged : do not forget to set dynamic_display_size="true" to guild_members container
9 -- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
10 -- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
13 ------------------------------------------------------------------------------------------------------------
14 -- create the game namespace without reseting if already created in an other file.
15 if (game==nil) then
16 game= {};
17 end
19 ------------------------------------------------------------------------------------------------------------
21 function game:guildIsPresent()
23 local name = getDbProp('SERVER:GUILD:NAME');
24 if (name == 0) then
25 return false;
26 else
27 return true;
28 end
29 end
31 ------------------------------------------------------------------------------------------------------------
32 -- called when something change (new player etc...)
33 function game:guildBuildInterface()
36 -- sort the members in Guild Manager
37 sortGuildMembers();
39 -- update interface with data of Guild Manager
41 -- freeze / unfreeze quit button
42 local uiQuitButton = getUI('ui:interface:guild:content:quit_guild');
43 uiQuitButton.frozen = isGuildQuitAvailable();
45 -- member count
46 local nbMember = getNbGuildMembers();
47 local uiTextCnt = getUI('ui:interface:guild:content:member_count');
48 uiTextCnt.hardtext = nbMember;
50 -- fill with guild icon : automatically done at draw time of the ctrl sheet
52 -- fill with guild members
53 local sMemberList = 'ui:interface:guild_members:content';
54 local uiMemberList = getUI(sMemberList);
55 uiMemberList:clear();
56 for i = 0,(nbMember-1) do
58 local sTemplateId = 'm' .. i;
59 local uiMember = createGroupInstance('member_template', sMemberList, { id = sTemplateId });
60 if (uiMember ~= nil) then
61 uiMember.name.hardtext = getGuildMemberName(i);
62 local memberGrade = getGuildMemberGrade(i);
63 if (memberGrade == 'Leader') then
64 uiMember.grade.uc_hardtext = i18n.get('uiGuildLeader');
65 elseif (memberGrade == 'HighOfficer') then
66 uiMember.grade.uc_hardtext = i18n.get('uiGuildHighOfficer');
67 elseif (memberGrade == 'Officer') then
68 uiMember.grade.uc_hardtext = i18n.get('uiGuildOfficer');
69 else
70 uiMember.grade.uc_hardtext = i18n.get('uiGuildMember');
71 end
72 uiMemberList:addChild(uiMember);
73 end
74 end
75 end
78 ------------------------------------------------------------------------------------------------------------
79 -- called when we open the guild main container
80 function game:guildActive()
82 setDbProp('UI:VARIABLES:ISACTIVE:GUILD', 1);
84 game:guildBuildInterface();
86 local ui = getUI('ui:interface:guild');
87 if (not game:guildIsPresent()) then
88 ui.active = false;
89 end
90 ui.w = 328;
91 end
93 ------------------------------------------------------------------------------------------------------------
94 --
95 function game:guildDeactive()
97 setDbProp('UI:VARIABLES:ISACTIVE:GUILD', 0);
98 end
100 -- VERSION --
101 RYZOM_GUILD_VERSION = 324