예제 #1
0
        public EggParents(FrameType frameType, EncounterType encounterType, uint seed)
        {
            InitializeComponent();

            this.seed = seed;
            this.encounterType = encounterType;
            this.frameType = frameType;

            if (frameType == FrameType.BWBred || frameType == FrameType.BWBredInternational)
            {
                Text = "Display Parent IVs";
                buttonRetrieveIVs.Text = "Get IVs from IVRNG (Frame 8)";
            }
            else if (frameType == FrameType.DPPtBred ||
                     frameType == FrameType.HGSSBred ||
                     frameType == FrameType.Bred ||
                     frameType == FrameType.BredSplit ||
                     frameType == FrameType.BredAlternate)
            {
                labelParentA.Text = "Parent A";
                labelParentB.Text = "Parent B";

                labelParentA.Location = new Point(39, 40);
                labelParentB.Location = new Point(39, 66);

                labelIVRNG.Visible = false;
                maskedTextBoxHP_IVRNG.Visible = false;
                maskedTextBoxAtk_IVRNG.Visible = false;
                maskedTextBoxDef_IVRNG.Visible = false;
                maskedTextBoxSpA_IVRNG.Visible = false;
                maskedTextBoxSpD_IVRNG.Visible = false;
                maskedTextBoxSpe_IVRNG.Visible = false;
            }
            else
            {
                maskedTextBoxHP_ParentA.Enabled = false;
                maskedTextBoxAtk_ParentA.Enabled = false;
                maskedTextBoxDef_ParentA.Enabled = false;
                maskedTextBoxSpA_ParentA.Enabled = false;
                maskedTextBoxSpD_ParentA.Enabled = false;
                maskedTextBoxSpe_ParentA.Enabled = false;

                maskedTextBoxHP_ParentB.Enabled = false;
                maskedTextBoxAtk_ParentB.Enabled = false;
                maskedTextBoxDef_ParentB.Enabled = false;
                maskedTextBoxSpA_ParentB.Enabled = false;
                maskedTextBoxSpD_ParentB.Enabled = false;
                maskedTextBoxSpe_ParentB.Enabled = false;

                Text = "Display Characteristics in List";
                buttonRetrieveIVs.Text = encounterType == EncounterType.LarvestaEgg
                                             ? "Get IVs from IVRNG (Frame 2)"
                                             : "Get IVs from IVRNG (Frame 1)";
            }
        }
예제 #2
0
        public Adjacents(DateTime dateTime,
                         int profile, IEnumerable<ButtonComboType> buttons,
                         FrameType frameType, EncounterType encounterType,
                         uint Advances)
        {
            InitializeComponent();
            datePicker.Value = dateTime;

            maskedTextBoxCapMinOffset.Text = Advances.ToString();
            maskedTextBoxCapMaxOffset.Text = Advances.ToString();

            this.frameType = frameType;
            this.encounterType = encounterType;

            foreach (ButtonComboType button in buttons)
            {
                comboBoxKeypresses.CheckBoxItems[(int) button].Checked = true;
            }
            this.profile = profile;
            loadSearchResult = true;
        }
예제 #3
0
 public static int BWSlot(uint result, EncounterType encounterType, bool isBW2)
 {
     uint percent = isBW2 ? (uint) (((ulong) result*100) >> 32) : (result >> 16)/656;
     switch (encounterType)
     {
         case EncounterType.WildSurfing:
             {
                 Range[] ranges =
                     {
                         new Range(0, 59), new Range(60, 89), new Range(90, 94), new Range(95, 98),
                         new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         case EncounterType.WildWaterSpot:
         case EncounterType.WildSuperRod:
             {
                 Range[] ranges =
                     {
                         new Range(0, 39), new Range(40, 79), new Range(80, 94), new Range(95, 98),
                         new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         default:
             {
                 Range[] ranges =
                     {
                         new Range(0, 19), new Range(20, 39), new Range(40, 49), new Range(50, 59),
                         new Range(60, 69), new Range(70, 79), new Range(80, 84), new Range(85, 89),
                         new Range(90, 93), new Range(94, 97), new Range(98, 98), new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
     }
 }
예제 #4
0
        public void CheckQueue()
        {
            if (Queue.Count == 0)
            {
                return;
            }

            bool message = false;

            List <Mobile> copy = new List <Mobile>(Queue.Keys);

            for (int i = 0; i < copy.Count; i++)
            {
                Mobile m = copy[i];

                if (m.Map != Map.TerMur || m.NetState == null)
                {
                    RemoveFromQueue(m);

                    if (i == 0)
                    {
                        message = true;
                    }

                    continue;
                }

                foreach (ShadowguardEncounter inst in Encounters.Where(inst => inst.PartyLeader == m))
                {
                    if (i == 0)
                    {
                        message = true;
                    }

                    RemoveFromQueue(m);
                    continue;
                }

                if (Queue.Count > 0)
                {
                    message = true;

                    Timer.DelayCall(TimeSpan.FromMinutes(2), mobile =>
                    {
                        if (Queue.ContainsKey(m))
                        {
                            EncounterType type           = Queue[m];
                            ShadowguardInstance instance = GetAvailableInstance(type);

                            if (instance != null && instance.TryBeginEncounter(m, true, type))
                            {
                                RemoveFromQueue(m);
                            }
                        }
                    }, m);
                }

                break;
            }

            ColUtility.Free(copy);

            if (message && Queue.Count > 0)
            {
                ColUtility.For(Queue.Keys, (i, mob) =>
                {
                    Party p = Party.Get(mob);

                    if (p != null)
                    {
                        p.Members.ForEach(info => info.Mobile.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next"));
                    }
                    //A Shadowguard encounter has opened. You are currently ~1_NUM~ in the
                    //queue. If you are next, you may proceed to the entry stone to join.
                    else
                    {
                        mob.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next");
                    }
                });
            }
        }
예제 #5
0
        public ShadowguardInstance GetAvailableInstance(EncounterType type)
        {
            if (RandomInstances)
            {
                List <ShadowguardInstance> instances;

                if (type == EncounterType.Roof)
                {
                    instances = new List <ShadowguardInstance>();

                    for (var index = 0; index < Instances.Count; index++)
                    {
                        var e = Instances[index];

                        if (e.IsRoof && !e.InUse)
                        {
                            instances.Add(e);
                        }
                    }
                }
                else
                {
                    instances = new List <ShadowguardInstance>();

                    for (var index = 0; index < Instances.Count; index++)
                    {
                        var e = Instances[index];

                        if (!e.IsRoof && !e.InUse)
                        {
                            instances.Add(e);
                        }
                    }
                }

                ShadowguardInstance inst = null;

                if (instances.Count > 0)
                {
                    inst = instances[Utility.Random(instances.Count)];
                }

                ColUtility.Free(instances);
                return(inst);
            }

            if (type == EncounterType.Roof)
            {
                for (var index = 0; index < Instances.Count; index++)
                {
                    var e = Instances[index];

                    if (e.IsRoof && !e.InUse)
                    {
                        return(e);
                    }
                }

                return(null);
            }

            for (var index = 0; index < Instances.Count; index++)
            {
                var e = Instances[index];

                if (!e.IsRoof && !e.InUse)
                {
                    return(e);
                }
            }

            return(null);
        }
예제 #6
0
        public static Frame GenerateFrame(
            FrameType frameType,
            EncounterType encounterType,
            uint number,
            uint rngResult,
            uint pid,
            uint id,
            uint sid,
            uint natureValue,
            bool synch,
            int encounterSlot,
            uint itemCalc,
            uint[] rngIVs)
        {
            var frame = new Frame(frameType)
                {
                    Number = number,
                    RngResult = rngResult,
                    id = id,
                    sid = sid,
                    Pid = pid,
                    Nature = natureValue,
                    ability = (pid >> 16) & 1,
                    EncounterType = encounterType,
                    EncounterSlot = encounterSlot,
                    ItemCalc = itemCalc,
                    synchable = synch,
                    Hp = rngIVs[0],
                    Atk = rngIVs[1],
                    Def = rngIVs[2],
                    Spa = rngIVs[3],
                    Spd = rngIVs[4],
                    Spe = rngIVs[5]
                };

            //  Set up the ID and SID before we calculate
            //  the pid, as we are going to need this.

            return frame;
        }
예제 #7
0
    public void GenerateEncounter(float difficulty)
    {
        int xPos = 3;

        if (type == EncounterType.ENEMY)
        {
            float totalDifficulty  = 0;
            float targetDifficulty = difficulty + Random.Range(0.0f, 0.5f) * difficulty;
            while (totalDifficulty < targetDifficulty)
            {
                int        enemyNum = Random.Range(0, enemyInventory.Count);
                GameObject enemy    = Instantiate(enemyInventory[enemyNum], new Vector3(xPos, -2, 10), Quaternion.identity, this.transform);
                if (enemy.GetComponent <Enemy>().isBoss == false)
                {
                    totalDifficulty += enemy.GetComponent <Enemy>().difficulty;
                    enemies.Add(enemy);
                    xPos += 2;
                }
                else
                {
                    Destroy(enemy);
                }
            }
            gold = (int)Random.Range(5 * difficulty, 5 * difficulty + 5);
            if (Random.Range(0.0f, 1.0f) < 0.25f)
            {
                //award random item at end of fight
                items.Add(GameObject.Find("ItemManager").GetComponent <ItemManager>().RandomItem(difficulty));
            }
        }
        else if (type == EncounterType.TREASURE)
        {
            gold = (int)Random.Range(15 * difficulty, 15 * difficulty + 10);
            //ItemManager im = GameObject.Find("ItemManager").GetComponent<ItemManager>();
            //items.AddRange(im.RandomItems());
        }
        else if (type == EncounterType.SHOP)
        {
            List <string> added = new List <string>();
            for (int i = 0; i < 5; i++)
            {
                GameObject tempItem = GameObject.Find("ItemManager").GetComponent <ItemManager>().RandomItem(difficulty);
                if (added.Contains(tempItem.GetComponent <ItemInterface>().itemName))
                {
                    //duplicate
                    i--;
                }
                else
                {
                    //add item
                    items.Add(tempItem);
                    added.Add(tempItem.GetComponent <ItemInterface>().itemName);
                }
            }
            //print("items:");
            //foreach (GameObject go in items)
            //print(go.GetComponent<ItemInterface>().itemName);
        }
        else if (type == EncounterType.EVENT)
        {
            eventID = Random.Range(0, 3);
            switch (eventID)
            {
            case 0:     //treasure room
                type = EncounterType.TREASURE;
                GenerateEncounter(difficulty);
                type = EncounterType.EVENT;
                break;

            case 1:     //enemy room
                type = EncounterType.ENEMY;
                GenerateEncounter(difficulty);
                type = EncounterType.EVENT;
                break;

            case 2:     //heal party

                break;
            }
        }
        else if (type == EncounterType.BOSS)
        {
            int bossNum = Random.Range(0, bossEncounters.Count);
            foreach (int i in bossEncounters[bossNum])
            {
                GameObject enemy = Instantiate(enemyInventory[i], new Vector3(xPos, -2, 10),
                                               Quaternion.identity, this.transform);
                enemies.Add(enemy);
                xPos += 2;
            }
            gold = (int)Random.Range(10 * difficulty, 10 * difficulty + 5);
            //award random item at end of fight
            items.Add(GameObject.Find("ItemManager").GetComponent <ItemManager>().RandomItem(difficulty));
        }
    }
예제 #8
0
 public static bool Contains(this EncounterType g1, int g2) => g1.HasFlag((EncounterType)(1 << g2));
예제 #9
0
 public static int encounterSlot(uint result, FrameType frameType, EncounterType encounterType, bool isBW2)
 {
     switch (frameType)
     {
         case FrameType.MethodH4:
         case FrameType.MethodH2:
         case FrameType.MethodH1:
             return HSlot(result, encounterType);
         case FrameType.MethodK:
             return KSlot(result, encounterType);
         case FrameType.MethodJ:
             return JSlot(result, encounterType);
         case FrameType.Method5Natures:
             //YOU LOSE
             return BWSlot(result, encounterType, isBW2);
     }
     return -1;
 }
예제 #10
0
        internal EncounterSlot[] getSlots(EncounterType type)
        {
            EncounterSlot[] selected = null, returnSlots = null;
            switch (type)
            {
            case EncounterType.Walking:
                if (new[] { 20, 24, 28 }.Contains(map))
                {
                    selected = OtherSlots;
                }
                else
                {
                    selected = WalkSlots;
                }
                returnSlots = new EncounterSlot[12];
                break;

            case EncounterType.RedFlowers:
                selected    = RedFlowersSlots;
                returnSlots = new EncounterSlot[12];
                break;

            case EncounterType.YellowFlowers:
                selected    = YellowFlowersSlots;
                returnSlots = new EncounterSlot[12];
                break;

            case EncounterType.PurpleFlowers:
                selected    = PurpleFlowersSlots;
                returnSlots = new EncounterSlot[12];
                break;

            case EncounterType.Surf:
                selected    = SurfSlots;
                returnSlots = new EncounterSlot[5];
                break;

            case EncounterType.RockSmash:
                selected    = RockSmash;
                returnSlots = new EncounterSlot[5];
                break;

            case EncounterType.OldRod:
                selected    = OldRodSlots;
                returnSlots = new EncounterSlot[3];
                break;

            case EncounterType.GoodRod:
                selected    = GoodRodSlots;
                returnSlots = new EncounterSlot[3];
                break;

            case EncounterType.SuperRod:
                selected    = SuperRodSlots;
                returnSlots = new EncounterSlot[3];
                break;

            case EncounterType.ShallowWater:
            case EncounterType.TallGrass:
                selected    = OtherSlots;
                returnSlots = new EncounterSlot[12];
                break;

            default: return(null);
            }


            for (int i = 0; i < selected.Length; i++)
            {
                returnSlots[i] = new EncounterSlot(selected[i]);
            }


            return(returnSlots);
        }
 public EnconterToDeleteDTO(Guid id, EncounterType encounterType)
 {
     Id   = id;
     Name = encounterType?.Name;
 }
예제 #12
0
 public static int encounterSlot(uint result, FrameType frameType, EncounterType encounterType)
 {
     return(encounterSlot(result, frameType, encounterType, false));
 }
예제 #13
0
        private static int KSlot(uint result, EncounterType encounterType)
        {
            uint percent = (result >> 16) % 100;

            switch (encounterType)
            {
            case EncounterType.WildSurfing:
            {
                Range[] ranges =
                {
                    new Range(0,  59), new Range(60, 89), new Range(90, 94), new Range(95, 98),
                    new Range(99, 99)
                };
                return(CalcSlot(percent, ranges));
            }

            case EncounterType.WildSuperRod:
            case EncounterType.WildGoodRod:
            case EncounterType.WildOldRod:
            {
                Range[] ranges =
                {
                    new Range(0,  39), new Range(40, 69), new Range(70, 84), new Range(85, 94),
                    new Range(95, 99)
                };
                return(CalcSlot(percent, ranges));
            }

            case EncounterType.BugCatchingContest:
            {
                Range[] ranges =
                {
                    new Range(80, 99), new Range(60, 79), new Range(50, 59), new Range(40, 49),
                    new Range(30, 39), new Range(20, 29), new Range(15, 19), new Range(10, 14),
                    new Range(5,   9), new Range(0, 4)
                };
                return(CalcSlot(percent, ranges));
            }

            case EncounterType.SafariZone:
                return((int)((result >> 16) % 10));

            case EncounterType.Headbutt:
            {
                Range[] ranges =
                {
                    new Range(0,  49), new Range(50, 64), new Range(65, 79), new Range(80, 89),
                    new Range(90, 94), new Range(95, 99)
                };
                return(CalcSlot(percent, ranges));
            }

            default:
            {
                Range[] ranges =
                {
                    new Range(0,  19), new Range(20, 39), new Range(40, 49), new Range(50, 59),
                    new Range(60, 69), new Range(70, 79), new Range(80, 84), new Range(85, 89),
                    new Range(90, 93), new Range(94, 97), new Range(98, 98), new Range(99, 99)
                };
                return(CalcSlot(percent, ranges));
            }
            }
        }
예제 #14
0
 public EncounterGroup(JToken j)
 {
     Type  = j[nameof(Type)].EnumValue <EncounterType>();
     Table = j[nameof(Table)].Value <string>();
 }
예제 #15
0
        /// <summary>
        /// Get encounter slot data for a specific encounter type
        /// </summary>
        /// <param name="type">Encounter type</param>
        /// <returns>Encounter slot data, or null if data not available.</returns>
        internal EncounterSlot[] getSlots(EncounterType type, bool swarm = false, int timeOfDay = 0)
        {
            EncounterSlot[] returnSlots = null, selectedSlots = null;

            switch (type)
            {
            case EncounterType.Walking:
                returnSlots   = new EncounterSlot[7];
                selectedSlots = WalkSlots;
                if (timeOfDay == 1 && !swarm)
                {
                    selectedSlots = WalkDaySlots;
                }
                if (timeOfDay == 2 && !swarm)
                {
                    selectedSlots = WalkNightSlots;
                }
                if (timeOfDay == 0 && swarm)
                {
                    selectedSlots = OutbreakMorningSlots;
                }
                if (timeOfDay == 1 && swarm)
                {
                    selectedSlots = OutbreakDaySlots;
                }
                if (timeOfDay == 2 && swarm)
                {
                    selectedSlots = OutbreakNightSlots;
                }
                break;

            case EncounterType.Surf:
                returnSlots   = new EncounterSlot[3];
                selectedSlots = swarm ? OutbreakSurfSlots : SurfSlots;
                break;

            case EncounterType.RockSmash:
                returnSlots   = new EncounterSlot[2];
                selectedSlots = RockSmashSlots;
                break;

            case EncounterType.OldRod:
                returnSlots   = new EncounterSlot[3];
                selectedSlots = OldRodSlots;
                selectedSlots = swarm ? OutbreakOldRodSlots : OldRodSlots;
                break;

            case EncounterType.GoodRod:
                returnSlots = new EncounterSlot[4];
                if (swarm)
                {
                    selectedSlots = OutbreakGoodRodSlots;
                }
                else
                {
                    selectedSlots = (timeOfDay == 2) ? GoodRodNightSlots : GoodRodSlots;
                }
                break;

            case EncounterType.SuperRod:
                returnSlots = new EncounterSlot[4];
                if (swarm)
                {
                    selectedSlots = OutbreakSuperRodSlots;
                }
                else
                {
                    selectedSlots = (timeOfDay == 2) ? SuperRodNightSlots : SuperRodSlots;
                }
                break;

            default: return(null);
            }

            for (int i = 0; i < selectedSlots.Length; i++)
            {
                returnSlots[i] = new EncounterSlot(selectedSlots[i]);
            }

            return(returnSlots);
        }
예제 #16
0
 public EncounterTypeAttribute(EncounterType encounterType) => EncounterType = encounterType;
예제 #17
0
 private static int JSlot(uint result, EncounterType encounterType)
 {
     uint percent = (result >> 16)/656;
     // Diamond\Pearl\Platinum Slots
     switch (encounterType)
     {
         case EncounterType.WildOldRod:
         case EncounterType.WildSurfing:
             {
                 Range[] ranges =
                     {
                         new Range(0, 59), new Range(60, 89), new Range(90, 94), new Range(95, 98),
                         new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         case EncounterType.WildSuperRod:
         case EncounterType.WildGoodRod:
             {
                 Range[] ranges =
                     {
                         new Range(0, 39), new Range(40, 79), new Range(80, 94), new Range(95, 98),
                         new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         default:
             {
                 Range[] ranges =
                     {
                         new Range(0, 19), new Range(20, 39), new Range(40, 49), new Range(50, 59),
                         new Range(60, 69), new Range(70, 79), new Range(80, 84), new Range(85, 89),
                         new Range(90, 93), new Range(94, 97), new Range(98, 98), new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
     }
 }
예제 #18
0
 public EncounterGroup(EndianBinaryReader r)
 {
     Type  = r.ReadEnum <EncounterType>();
     Table = EncounterTable.LoadOrGet(r.ReadInt32());
 }
예제 #19
0
 private static int KSlot(uint result, EncounterType encounterType)
 {
     uint percent = (result >> 16)%100;
     switch (encounterType)
     {
         case EncounterType.WildSurfing:
             {
                 Range[] ranges =
                     {
                         new Range(0, 59), new Range(60, 89), new Range(90, 94), new Range(95, 98),
                         new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         case EncounterType.WildSuperRod:
         case EncounterType.WildGoodRod:
         case EncounterType.WildOldRod:
             {
                 Range[] ranges =
                     {
                         new Range(0, 39), new Range(40, 69), new Range(70, 84), new Range(85, 94),
                         new Range(95, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         case EncounterType.BugCatchingContest:
             {
                 Range[] ranges =
                     {
                         new Range(80, 99), new Range(60, 79), new Range(50, 59), new Range(40, 49),
                         new Range(30, 39), new Range(20, 29), new Range(15, 19), new Range(10, 14),
                         new Range(5, 9), new Range(0, 4)
                     };
                 return CalcSlot(percent, ranges);
             }
         case EncounterType.SafariZone:
             return (int) ((result >> 16)%10);
         case EncounterType.Headbutt:
             {
                 Range[] ranges =
                     {
                         new Range(0, 49), new Range(50, 64), new Range(65, 79), new Range(80, 89),
                         new Range(90, 94), new Range(95, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
         default:
             {
                 Range[] ranges =
                     {
                         new Range(0, 19), new Range(20, 39), new Range(40, 49), new Range(50, 59),
                         new Range(60, 69), new Range(70, 79), new Range(80, 84), new Range(85, 89),
                         new Range(90, 93), new Range(94, 97), new Range(98, 98), new Range(99, 99)
                     };
                 return CalcSlot(percent, ranges);
             }
     }
 }
예제 #20
0
 public bool HasCompletedEncounter(Mobile m, EncounterType encounter)
 {
     return(Table != null && Table.ContainsKey(m) && (Table[m] & encounter) != 0);
 }
예제 #21
0
 public static int encounterSlot(uint result, FrameType frameType, EncounterType encounterType)
 {
     return encounterSlot(result, frameType, encounterType, false);
 }
예제 #22
0
 public EggParents(FrameType frameType, EncounterType encounterType, uint seed, bool BW2)
     : this(frameType, encounterType, seed)
 {
     this.BW2 = BW2;
 }
예제 #23
0
 public static bool Contains(this EncounterType g1, int g2)
 {
     return(g1.Contains((EncounterType)g2));
 }
예제 #24
0
		public Game(Hashtable hash, SpaceTrader parentWin) : base(hash)
		{
			_game = this;
			ParentWindow = parentWin;

			string version = (string)GetValueFromHash(hash, "_version");
			if (version.CompareTo(Consts.CurrentVersion) > 0)
				throw new FutureVersionException();

			_universe = (StarSystem[])ArrayListToArray((ArrayList)GetValueFromHash(hash, "_universe"), "StarSystem");
			_wormholes = (int[])GetValueFromHash(hash, "_wormholes", _wormholes);
			_mercenaries = (CrewMember[])ArrayListToArray((ArrayList)GetValueFromHash(hash, "_mercenaries"), "CrewMember");
			_commander = new Commander((Hashtable)GetValueFromHash(hash, "_commander"));
			_dragonfly = new Ship((Hashtable)GetValueFromHash(hash, "_dragonfly", _dragonfly.Serialize()));
			_scarab = new Ship((Hashtable)GetValueFromHash(hash, "_scarab", _scarab.Serialize()));
			_scorpion = new Ship((Hashtable)GetValueFromHash(hash, "_scorpion", _scorpion.Serialize()));
			_spaceMonster = new Ship((Hashtable)GetValueFromHash(hash, "_spaceMonster", _spaceMonster.Serialize()));
			_opponent = new Ship((Hashtable)GetValueFromHash(hash, "_opponent", _opponent.Serialize()));
			_chanceOfTradeInOrbit = (int)GetValueFromHash(hash, "_chanceOfTradeInOrbit", _chanceOfTradeInOrbit);
			_clicks = (int)GetValueFromHash(hash, "_clicks", _clicks);
			_raided = (bool)GetValueFromHash(hash, "_raided", _raided);
			_inspected = (bool)GetValueFromHash(hash, "_inspected", _inspected);
			_tribbleMessage = (bool)GetValueFromHash(hash, "_tribbleMessage", _tribbleMessage);
			_arrivedViaWormhole = (bool)GetValueFromHash(hash, "_arrivedViaWormhole", _arrivedViaWormhole);
			_paidForNewspaper = (bool)GetValueFromHash(hash, "_paidForNewspaper", _paidForNewspaper);
			_litterWarning = (bool)GetValueFromHash(hash, "_litterWarning", _litterWarning);
			_newsEvents = new ArrayList((int[])GetValueFromHash(hash, "_newsEvents", _newsEvents.ToArray(System.Type.GetType("System.Int32"))));
			_difficulty = (Difficulty)GetValueFromHash(hash, "_difficulty", _difficulty);
			_cheatEnabled = (bool)GetValueFromHash(hash, "_cheatEnabled", _cheatEnabled);
			_autoSave = (bool)GetValueFromHash(hash, "_autoSave", _autoSave);
			_easyEncounters = (bool)GetValueFromHash(hash, "_easyEncounters", _easyEncounters);
			_endStatus = (GameEndType)GetValueFromHash(hash, "_endStatus", _endStatus);
			_encounterType = (EncounterType)GetValueFromHash(hash, "_encounterType", _encounterType);
			_selectedSystemId = (StarSystemId)GetValueFromHash(hash, "_selectedSystemId", _selectedSystemId);
			_warpSystemId = (StarSystemId)GetValueFromHash(hash, "_warpSystemId", _warpSystemId);
			_trackedSystemId = (StarSystemId)GetValueFromHash(hash, "_trackedSystemId", _trackedSystemId);
			_targetWormhole = (bool)GetValueFromHash(hash, "_targetWormhole", _targetWormhole);
			_priceCargoBuy = (int[])GetValueFromHash(hash, "_priceCargoBuy", _priceCargoBuy);
			_priceCargoSell = (int[])GetValueFromHash(hash, "_priceCargoSell", _priceCargoSell);
			_questStatusArtifact = (int)GetValueFromHash(hash, "_questStatusArtifact", _questStatusArtifact);
			_questStatusDragonfly = (int)GetValueFromHash(hash, "_questStatusDragonfly", _questStatusDragonfly);
			_questStatusExperiment = (int)GetValueFromHash(hash, "_questStatusExperiment", _questStatusExperiment);
			_questStatusGemulon = (int)GetValueFromHash(hash, "_questStatusGemulon", _questStatusGemulon);
			_questStatusJapori = (int)GetValueFromHash(hash, "_questStatusJapori", _questStatusJapori);
			_questStatusJarek = (int)GetValueFromHash(hash, "_questStatusJarek", _questStatusJarek);
			_questStatusMoon = (int)GetValueFromHash(hash, "_questStatusMoon", _questStatusMoon);
			_questStatusPrincess = (int)GetValueFromHash(hash, "_questStatusPrincess", _questStatusPrincess);
			_questStatusReactor = (int)GetValueFromHash(hash, "_questStatusReactor", _questStatusReactor);
			_questStatusScarab = (int)GetValueFromHash(hash, "_questStatusScarab", _questStatusScarab);
			_questStatusSculpture = (int)GetValueFromHash(hash, "_questStatusSculpture", _questStatusSculpture);
			_questStatusSpaceMonster = (int)GetValueFromHash(hash, "_questStatusSpaceMonster", _questStatusSpaceMonster);
			_questStatusWild = (int)GetValueFromHash(hash, "_questStatusWild", _questStatusWild);
			_fabricRipProbability = (int)GetValueFromHash(hash, "_fabricRipProbability", _fabricRipProbability);
			_justLootedMarie = (bool)GetValueFromHash(hash, "_justLootedMarie", _justLootedMarie);
			_canSuperWarp = (bool)GetValueFromHash(hash, "_canSuperWarp", _canSuperWarp);
			_chanceOfVeryRareEncounter = (int)GetValueFromHash(hash, "_chanceOfVeryRareEncounter", _chanceOfVeryRareEncounter);
			_veryRareEncounters = new ArrayList((int[])GetValueFromHash(hash, "_veryRareEncounters", _veryRareEncounters.ToArray(System.Type.GetType("System.Int32"))));
			_options = new GameOptions((Hashtable)GetValueFromHash(hash, "_options", _options.Serialize()));
		}
예제 #25
0
        public bool CanTryEncounter(Mobile m, EncounterType encounter)
        {
            Party p = Party.Get(m);

            if (p != null && p.Leader != m)
            {
                m.SendLocalizedMessage(1156184); // You may not start a Shadowguard encounter while in a party unless you are the party leader.
                return(false);
            }

            if (encounter == EncounterType.Roof)
            {
                if (p != null)
                {
                    foreach (PartyMemberInfo info in p.Members)
                    {
                        if (Table == null || !Table.ContainsKey(info.Mobile) || (Table[info.Mobile] & EncounterType.Required) != EncounterType.Required)
                        {
                            m.SendLocalizedMessage(1156249); // All members of your party must complete each of the Shadowguard Towers before attempting the finale.
                            return(false);
                        }
                    }
                }
                else if (Table == null || !Table.ContainsKey(m) || (Table[m] & EncounterType.Required) != EncounterType.Required)
                {
                    m.SendLocalizedMessage(1156196); // You must complete each level of Shadowguard before attempting the Roof.
                    return(false);
                }
            }

            if (p != null)
            {
                foreach (PartyMemberInfo info in p.Members)
                {
                    foreach (ShadowguardEncounter enc in Encounters)
                    {
                        if (enc.PartyLeader != null)
                        {
                            Party party = Party.Get(enc.PartyLeader);

                            if (enc.PartyLeader == info.Mobile || (party != null && party.Contains(info.Mobile)))
                            {
                                m.SendLocalizedMessage(1156189, info.Mobile.Name); // ~1_NAME~ in your party is already attempting to join a Shadowguard encounter.  Start a new party without them or wait until they are finished and try again.
                                return(false);
                            }
                        }

                        foreach (Mobile mob in Queue.Keys.Where(l => l != null))
                        {
                            Party party = Party.Get(mob);

                            if (mob == info.Mobile || (party != null && party.Contains(info.Mobile)))
                            {
                                m.SendLocalizedMessage(1156189, info.Mobile.Name); // ~1_NAME~ in your party is already attempting to join a Shadowguard encounter.  Start a new party without them or wait until they are finished and try again.
                                return(false);
                            }
                        }
                    }
                }
            }

            foreach (ShadowguardEncounter instance in Encounters)
            {
                if (instance.PartyLeader == m)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #26
0
        // for Methods H, J, K
        public static Frame GenerateFrame(
            uint seed,
            FrameType frameType,
            EncounterType encounterType,
            uint number,
            uint rngResult,
            uint pid1,
            uint pid2,
            uint dv1,
            uint dv2,
            uint id,
            uint sid,
            uint offset,
            int encounterSlot)
        {
            var frame = new Frame(frameType)
                {
                    Seed = seed,
                    Number = number,
                    RngResult = rngResult,
                    Offset = offset,
                    id = id,
                    sid = sid,
                    Pid = (pid2 << 16) + pid1,
                    Dv = (dv2 << 16) + dv1,
                    EncounterType = encounterType,
                    EncounterSlot = encounterSlot
                };

            //  Set up the ID and SID before we calculate
            //  the pid, as we are going to need this.

            return frame;
        }
예제 #27
0
 public static bool Contains(this EncounterType g1, int g2) => (g1 & (EncounterType)(1 << g2)) != 0;