Пример #1
0
        public override void Apply(GameEventOwner owner, Character ownerChar, Character character)
        {
            MonsterID proxy = ((StatusEffect)owner).StatusStates.GetWithDefault <MonsterIDState>().MonID;

            character.ProxySprite = proxy;
            character.ProxyName   = Character.GetFullFormName(character.Appearance);
        }
Пример #2
0
 /// <summary>
 /// Clears the current speaker, so none is displayed the next time TextDialogue is called!
 /// </summary>
 public void ResetSpeaker(bool keysound = true)
 {
     m_curspeakerID   = MonsterID.Invalid;
     m_curspeakerName = null;
     m_curspeakerEmo  = new EmoteStyle(0);
     m_curspeakerSnd  = keysound;
 }
Пример #3
0
 /// <summary>
 /// Sets the speaker to be displayed during the following calls to the TextDialogue functions.  It resets speaker emotion.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="keysound"></param>
 /// <param name="specie"></param>
 /// <param name="form"></param>
 /// <param name="skin"></param>
 /// <param name="gender"></param>
 public void SetSpeaker(string name, bool keysound, int specie, int form, int skin, Gender gender)
 {
     m_curspeakerID        = new MonsterID(specie, form, skin, gender);
     m_curspeakerName      = name;
     m_curspeakerEmo.Emote = 0;
     m_curspeakerSnd       = keysound;
 }
Пример #4
0
        //extra spawn event
        //items
        //status problems
        //special statuses
        //stat changes

        public MobSpawn()
        {
            BaseForm        = new MonsterID(0, 0, -1, Gender.Unknown);
            SpecifiedSkills = new List <int>();
            Intrinsic       = -1;
            SpawnFeatures   = new List <MobSpawnExtra>();
        }
Пример #5
0
 public void Begin(MonsterID appearance)
 {
     AnimRushTime   = GraphicsManager.GetChara(appearance).GetRushTime(AnimFrameType, CharDir);
     AnimHitTime    = GraphicsManager.GetChara(appearance).GetHitTime(AnimFrameType, CharDir);
     AnimReturnTime = GraphicsManager.GetChara(appearance).GetReturnTime(AnimFrameType, CharDir);
     AnimTotalTime  = GraphicsManager.GetChara(appearance).GetTotalTime(AnimFrameType, CharDir);
 }
Пример #6
0
        public QuestionDialog CreateMultiQuestion(MonsterID speaker, string speakerName, EmoteStyle emotion,
                                                  string msg, bool sound, DialogueChoice[] choices, int defaultChoice, int cancelChoice)
        {
            QuestionDialog box = new QuestionDialog(msg, sound, choices, defaultChoice, cancelChoice);

            box.SetSpeaker(speaker, speakerName, emotion);
            return(box);
        }
Пример #7
0
        public SpeakerPortrait(MonsterID speaker, EmoteStyle emotion, Loc loc, bool bordered)
        {
            Speaker        = speaker;
            SpeakerEmotion = emotion;
            Bordered       = bordered;

            Loc = loc;
        }
Пример #8
0
 public void SetPortrait(MonsterID speaker, EmoteStyle emotion)
 {
     if (speaker.IsValid())
     {
         Loc loc = new Loc(DialogueBox.SIDE_BUFFER, Bounds.Y - 56);
         speakerPic = new SpeakerPortrait(speaker, emotion, loc, true);
     }
 }
Пример #9
0
 public Monster(MonsterID id, string name, string pluralName, int size, int level, int maxHealthPoints, int ivHealthPoints, int strength, int ivStrength, int resistance,
                int ivResistance, int intelligence, int ivIntelligence, int mind, int ivMind, int speed, int ivSpeed, int luck) :
     base(name, level, maxHealthPoints, ivHealthPoints, strength, ivStrength, resistance, ivResistance, intelligence, ivIntelligence,
          mind, ivMind, speed, ivSpeed, luck)
 {
     ID         = id;
     PluralName = pluralName;
     Size       = size;
 }
Пример #10
0
        public void GetCurrentSprite(out MonsterID currentForm, out Loc currentOffset, out int currentHeight, out int currentAnim, out int currentTime, out int currentFrame)
        {
            currentForm   = CurrentForm;
            currentOffset = drawOffset;
            currentHeight = LocHeight;
            CharSheet sheet = GraphicsManager.GetChara(CurrentForm);

            currentCharAction.GetCurrentSprite(sheet, out currentAnim, out currentTime, out currentFrame);
        }
Пример #11
0
 public Monster(MonsterID id, string name, int maximumDamage, int rewardExperiencePoints, int rewardGold,
                int currentHitPoints, int maximumHitPoints) : base(currentHitPoints, maximumHitPoints)
 {
     ID         = id;
     Name       = name;
     MaxDamage  = maximumDamage;
     RewardXp   = rewardExperiencePoints;
     RewardGold = rewardGold;
     LootTable  = new List <LootItem>();
 }
Пример #12
0
        public QuestionDialog CreateQuestion(MonsterID speaker, string speakerName, EmoteStyle emotion,
                                             string msg, bool sound, Action yes, Action no, bool defaultNo)
        {
            DialogueChoice[] choices = new DialogueChoice[2];
            choices[0] = new DialogueChoice(Text.FormatKey("DLG_CHOICE_YES"), yes);
            choices[1] = new DialogueChoice(Text.FormatKey("DLG_CHOICE_NO"), no);

            QuestionDialog box = new QuestionDialog(msg, sound, choices, defaultNo ? 1 : 0, 1);

            box.SetSpeaker(speaker, speakerName, emotion);
            return(box);
        }
Пример #13
0
 protected MobSpawn(MobSpawn other) : this()
 {
     BaseForm = other.BaseForm;
     Tactic   = other.Tactic;
     Level    = other.Level;
     SpecifiedSkills.AddRange(other.SpecifiedSkills);
     Intrinsic = other.Intrinsic;
     foreach (MobSpawnExtra extra in other.SpawnFeatures)
     {
         SpawnFeatures.Add(extra.Copy());
     }
 }
Пример #14
0
        protected Character SpawnBase(Team team, IMobSpawnMap map)
        {
            MonsterID   formData = BaseForm;
            MonsterData dex      = DataManager.Instance.GetMonster(formData.Species);

            if (formData.Form == -1)
            {
                int form = map.Rand.Next(dex.Forms.Count);
                formData.Form = form;
            }

            BaseMonsterForm formEntry = dex.Forms[formData.Form];

            if (formData.Gender == Gender.Unknown)
            {
                formData.Gender = formEntry.RollGender(map.Rand);
            }

            if (formData.Skin == -1)
            {
                formData.Skin = formEntry.RollSkin(map.Rand);
            }

            CharData character = new CharData();

            character.BaseForm = formData;
            character.Level    = Level.Pick(map.Rand);

            List <int> final_skills = formEntry.RollLatestSkills(character.Level, SpecifiedSkills);

            for (int ii = 0; ii < final_skills.Count; ii++)
            {
                character.BaseSkills[ii] = new SlotSkill(final_skills[ii]);
            }

            if (Intrinsic == -1)
            {
                character.BaseIntrinsics[0] = formEntry.RollIntrinsic(map.Rand, 2);
            }
            else
            {
                character.BaseIntrinsics[0] = Intrinsic;
            }

            character.Discriminator = map.Rand.Next();

            Character new_mob = new Character(character, team);

            team.Players.Add(new_mob);

            return(new_mob);
        }
Пример #15
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            TreeNode node = tvForms.SelectedNode;

            if (node == null)
            {
                MessageBox.Show("No item selected to import to.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //get current sprite
            MonsterID formdata = (MonsterID)node.Tag;

            if (node.ImageIndex != 0)
            {
                if (MessageBox.Show("Are you sure you want to overwrite the existing sheet:\n" + GetFormString(formdata), "Sprite Sheet already exists.",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }

            //notify (once) that sprites need to follow a rigid guideline
            if (!notifiedImport)
            {
                MessageBox.Show("When importing sprites, " +
                                "make sure that all files in each folder adhere to the naming convention.", "Sprite Importing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                notifiedImport = true;
            }

            //remember addresses in registry
            string folderName = (string)Registry.GetValue(DiagManager.REG_PATH, checkSprites ? "SpriteDir" : "PortraitDir", "");

            if (String.IsNullOrEmpty(folderName))
            {
                folderName = Directory.GetCurrentDirectory();
            }

            //open window to choose directory

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.SelectedPath = folderName;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Registry.SetValue(DiagManager.REG_PATH, checkSprites ? "SpriteDir" : "PortraitDir", dialog.SelectedPath);
                cachedPath = dialog.SelectedPath + "/";
                cachedForm = formdata;
                Import(cachedPath, cachedForm);
            }
        }
Пример #16
0
 public DialogueBox CreateDialogue(MonsterID speaker, string speakerName, EmoteStyle emotion, bool sound, Action finishAction, int waitTime, params string[] msgs)
 {
     if (msgs.Length > 0)
     {
         DialogueBox box = null;
         for (int ii = msgs.Length - 1; ii >= 0; ii--)
         {
             DialogueBox prevBox = box;
             box = CreateBox(speaker, speakerName, emotion, sound, (prevBox == null) ? finishAction : () => { AddMenu(prevBox, false); }, waitTime, msgs[ii]);
         }
         return(box);
     }
     return(null);
 }
Пример #17
0
        public void SetSpeaker(MonsterID speaker, string speakerName, EmoteStyle emotion)
        {
            SetPortrait(speaker, emotion);

            if (!String.IsNullOrEmpty(speakerName))
            {
                Text.Text              = speakerName + ": " + Text.Text;
                Text.CurrentCharIndex += speakerName.Length + 2;
                foreach (TextPause pause in Pauses)
                {
                    pause.LetterIndex += speakerName.Length + 2;
                }
            }
        }
Пример #18
0
        public DialogueBox CreateBox(MonsterID speaker, string speakerName, EmoteStyle emotion, bool sound,
                                     Action finishAction, int waitTime, string msg)
        {
            DialogueBox box = null;

            if (waitTime > -1)
            {
                box = new TimedDialog(msg, sound, waitTime, finishAction);
            }
            else
            {
                box = new ClickedDialog(msg, sound, finishAction);
            }
            box.SetSpeaker(speaker, speakerName, emotion);
            return(box);
        }
Пример #19
0
        public void SetSpeaker(Character chara, bool keysound = true)
        {
            if (chara != null)
            {
                m_curspeakerID   = chara.CurrentForm;
                m_curspeakerName = chara.GetDisplayName(true);
            }
            else
            {
                DiagManager.Instance.LogInfo("ScriptUI.SetSpeaker(): The speaker was null!!");
                m_curspeakerID   = new MonsterID(0, 0, 0, Data.Gender.Unknown);
                m_curspeakerName = "NULL";
            }

            m_curspeakerEmo.Emote = 0;
            m_curspeakerSnd       = keysound;
        }
Пример #20
0
        private string GetFormString(MonsterID formdata)
        {
            string name = DataManager.Instance.GetMonster(formdata.Species).Name.ToLocal();

            if (formdata.Form > -1)
            {
                name += ", " + DataManager.Instance.GetMonster(formdata.Species).Forms[formdata.Form].FormName.ToLocal() + " form";
            }
            if (formdata.Skin > -1)
            {
                name += ", " + formdata.Skin + " skin";
            }
            if (formdata.Gender != Gender.Unknown)
            {
                name += ", " + formdata.Gender + " gender";
            }
            return(name);
        }
Пример #21
0
        public static MonsterID GetFallbackForm(CharaIndexNode guide, MonsterID data)
        {
            MonsterID fallback = MonsterID.Invalid;
            MonsterID buffer   = MonsterID.Invalid;

            if (guide.Nodes.ContainsKey(data.Species))
            {
                buffer.Species = data.Species;
                //if (guide.Nodes[data.Species].Position > 0)
                fallback = buffer;
                if (guide.Nodes[data.Species].Nodes.ContainsKey(data.Form))
                {
                    buffer.Form = data.Form;
                    if (guide.Nodes[data.Species].Nodes[data.Form].Position > 0)
                    {
                        fallback = buffer;
                    }
                    int trialSkin = data.Skin;
                    while (trialSkin > -1)
                    {
                        if (guide.Nodes[data.Species].Nodes[data.Form].Nodes.ContainsKey(trialSkin))
                        {
                            buffer.Skin = trialSkin;
                            if (guide.Nodes[data.Species].Nodes[data.Form].Nodes[trialSkin].Position > 0)
                            {
                                fallback = buffer;
                            }
                            if (guide.Nodes[data.Species].Nodes[data.Form].Nodes[trialSkin].Nodes.ContainsKey((int)data.Gender))
                            {
                                buffer.Gender = data.Gender;
                                if (guide.Nodes[data.Species].Nodes[data.Form].Nodes[trialSkin].Nodes[(int)data.Gender].Position > 0)
                                {
                                    fallback = buffer;
                                }
                            }
                            break;
                        }
                        trialSkin--;
                    }
                }
            }
            return(fallback);
        }
Пример #22
0
 private void LoadSpeciesFormData(Dictionary <MonsterID, byte[]> data, MonsterID formData)
 {
     using (MemoryStream stream = new MemoryStream())
     {
         using (BinaryWriter writer = new BinaryWriter(stream))
         {
             if (checkSprites)
             {
                 GraphicsManager.GetChara(formData).Save(writer);
             }
             else
             {
                 GraphicsManager.GetPortrait(formData).Save(writer);
             }
         }
         byte[] writingBytes = stream.ToArray();
         data[formData] = writingBytes;
     }
 }
Пример #23
0
        public void PromoteCharacter(Character character, PromoteBranch branch, int bypassItem)
        {
            MonsterData entry = DataManager.Instance.GetMonster(branch.Result);
            //exception item bypass
            bool      bypass  = character.EquippedItem.ID == bypassItem;
            MonsterID newData = character.BaseForm;

            newData.Species = branch.Result;
            if (newData.Form >= entry.Forms.Count)
            {
                newData.Form = 0;
            }
            character.Promote(newData);
            branch.OnPromote(character, false);
            //remove exception item if there is one...
            if (bypass)
            {
                character.DequipItem();
            }
        }
Пример #24
0
 public DialogueBox CreateDialogue(MonsterID speaker, string speakerName, EmoteStyle emotion, bool sound, Action finishAction, int waitTime, params string[] msgs)
 {
     if (msgs.Length > 0)
     {
         List <string> sep_msgs = new List <string>();
         for (int ii = 0; ii < msgs.Length; ii++)
         {
             string[] break_str = Regex.Split(msgs[ii], "\\[br\\]", RegexOptions.IgnoreCase);
             sep_msgs.AddRange(break_str);
         }
         DialogueBox box = null;
         for (int ii = sep_msgs.Count - 1; ii >= 0; ii--)
         {
             DialogueBox prevBox = box;
             box = CreateBox(speaker, speakerName, emotion, sound, (prevBox == null) ? finishAction : () => { AddMenu(prevBox, false); }, waitTime, sep_msgs[ii]);
         }
         return(box);
     }
     return(null);
 }
Пример #25
0
        public DialogueBox CreateMultiQuestion(MonsterID speaker, string speakerName, EmoteStyle emotion,
                                               string msg, bool sound, DialogueChoice[] choices, int defaultChoice, int cancelChoice)
        {
            string[] break_str = Regex.Split(msg, "\\[br\\]", RegexOptions.IgnoreCase);

            DialogueBox box = new QuestionDialog(break_str[break_str.Length - 1], sound, choices, defaultChoice, cancelChoice);

            box.SetSpeaker(speaker, speakerName, emotion);

            if (break_str.Length > 1)
            {
                string[] pre_str = new string[break_str.Length - 1];
                Array.Copy(break_str, pre_str, pre_str.Length);
                return(CreateDialogue(speaker, speakerName, emotion, sound, () => { AddMenu(box, false); }, -1, pre_str));
            }
            else
            {
                return(box);
            }
        }
Пример #26
0
        private void Export(string currentPath, MonsterID currentForm)
        {
            if (checkSprites)
            {
                CharSheet sheet = GraphicsManager.GetChara(currentForm);
                CharSheet.Export(sheet, currentPath);
            }
            else
            {
                PortraitSheet sheet = GraphicsManager.GetPortrait(currentForm);
                PortraitSheet.Export(sheet, currentPath);
            }


            DiagManager.Instance.LogInfo("Frames from:\n" +
                                         GetFormString(currentForm) +
                                         "\nhave been exported to:" + currentPath);


            btnReimport.Enabled = true;
        }
Пример #27
0
        public static IEnumerator <YieldInstruction> Begin(MonsterID monId, string name)
        {
            yield return(CoroutineManager.Instance.StartCoroutine(GameManager.Instance.FadeOut(false)));

            DataManager.Instance.SetProgress(new MainProgress(MathUtils.Rand.NextUInt64(), Guid.NewGuid().ToString().ToUpper()));
            DataManager.Instance.Save.ActiveTeam = new ExplorerTeam();
            DataManager.Instance.Save.ActiveTeam.SetRank(0);
            DataManager.Instance.Save.ActiveTeam.Name = "";

            Character newChar = DataManager.Instance.Save.ActiveTeam.CreatePlayer(MathUtils.Rand, monId, DataManager.Instance.StartLevel, -1, DataManager.Instance.StartPersonality);

            newChar.Nickname  = name;
            newChar.IsFounder = true;
            DataManager.Instance.Save.ActiveTeam.Players.Add(newChar);

            DataManager.Instance.Save.RegisterMonster(DataManager.Instance.Save.ActiveTeam.Players[0].BaseForm.Species);
            DataManager.Instance.Save.StartDate = String.Format("{0:yyyy-MM-dd_HH-mm-ss}", DateTime.Now);
            DataManager.Instance.Save.UpdateTeamProfile(true);

            yield return(CoroutineManager.Instance.StartCoroutine(GameManager.Instance.MoveToZone(DataManager.Instance.StartMap)));
        }
Пример #28
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            TreeNode node = tvForms.SelectedNode;

            if (node == null)
            {
                MessageBox.Show("No item selected to delete.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (node.ImageIndex == 0)
            {
                MessageBox.Show("This spritesheet does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //get current sprite
            MonsterID formdata = (MonsterID)node.Tag;

            if (MessageBox.Show("Are you sure you want to delete the following sheet:\n" + GetFormString(formdata), "Delete Sprite Sheet.",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            string fileName = GetFilename(formdata.Species);
            Dictionary <MonsterID, byte[]> data = LoadSpeciesData(formdata.Species);

            //delete sprite data
            data.Remove(formdata);

            //save data
            ImportHelper.SaveSpecies(fileName, data);

            DiagManager.Instance.LogInfo("Deleted frames for:" + GetFormString(formdata));

            node.ImageIndex         = 0;
            node.SelectedImageIndex = 0;

            //signal for reload
            GraphicsManager.NeedReload = GraphicsManager.AssetType.Chara;
        }
Пример #29
0
        public static PortraitSheet GetPortrait(MonsterID data)
        {
            data = GetFallbackForm(PortraitIndex, data);

            PortraitSheet sheet;

            if (portraitCache.TryGetValue(data, out sheet))
            {
                return(sheet);
            }

            if (data.IsValid())
            {
                try
                {
                    using (FileStream stream = File.OpenRead(String.Format(PORTRAIT_PATTERN, data.Species)))
                    {
                        using (BinaryReader reader = new BinaryReader(stream))
                        {
                            long position = PortraitIndex.GetPosition(data.Species, data.Form, (int)data.Skin, (int)data.Gender);
                            // Jump to the correct position
                            stream.Seek(position, SeekOrigin.Begin);
                            sheet = PortraitSheet.Load(reader);
                            portraitCache.Add(data, sheet);
                            return(sheet);
                        }
                    }
                }
                catch (Exception ex)
                {
                    DiagManager.Instance.LogError(new Exception("Error loading portrait " + data.Species + " " + data.Form + "-" + data.Skin + "-" + data.Gender + "\n", ex));
                }
            }

            //add error sheet
            PortraitSheet error = PortraitSheet.LoadError();

            portraitCache.Add(data, error);
            return(error);
        }
Пример #30
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            TreeNode node = tvForms.SelectedNode;

            if (node == null)
            {
                MessageBox.Show("No item selected to export from.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //get current sprite
            MonsterID formdata = (MonsterID)node.Tag;

            if (node.ImageIndex == 0)
            {
                MessageBox.Show("No graphics exist on this item.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //remember addresses in registry
            string folderName = (string)Registry.GetValue(DiagManager.REG_PATH, checkSprites ? "SpriteDir" : "PortraitDir", "");

            if (String.IsNullOrEmpty(folderName))
            {
                folderName = Directory.GetCurrentDirectory();
            }


            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.SelectedPath = folderName;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Registry.SetValue(DiagManager.REG_PATH, checkSprites ? "SpriteDir" : "PortraitDir", dialog.SelectedPath);
                cachedPath = dialog.SelectedPath + "/";
                cachedForm = formdata;
                Export(cachedPath, cachedForm);
            }
        }