DayZ 1.29
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;
212 g_Game.GetMenuDefaultCharacterData().SetCharacterType(m_CharacterType);
213 if (randomize_equip)
214 g_Game.GetMenuDefaultCharacterData().GenerateRandomEquip();
215
217 }
218
220 {
222 //m_CharacterDta.RequestGetDefaultCharacterData();
223 m_CharacterType = g_Game.GetMenuDefaultCharacterData().GetCharacterType();
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);
240 g_Game.GetMenuDefaultCharacterData().SetCharacterName(GameConstants.DEFAULT_CHARACTER_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);
272 g_Game.GetMenuDefaultCharacterData().EquipDefaultCharacter(m_CharacterObj);
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 string characterName = g_Game.GetPlayerGameName();
309 m_CharacterDta.GetCharacterName(m_CharacterId, characterName);
310 g_Game.SetPlayerGameName(characterName);
311 }
312
313 // Load all avalible options for character creation; mostly legacy stuff
314 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " gender", m_CharGenderList);
315 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " top", m_CharShirtList);
316 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " bottom", m_CharPantsList);
317 g_Game.ConfigGetTextArray("cfgCharacterCreation" + " shoe", m_CharShoesList);
318
319 // Init character table
320 m_Characters.Clear();
321 m_Characters.Insert( ECharGender.Male, new array<string> );
322 m_Characters.Insert( ECharGender.Female, new array<string> );
323
324 // Sort character by Gender
325 TStringArray characters = g_Game.ListAvailableCharacters();
326 for (int i = 0; i < characters.Count(); i++)
327 {
328 string char_cfg_name = characters.Get(i);
329 if ( g_Game.IsKindOf(char_cfg_name, "SurvivorMale_Base") )
330 {
331 m_Characters[ECharGender.Male].Insert( char_cfg_name );
332 }
333 else
334 {
335 m_Characters[ECharGender.Female].Insert( char_cfg_name );
336 }
337 }
338
339 CreateNewCharacterById(m_CharacterId/*, m_CharacterPos, m_CharacterRot*/);
340
341 if (GetCharacterObj() )
342 {
343 if ( GetCharacterObj().IsMale() )
345 else
347 }
348 }
349
350 //-------------------------
351 // CharacterUnload
352 //-------------------------
353 protected void CharacterUnload()
354 {
355 if ( m_CharacterObj )
356 {
357 g_Game.ObjectDelete(m_CharacterObj);
358 m_CharacterObj = NULL;
359 }
360 }
361
362 //-------------------------
363 // CharacterLoad
364 //-------------------------
365 protected void CharacterLoad( int character_id, vector char_pos, vector char_rot )
366 {
367 if ( character_id == -1 )
368 {
369 Error("IntroSceneCharacter->CharacterLoad: character_id = "+ character_id +" Cant Load Character!!!");
370 return;
371 }
372
374
375 SetCharacterID( character_id );
376
377 m_CharacterObj = PlayerBase.Cast( m_CharacterDta.CreateCharacterPerson( character_id ) );
378
379 if ( m_CharacterObj )
380 {
381
382 m_CharacterObj.PlaceOnSurface();
383 m_CharacterObj.SetPosition(char_pos);
384 m_CharacterObj.SetOrientation(char_rot);
385 }
386 }
387
388 //-------------------------
389 // SetupPlayerName
390 //-------------------------
391 protected void SetupPlayerName( bool new_name )
392 {
394
395#ifdef PLATFORM_CONSOLE
396 BiosUserManager user_manager = g_Game.GetUserManager();
397 if( user_manager )
398 {
399 BiosUser user = user_manager.GetSelectedUser();
400 if( user )
401 {
402 name = user.GetName();
403 }
404 }
405#else
406 if ( !new_name )
407 {
408 m_CharacterDta.GetCharacterName(m_CharacterId, name);
409 }
410#endif
411
412 g_Game.SetPlayerGameName(name);
413 }
414
415 //==============================================
416 // SetAttachment
417 //==============================================
418 void SetAttachment(string type, int slot)
419 {
420 if ( !m_CharacterObj )
421 {
422 return;
423 }
424
425 g_Game.ObjectDelete(m_CharacterObj.GetInventory().FindAttachment(slot));
426
427 EntityAI entity = EntityAI.Cast( g_Game.CreateObjectEx(type, m_CharacterObj.GetPosition(), ECE_PLACE_ON_SURFACE) );
428
429 if (entity)
430 {
431 m_CharacterObj.LocalTakeEntityAsAttachmentEx(entity, slot);
432 }
433 }
434
435 string GetCharacterNameById(int char_id )
436 {
437 string character_name;
439 {
440 character_name = g_Game.GetMenuDefaultCharacterData().GetCharacterName();
441 }
442 else
443 {
444 m_CharacterDta.GetCharacterName(char_id, character_name);
445 }
446 return character_name;
447 }
448
450 {
451 string character_name;
452 if (IsDefaultCharacter())
453 {
454 character_name = g_Game.GetMenuDefaultCharacterData().GetCharacterName();
455 }
456 else
457 {
458 m_CharacterDta.GetCharacterName(m_CharacterId, character_name);
459 }
460 return character_name;
461 }
462
463 //==============================================
464 // SaveCharName
465 //==============================================
466 void SaveCharName( string name )
467 {
468 if (IsDefaultCharacter())
469 {
470 g_Game.GetMenuDefaultCharacterData().SetCharacterName(name);
471 }
472 else
473 {
474 m_CharacterDta.SetCharacterName(m_CharacterId, name);
475 }
476 m_CharacterDta.SaveCharactersLocal();
477 }
478
479 //==============================================
480 // SaveDefaultCharacter
481 //==============================================
483 {
484 //if (m_CharacterObj)
485 {
486 m_CharacterDta.RequestSetDefaultCharacterData();
487 }
488 }
489}
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3942
ECharGender
Определения ECharGender.c:2
proto native owned string GetName()
Определения BiosUserManager.c:9
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
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:418
string m_CharacterType
Определения IntroSceneCharacter.c:4
string GetCharacterName()
Определения IntroSceneCharacter.c:449
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:353
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:365
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:466
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:391
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:482
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:435
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:917
Определения PlayerBaseClient.c:2
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения CachedEquipmentStorage.c:4
Определения EnConvert.c:119
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
const int DEFAULT_CHARACTER_MENU_ID
Определения 3_Game/DayZ/constants.c:987
const string DEFAULT_CHARACTER_NAME
Определения 3_Game/DayZ/constants.c:985
array< string > TStringArray
Определения EnScript.c:712
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].