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
}
///
/// A class containing actor stats
///
public class ActorStats {
///
/// The actors health
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Health { get; set; }
///
/// The actors anger
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Anger { get; set; }
///
/// The actors fear
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Fear { get; set; }
///
/// The actors fullness
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Fullness { get; set; }
///
/// The actors hydration
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Hydration { get; set; }
///
/// The actors energy
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Energy { get; set; }
///
/// The actors affection
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double Affection { get; set; }
}
///
/// The actors unique id
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int UniqueId { get; set; }
///
/// The actor type.
/// For example: 9 is Kelvin, 10 is Virginia, 11 is the big mouth mutant
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int TypeId { get; set; }
///
/// The actors family.
/// 0 is neutral
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int FamilyId { get; set; }
///
/// The actors position
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public Position Position { get; set; }
///
/// The actors rotation
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public Rotation Rotation { get; set; }
///
/// The spawner ID
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int SpawnerId { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int ActorSeed { get; set; }
///
/// The looking variation the actor has got
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int VariationId { get; set; }
///
/// The actors state
///
[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);
}
}
///
/// The equipment, the actor has got (shotgun, GPS, pistol, ...)
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public List EquippedItems { get; set; } // TODO
///
/// The outfit this character is wearing
///
[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; }
///
/// The actor stats list
///
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public ActorStats Stats { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int StateFlags { get; set; }
///
/// Revives the actor
///
public void Revive() {
if(this.State==6) {
this.State = 2;
this.Stats.Health = 1;
}
}
///
/// Returns the Display Name for this actor
///
/// String with the Display Name. If the Actor Type wasn't found, it returns 'ACTOR_id'
public string GetDisplayName() {
return GetDisplayNameById(this.TypeId);
}
///
/// 0 = Diverse, 1 = Male, 2 = Female
///
[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;
}
///
/// 0 = Diverse, 1 = Male, 2 = Female
///
/// The Actors TypeID
/// 0 = Diverse, 1 = Male, 2 = Female
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();
}
}
}