1 // Property of Alientrap
4 // stepValue should contain the field name
5 void() Nex_Action_JoinGame_SortBy =
7 if( HostCache_SortField == self.stepValue )
8 sethostcachesort( self.stepValue, !HostCache_SortDescending );
10 sethostcachesort( self.stepValue, true );
11 HostCache_ResortViewSet();
14 void() Nex_Automation_CreateEntries =
16 local entity lTemplate;
19 lTemplate = Menu_GetItem( "Entry" );
20 for( lCounter = 0 ; lCounter < 64 ; ++lCounter ) {
23 lEntry = Menu_DeriveItem( lTemplate, strcat( "Entry", ftos( lCounter) ), self.parent, true );
24 lEntry.stepValue = lCounter;
26 Menu_LinkItem( self._parent );
29 void() Nex_Action_EntryConnect =
32 cmd( gethostcachestring( SLIST_FIELD_CNAME, self.stepValue ) );
38 void() Nex_Action_RefreshSlist =
40 HostCache_RefreshHostCache();
43 void() Nex_Action_JumpToJoinGame =
47 resethostcachemasks();
48 HostCache_RefreshHostCache();
50 lItem = Menu_GetItem( "Normal::Panel" );
51 String_EntitySet( lItem, link, "JoinGame" );
53 Raise_Update( lItem );
54 Menu_UpdateRunFlags();
55 Menu_JumpToWindow( lItem._link, false, false );
59 /* query string format:
61 1) Prefix "mask" Advanced query
62 Format: ( and|or TYPE OP MASK [...] )*
63 TYPE : one of the slist fields
65 <;<=;>=;==;!= normal arithmetic comparison operators (default <=) (= instead of == also supported)
66 $$ 'does contain' (default string op)
70 On every occurence of AND or OR a new mask of the spec type is created.
71 E.g. or name: "WWClan" ping: 200 and protocol == 3 maxplayers > 5
72 will create an or and an and mask
77 compatible (same net protocol version)
78 goodping (ping <= 150)
79 mediumping (ping <= 250)
81 #define GetNextToken if( ++lTokenNum > lTokenCount ) goto finish; else lToken = argv( lTokenNum )
82 void() Nex_Action_ExecuteQuery =
84 local float lAndPos, lOrPos;
85 local float lTokenNum, lTokenCount;
87 resethostcachemasks();
88 lAndPos = SLIST_MASK_AND;
89 lOrPos = SLIST_MASK_OR;
91 lTokenCount = tokenize( self._target.value );
93 for( lTokenNum = 0 ; lTokenNum < lTokenCount ; ++lTokenNum ) {
95 lToken = argv( lTokenNum );
97 if( lToken == "notempty" ) {
98 sethostcachemasknumber( lAndPos, SLIST_FIELD_NUMPLAYERS, 0, SLIST_TEST_NOTEQUAL );
100 } else if( lToken == "compatible" ) {
101 sethostcachemasknumber( lAndPos, SLIST_FIELD_PROTOCOL, NET_CURRENTPROTOCOL, SLIST_TEST_EQUAL );
103 } else if( lToken == "goodping" ) {
104 sethostcachemasknumber( lAndPos, SLIST_FIELD_PING, 150, SLIST_TEST_LESSEQUAL );
106 } else if( lToken == "mediumping" ) {
107 sethostcachemasknumber( lAndPos, SLIST_FIELD_PROTOCOL, 250, SLIST_TEST_LESSEQUAL );
109 } else if( lToken == "mask" ) {
110 // start the query loop
117 else if( lToken == "and" )
120 goto finish; // abort the parsing
121 // now parse all condition fields
124 local float lOperator;
125 local bool lIsStringArg;
128 // now get the field number
129 if( lToken == "cname" ) {
130 lField = SLIST_FIELD_CNAME;
133 else if( lToken == "ping" ) {
134 lField = SLIST_FIELD_PING;
135 lIsStringArg = false;
137 else if( lToken == "game" ) {
138 lField = SLIST_FIELD_GAME;
141 else if( lToken == "mod" ) {
142 lField = SLIST_FIELD_MOD;
145 else if( lToken == "map" ) {
146 lField = SLIST_FIELD_MAP;
149 else if( lToken == "name" ) {
150 lField = SLIST_FIELD_NAME;
153 else if( lToken == "maxplayers" ) {
154 lField = SLIST_FIELD_MAXPLAYERS;
155 lIsStringArg = false;
157 else if( lToken == "numplayers" ) {
158 lField = SLIST_FIELD_NUMPLAYERS;
159 lIsStringArg = false;
161 else if( lToken == "protocol" ) {
162 lField = SLIST_FIELD_PROTOCOL;
163 lIsStringArg = false;
166 { // increment the mask pos and let upper check for or or and
173 // now lets determine the comparison operator
176 lOperator = SLIST_TEST_CONTAINS;
177 else if( lToken == "!$" )
178 lOperator = SLIST_TEST_NOTCONTAIN;
179 else if( lToken == "<" )
180 lOperator = SLIST_TEST_LESS;
181 else if( lToken == "<=" )
182 lOperator = SLIST_TEST_LESSEQUAL;
183 else if( lToken == "==" || lToken == "=" )
184 lOperator = SLIST_TEST_EQUAL;
185 else if( lToken == ">" )
186 lOperator = SLIST_TEST_GREATER;
187 else if( lToken == ">=" )
188 lOperator = SLIST_TEST_GREATEREQUAL;
189 else if( lToken == "!=" )
190 lOperator = SLIST_TEST_NOTEQUAL;
191 else if( lToken == ":" )
193 lOperator = SLIST_TEST_CONTAINS;
195 lOperator = SLIST_TEST_LESSEQUAL;
197 goto finish; // abort the parsing
202 sethostcachemaskstring( lAndPos, lField, lToken, lOperator );
204 sethostcachemaskstring( lOrPos, lField, lToken, lOperator );
207 sethostcachemasknumber( lAndPos, lField, stof( lToken ), lOperator );
209 sethostcachemasknumber( lOrPos, lField, stof( lToken ), lOperator );
212 } else { // lets have a try it with or and string contain
213 sethostcachemaskstring( lOrPos, SLIST_FIELD_MAP, lToken, SLIST_TEST_CONTAINS );
215 sethostcachemaskstring( lOrPos, SLIST_FIELD_NAME, lToken, SLIST_TEST_CONTAINS );
217 //sethostcachemasknumber( lOrPos, SLIST_FIELD_MOD, lToken, SLIST_TEST_CONTAINS );
218 //lOrPos = lOrPos + 1;
222 HostCache_ResortViewSet();
223 #undef GetNextToken()