Ejemplo n.º 1
0
 public static void SetFavoredEnemyFeat(RacialType iRace, FeatType iFeat)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetFavoredEnemyFeat");
     Internal.NativeFunctions.nwnxPushInt(iFeat.InternalValue);
     Internal.NativeFunctions.nwnxPushInt(iRace.InternalValue);
     Internal.NativeFunctions.nwnxCallFunction();
 }
Ejemplo n.º 2
0
 // Gets the parent race for a race.
 public static int GetParentRace(RacialType race)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "GetParentRace");
     Internal.NativeFunctions.nwnxPushInt(race.InternalValue);
     Internal.NativeFunctions.nwnxCallFunction();
     return(Internal.NativeFunctions.nwnxPopInt());
 }
Ejemplo n.º 3
0
 // Sets the creature's racial type
 public static void SetRacialType(uint creature, RacialType racialtype)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetRacialType");
     Internal.NativeFunctions.nwnxPushInt((int)racialtype);
     Internal.NativeFunctions.nwnxPushObject(creature);
     Internal.NativeFunctions.nwnxCallFunction();
 }
Ejemplo n.º 4
0
 public PersonalInfo(string name, CreatureSize size, RacialType type, string typeTag, string alignment)
 {
     Name      = name;
     Size      = size;
     Type      = type;
     TypeTag   = typeTag;
     Alignment = alignment;
 }
Ejemplo n.º 5
0
 // Sets a racial modifier.
 public static void SetRacialModifier(RacialType race, RaceModifiers modifier, uint iParam1,
                                      uint iParam2 = 0xDEADBEEF, uint iParam3 = 0xDEADBEEF)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetRacialModifier");
     Internal.NativeFunctions.nwnxPushInt((int)iParam3);
     Internal.NativeFunctions.nwnxPushInt((int)iParam2);
     Internal.NativeFunctions.nwnxPushInt((int)iParam1);
     Internal.NativeFunctions.nwnxPushInt((int)modifier);
     Internal.NativeFunctions.nwnxPushInt((int)race);
     Internal.NativeFunctions.nwnxCallFunction();
 }
Ejemplo n.º 6
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            string     command   = args[0].ToLower();
            RacialType race      = (RacialType)user.RacialType;
            var        languages = LanguageService.Languages;

            if (command == "help")
            {
                List <string> commands = new List <string>
                {
                    "help: Displays this help text."
                };

                foreach (var language in languages)
                {
                    var chatText = language.ChatNames.ElementAt(0);
                    int count    = language.ChatNames.Count();

                    for (int x = 1; x < count; x++)
                    {
                        chatText += ", " + language.ChatNames.ElementAt(x);
                    }

                    commands.Add($"{chatText}: Sets the active language to {language.ProperName}.");
                }

                user.SendMessage(commands.Aggregate((a, b) => a + '\n' + b));
                return;
            }

            // Wookiees cannot speak any language besides Shyriiwook.
            if (race == RacialType.Wookiee &&
                command != SkillType.Shyriiwook.ToString().ToLower())
            {
                LanguageService.SetActiveLanguage(user, SkillType.Shyriiwook);
                user.SendMessage(ColorTokenService.Red("Wookiees can only speak Shyriiwook."));
                return;
            }


            foreach (var language in LanguageService.Languages)
            {
                if (language.ChatNames.Contains(command))
                {
                    LanguageService.SetActiveLanguage(user, language.Skill);
                    user.SendMessage($"Set active language to {language.ProperName}.");
                    return;
                }
            }

            user.SendMessage(ColorTokenService.Red($"Unknown language {command}."));
        }
Ejemplo n.º 7
0
        private static void OnModuleEnter()
        {
            NWPlayer player = _.GetEnteringObject();

            if (!player.IsPlayer)
            {
                return;
            }

            RacialType race = (RacialType)player.RacialType;

            if (race == RacialType.Wookiee)
            {
                _.SetObjectVisualTransform(player, ObjectVisualTransform.Scale, 1.2f);
            }
        }
Ejemplo n.º 8
0
        public static Effect SetEyesRed(this uint pc)
        {
            Effect     eyeColor;
            GenderType gender = GetGender(pc);
            RacialType race   = GetRacialType(pc);

            if (race == RacialType.Dwarf)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Dwarf_Female) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Dwarf_Male);
            }
            else if (race == RacialType.Elf)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Elf_Female) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Elf_Male);
            }
            else if (race == RacialType.Gnome)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Gnome_Female) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Gnome_Male);
            }
            else if (race == RacialType.Halfelf)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Troglodyte) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Troglodyte);
            }
            else if (race == RacialType.Halfling)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Halfling_Female) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Halfling_Male);
            }
            else if (race == RacialType.Halforc)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Halforc_Female) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Halforc_Male);
            }
            else if (race == RacialType.Human)
            {
                eyeColor = gender == GenderType.Female ? EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Human_Female) : EffectVisualEffect(VisualEffectType.Vfx_Eyes_Red_Flame_Human_Male);
            }
            else
            {
                SendMessageToPC(pc, $"Invalid Race {race}. SetEyesRed.");
                throw new ArgumentException($"Name:{GetName(pc)} | BIC:{Player.GetBicFileName(pc)} failed to change SetEyesRed. Invalid race {race}.");
            }

            return(eyeColor);
        }
Ejemplo n.º 9
0
        public override void Initialize()
        {
            RacialType race     = (RacialType)GetPC().RacialType;
            string     hairText = "Hair";

            if (race == RacialType.Trandoshan ||
                race == RacialType.MonCalamari)
            {
                hairText = "Eyes";
                SetResponseVisible("MainPage", 5, false);
            }

            SetResponseText("MainPage", 4, "Change " + hairText);

            // Skin color can't change for Wookiees. Disable the option.
            if (race == RacialType.Wookiee)
            {
                SetResponseVisible("MainPage", 2, false);
            }
        }
Ejemplo n.º 10
0
        private static void OnModuleNWNXChat()
        {
            ChatChannel channel = (ChatChannel)NWNXChat.GetChannel();

            // So we're going to play with a couple of channels here.

            // - PlayerTalk, PlayerWhisper, PlayerParty, and PlayerShout are all IC channels. These channels
            //   are subject to emote colouring and language translation. (see below for more info).
            // - PlayerParty is an IC channel with special behaviour. Those outside of the party but within
            //   range may listen in to the party chat. (see below for more information).
            // - PlayerShout sends a holocom message server-wide through the DMTell channel.
            // - PlayerDM echoes back the message received to the sender.

            bool inCharacterChat =
                channel == ChatChannel.PlayerTalk ||
                channel == ChatChannel.PlayerWhisper ||
                channel == ChatChannel.PlayerParty ||
                channel == ChatChannel.PlayerShout;

            bool messageToDm = channel == ChatChannel.PlayerDM;

            if (!inCharacterChat && !messageToDm)
            {
                // We don't much care about traffic on the other channels.
                return;
            }

            NWObject sender  = NWNXChat.GetSender();
            string   message = NWNXChat.GetMessage().Trim();

            if (string.IsNullOrWhiteSpace(message))
            {
                // We can't handle empty messages, so skip it.
                return;
            }

            if (ChatCommandService.CanHandleChat(sender, message) ||
                BaseService.CanHandleChat(sender) ||
                CraftService.CanHandleChat(sender) ||
                MarketService.CanHandleChat(sender.Object) ||
                MessageBoardService.CanHandleChat(sender) ||
                ItemService.CanHandleChat(sender))
            {
                // This will be handled by other services, so just bail.
                return;
            }

            if (channel == ChatChannel.PlayerDM)
            {
                // Simply echo the message back to the player.
                NWNXChat.SendMessage((int)ChatChannel.ServerMessage, "(Sent to DM) " + message, sender, sender);
                return;
            }

            // At this point, every channel left is one we want to manually handle.
            NWNXChat.SkipMessage();

            // If this is a shout message, and the holonet is disabled, we disallow it.
            if (channel == ChatChannel.PlayerShout && sender.IsPC &&
                GetLocalBool(sender, "DISPLAY_HOLONET") == false)
            {
                NWPlayer player = sender.Object;
                player.SendMessage("You have disabled the holonet and cannot send this message.");
                return;
            }

            List <ChatComponent> chatComponents;

            // Quick early out - if we start with "//" or "((", this is an OOC message.
            bool isOOC = false;

            if (message.Length >= 2 && (message.Substring(0, 2) == "//" || message.Substring(0, 2) == "(("))
            {
                ChatComponent component = new ChatComponent
                {
                    m_Text         = message,
                    m_CustomColour = true,
                    m_ColourRed    = 64,
                    m_ColourGreen  = 64,
                    m_ColourBlue   = 64,
                    m_Translatable = false
                };

                chatComponents = new List <ChatComponent> {
                    component
                };

                if (channel == ChatChannel.PlayerShout)
                {
                    _.SendMessageToPC(sender, "Out-of-character messages cannot be sent on the Holonet.");
                    return;
                }

                isOOC = true;
            }
            else
            {
                if (EmoteStyleService.GetEmoteStyle(sender) == EmoteStyle.Regular)
                {
                    chatComponents = SplitMessageIntoComponents_Regular(message);
                }
                else
                {
                    chatComponents = SplitMessageIntoComponents_Novel(message);
                }

                // For any components with colour, set the emote colour.
                foreach (ChatComponent component in chatComponents)
                {
                    if (component.m_CustomColour)
                    {
                        component.m_ColourRed   = 0;
                        component.m_ColourGreen = 255;
                        component.m_ColourBlue  = 0;
                    }
                }
            }

            // Now, depending on the chat channel, we need to build a list of recipients.
            bool  needsAreaCheck = false;
            float distanceCheck  = 0.0f;

            // The sender always wants to see their own message.
            List <NWObject> recipients = new List <NWObject> {
                sender
            };

            // This is a server-wide holonet message (that receivers can toggle on or off).
            if (channel == ChatChannel.PlayerShout)
            {
                recipients.AddRange(NWModule.Get().Players.Where(player => GetLocalBool(player, "DISPLAY_HOLONET") == true));
                recipients.AddRange(AppCache.ConnectedDMs);
            }
            // This is the normal party chat, plus everyone within 20 units of the sender.
            else if (channel == ChatChannel.PlayerParty)
            {
                // Can an NPC use the playerparty channel? I feel this is safe ...
                NWPlayer player = sender.Object;
                recipients.AddRange(player.PartyMembers.Cast <NWObject>().Where(x => x != sender));
                recipients.AddRange(AppCache.ConnectedDMs);

                needsAreaCheck = true;
                distanceCheck  = 20.0f;
            }
            // Normal talk - 20 units.
            else if (channel == ChatChannel.PlayerTalk)
            {
                needsAreaCheck = true;
                distanceCheck  = 20.0f;
            }
            // Whisper - 4 units.
            else if (channel == ChatChannel.PlayerWhisper)
            {
                needsAreaCheck = true;
                distanceCheck  = 4.0f;
            }

            if (needsAreaCheck)
            {
                recipients.AddRange(sender.Area.Objects.Where(obj => obj.IsPC && _.GetDistanceBetween(sender, obj) <= distanceCheck));
                recipients.AddRange(AppCache.ConnectedDMs.Where(dm => dm.Area == sender.Area && _.GetDistanceBetween(sender, dm) <= distanceCheck));
            }

            // Now we have a list of who is going to actually receive a message, we need to modify
            // the message for each recipient then dispatch them.

            foreach (NWObject obj in recipients.Distinct())
            {
                // Generate the final message as perceived by obj.

                StringBuilder finalMessage = new StringBuilder();

                if (channel == ChatChannel.PlayerShout)
                {
                    finalMessage.Append("[Holonet] ");
                }
                else if (channel == ChatChannel.PlayerParty)
                {
                    finalMessage.Append("[Comms] ");

                    if (obj.IsDM)
                    {
                        // Convenience for DMs - append the party members.
                        finalMessage.Append("{ ");

                        int               count        = 0;
                        NWPlayer          player       = sender.Object;
                        List <NWCreature> partyMembers = player.PartyMembers.ToList();

                        foreach (NWCreature otherPlayer in partyMembers)
                        {
                            string name = otherPlayer.Name;
                            finalMessage.Append(name.Substring(0, Math.Min(name.Length, 10)));

                            ++count;

                            if (count >= 3)
                            {
                                finalMessage.Append(", ...");
                                break;
                            }
                            else if (count != partyMembers.Count)
                            {
                                finalMessage.Append(",");
                            }
                        }

                        finalMessage.Append(" } ");
                    }
                }

                var originalSender = sender;
                // temp set sender to hologram owner for holocoms
                if (GetIsObjectValid(HoloComService.GetHoloGramOwner(sender)) == true)
                {
                    sender = HoloComService.GetHoloGramOwner(sender);
                }

                SkillType language = LanguageService.GetActiveLanguage(sender);

                // Wookiees cannot speak any other language (but they can understand them).
                // Swap their language if they attempt to speak in any other language.
                RacialType race = (RacialType)_.GetRacialType(sender);
                if (race == RacialType.Wookiee && language != SkillType.Shyriiwook)
                {
                    LanguageService.SetActiveLanguage(sender, SkillType.Shyriiwook);
                    language = SkillType.Shyriiwook;
                }

                int  colour = LanguageService.GetColour(language);
                byte r      = (byte)(colour >> 24 & 0xFF);
                byte g      = (byte)(colour >> 16 & 0xFF);
                byte b      = (byte)(colour >> 8 & 0xFF);

                if (language != SkillType.Basic)
                {
                    string languageName = LanguageService.GetName(language);
                    finalMessage.Append(ColorTokenService.Custom($"[{languageName}] ", r, g, b));
                }

                foreach (ChatComponent component in chatComponents)
                {
                    string text = component.m_Text;

                    if (component.m_Translatable && language != SkillType.Basic)
                    {
                        text = LanguageService.TranslateSnippetForListener(sender, obj.Object, language, component.m_Text);

                        if (colour != 0)
                        {
                            text = ColorTokenService.Custom(text, r, g, b);
                        }
                    }

                    if (component.m_CustomColour)
                    {
                        text = ColorTokenService.Custom(text, component.m_ColourRed, component.m_ColourGreen, component.m_ColourBlue);
                    }

                    finalMessage.Append(text);
                }

                // Dispatch the final message - method depends on the original chat channel.
                // - Shout and party is sent as DMTalk. We do this to get around the restriction that
                //   the PC needs to be in the same area for the normal talk channel.
                //   We could use the native channels for these but the [shout] or [party chat] labels look silly.
                // - Talk and whisper are sent as-is.

                ChatChannel finalChannel = channel;

                if (channel == ChatChannel.PlayerShout || channel == ChatChannel.PlayerParty)
                {
                    finalChannel = ChatChannel.DMTalk;
                }

                // There are a couple of colour overrides we want to use here.
                // - One for holonet (shout).
                // - One for comms (party chat).

                string finalMessageColoured = finalMessage.ToString();

                if (channel == ChatChannel.PlayerShout)
                {
                    finalMessageColoured = ColorTokenService.Custom(finalMessageColoured, 0, 180, 255);
                }
                else if (channel == ChatChannel.PlayerParty)
                {
                    finalMessageColoured = ColorTokenService.Orange(finalMessageColoured);
                }

                // set back to original sender, if it was changed by holocom connection
                sender = originalSender;

                NWNXChat.SendMessage((int)finalChannel, finalMessageColoured, sender, obj);
            }

            MessageHub.Instance.Publish(new OnChatProcessed(sender, channel, isOOC));
        }
Ejemplo n.º 11
0
        public static void InitializePlayerLanguages(NWPlayer player)
        {
            RacialType     race       = (RacialType)player.RacialType;
            BackgroundType background = (BackgroundType)player.Class1;
            var            languages  = new List <SkillType>(new[] { SkillType.Basic });

            switch (race)
            {
            case RacialType.Bothan:
                languages.Add(SkillType.Bothese);
                break;

            case RacialType.Chiss:
                languages.Add(SkillType.Cheunh);
                break;

            case RacialType.Zabrak:
                languages.Add(SkillType.Zabraki);
                break;

            case RacialType.Wookiee:
                languages.Add(SkillType.Shyriiwook);
                break;

            case RacialType.Twilek:
                languages.Add(SkillType.Twileki);
                break;

            case RacialType.Cathar:
                languages.Add(SkillType.Catharese);
                break;

            case RacialType.Trandoshan:
                languages.Add(SkillType.Dosh);
                break;

            case RacialType.Cyborg:
                languages.Add(SkillType.Droidspeak);
                break;

            case RacialType.Mirialan:
                languages.Add(SkillType.Mirialan);
                break;

            case RacialType.MonCalamari:
                languages.Add(SkillType.MonCalamarian);
                break;

            case RacialType.Ugnaught:
                languages.Add(SkillType.Ugnaught);
                break;
            }

            switch (background)
            {
            case BackgroundType.Mandalorian:
                languages.Add(SkillType.Mandoa);
                break;
            }

            // Fair warning: We're short-circuiting the skill system here.
            // Languages don't level up like normal skills (no stat increases, SP, etc.)
            // So it's safe to simply set the player's rank in the skill to max.

            List <int> languageSkillIDs = languages.ConvertAll(x => (int)x);
            var        pcSkills         = DataService.PCSkill.GetAllByPlayerIDAndSkillIDs(player.GlobalID, languageSkillIDs).ToList();

            foreach (var pcSkill in pcSkills)
            {
                var skill     = DataService.Skill.GetByID(pcSkill.SkillID);
                int maxRank   = skill.MaxRank;
                int maxRankXP = SkillService.SkillXPRequirements[maxRank];

                pcSkill.Rank = maxRank;
                pcSkill.XP   = maxRankXP - 1;

                DataService.SubmitDataChange(pcSkill, DatabaseActionType.Update);
            }
        }
Ejemplo n.º 12
0
        private void ChangeBodyPartResponses(int responseID)
        {
            var        model = GetDialogCustomData <Model>();
            RacialType race  = (RacialType)GetPC().RacialType;

            // Note: The following part IDs are found in the "parts_*.2da" files.
            // Don't use the ID number listed in the toolset when selecting parts to make available.
            // The ID in the toolset is a DIFFERENT index and doesn't correlate to the 2da ID number.
            switch (responseID)
            {
            case 1:     // Torso
                model.BodyPartID = CreaturePart.Torso;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208, 209 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 166 };
                    break;
                }
                model.PartName = "Torso";
                break;

            case 2:     // Pelvis
                model.BodyPartID = CreaturePart.Pelvis;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208, 209 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 11, 158 };
                    break;
                }
                model.PartName = "Pelvis";
                break;

            case 3:     // Right Bicep
                model.BodyPartID = CreaturePart.RightBicep;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2 };
                    break;
                }
                model.PartName = "Right Bicep";
                break;

            case 4:     // Right Forearm
                model.BodyPartID = CreaturePart.RightForearm;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 152 };
                    break;
                }
                model.PartName = "Right Forearm";
                break;

            case 5:     // Right Hand
                model.BodyPartID = CreaturePart.RightHand;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                case RacialType.Rodian:
                    model.Parts = new[] { 44 };
                    break;

                case RacialType.KelDor:
                    model.Parts = new[] { 45 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 5, 6, 63, 100, 110, 113, 121, 151, };
                    break;
                }
                model.PartName = "Right Hand";
                break;

            case 6:     // Right Thigh
                model.BodyPartID = CreaturePart.RightThigh;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 154 };
                    break;
                }
                model.PartName = "Right Thigh";
                break;

            case 7:     // Right Shin
                model.BodyPartID = CreaturePart.RightShin;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2 };
                    break;
                }
                model.PartName = "Right Shin";
                break;

            case 8:     // Left Bicep
                model.BodyPartID = CreaturePart.LeftBicep;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2 };
                    break;
                }
                model.PartName = "Left Bicep";
                break;

            case 9:     // Left Forearm
                model.BodyPartID = CreaturePart.LeftForearm;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 152 };
                    break;
                }
                model.PartName = "Left Forearm";
                break;

            case 10:     // Left Hand
                model.BodyPartID = CreaturePart.LeftHand;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                case RacialType.Rodian:
                    model.Parts = new[] { 44 };
                    break;

                case RacialType.KelDor:
                    model.Parts = new[] { 45 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 5, 6, 63, 100, 110, 113, 121, 151, };
                    break;
                }
                model.PartName = "Left Hand";
                break;

            case 11:     // Left Thigh
                model.BodyPartID = CreaturePart.LeftThigh;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2, 154 };
                    break;
                }
                model.PartName = "Left Thigh";
                break;

            case 12:     // Left Shin
                model.BodyPartID = CreaturePart.LeftShin;
                switch (race)
                {
                case RacialType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case RacialType.MonCalamari:
                    model.Parts = new[] { 204 };
                    break;

                default:
                    model.Parts = new[] { 1, 2 };
                    break;
                }
                model.PartName = "Left Shin";
                break;
            }

            LoadEditPartPage();
            ChangePage("EditPartPage");
        }
Ejemplo n.º 13
0
        private void LoadHairColorPage()
        {
            ClearPageResponses("ChangeHairColorPage");

            // These IDs are pulled from the HairColors.jpg file found in the ServerFiles/Reference folder.
            int[] HumanHairColors       = { };  // All
            int[] BothanHairColors      = { };  // All
            int[] ChissHairColors       = { };  // All
            int[] ZabrakHairColors      = { };  // All
            int[] TwilekHairColors      = { };  // All
            int[] MirialanHairColors    = { };  // All
            int[] EchaniHairColors      = {  }; // All
            int[] CyborgHairColors      = { };  // All
            int[] CatharHairColors      = { };  // All
            int[] TrandoshanEyeColors   = { };  // All
            int[] WookieeHairColors     = {};   // All
            int[] MonCalamariHairColors = { };  // All
            int[] UgnaughtHairColors    = { };  // All
            int[] TogrutaHairColors     = { };  // All
            int[] RodianHairColors      = { };  // All
            int[] KelDorHairColors      = { };  // All

            RacialType race = (RacialType)GetPC().RacialType;

            int[] colorsToUse;

            switch (race)
            {
            case RacialType.Human:
                colorsToUse = HumanHairColors;
                break;

            case RacialType.Bothan:
                colorsToUse = BothanHairColors;
                break;

            case RacialType.Chiss:
                colorsToUse = ChissHairColors;
                break;

            case RacialType.Zabrak:
                colorsToUse = ZabrakHairColors;
                break;

            case RacialType.Twilek:
                colorsToUse = TwilekHairColors;
                break;

            case RacialType.Mirialan:
                colorsToUse = MirialanHairColors;
                break;

            case RacialType.Echani:
                colorsToUse = EchaniHairColors;
                break;

            case RacialType.Cyborg:
                colorsToUse = CyborgHairColors.Concat(HumanHairColors).ToArray();
                break;

            case RacialType.Cathar:
                colorsToUse = CatharHairColors;
                break;

            case RacialType.Trandoshan:
                colorsToUse = TrandoshanEyeColors;
                break;

            case RacialType.Wookiee:
                colorsToUse = WookieeHairColors;
                break;

            case RacialType.MonCalamari:
                colorsToUse = MonCalamariHairColors;
                break;

            case RacialType.Ugnaught:
                colorsToUse = UgnaughtHairColors;
                break;

            case RacialType.Togruta:
                colorsToUse = TogrutaHairColors;
                break;

            case RacialType.Rodian:
                colorsToUse = RodianHairColors;
                break;

            case RacialType.KelDor:
                colorsToUse = KelDorHairColors;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // If none specified, display all.
            if (colorsToUse.Length <= 0)
            {
                for (int x = 0; x <= 175; x++)
                {
                    AddResponseToPage("ChangeHairColorPage", "Color #" + x, true, x);
                }
            }
            else
            {
                Array.Sort(colorsToUse);
                foreach (var color in colorsToUse)
                {
                    AddResponseToPage("ChangeHairColorPage", "Color #" + color, true, color);
                }
            }
        }
Ejemplo n.º 14
0
        private void LoadHeadPage()
        {
            ClearPageResponses("ChangeHeadPage");

            int[] MaleHumanHeads       = { 1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 100, 102, 110, 116, 121, 126, 129, 130, 131, 132, 134, 135, 136, 137, 138, 140, 141, 142, 145, 146, 150, 152, 153, 160, 161, 164, 165, 166, 167, 171, 176, 177, 182, 183, 184, 186, 190, 191, 194, 195, 196, 197, 198, 199, 201, 202, 230, 231, 232 };
            int[] MaleBothanHeads      = { 40, 41, 43, 50, 51, 52 };
            int[] MaleChissHeads       = { };
            int[] MaleZabrakHeads      = { 56, 57, 58, 59, 60, 61, 62, 103, };
            int[] MaleTwilekHeads      = { 65, 66, 67, 115, };
            int[] MaleMirialanHeads    = { };
            int[] MaleEchaniHeads      = { };
            int[] MaleCyborgHeads      = { 74, 88, 156, 168, 181, 187 };
            int[] MaleCatharHeads      = { 26, 27, 28, 29, };
            int[] MaleTrandoshanHeads  = { 2, 97, 98, 101, 111, 123, 124, 125, 143, 147, 148, 162 };
            int[] MaleWookieeHeads     = { 117, 119, 192, 193 };
            int[] MaleMonCalamariHeads = { 6, 44, 48, 49, 104, 105, 106, 107, 108, 112, 113, 114, 117, 119, 120, 127 };
            int[] MaleUgnaughtHeads    = { 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110 };
            int[] MaleTogrutaHeads     = { 212, 213, 214, 215, 216, 217, 128, 219, 220, 221, 222 };
            int[] MaleRodianHeads      = { 39, 54, 55, 56, 57, 58, 59, 60, 61, 62 };
            int[] MaleKelDorHeads      = { 223, 224, 225, 226, 227, 228, 229, 233, 234 };

            int[] FemaleHumanHeads       = { 1, 2, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 22, 23, 25, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 42, 44, 45, 46, 48, 49, 52, 53, 54, 100, 101, 102, 103, 104, 105, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 121, 123, 124, 125, 127, 130, 132, 134, 136, 137, 138, 140, 141, 142, 164, 167, 168, 171, 172, 173, 174, 175, 177, 178, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 199, 220, 221 };
            int[] FemaleBothanHeads      = { 109, 162, };
            int[] FemaleChissHeads       = { };
            int[] FemaleZabrakHeads      = { 38, 69, 70, 71, 72, 73, 120 };
            int[] FemaleTwilekHeads      = { 79, 80, 81, 82, 139, 144, 145, 205, 206, 207, 208, 209 };
            int[] FemaleMirialanHeads    = { };
            int[] FemaleEchaniHeads      = { };
            int[] FemaleCyborgHeads      = { 41, 109 };
            int[] FemaleCatharHeads      = { 13, 14 };
            int[] FemaleTrandoshanHeads  = { 24, 50, 51, 126, 128, 129, 131, 135, 150, 157 };
            int[] FemaleWookieeHeads     = { 110, 185, 186, 190, 192, 193, 195 };
            int[] FemaleMonCalamariHeads = { 3, 6, 16, 17, 21, 26, 29, 41, 43, 47, 109, 110, 115, 119, 122 };
            int[] FemaleUgnaughtHeads    = { 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110 };
            int[] FemaleTogrutaHeads     = { 200, 201, 202, 203, 204, 210, 211, 212, 213, 214, 215 };
            int[] FemaleRodianHeads      = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 182 };
            int[] FemaleKelDorHeads      = { 223, 224, 225, 226, 227, 228, 229, 230, 231 };

            RacialType race   = (RacialType)GetPC().RacialType;
            var        gender = GetPC().Gender;

            int[] headsToUse;

            switch (race)
            {
            case RacialType.Human:
                headsToUse = gender == Gender.Male ? MaleHumanHeads : FemaleHumanHeads;
                break;

            case RacialType.Bothan:
                headsToUse = gender == Gender.Male ? MaleBothanHeads : FemaleBothanHeads;
                break;

            case RacialType.Chiss:
                headsToUse = gender == Gender.Male ?
                             MaleChissHeads.Concat(MaleHumanHeads).ToArray() :
                             FemaleChissHeads.Concat(FemaleHumanHeads).ToArray();
                break;

            case RacialType.Zabrak:
                headsToUse = gender == Gender.Male ? MaleZabrakHeads : FemaleZabrakHeads;
                break;

            case RacialType.Twilek:
                headsToUse = gender == Gender.Male ? MaleTwilekHeads : FemaleTwilekHeads;
                break;

            case RacialType.Mirialan:
                headsToUse = gender == Gender.Male ?
                             MaleMirialanHeads.Concat(MaleHumanHeads).ToArray() :
                             FemaleMirialanHeads.Concat(FemaleHumanHeads).ToArray();
                break;

            case RacialType.Echani:
                headsToUse = gender == Gender.Male ?
                             MaleEchaniHeads.Concat(MaleHumanHeads).ToArray() :
                             FemaleEchaniHeads.Concat(FemaleHumanHeads).ToArray();
                break;

            case RacialType.Cyborg:
                headsToUse = gender == Gender.Male ?
                             MaleCyborgHeads.Concat(MaleHumanHeads).ToArray() :
                             FemaleCyborgHeads.Concat(FemaleHumanHeads).ToArray();
                break;

            case RacialType.Cathar:
                headsToUse = gender == Gender.Male ? MaleCatharHeads : FemaleCatharHeads;
                break;

            case RacialType.Trandoshan:
                headsToUse = gender == Gender.Male ? MaleTrandoshanHeads : FemaleTrandoshanHeads;
                break;

            case RacialType.Wookiee:
                headsToUse = gender == Gender.Male ? MaleWookieeHeads : FemaleWookieeHeads;
                break;

            case RacialType.MonCalamari:
                headsToUse = gender == Gender.Male ? MaleMonCalamariHeads : FemaleMonCalamariHeads;
                break;

            case RacialType.Ugnaught:
                headsToUse = gender == Gender.Male ? MaleUgnaughtHeads : FemaleUgnaughtHeads;
                break;

            case RacialType.Togruta:
                headsToUse = gender == Gender.Male ? MaleTogrutaHeads : FemaleTogrutaHeads;
                break;

            case RacialType.Rodian:
                headsToUse = gender == Gender.Male ? MaleRodianHeads : FemaleRodianHeads;
                break;

            case RacialType.KelDor:
                headsToUse = gender == Gender.Male ? MaleKelDorHeads : FemaleKelDorHeads;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Array.Sort(headsToUse);
            foreach (var head in headsToUse)
            {
                AddResponseToPage("ChangeHeadPage", "Head #" + head, true, head);
            }
        }
Ejemplo n.º 15
0
        private void LoadSkinColorPage()
        {
            ClearPageResponses("ChangeSkinColorPage");

            // These IDs are pulled from the SkinColors.jpg file found in the ServerFiles/Reference folder.

            // These IDs are pulled from the SkinColors.jpg file found in the ServerFiles/Reference folder.
            int[] HumanSkinColors =
            {
                0,     1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,  64,  65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
                80,   81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
                146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175
            };
            int[] BothanSkinColors = HumanSkinColors;

            int[] ChissSkinColors = HumanSkinColors;

            int[] ZabrakSkinColors = HumanSkinColors;

            int[] TwilekSkinColors = HumanSkinColors;

            int[] CyborgSkinColors = HumanSkinColors;

            int[] CatharSkinColors = HumanSkinColors;

            int[] TrandoshanSkinColors = HumanSkinColors;

            int[] MirialanSkinColors = HumanSkinColors;

            int[] EchaniSkinColors = HumanSkinColors;

            int[] MonCalamariSkinColors = HumanSkinColors;

            int[] UgnaughtSkinColors = HumanSkinColors;

            int[] TogrutaSkinColors = HumanSkinColors;

            int[] RodianSkinColors = HumanSkinColors;

            int[] KelDorSkinColors = HumanSkinColors;

            RacialType race = (RacialType)GetPC().RacialType;

            int[] colorsToUse;

            switch (race)
            {
            case RacialType.Human:
                colorsToUse = HumanSkinColors;
                break;

            case RacialType.Bothan:
                colorsToUse = BothanSkinColors;
                break;

            case RacialType.Chiss:
                colorsToUse = ChissSkinColors;
                break;

            case RacialType.Zabrak:
                colorsToUse = ZabrakSkinColors;
                break;

            case RacialType.Twilek:
                colorsToUse = TwilekSkinColors;
                break;

            case RacialType.Mirialan:
                colorsToUse = MirialanSkinColors;
                break;

            case RacialType.Echani:
                colorsToUse = EchaniSkinColors;
                break;

            case RacialType.Cyborg:
                colorsToUse = CyborgSkinColors;
                break;

            case RacialType.Cathar:
                colorsToUse = CatharSkinColors;
                break;

            case RacialType.Trandoshan:
                colorsToUse = TrandoshanSkinColors;
                break;

            case RacialType.MonCalamari:
                colorsToUse = MonCalamariSkinColors;
                break;

            case RacialType.Ugnaught:
                colorsToUse = UgnaughtSkinColors;
                break;

            case RacialType.Togruta:
                colorsToUse = TogrutaSkinColors;
                break;

            case RacialType.Rodian:
                colorsToUse = RodianSkinColors;
                break;

            case RacialType.KelDor:
                colorsToUse = KelDorSkinColors;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Array.Sort(colorsToUse);
            foreach (var color in colorsToUse)
            {
                AddResponseToPage("ChangeSkinColorPage", "Color #" + color, true, color);
            }
        }
Ejemplo n.º 16
0
 public static CreatureTypeFilter RacialType(RacialType racialType)
 => new CreatureTypeFilter(CreatureType.RacialType, (int)racialType);
Ejemplo n.º 17
0
        private void LoadHairColorPage()
        {
            ClearPageResponses("ChangeHairColorPage");

            // These IDs are pulled from the HairColors.jpg file found in the ServerFiles/Reference folder.
            int[] HumanHairColors       = { 0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 23, 167 };
            int[] BothanHairColors      = { 2, 3, };
            int[] ChissHairColors       = { 23, 51, 63, 16, 17, 24, 25, 31, 32, 33, 164, 165, 166, 167, 170, 171 };
            int[] ZabrakHairColors      = { 0 };
            int[] TwilekHairColors      = { }; // All
            int[] MirialanHairColors    = { 0, 1, 2, 3, 4, 5, 6, 7, 14, 15, 16, 17, 167 };
            int[] EchaniHairColors      = { 16, 62 };
            int[] CyborgHairColors      = { 16, 17, 18, 19, 20, 21 };
            int[] CatharHairColors      = { 0, 1, 2, 3, 4, 5, 6, 7, 116, 117 };
            int[] TrandoshanEyeColors   = { }; // All
            int[] WookieeHairColors     = { 0, 1, 2, 3, 14, 49, 51 };
            int[] MonCalamariHairColors = { }; // All
            int[] UgnaughtHairColors    = { 16, 17, 18, 19, 62, 120, 128, 164, 166, 168 };

            RacialType race = (RacialType)GetPC().RacialType;

            int[] colorsToUse;

            switch (race)
            {
            case RacialType.Human:
                colorsToUse = HumanHairColors;
                break;

            case RacialType.Bothan:
                colorsToUse = BothanHairColors;
                break;

            case RacialType.Chiss:
                colorsToUse = ChissHairColors;
                break;

            case RacialType.Zabrak:
                colorsToUse = ZabrakHairColors;
                break;

            case RacialType.Twilek:
                colorsToUse = TwilekHairColors;
                break;

            case RacialType.Mirialan:
                colorsToUse = MirialanHairColors;
                break;

            case RacialType.Echani:
                colorsToUse = EchaniHairColors;
                break;

            case RacialType.Cyborg:
                colorsToUse = CyborgHairColors.Concat(HumanHairColors).ToArray();
                break;

            case RacialType.Cathar:
                colorsToUse = CatharHairColors;
                break;

            case RacialType.Trandoshan:
                colorsToUse = TrandoshanEyeColors;
                break;

            case RacialType.Wookiee:
                colorsToUse = WookieeHairColors;
                break;

            case RacialType.MonCalamari:
                colorsToUse = MonCalamariHairColors;
                break;

            case RacialType.Ugnaught:
                colorsToUse = UgnaughtHairColors;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // If none specified, display all.
            if (colorsToUse.Length <= 0)
            {
                for (int x = 0; x <= 175; x++)
                {
                    AddResponseToPage("ChangeHairColorPage", "Color #" + x, true, x);
                }
            }
            else
            {
                Array.Sort(colorsToUse);
                foreach (var color in colorsToUse)
                {
                    AddResponseToPage("ChangeHairColorPage", "Color #" + color, true, color);
                }
            }
        }
Ejemplo n.º 18
0
        private static Player CreateDBPCEntity(NWPlayer player)
        {
            RacialType      race = (RacialType)player.RacialType;
            AssociationType assType;
            var             goodEvil = GetAlignmentGoodEvil(player);
            var             lawChaos = GetAlignmentLawChaos(player);

            // Jedi Order -- Mandalorian -- Sith Empire
            if (goodEvil == Alignment.Good && lawChaos == Alignment.Lawful)
            {
                assType = AssociationType.JediOrder;
            }
            else if (goodEvil == Alignment.Good && lawChaos == Alignment.Neutral)
            {
                assType = AssociationType.Mandalorian;
            }
            else if (goodEvil == Alignment.Good && lawChaos == Alignment.Chaotic)
            {
                assType = AssociationType.SithEmpire;
            }

            // Smugglers -- Unaligned -- Hutt Cartel
            else if (goodEvil == Alignment.Neutral && lawChaos == Alignment.Lawful)
            {
                assType = AssociationType.Smugglers;
            }
            else if (goodEvil == Alignment.Neutral && lawChaos == Alignment.Neutral)
            {
                assType = AssociationType.Unaligned;
            }
            else if (goodEvil == Alignment.Neutral && lawChaos == Alignment.Chaotic)
            {
                assType = AssociationType.HuttCartel;
            }

            // Republic -- Czerka -- Sith Order
            else if (goodEvil == Alignment.Evil && lawChaos == Alignment.Lawful)
            {
                assType = AssociationType.Republic;
            }
            else if (goodEvil == Alignment.Evil && lawChaos == Alignment.Neutral)
            {
                assType = AssociationType.Czerka;
            }
            else if (goodEvil == Alignment.Evil && lawChaos == Alignment.Chaotic)
            {
                assType = AssociationType.SithOrder;
            }
            else
            {
                throw new Exception("Association type not found. GoodEvil = " + goodEvil + ", LawChaos = " + lawChaos);
            }

            int sp = 5;

            if (race == RacialType.Human)
            {
                sp++;
            }

            Player entity = new Player
            {
                ID                                = player.GlobalID,
                CharacterName                     = player.Name,
                HitPoints                         = player.CurrentHP,
                LocationAreaResref                = GetResRef(GetAreaFromLocation(player.Location)),
                LocationX                         = player.Position.X,
                LocationY                         = player.Position.Y,
                LocationZ                         = player.Position.Z,
                LocationOrientation               = player.Facing,
                CreateTimestamp                   = DateTime.UtcNow,
                UnallocatedSP                     = sp,
                HPRegenerationAmount              = 1,
                RegenerationTick                  = 20,
                RegenerationRate                  = 0,
                VersionNumber                     = 1,
                MaxFP                             = 0,
                CurrentFP                         = 0,
                CurrentFPTick                     = 20,
                RespawnAreaResref                 = string.Empty,
                RespawnLocationX                  = 0.0f,
                RespawnLocationY                  = 0.0f,
                RespawnLocationZ                  = 0.0f,
                RespawnLocationOrientation        = 0.0f,
                DateSanctuaryEnds                 = DateTime.UtcNow + TimeSpan.FromDays(3),
                IsSanctuaryOverrideEnabled        = false,
                STRBase                           = NWNXCreature.GetRawAbilityScore(player, AbilityType.Strength),
                DEXBase                           = NWNXCreature.GetRawAbilityScore(player, AbilityType.Dexterity),
                CONBase                           = NWNXCreature.GetRawAbilityScore(player, AbilityType.Constitution),
                INTBase                           = NWNXCreature.GetRawAbilityScore(player, AbilityType.Intelligence),
                WISBase                           = NWNXCreature.GetRawAbilityScore(player, AbilityType.Wisdom),
                CHABase                           = NWNXCreature.GetRawAbilityScore(player, AbilityType.Charisma),
                TotalSPAcquired                   = 0,
                DisplayHelmet                     = true,
                PrimaryResidencePCBaseStructureID = null,
                PrimaryResidencePCBaseID          = null,
                AssociationID                     = (int)assType,
                DisplayHolonet                    = true,
                DisplayDiscord                    = true,
                XPBonus                           = 0,
                LeaseRate                         = 0,
                ModeDualPistol                    = false
            };

            return(entity);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Resolves a <see cref="NwRace"/> from a <see cref="Anvil.API.RacialType"/>.
 /// </summary>
 /// <param name="racialType">The racial type to resolve.</param>
 /// <returns>The associated <see cref="NwRace"/> instance. Null if the racial type is invalid.</returns>
 public static NwRace?FromRacialType(RacialType racialType)
 {
     return(NwRuleset.Races.ElementAtOrDefault((int)racialType));
 }
Ejemplo n.º 20
0
        public static void ApplyDefaultAppearance(NWPlayer player)
        {
            RacialType race = (RacialType)player.RacialType;
            int        maleHead;
            int        femaleHead;
            int        skinColor;
            int        hairColor;
            var        gender     = player.Gender;
            var        appearance = AppearanceType.Human;

            int maleNeck         = 1;
            int maleTorso        = 1;
            int malePelvis       = 1;
            int maleRightBicep   = 1;
            int maleRightForearm = 1;
            int maleRightHand    = 1;
            int maleRightThigh   = 1;
            int maleRightShin    = 1;
            int maleRightFoot    = 1;
            int maleLeftBicep    = 1;
            int maleLeftForearm  = 1;
            int maleLeftHand     = 1;
            int maleLeftThigh    = 1;
            int maleLeftShin     = 1;
            int maleLeftFoot     = 1;

            int femaleNeck         = 1;
            int femaleTorso        = 1;
            int femalePelvis       = 1;
            int femaleRightBicep   = 1;
            int femaleRightForearm = 1;
            int femaleRightHand    = 1;
            int femaleRightThigh   = 1;
            int femaleRightShin    = 1;
            int femaleRightFoot    = 1;
            int femaleLeftBicep    = 1;
            int femaleLeftForearm  = 1;
            int femaleLeftHand     = 1;
            int femaleLeftThigh    = 1;
            int femaleLeftShin     = 1;
            int femaleLeftFoot     = 1;


            switch (race)
            {
            case RacialType.Human:
                skinColor  = 2;
                hairColor  = 0;
                maleHead   = 1;
                femaleHead = 1;
                break;

            case RacialType.Bothan:
                skinColor  = 6;
                hairColor  = 1;
                appearance = AppearanceType.Elf;
                maleHead   = 40;
                femaleHead = 109;
                break;

            case RacialType.Chiss:
                skinColor  = 137;
                hairColor  = 134;
                maleHead   = 33;
                femaleHead = 191;
                break;

            case RacialType.Zabrak:
                skinColor  = 88;
                hairColor  = 0;
                maleHead   = 103;
                femaleHead = 120;
                break;

            case RacialType.Twilek:
                skinColor  = 52;
                hairColor  = 0;
                maleHead   = 115;
                femaleHead = 145;
                break;

            case RacialType.Cyborg:
                skinColor  = 2;
                hairColor  = 0;
                maleHead   = 168;
                femaleHead = 41;
                break;

            case RacialType.Mirialan:
                skinColor  = 38;
                hairColor  = 3;
                maleHead   = 20;
                femaleHead = 1;
                break;

            case RacialType.Echani:
                skinColor  = 164;
                hairColor  = 16;
                maleHead   = 182;
                femaleHead = 45;
                break;

            case RacialType.Cathar:
                skinColor  = 54;
                hairColor  = 0;
                appearance = AppearanceType.HalfOrc;
                maleHead   = 27;
                femaleHead = 18;
                break;

            case RacialType.Trandoshan:
                skinColor        = 39;
                hairColor        = 4;
                maleHead         = 162;
                femaleHead       = 135;
                maleNeck         = 201;
                maleTorso        = 201;
                malePelvis       = 201;
                maleRightBicep   = 201;
                maleRightForearm = 201;
                maleRightHand    = 201;
                maleRightThigh   = 201;
                maleRightShin    = 201;
                maleRightFoot    = 201;
                maleLeftBicep    = 201;
                maleLeftForearm  = 201;
                maleLeftHand     = 201;
                maleLeftThigh    = 201;
                maleLeftShin     = 201;
                maleLeftFoot     = 201;

                femaleNeck         = 201;
                femaleTorso        = 201;
                femalePelvis       = 201;
                femaleRightBicep   = 201;
                femaleRightForearm = 201;
                femaleRightHand    = 201;
                femaleRightThigh   = 201;
                femaleRightShin    = 201;
                femaleRightFoot    = 201;
                femaleLeftBicep    = 201;
                femaleLeftForearm  = 201;
                femaleLeftHand     = 201;
                femaleLeftThigh    = 201;
                femaleLeftShin     = 201;
                femaleLeftFoot     = 201;

                break;

            case RacialType.Wookiee:

                appearance       = AppearanceType.Elf;
                skinColor        = 0;
                hairColor        = 0;
                maleHead         = 192;
                femaleHead       = 110;
                maleNeck         = 1;
                maleTorso        = 208;
                malePelvis       = 208;
                maleRightBicep   = 208;
                maleRightForearm = 208;
                maleRightHand    = 208;
                maleRightThigh   = 208;
                maleRightShin    = 208;
                maleRightFoot    = 208;
                maleLeftBicep    = 208;
                maleLeftForearm  = 208;
                maleLeftHand     = 208;
                maleLeftThigh    = 208;
                maleLeftShin     = 208;
                maleLeftFoot     = 208;

                femaleNeck         = 1;
                femaleTorso        = 208;
                femalePelvis       = 208;
                femaleRightBicep   = 208;
                femaleRightForearm = 208;
                femaleRightHand    = 208;
                femaleRightThigh   = 208;
                femaleRightShin    = 208;
                femaleRightFoot    = 208;
                femaleLeftBicep    = 208;
                femaleLeftForearm  = 208;
                femaleLeftHand     = 208;
                femaleLeftThigh    = 208;
                femaleLeftShin     = 208;
                femaleLeftFoot     = 208;

                break;

            case RacialType.MonCalamari:
                skinColor = 6;
                hairColor = 7;

                maleHead         = 6;
                femaleHead       = 6;
                maleNeck         = 1;
                maleTorso        = 204;
                malePelvis       = 204;
                maleRightBicep   = 204;
                maleRightForearm = 204;
                maleRightHand    = 204;
                maleRightThigh   = 204;
                maleRightShin    = 204;
                maleRightFoot    = 204;
                maleLeftBicep    = 204;
                maleLeftForearm  = 204;
                maleLeftHand     = 204;
                maleLeftThigh    = 204;
                maleLeftShin     = 204;
                maleLeftFoot     = 204;

                femaleNeck         = 1;
                femaleTorso        = 204;
                femalePelvis       = 204;
                femaleRightBicep   = 204;
                femaleRightForearm = 204;
                femaleRightHand    = 204;
                femaleRightThigh   = 204;
                femaleRightShin    = 204;
                femaleRightFoot    = 204;
                femaleLeftBicep    = 204;
                femaleLeftForearm  = 204;
                femaleLeftHand     = 204;
                femaleLeftThigh    = 204;
                femaleLeftShin     = 204;
                femaleLeftFoot     = 204;
                break;

            case RacialType.Ugnaught:

                appearance       = AppearanceType.Dwarf;
                skinColor        = 0;
                hairColor        = 0;
                maleHead         = 100;
                femaleHead       = 100;
                maleNeck         = 1;
                maleTorso        = 1;
                malePelvis       = 7;
                maleRightBicep   = 1;
                maleRightForearm = 1;
                maleRightHand    = 1;
                maleRightThigh   = 1;
                maleRightShin    = 1;
                maleRightFoot    = 1;
                maleLeftBicep    = 1;
                maleLeftForearm  = 1;
                maleLeftHand     = 1;
                maleLeftThigh    = 1;
                maleLeftShin     = 1;
                maleLeftFoot     = 1;

                femaleNeck         = 1;
                femaleTorso        = 54;
                femalePelvis       = 70;
                femaleRightBicep   = 1;
                femaleRightForearm = 1;
                femaleRightHand    = 1;
                femaleRightThigh   = 1;
                femaleRightShin    = 1;
                femaleRightFoot    = 1;
                femaleLeftBicep    = 1;
                femaleLeftForearm  = 1;
                femaleLeftHand     = 1;
                femaleLeftThigh    = 1;
                femaleLeftShin     = 1;
                femaleLeftFoot     = 1;
                break;

            default:
            {
                _.BootPC(player, "You have selected an invalid race. This could be due to files in your override folder. Ensure these are removed from the folder and then try creating a new character. If you have any problems, visit our website at http://starwarsnwn.com");
                return;
            }
            }
            _.SetCreatureAppearanceType(player, appearance);
            _.SetColor(player, ColorChannel.Skin, skinColor);
            _.SetColor(player, ColorChannel.Hair, hairColor);

            if (gender == Gender.Male)
            {
                _.SetCreatureBodyPart(CreaturePart.Head, maleHead, player);

                _.SetCreatureBodyPart(CreaturePart.Neck, maleNeck, player);
                _.SetCreatureBodyPart(CreaturePart.Torso, maleTorso, player);
                _.SetCreatureBodyPart(CreaturePart.Pelvis, malePelvis, player);

                _.SetCreatureBodyPart(CreaturePart.RightBicep, maleRightBicep, player);
                _.SetCreatureBodyPart(CreaturePart.RightForearm, maleRightForearm, player);
                _.SetCreatureBodyPart(CreaturePart.RightHand, maleRightHand, player);
                _.SetCreatureBodyPart(CreaturePart.RightThigh, maleRightThigh, player);
                _.SetCreatureBodyPart(CreaturePart.RightShin, maleRightShin, player);
                _.SetCreatureBodyPart(CreaturePart.RightFoot, maleRightFoot, player);
                _.SetCreatureBodyPart(CreaturePart.LeftBicep, maleLeftBicep, player);
                _.SetCreatureBodyPart(CreaturePart.LeftForearm, maleLeftForearm, player);
                _.SetCreatureBodyPart(CreaturePart.LeftHand, maleLeftHand, player);
                _.SetCreatureBodyPart(CreaturePart.LeftThigh, maleLeftThigh, player);
                _.SetCreatureBodyPart(CreaturePart.LeftShin, maleLeftShin, player);
                _.SetCreatureBodyPart(CreaturePart.LeftFoot, maleLeftFoot, player);
            }
            else if (gender == Gender.Female)
            {
                _.SetCreatureBodyPart(CreaturePart.Head, femaleHead, player);

                _.SetCreatureBodyPart(CreaturePart.Neck, femaleNeck, player);
                _.SetCreatureBodyPart(CreaturePart.Torso, femaleTorso, player);
                _.SetCreatureBodyPart(CreaturePart.Pelvis, femalePelvis, player);

                _.SetCreatureBodyPart(CreaturePart.RightBicep, femaleRightBicep, player);
                _.SetCreatureBodyPart(CreaturePart.RightForearm, femaleRightForearm, player);
                _.SetCreatureBodyPart(CreaturePart.RightHand, femaleRightHand, player);
                _.SetCreatureBodyPart(CreaturePart.RightThigh, femaleRightThigh, player);
                _.SetCreatureBodyPart(CreaturePart.RightShin, femaleRightShin, player);
                _.SetCreatureBodyPart(CreaturePart.RightFoot, femaleRightFoot, player);
                _.SetCreatureBodyPart(CreaturePart.LeftBicep, femaleLeftBicep, player);
                _.SetCreatureBodyPart(CreaturePart.LeftForearm, femaleLeftForearm, player);
                _.SetCreatureBodyPart(CreaturePart.LeftHand, femaleLeftHand, player);
                _.SetCreatureBodyPart(CreaturePart.LeftThigh, femaleLeftThigh, player);
                _.SetCreatureBodyPart(CreaturePart.LeftShin, femaleLeftShin, player);
                _.SetCreatureBodyPart(CreaturePart.LeftFoot, femaleLeftFoot, player);
            }
        }