Ejemplo n.º 1
0
        public void InitializePlayerLanguages(NWPlayer player)
        {
            CustomRaceType race      = (CustomRaceType)player.RacialType;
            var            languages = new List <SkillType>(new[] { SkillType.Basic });

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

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

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

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

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

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

            case CustomRaceType.Trandoshan:
                languages.Add(SkillType.Dosh);
                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.
            var pcSkills = _data.Where <PCSkill>
                               (x => x.PlayerID == player.GlobalID &&
                               languages.Contains((SkillType)x.SkillID))
                           .ToList();

            foreach (var pcSkill in pcSkills)
            {
                var skill    = _data.Get <Skill>(pcSkill.SkillID);
                int maxRank  = skill.MaxRank;
                int skillID  = skill.ID;
                var xpRecord = _data.Single <SkillXPRequirement>(x => x.SkillID == skillID && x.Rank == maxRank);

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

                _data.SubmitDataChange(pcSkill, DatabaseActionType.Update);
            }
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            CustomRaceType race     = (CustomRaceType)GetPC().RacialType;
            string         hairText = "Hair";

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

            SetResponseText("MainPage", 4, "Change " + hairText);
        }
Ejemplo n.º 3
0
        private static void OnModuleEnter()
        {
            NWPlayer player = _.GetEnteringObject();

            if (!player.IsPlayer)
            {
                return;
            }

            CustomRaceType race = (CustomRaceType)player.RacialType;

            if (race == CustomRaceType.Wookiee)
            {
                _.SetObjectVisualTransform(player, OBJECT_VISUAL_TRANSFORM_SCALE, 1.2f);
            }
        }
        public override void Initialize()
        {
            CustomRaceType race     = (CustomRaceType)GetPC().RacialType;
            string         hairText = "Hair";

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

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

            // Skin color can't change for Wookiees. Disable the option.
            if (race == CustomRaceType.Wookiee)
            {
                SetResponseVisible("MainPage", 2, false);
            }
        }
Ejemplo n.º 5
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            string         command = args[0].ToLower();
            CustomRaceType race    = (CustomRaceType)user.RacialType;

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

                foreach (SkillType language in LanguageService.GetLanguages())
                {
                    commands.Add($"{language.ToString()}: Sets the active language to {language.ToString()}.");
                }

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

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

            foreach (SkillType language in LanguageService.GetLanguages())
            {
                if (language.ToString().ToLower() == command)
                {
                    LanguageService.SetActiveLanguage(user, language);
                    user.SendMessage($"Set active language to {language.ToString()}.");
                    return;
                }
            }

            user.SendMessage(ColorTokenService.Red($"Unknown language {command}."));
        }
Ejemplo n.º 6
0
        private static void OnModuleNWNXChat()
        {
            ChatChannelType channel = (ChatChannelType)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 == ChatChannelType.PlayerTalk ||
                channel == ChatChannelType.PlayerWhisper ||
                channel == ChatChannelType.PlayerParty ||
                channel == ChatChannelType.PlayerShout;

            bool messageToDm = channel == ChatChannelType.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 == ChatChannelType.PlayerDM)
            {
                // Simply echo the message back to the player.
                NWNXChat.SendMessage((int)ChatChannelType.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 == ChatChannelType.PlayerShout && sender.IsPC &&
                sender.GetLocalInt("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 == ChatChannelType.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 == ChatChannelType.PlayerShout)
            {
                recipients.AddRange(NWModule.Get().Players.Where(player => player.GetLocalInt("DISPLAY_HOLONET") == TRUE));
                recipients.AddRange(AppCache.ConnectedDMs);
            }
            // This is the normal party chat, plus everyone within 20 units of the sender.
            else if (channel == ChatChannelType.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 == ChatChannelType.PlayerTalk)
            {
                needsAreaCheck = true;
                distanceCheck  = 20.0f;
            }
            // Whisper - 4 units.
            else if (channel == ChatChannelType.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 == ChatChannelType.PlayerShout)
                {
                    finalMessage.Append("[Holonet] ");
                }
                else if (channel == ChatChannelType.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(" } ");
                    }
                }

                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.
                CustomRaceType race = (CustomRaceType)_.GetRacialType(sender);
                if (race == CustomRaceType.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.

                ChatChannelType finalChannel = channel;

                if (channel == ChatChannelType.PlayerShout || channel == ChatChannelType.PlayerParty)
                {
                    finalChannel = ChatChannelType.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 == ChatChannelType.PlayerShout)
                {
                    finalMessageColoured = ColorTokenService.Custom(finalMessageColoured, 0, 180, 255);
                }
                else if (channel == ChatChannelType.PlayerParty)
                {
                    finalMessageColoured = ColorTokenService.Orange(finalMessageColoured);
                }

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

            MessageHub.Instance.Publish(new OnChatProcessed(sender, channel, isOOC));
        }
Ejemplo n.º 7
0
        private void ChangeBodyPartResponses(int responseID)
        {
            var            model = GetDialogCustomData <Model>();
            CustomRaceType race  = (CustomRaceType)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 = CREATURE_PART_TORSO;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208, 209 };
                    break;

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

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

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

                case CustomRaceType.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 = CREATURE_PART_RIGHT_BICEP;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

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

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

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

                case CustomRaceType.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 = CREATURE_PART_RIGHT_HAND;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case CustomRaceType.MonCalamari:
                    model.Parts = new[] { 204 };
                    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 = CREATURE_PART_RIGHT_THIGH;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case CustomRaceType.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 = CREATURE_PART_RIGHT_SHIN;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

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

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

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

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

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

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

                case CustomRaceType.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 = CREATURE_PART_LEFT_HAND;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case CustomRaceType.MonCalamari:
                    model.Parts = new[] { 204 };
                    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 = CREATURE_PART_LEFT_THIGH;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

                case CustomRaceType.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 = CREATURE_PART_LEFT_SHIN;
                switch (race)
                {
                case CustomRaceType.Wookiee:
                    model.Parts = new[] { 208 };
                    break;

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

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

            LoadEditPartPage();
            ChangePage("EditPartPage");
        }
Ejemplo n.º 8
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 };

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

            int[] colorsToUse;

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

            case CustomRaceType.Bothan:
                colorsToUse = BothanHairColors;
                break;

            case CustomRaceType.Chiss:
                colorsToUse = ChissHairColors;
                break;

            case CustomRaceType.Zabrak:
                colorsToUse = ZabrakHairColors;
                break;

            case CustomRaceType.Twilek:
                colorsToUse = TwilekHairColors;
                break;

            case CustomRaceType.Mirialan:
                colorsToUse = MirialanHairColors;
                break;

            case CustomRaceType.Echani:
                colorsToUse = EchaniHairColors;
                break;

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

            case CustomRaceType.Cathar:
                colorsToUse = CatharHairColors;
                break;

            case CustomRaceType.Trandoshan:
                colorsToUse = TrandoshanEyeColors;
                break;

            case CustomRaceType.Wookiee:
                colorsToUse = WookieeHairColors;
                break;

            case CustomRaceType.MonCalamari:
                colorsToUse = MonCalamariHairColors;
                break;

            case CustomRaceType.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.º 9
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, 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, 231 };
            int[] MaleBothanHeads      = { 40, 41, 43, };
            int[] MaleChissHeads       = { };
            int[] MaleZabrakHeads      = { 103, };
            int[] MaleTwilekHeads      = { 115, };
            int[] MaleMirialanHeads    = { };
            int[] MaleEchaniHeads      = { };
            int[] MaleCyborgHeads      = { 74, 88, 156, 168, 181, 187 };
            int[] MaleCatharHeads      = { 26, 27, 28, 29, };
            int[] MaleTrandoshanHeads  = { 2, 101, 111, 123, 124, 125, 143, 162 };
            int[] MaleWookieeHeads     = { 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[] 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, 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, 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 };
            int[] FemaleBothanHeads      = { 109, 162, };
            int[] FemaleChissHeads       = { };
            int[] FemaleZabrakHeads      = { 38, 120 };
            int[] FemaleTwilekHeads      = { 139, 144, 145, };
            int[] FemaleMirialanHeads    = { };
            int[] FemaleEchaniHeads      = { };
            int[] FemaleCyborgHeads      = { 41, 109 };
            int[] FemaleCatharHeads      = { 13, 14 };
            int[] FemaleTrandoshanHeads  = { 24, 126, 128, 135, 150, 157 };
            int[] FemaleWookieeHeads     = { 110, 185, 186, 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 };

            CustomRaceType race   = (CustomRaceType)GetPC().RacialType;
            int            gender = GetPC().Gender;

            int[] headsToUse;

            switch (race)
            {
            case CustomRaceType.Human:
                headsToUse = gender == GENDER_MALE ? MaleHumanHeads : FemaleHumanHeads;
                break;

            case CustomRaceType.Bothan:
                headsToUse = gender == GENDER_MALE ? MaleBothanHeads : FemaleBothanHeads;
                break;

            case CustomRaceType.Chiss:
                headsToUse = gender == GENDER_MALE?
                             MaleChissHeads.Concat(MaleHumanHeads).ToArray() :
                                 FemaleChissHeads.Concat(FemaleHumanHeads).ToArray();

                break;

            case CustomRaceType.Zabrak:
                headsToUse = gender == GENDER_MALE ? MaleZabrakHeads : FemaleZabrakHeads;
                break;

            case CustomRaceType.Twilek:
                headsToUse = gender == GENDER_MALE ? MaleTwilekHeads : FemaleTwilekHeads;
                break;

            case CustomRaceType.Mirialan:
                headsToUse = gender == GENDER_MALE?
                             MaleMirialanHeads.Concat(MaleHumanHeads).ToArray() :
                                 FemaleMirialanHeads.Concat(FemaleHumanHeads).ToArray();

                break;

            case CustomRaceType.Echani:
                headsToUse = gender == GENDER_MALE?
                             MaleEchaniHeads.Concat(MaleHumanHeads).ToArray() :
                                 FemaleEchaniHeads.Concat(FemaleHumanHeads).ToArray();

                break;

            case CustomRaceType.Cyborg:
                headsToUse = gender == GENDER_MALE?
                             MaleCyborgHeads.Concat(MaleHumanHeads).ToArray() :
                                 FemaleCyborgHeads.Concat(FemaleHumanHeads).ToArray();

                break;

            case CustomRaceType.Cathar:
                headsToUse = gender == GENDER_MALE ? MaleCatharHeads : FemaleCatharHeads;
                break;

            case CustomRaceType.Trandoshan:
                headsToUse = gender == GENDER_MALE ? MaleTrandoshanHeads : FemaleTrandoshanHeads;
                break;

            case CustomRaceType.Wookiee:
                headsToUse = gender == GENDER_MALE ? MaleWookieeHeads : FemaleWookieeHeads;
                break;

            case CustomRaceType.MonCalamari:
                headsToUse = gender == GENDER_MALE ? MaleMonCalamariHeads : FemaleMonCalamariHeads;
                break;

            case CustomRaceType.Ugnaught:
                headsToUse = gender == GENDER_MALE ? MaleUgnaughtHeads : FemaleUgnaughtHeads;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

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

            // 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, 10, 11 };
            int[] BothanSkinColors      = { 6, 7, 10, 11, 117, 118, 119, 130, 131 };
            int[] ChissSkinColors       = { 48, 49, 50, 51, 22, 136, 137, 138, 139, 140, 141, 142, 143 };
            int[] ZabrakSkinColors      = { 0, 1, 2, 3, 88, 89, 90, 91, 102, 103 };
            int[] TwilekSkinColors      = { 0, 1, 2, 3, 4, 5, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 88, 89, 90, 91, 96, 97, 98, 99, 140, 141, 142, 143 };
            int[] CyborgSkinColors      = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 17, 18, 19 };
            int[] CatharSkinColors      = { 6, 7, 10, 11, 117, 118, 119, 130, 131 };
            int[] TrandoshanSkinColors  = { 4, 5, 6, 18, 19, 34, 35, 36, 38, 39, 172 };
            int[] MirialanSkinColors    = { 33, 34, 36, 37, 38, 52, 53, 54, 55, 93, 94 };
            int[] EchaniSkinColors      = { 16, 20, 40, 164 };
            int[] MonCalamariSkinColors =
            {
                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,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  60,  64,  65,  66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
                80, 81, 82, 83, 84, 85, 86, 87, 94, 95, 97, 98, 99, 105, 106, 107, 109, 110, 111, 113, 114, 115, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 129, 130, 131, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 151, 153, 155, 157, 158, 159, 160, 161, 162, 165, 171, 172, 175
            };
            int[] UgnaughtSkinColors = { 0, 1, 2, 3, 4, 5, 10, 12, 13, 14, 116, 117 };

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

            int[] colorsToUse;

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

            case CustomRaceType.Bothan:
                colorsToUse = BothanSkinColors;
                break;

            case CustomRaceType.Chiss:
                colorsToUse = ChissSkinColors;
                break;

            case CustomRaceType.Zabrak:
                colorsToUse = ZabrakSkinColors;
                break;

            case CustomRaceType.Twilek:
                colorsToUse = TwilekSkinColors;
                break;

            case CustomRaceType.Mirialan:
                colorsToUse = MirialanSkinColors;
                break;

            case CustomRaceType.Echani:
                colorsToUse = EchaniSkinColors;
                break;

            case CustomRaceType.Cyborg:
                colorsToUse = CyborgSkinColors;
                break;

            case CustomRaceType.Cathar:
                colorsToUse = CatharSkinColors;
                break;

            case CustomRaceType.Trandoshan:
                colorsToUse = TrandoshanSkinColors;
                break;

            case CustomRaceType.MonCalamari:
                colorsToUse = MonCalamariSkinColors;
                break;

            case CustomRaceType.Ugnaught:
                colorsToUse = UgnaughtSkinColors;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Array.Sort(colorsToUse);
            foreach (var color in colorsToUse)
            {
                AddResponseToPage("ChangeSkinColorPage", "Color #" + color, true, color);
            }
        }
Ejemplo n.º 11
0
        public static void InitializePlayerLanguages(NWPlayer player)
        {
            CustomRaceType race       = (CustomRaceType)player.RacialType;
            BackgroundType background = (BackgroundType)player.Class1;
            var            languages  = new List <SkillType>(new[] { SkillType.Basic });

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

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

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

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

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

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

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

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

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

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

            case CustomRaceType.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
        public static void ApplyDefaultAppearance(NWPlayer player)
        {
            CustomRaceType race = (CustomRaceType)player.RacialType;
            int            maleHead;
            int            femaleHead;
            int            skinColor;
            int            hairColor;
            int            gender     = player.Gender;
            int            appearance = APPEARANCE_TYPE_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 CustomRaceType.Human:
                skinColor  = 2;
                hairColor  = 0;
                maleHead   = 1;
                femaleHead = 1;
                break;

            case CustomRaceType.Bothan:
                skinColor  = 6;
                hairColor  = 1;
                appearance = APPEARANCE_TYPE_ELF;
                maleHead   = 40;
                femaleHead = 109;
                break;

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

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

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

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

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

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

            case CustomRaceType.Cathar:
                skinColor  = 54;
                hairColor  = 0;
                appearance = APPEARANCE_TYPE_HALF_ORC;
                maleHead   = 27;
                femaleHead = 18;
                break;

            case CustomRaceType.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 CustomRaceType.Wookiee:

                appearance       = APPEARANCE_TYPE_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 CustomRaceType.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 CustomRaceType.Ugnaught:

                appearance       = APPEARANCE_TYPE_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, COLOR_CHANNEL_SKIN, skinColor);
            _.SetColor(player, COLOR_CHANNEL_HAIR, hairColor);

            if (gender == GENDER_MALE)
            {
                _.SetCreatureBodyPart(CREATURE_PART_HEAD, maleHead, player);

                _.SetCreatureBodyPart(CREATURE_PART_NECK, maleNeck, player);
                _.SetCreatureBodyPart(CREATURE_PART_TORSO, maleTorso, player);
                _.SetCreatureBodyPart(CREATURE_PART_PELVIS, malePelvis, player);

                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_BICEP, maleRightBicep, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_FOREARM, maleRightForearm, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_HAND, maleRightHand, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_THIGH, maleRightThigh, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_SHIN, maleRightShin, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_FOOT, maleRightFoot, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_BICEP, maleLeftBicep, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_FOREARM, maleLeftForearm, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_HAND, maleLeftHand, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_THIGH, maleLeftThigh, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_SHIN, maleLeftShin, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_FOOT, maleLeftFoot, player);
            }
            else if (gender == GENDER_FEMALE)
            {
                _.SetCreatureBodyPart(CREATURE_PART_HEAD, femaleHead, player);

                _.SetCreatureBodyPart(CREATURE_PART_NECK, femaleNeck, player);
                _.SetCreatureBodyPart(CREATURE_PART_TORSO, femaleTorso, player);
                _.SetCreatureBodyPart(CREATURE_PART_PELVIS, femalePelvis, player);

                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_BICEP, femaleRightBicep, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_FOREARM, femaleRightForearm, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_HAND, femaleRightHand, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_THIGH, femaleRightThigh, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_SHIN, femaleRightShin, player);
                _.SetCreatureBodyPart(CREATURE_PART_RIGHT_FOOT, femaleRightFoot, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_BICEP, femaleLeftBicep, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_FOREARM, femaleLeftForearm, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_HAND, femaleLeftHand, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_THIGH, femaleLeftThigh, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_SHIN, femaleLeftShin, player);
                _.SetCreatureBodyPart(CREATURE_PART_LEFT_FOOT, femaleLeftFoot, player);
            }
        }
Ejemplo n.º 13
0
        private Player CreateDBPCEntity(NWPlayer player)
        {
            CustomRaceType  race = (CustomRaceType)player.RacialType;
            AssociationType assType;
            int             goodEvil = _.GetAlignmentGoodEvil(player);
            int             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 == CustomRaceType.Human)
            {
                sp++;
            }

            Player entity = new Player
            {
                ID                                = player.GlobalID,
                CharacterName                     = player.Name,
                HitPoints                         = player.CurrentHP,
                LocationAreaResref                = _.GetResRef(_.GetAreaFromLocation(player.Location)),
                LocationX                         = player.Position.m_X,
                LocationY                         = player.Position.m_Y,
                LocationZ                         = player.Position.m_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, ABILITY_STRENGTH),
                DEXBase                           = _nwnxCreature.GetRawAbilityScore(player, ABILITY_DEXTERITY),
                CONBase                           = _nwnxCreature.GetRawAbilityScore(player, ABILITY_CONSTITUTION),
                INTBase                           = _nwnxCreature.GetRawAbilityScore(player, ABILITY_INTELLIGENCE),
                WISBase                           = _nwnxCreature.GetRawAbilityScore(player, ABILITY_WISDOM),
                CHABase                           = _nwnxCreature.GetRawAbilityScore(player, ABILITY_CHARISMA),
                TotalSPAcquired                   = 0,
                DisplayHelmet                     = true,
                PrimaryResidencePCBaseStructureID = null,
                PrimaryResidencePCBaseID          = null,
                AssociationID                     = (int)assType,
                DisplayHolonet                    = true,
                DisplayDiscord                    = true,
                XPBonus                           = 0,
                LeaseRate                         = 0
            };

            return(entity);
        }
Ejemplo n.º 14
0
        private void LoadSkinColorPage()
        {
            ClearPageResponses("ChangeSkinColorPage");

            // 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, 10, 11 };
            int[] BothanSkinColors     = { 6, 7, 10, 11, 117, 118, 119, 130, 131 };
            int[] ChissSkinColors      = { 48, 49, 50, 51, 22, 136, 137, 138, 139, 140, 141, 142, 143 };
            int[] ZabrakSkinColors     = { 0, 1, 2, 3, 88, 89, 90, 91, 102, 103 };
            int[] TwilekSkinColors     = { 0, 1, 2, 3, 4, 5, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 88, 89, 90, 91, 96, 97, 98, 99, 140, 141, 142, 143 };
            int[] CyborgSkinColors     = { 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 17, 18, 19 };
            int[] CatharSkinColors     = { 6, 7, 10, 11, 117, 118, 119, 130, 131 };
            int[] TrandoshanSkinColors = { 4, 5, 6, 18, 19, 34, 35, 36, 38, 39, 172 };

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

            int[] colorsToUse;

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

            case CustomRaceType.Bothan:
                colorsToUse = BothanSkinColors;
                break;

            case CustomRaceType.Chiss:
                colorsToUse = ChissSkinColors;
                break;

            case CustomRaceType.Zabrak:
                colorsToUse = ZabrakSkinColors;
                break;

            case CustomRaceType.Twilek:
                colorsToUse = TwilekSkinColors;
                break;

            case CustomRaceType.Cyborg:
                colorsToUse = CyborgSkinColors;
                break;

            case CustomRaceType.Cathar:
                colorsToUse = CatharSkinColors;
                break;

            case CustomRaceType.Trandoshan:
                colorsToUse = TrandoshanSkinColors;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Array.Sort(colorsToUse);
            foreach (var color in colorsToUse)
            {
                AddResponseToPage("ChangeSkinColorPage", "Color #" + color, true, color);
            }
        }