Advertisement
Nighticus

Untitled

Nov 21st, 2021
1,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.60 KB | None | 0 0
  1.         private void SetScenarioData(string Header, string Address, string Data)
  2.         {
  3.             Player MainCharacter = new Player(RWMain);
  4.             string ParsedData = Data;
  5.             if (Data.StartsWith("Random"))
  6.             {
  7.                 int Min = int.Parse(Data.Split('(')[1].Split(',')[0]);
  8.                 int Max = int.Parse(Data.Split('(')[1].Split(',')[1].Split(')')[0]);
  9.                 ParsedData = new Random().Next(Min, Max).ToString();
  10.             }
  11.  
  12.             switch (Header)
  13.             {
  14.                 case "Attributes":
  15.                     if (!string.IsNullOrEmpty(Address))
  16.                         MainCharacter.Attributes[Address].Level = byte.Parse(ParsedData);
  17.                     break;
  18.                 case "Skills":
  19.                     if (!string.IsNullOrEmpty(Address))
  20.                         MainCharacter.Skills[Address].Level = byte.Parse(ParsedData);
  21.                     break;
  22.                 case "Injuries":
  23.                     if (!string.IsNullOrEmpty(Address)) // Injury(Location, Type, Severity, Damage, IsBleeding)
  24.                         for (int i = 0; i < 20; i ++)
  25.                         {
  26.                             if (BitConverter.ToInt64(MainCharacter.Injuries[i].Buffer, 0) == 0)
  27.                             {
  28.                                 String[] InjuryData = Address.Split('(')[1].Split(')')[0].Split(',');
  29.                                 MainCharacter.Injuries[i].Location = (byte)Array.IndexOf(Injury.InjuryLocationNames, InjuryData[0]);
  30.                                 MainCharacter.Injuries[i].Type = (byte)Array.IndexOf(Injury.InjuryTypeNames.ToArray(), InjuryData[1]);
  31.                                 MainCharacter.Injuries[i].Severity = (byte)Array.IndexOf(Injury.InjurySeverityNames.ToArray(), InjuryData[2]);
  32.                                 MainCharacter.Injuries[i].Damage = byte.Parse(InjuryData[3]);
  33.                                 MainCharacter.Injuries[i].State = (byte)Array.IndexOf(Injury.InjuryStateNames, InjuryData[4]);
  34.                             }
  35.                         }
  36.                     break;
  37.                 default:
  38.                     break;
  39.             }
  40.  
  41.             switch (Address)
  42.             {
  43.                 case "Name":
  44.                     MainCharacter.Name = Data;
  45.                     break;
  46.                 case "TribeName":
  47.                     MainCharacter.TribeName = Data;
  48.                     break;
  49.                 case "Height":
  50.                     MainCharacter.Height = int.Parse(Data);
  51.                     break;
  52.                 case "Weight":
  53.                     MainCharacter.Weight = int.Parse(Data);
  54.                     break;
  55.  
  56.                 #region Stats
  57.                 case "Temperature":
  58.                     MainCharacter.Temperature = float.Parse(Data);
  59.                     break;
  60.                 case "Hunger":
  61.                     MainCharacter.Hunger = int.Parse(Data);
  62.                     break;
  63.                 case "Starvation":
  64.                     MainCharacter.Starvation = byte.Parse(Data);
  65.                     break;
  66.                 case "Nutrition":
  67.                     MainCharacter.Nutrition = int.Parse(Data);
  68.                     break;
  69.                 case "Thirst":
  70.                     MainCharacter.Thirst = int.Parse(Data);
  71.                     break;
  72.                 case "Energy":
  73.                     MainCharacter.Hunger = int.Parse(Data);
  74.                     break;
  75.                 case "Fatigue":
  76.                     MainCharacter.Fatigue = float.Parse(Data);
  77.                     break;
  78.                     #endregion
  79.             }
  80.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement