Exemplo n.º 1
0
 public void updateMonsterUI(PlayerRosterMeta[] roster, TrainerType tType)
 {
     if (tType == TrainerType.Wild)
     {
         GameObject.Find("WildTxt").GetComponent <Text>().enabled = true;
     }
     else if (tType == TrainerType.Trainer)
     {
         GameObject.Find("WildTxt").GetComponent <Text>().enabled = false;
     }
     if (tType == TrainerType.Trainer || tType == TrainerType.Player)
     {
         for (int i = 0; i < 6; i++)
         {
             if (i < roster.Length)
             {
                 monsterUI[i].SetActive(true);
                 Color thisColor = monsterUI[i].transform.GetChild(0).gameObject.GetComponent <Image>().color;
                 if (roster[i].curHealth > 0)
                 {
                     thisColor.a = 0;
                 }
                 else
                 {
                     thisColor.a = 1;
                 }
                 monsterUI[i].transform.GetChild(0).gameObject.GetComponent <Image>().color = thisColor;
             }
             else
             {
                 monsterUI[i].SetActive(false);
             }
         }
     }
 }
Exemplo n.º 2
0
 public void CreateFromBase(Trainer t)
 {
     trainerType = t.trainerType;
     TrainerName = t.TrainerName;
     trainerTeam = t.trainerTeam;
     DefeatQuote = t.DefeatQuote;
     PrizeMoney  = t.PrizeMoney;
 }
Exemplo n.º 3
0
        public Trainer(uint id, TrainerType type, string greeting, List <TrainerSpell> spells)
        {
            _id     = id;
            _type   = type;
            _spells = spells;

            _greeting[(int)Locale.enUS] = greeting;
        }
Exemplo n.º 4
0
        /* * * * * * * * * *
        * Common Methods
        * * * * * * * * * */
        #region Common Methods

        public static Dictionary <string, TrainerPointer> GetEmulatorPointer(this TrainerType trainerType, bool?is64bits = null,
                                                                             PSXEmulator psxEmulator         = PSXEmulator.Null,
                                                                             NESEmulator nesEmulator         = NESEmulator.Null,
                                                                             SNESEmulator snesEmulator       = SNESEmulator.Null,
                                                                             N64Emulator n64Emulator         = N64Emulator.Null,
                                                                             SMSEmulator smsEmulator         = SMSEmulator.Null,
                                                                             GenesisEmulator genesisEmulator = GenesisEmulator.Null) =>
        trainerType switch
        {
Exemplo n.º 5
0
 public Trainer(string n, Pokemon[] m, Bitmap b, TrainerType t)
 {
     this.name = n;
     this.party.AddRange(m);
     for (int i = 0; i < this.party.Count; i++)
     {
         this.party[i].OTid = this.id;
         this.party[i].OTsecretid = this.secretID;
         this.party[i].OTname = this.name;
     }
     this.img = b;
     this.type = t;
 }
Exemplo n.º 6
0
 public Trainer(string n, Pokemon[] m, Bitmap b, TrainerType t)
 {
     this.name = n;
     this.party.AddRange(m);
     for (int i = 0; i < this.party.Count; i++)
     {
         this.party[i].OTid       = this.id;
         this.party[i].OTsecretid = this.secretID;
         this.party[i].OTname     = this.name;
     }
     this.img  = b;
     this.type = t;
 }
Exemplo n.º 7
0
        public static bool ParseTrainerListOpcode(GenericReader gr, GenericReader gr2, StringBuilder sb, StreamWriter swe, byte direction)
        {
            sb.AppendLine("Packet offset " + gr.BaseStream.Position.ToString("X2"));
            sb.AppendLine("Opcode SMSG_TRAINER_LIST (0x01B1)");

            StreamWriter sw = new StreamWriter("trainer.log", true, Encoding.ASCII);

            ulong       guid         = gr2.ReadUInt64();
            TrainerType trainer_type = (TrainerType)gr2.ReadUInt32();
            uint        spells_count = gr2.ReadUInt32();

            sw.WriteLine("Trainer {0}, type {1}, spells_count {2}", guid.ToString("X16"), trainer_type, spells_count);

            for (uint i = 0; i < spells_count; i++)
            {
                uint spellid            = gr2.ReadUInt32();
                TrainerSpellState state = (TrainerSpellState)gr2.ReadByte();
                uint spellcost          = gr2.ReadUInt32();
                uint unk1          = gr2.ReadUInt32(); // isProfession?
                uint unk2          = gr2.ReadUInt32();
                byte reqlevel      = gr2.ReadByte();
                uint reqskill      = gr2.ReadUInt32();
                uint reqskillvalue = gr2.ReadUInt32();
                uint reqspell      = gr2.ReadUInt32();
                uint unk3          = gr2.ReadUInt32();
                uint unk4          = gr2.ReadUInt32();

                sw.WriteLine("Spell {0}, state {1}, cost {2}, unk1 {3}, unk2 {4}, reqlevel {5}, reqskill {6}, reqskillvalue {7}, reqspell {8}, unk3 {9} unk4 {10}", spellid, state, spellcost, unk1, unk2, reqlevel, reqskill, reqskillvalue, reqspell, unk3, unk4);
            }

            string title = gr2.ReadStringNull();

            sw.WriteLine("title {0}", title);

            sw.Flush();
            sw.Close();

            if (gr2.BaseStream.Position == gr2.BaseStream.Length)
            {
                sb.AppendLine("parsed: ok...");
            }
            else
            {
                sb.AppendLine("parsed: error...");
            }

            return(true);
        }
Exemplo n.º 8
0
 public EventObj(Map.Events.ObjEvent oe, Map map)
     : base(oe.Id, oe.Sprite, new Position(oe))
 {
     MovementType = oe.MovementType;
     InitMovementType();
     OriginX      = oe.X;
     MovementX    = oe.MovementX;
     OriginY      = oe.Y;
     MovementY    = oe.MovementY;
     TrainerType  = oe.TrainerType;
     TrainerSight = oe.TrainerSight;
     Script       = oe.Script;
     Flag         = oe.Flag;
     map.Objs.Add(this);
     Map = map;
 }
Exemplo n.º 9
0
                public ObjEvent(EndianBinaryReader r)
                {
                    X         = r.ReadInt32();
                    Y         = r.ReadInt32();
                    Elevation = r.ReadByte();

                    Id           = r.ReadUInt16();
                    Sprite       = r.ReadStringNullTerminated();
                    MovementType = r.ReadEnum <ObjMovementType>();
                    MovementX    = r.ReadInt32();
                    MovementY    = r.ReadInt32();
                    TrainerType  = r.ReadEnum <TrainerType>();
                    TrainerSight = r.ReadByte();
                    Script       = r.ReadStringNullTerminated();
                    Flag         = r.ReadEnum <Flag>();
                }
Exemplo n.º 10
0
                public ObjEvent(JToken j)
                {
                    X         = j[nameof(X)].Value <int>();
                    Y         = j[nameof(Y)].Value <int>();
                    Elevation = j[nameof(Elevation)].Value <byte>();

                    Id           = j[nameof(Id)].Value <ushort>();
                    Sprite       = j[nameof(Sprite)].Value <string>();
                    MovementType = j[nameof(MovementType)].EnumValue <ObjMovementType>();
                    MovementX    = j[nameof(MovementX)].Value <int>();
                    MovementY    = j[nameof(MovementY)].Value <int>();
                    TrainerType  = j[nameof(TrainerType)].EnumValue <TrainerType>();
                    TrainerSight = j[nameof(TrainerSight)].Value <byte>();
                    Script       = j[nameof(Script)].Value <string>();
                    Flag         = j[nameof(Flag)].EnumValue <Flag>();
                }
Exemplo n.º 11
0
 public Trainer(string name, TrainerType type)
     : base(name, TrainerBaseHp)
 {
     this.TrainerType = type;
 }
Exemplo n.º 12
0
        public override void Parse(string page, uint id)
        {
            MatchCollection items = trainerTypeRegex.Matches(page);

            foreach (Match item in items)
            {
                TrainerType type = TrainerType.TypeNone;

                switch (item.Groups[1].Value)
                {
                case "\'teaches-other\'":
                    type = TrainerType.TypeOther;
                    break;

                case "\'teaches-ability\'":
                    type = TrainerType.TypeClass;
                    break;

                case "\'teaches-recipe\'":
                    type = TrainerType.TypeTradeskills;
                    break;

                default:
                    continue;
                }

                if (type == TrainerType.TypeNone)
                {
                    return;
                }

                int startIndex = item.Index;
                int endIndex   = page.FastIndexOf("});", startIndex);

                string template = page.Substring(startIndex, endIndex - startIndex + 3);

                Match find = dataRegex.Match(template);
                if (!find.Success)
                {
                    continue;
                }

                Builder.SetKey(id);
                Builder.AppendSqlQuery(id, @"UPDATE `creature_template` SET `npcflag` = `npcflag` | 0x{0:X4}, `trainer_type` = '{1}' WHERE `entry` = '{2}';", npcFlags[type], trainerTypes[type], id);

                MatchCollection matches = _patterns[type].Matches(find.Value);
                foreach (Match match in matches)
                {
                    GroupCollection groups = match.Groups;
                    switch (type)
                    {
                    case TrainerType.TypeOther:
                    {
                        string reqSkill = (string.IsNullOrEmpty(groups[3].Value) ? Zero : groups[3].Value);
                        Builder.AppendValues(groups[1].Value, Zero, groups[2].Value, reqSkill, Zero);
                    }
                    break;

                    case TrainerType.TypeClass:
                    {
                        string reqSkill  = (string.IsNullOrEmpty(groups[3].Value) ? Zero : groups[3].Value);
                        string spellCost = (string.IsNullOrEmpty(groups[4].Value) ? Zero : groups[4].Value);
                        Builder.AppendValues(groups[1].Value, spellCost, groups[2].Value, reqSkill, Zero);
                    }
                    break;

                    case TrainerType.TypeTradeskills:
                    {
                        string reqSkill      = (string.IsNullOrEmpty(groups[3].Value) ? Zero : groups[3].Value);
                        string reqSkillValue = (string.IsNullOrEmpty(groups[2].Value) ? Zero : groups[2].Value);
                        string spellCost     = (string.IsNullOrEmpty(groups[4].Value) ? Zero : groups[4].Value);
                        Builder.AppendValues(groups[1].Value, spellCost, Zero, reqSkill, reqSkillValue);
                    }
                    break;
                    }

                    Builder.Flush();
                }
            }
        }
Exemplo n.º 13
0
 public Trainer(string name, TrainerType type)
     : base(name, TrainerBaseHp)
 {
     this.TrainerType = type;
 }
 public void Update(TrainerType obj)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BehaviorName.Length != 0)
            {
                hash ^= BehaviorName.GetHashCode();
            }
            if (TrainerType.Length != 0)
            {
                hash ^= TrainerType.GetHashCode();
            }
            if (ExtrinsicRewardEnabled != false)
            {
                hash ^= ExtrinsicRewardEnabled.GetHashCode();
            }
            if (GailRewardEnabled != false)
            {
                hash ^= GailRewardEnabled.GetHashCode();
            }
            if (CuriosityRewardEnabled != false)
            {
                hash ^= CuriosityRewardEnabled.GetHashCode();
            }
            if (RndRewardEnabled != false)
            {
                hash ^= RndRewardEnabled.GetHashCode();
            }
            if (BehavioralCloningEnabled != false)
            {
                hash ^= BehavioralCloningEnabled.GetHashCode();
            }
            if (RecurrentEnabled != false)
            {
                hash ^= RecurrentEnabled.GetHashCode();
            }
            if (VisualEncoder.Length != 0)
            {
                hash ^= VisualEncoder.GetHashCode();
            }
            if (NumNetworkLayers != 0)
            {
                hash ^= NumNetworkLayers.GetHashCode();
            }
            if (NumNetworkHiddenUnits != 0)
            {
                hash ^= NumNetworkHiddenUnits.GetHashCode();
            }
            if (TrainerThreaded != false)
            {
                hash ^= TrainerThreaded.GetHashCode();
            }
            if (SelfPlayEnabled != false)
            {
                hash ^= SelfPlayEnabled.GetHashCode();
            }
            if (CurriculumEnabled != false)
            {
                hash ^= CurriculumEnabled.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override string Parse(Block block)
        {
            StringBuilder content = new StringBuilder();

            string      page = block.Page;
            TrainerType type = GetTrainerType(page);

            string pattern    = @"data: \[.*;";
            string subPattern = string.Empty;

            switch (type)
            {
            case TrainerType.ClassTrainer:
                subPattern = "{[^}]*\"id\":(\\d+)[^}]*\"level\":(\\d+)[^}]*\"skill\":\\[(\\d+)?\\][^}]*\"trainingcost\":(\\d+)[^}]*";
                break;

            case TrainerType.RecipeTrainer:
                subPattern = "{[^}]*\"id\":(\\d+)[^}]*\"learnedat\":(\\d+)[^}]*\"level\":(\\d+)[^}]*\"skill\":\\[(\\d+)?\\][^}]*\"trainingcost\":(\\d+)[^}]*";
                break;

            default:
                return(string.Format("-- Unknown trainer type: {0}", type));
            }

            bool print = false;

            MatchCollection find = Regex.Matches(page, pattern);

            foreach (Match item in find)
            {
                MatchCollection matches = Regex.Matches(item.Value, subPattern);
                if (!print && matches.Count > 0)
                {
                    content.AppendLine();
                    content.AppendFormat(@"SET @ENTRY := {0};", block.Entry).AppendLine();
                    content.AppendLine(@"UPDATE `creature_template` SET `npcflag` = `npcflag` | 48 WHERE `entry` = @ENTRY;");
                    content.AppendLine(@"REPLACE INTO `npc_trainer` (`entry`, `spell`, `spellcost`, `reqlevel`, `reqSkill`, `reqSkillValue`) VALUES");
                    print = true;
                }

                for (int i = 0; i < matches.Count; ++i)
                {
                    GroupCollection groups = matches[i].Groups;

                    string spell = groups[1].Value;
                    string end   = (i < matches.Count - 1 ? "," : ";");
                    if (type == TrainerType.RecipeTrainer)
                    {
                        string reqSkill      = (string.IsNullOrEmpty(groups[4].Value) ? "0" : groups[4].Value);
                        string reqSkillValue = (string.IsNullOrEmpty(groups[2].Value) ? "0" : groups[2].Value);

                        content.AppendFormat(@"(@ENTRY, {0}, {1}, {2}, {3}, {4}){5}", spell, groups[5].Value, groups[3].Value, reqSkill, reqSkillValue, end).AppendLine();
                    }
                    else if (type == TrainerType.ClassTrainer)
                    {
                        string reqSkill = (string.IsNullOrEmpty(groups[3].Value) ? "0" : groups[3].Value);

                        content.AppendFormat(@"(@ENTRY, {0}, {1}, {2}, {3}, {4}){5}", spell, groups[4].Value, groups[2].Value, reqSkill, "0", end).AppendLine();
                    }
                }
            }

            return(content.ToString());
        }