/// <summary> /// Construct an NPC /// </summary> /// <param name="mapRef">Which map are they on?</param> /// <param name="sched">daily schedule</param> /// <param name="npcType">type of NPC they are</param> /// <param name="dialogNumber">dialog number referencing data OVL</param> /// <param name="dialogIndex">0-31 index of it's position in the NPC arrays (used for saved.gam references)</param> /// <param name="talkScript">their conversation script</param> public NonPlayerCharacterReference(SmallMapReferences.SingleMapReference.Location location, GameState gameStateRef, NPC_Schedule sched, byte npcType, byte dialogNumber, int dialogIndex, TalkScript talkScript, int nKeySprite) { Schedule = new NonPlayerCharacterSchedule(sched); MapLocation = location; NPCKeySprite = nKeySprite; CharacterType = npcType; DialogNumber = dialogNumber; Script = talkScript; DialogIndex = dialogIndex; this.gameStateRef = gameStateRef; // no schedule? I guess you're not real if (!IsEmptySched(sched)) { System.Console.WriteLine(location.ToString() + " NPC Number: " + this.DialogNumber + " in " + location.ToString()); } }
public string GetLocationName(SmallMapReferences.SingleMapReference.Location location) { Func <DataOvlReference.LOCATION_STRINGS, string> getLocationNameStr = delegate(DataOvlReference.LOCATION_STRINGS index) { return(dataRef.GetStringFromDataChunkList(DataOvlReference.DataChunkName.LOCATION_NAMES, (int)index)); }; // filthy way to convert our more commonly used Location enum to the less used LOCATION_STRINGS // they didn't even bother having them all match, and then decided to leave some out DataOvlReference.LOCATION_STRINGS newLocStrEnum = (DataOvlReference.LOCATION_STRINGS)Enum.Parse(typeof(DataOvlReference.LOCATION_STRINGS), location.ToString()); // if the DataOVL didn't provide a name, then we are forced to set our own... :( if ((int)newLocStrEnum < 0) { switch (newLocStrEnum) { case DataOvlReference.LOCATION_STRINGS.Suteks_Hut: return("SUTEK'S HUT"); case DataOvlReference.LOCATION_STRINGS.SinVraals_Hut: return("SIN VRAAL'S HUT"); case DataOvlReference.LOCATION_STRINGS.Grendels_Hut: return("GRENDAL'S HUT"); case DataOvlReference.LOCATION_STRINGS.Lord_Britishs_Castle: return("LORD BRITISH'S CASTLE"); case DataOvlReference.LOCATION_STRINGS.Palace_of_Blackthorn: return("PALACE OF BLACKTHORN"); default: throw new Exception("Ummm asked for a location name and wasn't on the guest list."); } } else { return(getLocationNameStr(newLocStrEnum)); } }