| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- using System;
- using System.Collections.Generic;
- using System.Text.Json.Serialization;
- namespace SOTF_Struct.Generic {
- public class Actor {
- public const int MAX_TYPEID = 60;
- public enum eActorType {
- Unknown,
- Animal,
- NPC,
- Cannibal,
- Creep,
- Daemon
- }
- /// <summary>
- /// A class containing actor stats
- /// </summary>
- public class ActorStats {
- /// <summary>
- /// The actors health
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Health { get; set; }
- /// <summary>
- /// The actors anger
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Anger { get; set; }
- /// <summary>
- /// The actors fear
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Fear { get; set; }
- /// <summary>
- /// The actors fullness
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Fullness { get; set; }
- /// <summary>
- /// The actors hydration
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Hydration { get; set; }
- /// <summary>
- /// The actors energy
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Energy { get; set; }
- /// <summary>
- /// The actors affection
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double Affection { get; set; }
- }
- /// <summary>
- /// The actors unique id
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int UniqueId { get; set; }
- /// <summary>
- /// The actor type.
- /// For example: 9 is Kelvin, 10 is Virginia, 11 is the big mouth mutant
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int TypeId { get; set; }
- /// <summary>
- /// The actors family.
- /// 0 is neutral
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int FamilyId { get; set; }
- /// <summary>
- /// The actors position
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public Position Position { get; set; }
- /// <summary>
- /// The actors rotation
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public Rotation Rotation { get; set; }
- /// <summary>
- /// The spawner ID
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int SpawnerId { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int ActorSeed { get; set; }
- /// <summary>
- /// The looking variation the actor has got
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int VariationId { get; set; }
- /// <summary>
- /// The actors state
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int State { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int GraphMask { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.Always)]
- public int AreaMask {
- get {
- return SOTF_Savegame_Editor.SOTFSave.SOTF.MapGraphMaskToAreaMask(this.GraphMask);
- }
- set {
- this.GraphMask = SOTF_Savegame_Editor.SOTFSave.SOTF.MapAreaMaskToGraphMask(this.GraphMask);
- }
- }
- /// <summary>
- /// The equipment, the actor has got (shotgun, GPS, pistol, ...)
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public List<int> EquippedItems { get; set; } // TODO
- /// <summary>
- /// The outfit this character is wearing
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int OutfitId { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double NextGiftTime { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public double LastVisitTime { get; set; }
- /// <summary>
- /// The actor stats list
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public ActorStats Stats { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
- public int StateFlags { get; set; }
- /// <summary>
- /// Revives the actor
- /// </summary>
- public void Revive() {
- if(this.State==6) {
- this.State = 2;
- this.Stats.Health = 1;
- }
- }
- /// <summary>
- /// Returns the Display Name for this actor
- /// </summary>
- /// <returns>String with the Display Name. If the Actor Type wasn't found, it returns 'ACTOR_id'</returns>
- public string GetDisplayName() {
- return GetDisplayNameById(this.TypeId);
- }
- /// <summary>
- /// 0 = Diverse, 1 = Male, 2 = Female
- /// </summary>
- [JsonIgnore(Condition = JsonIgnoreCondition.Always)]
- public int Gendre {
- get {
- return GetGendreById(this.TypeId);
- }
- }
- [JsonIgnore(Condition = JsonIgnoreCondition.Always)]
- public eActorType ActorType {
- get {
- eActorType res = GetActorTypeById(this.TypeId);
- System.Diagnostics.Debug.WriteLine("ActorType = " + res.ToString());
- return res;
- }
- }
- public static eActorType GetActorTypeById(int TypeId) {
- System.Diagnostics.Debug.WriteLine("GetActorTypeById(" + TypeId + ")");
- if(TypeId == 24 ||TypeId == 32 ||TypeId == 35 || TypeId == 43)
- return eActorType.Unknown;
- if (TypeId <= 7) return eActorType.Animal;
- else if (TypeId <= 10) return eActorType.NPC;
- else if (TypeId == 11) return eActorType.Creep;
- else if (TypeId <= 16) return eActorType.Cannibal;
- else if (TypeId == 17) return eActorType.Animal;
- else if (TypeId <= 22) return eActorType.Creep;
- else if (TypeId <= 22) return eActorType.Creep;
- else if (TypeId <= 31) return eActorType.Cannibal;
- else if (TypeId <= 37) return eActorType.Animal;
- else if (TypeId == 38) return eActorType.Creep;
- else if (TypeId == 39) return eActorType.NPC;
- else if (TypeId <= 41) return eActorType.Creep;
- else if (TypeId == 42) return eActorType.Daemon;
- else if (TypeId == 43) return eActorType.Cannibal;
- else if (TypeId == 45) return eActorType.Daemon;
- else if (TypeId <= 47) return eActorType.Creep;
- else
- return eActorType.Unknown;
- }
- /// <summary>
- /// 0 = Diverse, 1 = Male, 2 = Female
- /// </summary>
- /// <param name="TypeId">The Actors TypeID</param>
- /// <returns>0 = Diverse, 1 = Male, 2 = Female</returns>
- public static int GetGendreById(int TypeId) {
- switch(TypeId) {
- case 8:
- case 9:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 20:
- case 27:
- case 29:
- case 30:
- case 31:
- case 38:
- case 41:
- case 43:
- case 46:
- return 1;
- case 21:
- case 23:
- case 25:
- case 26:
- case 28:
- case 39:
- case 45:
- case 47:
- return 2;
- }
- return 0;
- }
- public static string GetDisplayNameById(int TypeId) {
- if (TypeId == 0) return "ACTOR_0";
- else if (TypeId == 1) return "Rabbit";
- else if (TypeId == 2) return "Squirrel";
- else if (TypeId == 3) return "Sea turtle";
- else if (TypeId == 4) return "Shark";
- else if (TypeId == 5) return "Seagull";
- else if (TypeId == 6) return "Eagle";
- else if (TypeId == 7) return "Duck";
- else if (TypeId == 8) return "Timmy";
- else if (TypeId == 9) return "Kelvin";
- else if (TypeId == 10) return "Virginia";
- else if (TypeId == 11) return "Fingers";
- else if (TypeId == 12) return "Cannibal Carl";
- else if (TypeId == 13) return "Cannibal Andy";
- else if (TypeId == 14) return "Cannibal Danny";
- else if (TypeId == 15) return "Cannibal Billy";
- else if (TypeId == 16) return "Gold Mask";
- else if (TypeId == 17) return "Moose";
- else if (TypeId == 18) return "Baby";
- else if (TypeId == 19) return "Twins";
- else if (TypeId == 20) return "Mutant (Puffy Male)";
- else if (TypeId == 21) return "Mutant (Puffy Female)";
- else if (TypeId == 22) return "Sluggy";
- else if (TypeId == 23) return "Cannibal Angel"; // F
- //else if (TypeId == 24) return "";
- else if (TypeId == 25) return "Cannibal Brandy"; // F
- else if (TypeId == 26) return "CannibalCrystal"; // F
- else if (TypeId == 27) return "Cannibal Destiny"; // F
- else if (TypeId == 28) return "Muddy Female Cannibal"; // F
- else if (TypeId == 29) return "Muddy Male Cannibal";
- else if (TypeId == 30) return "Heavy Male Cannibal";
- else if (TypeId == 31) return "Red masked Cannibal"; // Sponge Test
- else if (TypeId == 32) return "Bat";
- else if (TypeId == 33) return "Deer";
- else if (TypeId == 34) return "Bluebird";
- //else if (TypeId == 35) return "";
- else if (TypeId == 36) return "Killer Whale";
- else if (TypeId == 37) return "Land turtle";
- else if (TypeId == 38) return "Fat Male Cannibal";
- else if (TypeId == 39) return "Fat Female Cannibal";
- else if (TypeId == 40) return "John / Cat Dog";
- else if (TypeId == 41) return "Faceless Male";
- else if (TypeId == 42) return "Deamon";
- else if (TypeId == 43) return "Painted Cannibal Male";
- //else if (TypeId == 44) return "";
- else if (TypeId == 45) return "Daemon Queen";
- else if (TypeId == 46) return "Mr. Pufton (Boss)";
- else if (TypeId == 47) return "Ms. Pufton (Boss)";
- else
- return "ACTOR_" + TypeId.ToString();
- }
- }
- }
|