DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
IntroSceneCharacter.c
См. документацию.
1class IntroSceneCharacter extends Managed
2{
3 protected int m_CharacterId;
4 protected string m_CharacterType;
9
11 protected ref TStringArray m_CharShirtList = new TStringArray; //legacy
12 protected ref TStringArray m_CharPantsList = new TStringArray; //legacy
13 protected ref TStringArray m_CharShoesList = new TStringArray; //legacy
14
16
18
23
25 {
27 }
28
33
38 //==============================================
39 // SetcharacterID
40 //==============================================
41 void SetCharacterID(int char_id)
42 {
43 m_CharacterId = char_id;
44 }
45
46 //==============================================
47 // GetCharacterID
48 //==============================================
50 {
51 return m_CharacterId;
52 }
53
54 //==============================================
55 // GetCharacterObj
56 //==============================================
61
62 //==============================================
63 // GetCharGenderList
64 //==============================================
69
70 //==============================================
71 // GetCharGenderList
72 //==============================================
74 {
75 return m_Characters[gender];
76 }
77
78 //==============================================
79 // GetCharShirtsList
80 //==============================================
85
86 //==============================================
87 // GetCharPantsList
88 //==============================================
93
94 //==============================================
95 // GetCharShoesList
96 //==============================================
101
102 //==============================================
103 // SetCharacterGender
104 //==============================================
106 {
107 m_CharGender = gender;
108 }
109
110 //==============================================
111 // IsCharacterFemale
112 //==============================================
114 {
115 return ( m_CharGender == ECharGender.Female );
116 }
117
118 //==============================================
119 // SetCharacterGender
120 //==============================================
122 {
123 return m_CharGender;
124 }
125
126 //==============================================
127 // GetPosition
128 //==============================================
130 {
131 return m_CharacterObj.GetPosition();
132 }
133
134 //==============================================
135 // GetNextCharacterID
136 //==============================================
138 {
139 int count = m_CharacterDta.GetCharactersCount();
140
141 if ( count == 0 )
142 {
143 return -1;
144 }
145
146 if ( m_CharacterId + 1 < count )
147 {
148 return m_CharacterId + 1;
149 }
150 else
151 {
152 return -1;
153 }
154 }
155
156 //==============================================
157 // GetPrevCharacterID
158 //==============================================
160 {
161 int count = m_CharacterDta.GetCharactersCount();
162
163 if ( count == 0 )
164 {
165 return -1;
166 }
167
168 if ( m_CharacterId > -1 )
169 {
170 return m_CharacterId - 1;
171 }
172
173 return count - 1;
174 }
175
176 //==============================================
177 // CreateNewCharacterRandom
178 //==============================================
180 {
181 // Select random gender
183
184 // Select random character skin (class name)
185 string char_name_random = m_Characters[GetCharacterGender()].GetRandomElement();
186
187 // Create new character
188 CreateNewCharacterByName( char_name_random );
189 }
190
191 //==============================================
192 // CreateNewCharacterById
193 //==============================================
194 void CreateNewCharacterById( int character_id )
195 {
196 if ( character_id == GameConstants.DEFAULT_CHARACTER_MENU_ID )
197 {
199 }
200 else
201 {
203 }
204 }
205
206 //==============================================
207 // CreateNewCharacterByName
208 //==============================================
209 void CreateNewCharacterByName( string character_name, bool randomize_equip = true )
210 {
211 m_CharacterType = character_name;
213 if (randomize_equip)
215
217 }
218
220 {
222 //m_CharacterDta.RequestGetDefaultCharacterData();
224 if (m_CharacterType != "")
225 {
227 }
228
230 {
231 m_CharacterObj.PlaceOnSurface();
232 m_CharacterObj.SetPosition(m_CharacterPos);
233 m_CharacterObj.SetOrientation(m_CharacterRot);
234 }
235 else
236 {
237 string default_name = Widget.TranslateString( GameConstants.DEFAULT_CHARACTER_NAME );
239 //m_CharacterDta.SetCharacterName(GameConstants.DEFAULT_CHARACTER_MENU_ID, default_name);
241 }
242 }
243
244 void GetLastPlayedServer(int characterID, out string address, out string name, out int port)
245 {
246 m_CharacterDta.GetLastServerAddress(characterID,address);
247 port = m_CharacterDta.GetLastServerPort(characterID);
248 m_CharacterDta.GetLastServerName(characterID,name);
249 }
250
251 void GetLastPlayedServerEx(int characterID, out string address, out string name, out int port, out int steamQueryPort)
252 {
253 steamQueryPort = m_CharacterDta.GetLastSteamQueryPort(characterID);
254 GetLastPlayedServer(characterID, address, name, port);
255 }
256
257 //==============================================
258 // CreateNewCharacter
259 //==============================================
261 {
262 // Unload old character (if exist)
264
265 // Create Character
267
268 if (m_CharacterObj)
269 {
270 m_CharacterObj.PlaceOnSurface();
271 m_CharacterObj.SetOrientation(m_CharacterRot);
273 }
274
275 //Create New Random Character
276 SetupPlayerName( true );
277 }
278
280 /*void EquipNewCharacter()
281 {
282 int slot_ID;
283 string attachment_type;
284 for (int i = 0; i < DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Count(); i++)
285 {
286 slot_ID = DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Get(i);
287 if (DefaultCharacterCreationMethods.GetConfigArrayCountFromSlotID(slot_ID) > 0)
288 {
289 attachment_type = DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).GetRandomElement();
290 if (attachment_type != "")
291 SetAttachment(attachment_type,slot_ID);
292 }
293 }
294 }*/
295
296 //==============================================
297 // LoadCharacterData
298 //==============================================
299 void LoadCharacterData(vector char_pos, vector char_rot, bool default_char = false)
300 {
301 m_CharacterDta = g_Game.GetMenuData();
302 m_CharacterPos = char_pos;
303 m_CharacterRot = char_rot;
304
305 if (!default_char && m_CharacterDta.GetLastPlayedCharacter() > -1 )
306 {
307 m_CharacterId = m_CharacterDta.GetLastPlayedCharacter();
308 m_CharacterDta.GetCharacterName(m_CharacterId, g_Game.GetPlayerGameName());
309 }
310
311 // Load all avalible options for character creation; mostly legacy stuff
312 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " gender", m_CharGenderList);
313 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " top", m_CharShirtList);
314 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " bottom", m_CharPantsList);
315 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " shoe", m_CharShoesList);
316
317 // Init character table
318 m_Characters.Clear();
319 m_Characters.Insert( ECharGender.Male, new array<string> );
320 m_Characters.Insert( ECharGender.Female, new array<string> );
321
322 // Sort character by Gender
324 for (int i = 0; i < characters.Count(); i++)
325 {
326 string char_cfg_name = characters.Get(i);
327 if ( GetGame().IsKindOf(char_cfg_name, "SurvivorMale_Base") )
328 {
329 m_Characters[ECharGender.Male].Insert( char_cfg_name );
330 }
331 else
332 {
333 m_Characters[ECharGender.Female].Insert( char_cfg_name );
334 }
335 }
336
337 CreateNewCharacterById(m_CharacterId/*, m_CharacterPos, m_CharacterRot*/);
338
339 if (GetCharacterObj() )
340 {
341 if ( GetCharacterObj().IsMale() )
343 else
345 }
346 }
347
348 //-------------------------
349 // CharacterUnload
350 //-------------------------
351 protected void CharacterUnload()
352 {
353 if ( m_CharacterObj )
354 {
355 g_Game.ObjectDelete(m_CharacterObj);
356 m_CharacterObj = NULL;
357 }
358 }
359
360 //-------------------------
361 // CharacterLoad
362 //-------------------------
363 protected void CharacterLoad( int character_id, vector char_pos, vector char_rot )
364 {
365 if ( character_id == -1 )
366 {
367 Error("IntroSceneCharacter->CharacterLoad: character_id = "+ character_id +" Cant Load Character!!!");
368 return;
369 }
370
372
373 SetCharacterID( character_id );
374
375 m_CharacterObj = PlayerBase.Cast( m_CharacterDta.CreateCharacterPerson( character_id ) );
376
377 if ( m_CharacterObj )
378 {
379
380 m_CharacterObj.PlaceOnSurface();
381 m_CharacterObj.SetPosition(char_pos);
382 m_CharacterObj.SetOrientation(char_rot);
383 }
384 }
385
386 //-------------------------
387 // SetupPlayerName
388 //-------------------------
389 protected void SetupPlayerName( bool new_name )
390 {
392
393#ifdef PLATFORM_CONSOLE
394 BiosUserManager user_manager = GetGame().GetUserManager();
395 if( user_manager )
396 {
397 BiosUser user = user_manager.GetSelectedUser();
398 if( user )
399 {
400 name = user.GetName();
401 }
402 }
403#else
404 if ( !new_name )
405 {
406 m_CharacterDta.GetCharacterName(m_CharacterId, name);
407 }
408#endif
409
410 g_Game.SetPlayerGameName(name);
411 }
412
413 //==============================================
414 // SetAttachment
415 //==============================================
416 void SetAttachment(string type, int slot)
417 {
418 if ( !m_CharacterObj )
419 {
420 return;
421 }
422
423 g_Game.ObjectDelete(m_CharacterObj.GetInventory().FindAttachment(slot));
424
425 EntityAI entity = EntityAI.Cast( g_Game.CreateObjectEx(type, m_CharacterObj.GetPosition(), ECE_PLACE_ON_SURFACE) );
426
427 if (entity)
428 {
429 m_CharacterObj.LocalTakeEntityAsAttachmentEx(entity, slot);
430 }
431 }
432
433 string GetCharacterNameById(int char_id )
434 {
435 string character_name;
437 {
439 }
440 else
441 {
442 m_CharacterDta.GetCharacterName(char_id, character_name);
443 }
444 return character_name;
445 }
446
448 {
449 string character_name;
450 if (IsDefaultCharacter())
451 {
453 }
454 else
455 {
456 m_CharacterDta.GetCharacterName(m_CharacterId, character_name);
457 }
458 return character_name;
459 }
460
461 //==============================================
462 // SaveCharName
463 //==============================================
464 void SaveCharName( string name )
465 {
466 if (IsDefaultCharacter())
467 {
469 }
470 else
471 {
472 m_CharacterDta.SetCharacterName(m_CharacterId, name);
473 }
474 m_CharacterDta.SaveCharactersLocal();
475 }
476
477 //==============================================
478 // SaveDefaultCharacter
479 //==============================================
481 {
482 //if (m_CharacterObj)
483 {
484 m_CharacterDta.RequestSetDefaultCharacterData();
485 }
486 }
487}
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
map
Определения ControlsXboxNew.c:4
DayZGame g_Game
Определения DayZGame.c:3868
ECharGender
Определения ECharGender.c:2
proto native owned string GetName()
Определения BiosUserManager.c:9
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
override TStringArray ListAvailableCharacters()
Определения DayZGame.c:3390
proto native BiosUserManager GetUserManager()
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Определения Game.c:1493
Определения Building.c:6
Определения constants.c:659
PlayerBase GetCharacterObj()
Определения IntroSceneCharacter.c:57
int GetCharacterID()
Определения IntroSceneCharacter.c:49
ref TStringArray m_CharGenderList
Определения IntroSceneCharacter.c:10
void SetAttachment(string type, int slot)
Определения IntroSceneCharacter.c:416
string m_CharacterType
Определения IntroSceneCharacter.c:4
string GetCharacterName()
Определения IntroSceneCharacter.c:447
void CreateDefaultCharacter()
Определения IntroSceneCharacter.c:219
TStringArray GetCharShoesList()
Определения IntroSceneCharacter.c:97
vector GetPosition()
Определения IntroSceneCharacter.c:129
void CreateNewCharacter()
Определения IntroSceneCharacter.c:260
void SetCharacterGender(ECharGender gender)
Определения IntroSceneCharacter.c:105
void SetCharacterID(int char_id)
Определения IntroSceneCharacter.c:41
void CharacterUnload()
Определения IntroSceneCharacter.c:351
int GetPrevCharacterID()
Определения IntroSceneCharacter.c:159
void CreateNewCharacterById(int character_id)
Определения IntroSceneCharacter.c:194
int GetNextCharacterID()
Определения IntroSceneCharacter.c:137
void CharacterLoad(int character_id, vector char_pos, vector char_rot)
Определения IntroSceneCharacter.c:363
void GetLastPlayedServer(int characterID, out string address, out string name, out int port)
Определения IntroSceneCharacter.c:244
TStringArray GetCharShirtsList()
Определения IntroSceneCharacter.c:81
void CreateNewCharacterRandom()
Определения IntroSceneCharacter.c:179
void SaveCharName(string name)
Определения IntroSceneCharacter.c:464
void SetToDefaultCharacter()
Определения IntroSceneCharacter.c:34
ref TStringArray m_CharShirtList
Определения IntroSceneCharacter.c:11
int m_CharacterId
Определения IntroSceneCharacter.c:3
bool IsDefaultCharacter()
Определения IntroSceneCharacter.c:29
void SetupPlayerName(bool new_name)
Определения IntroSceneCharacter.c:389
ref TStringArray m_CharPantsList
Определения IntroSceneCharacter.c:12
vector m_CharacterPos
Определения IntroSceneCharacter.c:7
void GetLastPlayedServerEx(int characterID, out string address, out string name, out int port, out int steamQueryPort)
Определения IntroSceneCharacter.c:251
PlayerBase m_CharacterObj
Определения IntroSceneCharacter.c:6
ref map< ECharGender, ref array< string > > m_Characters
Определения IntroSceneCharacter.c:15
MenuData m_CharacterDta
Определения IntroSceneCharacter.c:5
void SaveDefaultCharacter()
Определения IntroSceneCharacter.c:480
void CreateNewCharacterByName(string character_name, bool randomize_equip=true)
Определения IntroSceneCharacter.c:209
TStringArray GetCharGenderList()
Определения IntroSceneCharacter.c:65
TStringArray GetCharPantsList()
Определения IntroSceneCharacter.c:89
TStringArray GetCharList(ECharGender gender)
Определения IntroSceneCharacter.c:73
void IntroSceneCharacter()
Определения IntroSceneCharacter.c:19
vector m_CharacterRot
Определения IntroSceneCharacter.c:8
ref TStringArray m_CharShoesList
Определения IntroSceneCharacter.c:13
string GetCharacterNameById(int char_id)
Определения IntroSceneCharacter.c:433
void LoadCharacterData(vector char_pos, vector char_rot, bool default_char=false)
Generates random equip for the new IntroSceneCharacter, whatever is defined in 'cfgCharacterCreation'...
Определения IntroSceneCharacter.c:299
bool IsCharacterFemale()
Определения IntroSceneCharacter.c:113
ECharGender GetCharacterGender()
Определения IntroSceneCharacter.c:121
ECharGender m_CharGender
Определения IntroSceneCharacter.c:17
void ~IntroSceneCharacter()
Определения IntroSceneCharacter.c:24
TODO doc.
Определения EnScript.c:118
Определения EnMath.c:7
Определения gameplay.c:918
void SetCharacterType(string character_type)
Определения gameplay.c:1105
string GetCharacterName()
Определения gameplay.c:1100
string GetCharacterType()
Определения gameplay.c:1110
void SetCharacterName(string name)
Определения gameplay.c:1095
void GenerateRandomEquip()
Определения gameplay.c:1017
void EquipDefaultCharacter(Man player)
Определения gameplay.c:1035
Определения PlayerBaseClient.c:2
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
const int DEFAULT_CHARACTER_MENU_ID
Определения constants.c:982
const string DEFAULT_CHARACTER_NAME
Определения constants.c:980
array< string > TStringArray
Определения EnScript.c:685
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].