Exemplo n.º 1
0
 private void butOK_Click(object sender, EventArgs e)
 {
     //TODO: valid date box, validation here.
     if (textDateEnc.errorProvider1.GetError(textDateEnc) != "")
     {
         MsgBox.Show(this, "You must enter a valid date");
         return;
     }
     _encCur.ProvNum       = _provNumSelected;
     _encCur.Note          = textNote.Text;  //PIn.String(textNote.Text);
     _encCur.DateEncounter = PIn.Date(textDateEnc.Text);
     if (_encCur.CodeValue == null || _encCur.CodeSystem == null)
     {
         MsgBox.Show(this, "You must select a code");
         return;
     }
     if (_encCur.ProvNum == 0)            //Should never be hit, defaults to index 1
     {
         MsgBox.Show(this, "You must select a provider");
         return;
     }
     if (_encCur.IsNew)
     {
         Encounters.Insert(_encCur);
     }
     else
     {
         Encounters.Update(_encCur);
     }
     DialogResult = DialogResult.OK;
 }
        public List <Encounters> FillEncounters(IEntryCollection entryCollection, string name)
        {
            List <Encounters> encounters = new List <Encounters>();

            foreach (IEntry entryitem in entryCollection)
            {
                Encounters         ptEncounters      = new Encounters();
                IEncounter         entryEncounter    = entryitem.AsEncounter;
                IEntryRelationship entryRelationItem = entryEncounter.EntryRelationship.FirstOrDefault();
                if (entryRelationItem != null)
                {
                    IObservation observation = entryRelationItem.AsObservation;
                    IIVL_TS      efftime     = observation.EffectiveTime;
                    if (efftime == null)
                    {
                        throw new InvalidOperationException();
                    }
                    IANY   observationvalue = observation.Value.FirstOrDefault();
                    ICD    str      = (ICD)observationvalue;
                    string location = observation.Participant.Count > 0 ? observation.Participant[0].ParticipantRole.AsPlayingEntity.Name[0].Text : null;
                    ptEncounters.Code = str.Code;
                    ptEncounters.EncounterDescription = str.DisplayName;
                    ptEncounters.PerformerName        = name;
                    //ptEncounters.EncounterDate = efftime != null ? efftime.Low != null ? efftime.Low.Value != null ? new DateTime?(Convert.ToDateTime(efftime.Low.AsDateTime)) : null : null : efftime.Value != null ? new DateTime?(Convert.ToDateTime(efftime.AsDateTime)) : null;
                }
                encounters.Add(ptEncounters);
            }

            return(encounters);
        }
Exemplo n.º 3
0
 public void RecvPokemons(List <EncounterInfo> data)
 {
     data = data.FindNonContains(Encounters.GetAll);
     if (data.Count <= 0)
     {
         return;
     }
     try
     {
         for (var i = 0; i < data.Count; i++)
         {
             var elapsed = (int)(data[i].GetExpiration() - DateTime.Now).TotalMilliseconds;
             if (elapsed > 0)
             {
                 var snc = Encounters.Add(data[i], new TimeSpan(0, 0, 0, 0, elapsed), data[i].UniqueKey());
                 if (snc)
                 {
                     continue;
                 }
             }
             data.RemoveAt(i);
             i--;
         }
         if (data.Count > 0)
         {
             Clients.Group(HubType.Listener.ToString()).NewPokemons(data);
         }
     }
     catch (Exception)
     {
         // ignored
     }
 }
Exemplo n.º 4
0
        public void Encounter(string encounterName)
        {
            Encounters encounter = new Encounters(encounterName);

            //Console.WriteLine(encounter.Name);
            if (encounterName == "VulnerableBirdHunter")
            {
                if (vulnerableCounter > 4)
                {
                    vulnerableCounter = 1;
                    totalPoints      += 200;
                    vulnerableCounter++;
                    if (totalPoints >= pointLifeLimit)
                    {
                        lives++;
                        pointLifeLimit += 10000;
                    }
                }
                else
                {
                    switch (vulnerableCounter)
                    {
                    case 1:
                        totalPoints += 200;
                        break;

                    case 2:
                        totalPoints += 400;
                        break;

                    case 3:
                        totalPoints += 800;
                        break;

                    case 4:
                        totalPoints += 1600;
                        break;
                    }
                    vulnerableCounter++;
                    if (totalPoints >= pointLifeLimit)
                    {
                        lives++;
                        pointLifeLimit += 10000;
                    }
                }
            }
            else if (encounterName == "InvincibleBirdHunter")
            {
                lives--;
            }
            else
            {
                totalPoints += encounter.PointValue;
                if (totalPoints >= pointLifeLimit)
                {
                    lives++;
                    pointLifeLimit += 10000;
                }
            }
        }
Exemplo n.º 5
0
        public void OnEncounterComplete(ShadowguardEncounter encounter, bool expired)
        {
            Encounters.Remove(encounter);
            CheckQueue();

            if (!expired)
            {
                Mobile m = encounter.PartyLeader;

                if (m == null)
                {
                    return;
                }

                Party p = Party.Get(m);

                if (p != null)
                {
                    foreach (PartyMemberInfo info in p.Members)
                    {
                        AddToTable(info.Mobile, encounter.Encounter);
                    }
                }
                else
                {
                    AddToTable(m, encounter.Encounter);
                }
            }
        }
Exemplo n.º 6
0
        public void OnTick()
        {
            if (Encounters == null)
            {
                return;
            }

            Encounters.ForEach(e =>
            {
                if (e != null)
                {
                    DateTime end = e.StartTime + e.EncounterDuration;

                    if (!e.DoneWarning && DateTime.UtcNow > end - TimeSpan.FromMinutes(5))
                    {
                        e.DoWarning();
                    }
                    else if (DateTime.UtcNow >= end)
                    {
                        e.Expire();
                    }
                    else
                    {
                        e.OnTick();
                    }
                }
            });
        }
Exemplo n.º 7
0
        public override void Delete()
        {
            base.Delete();

            EndTimer();

            Encounters.ForEach(e =>
            {
                e.Reset();

                if (e.Instance.Region != null)
                {
                    e.Instance.Region.Unregister();
                }
            });

            ColUtility.Free(Encounters);
            Encounters = null;

            if (Queue != null)
            {
                Queue.Clear();
                Queue = null;
            }

            if (Table != null)
            {
                Table.Clear();
                Table = null;
            }
        }
Exemplo n.º 8
0
    public static void hallCloset2()
    {
        //reuse code from original
        // initializing variables for the encounter
        int playerRoll = 0;
        int closetRoll = 0;
        var rand       = new Random();

        Console.WriteLine("As you open the closet door, you see a ghostly hand reach for you!");
        Console.WriteLine("Pick a number between 1 and 20, to see if you dodge the hand...: ");
        playerRoll = Int32.Parse(Console.ReadLine());
        closetRoll = 5 + rand.Next(1, 21);       // SHOULD generate a random integer between 1 and 20

        if (playerRoll > closetRoll)
        {
            Encounters.handSurvived();
        }
        else if ((playerRoll - closetRoll) <= -5)
        {
            Encounters.handDeath();
        }
        else
        {
            Encounters.handPassedThrough();
        }
    }
Exemplo n.º 9
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0);

            writer.Write(KickLocation);
            writer.Write(Lobby);

            writer.Write(Encounters.Count);
            Encounters.ForEach(encounter =>
            {
                writer.Write((int)encounter.Encounter);
                encounter.Serialize(writer);
            });

            writer.Write(Table == null ? 0 : Table.Count);

            if (Table != null)
            {
                ColUtility.ForEach(Table, (m, encounter) =>
                {
                    writer.Write(m);
                    writer.Write((int)encounter);
                });
            }

            writer.Write(Addons.Count);
            Addons.ForEach(addon => writer.Write(addon));
        }
Exemplo n.º 10
0
 public void StartEncounter(MimicBoss mb, int i)
 {
     boss      = true;
     this.enc  = mb;
     enemies   = mb.enemies;
     encounter = BossFight();
     StartCoroutine(encounter);
 }
Exemplo n.º 11
0
        public void Merge(TrackPlayer originalPlayer)
        {
            // simple fields just use original player
            FreeCompany = originalPlayer.FreeCompany;
            CategoryId  = originalPlayer.CategoryId;
            Icon        = originalPlayer.Icon;
            Color       = originalPlayer.Color;
            Alert       = originalPlayer.Alert;
            CategoryId  = originalPlayer.CategoryId;

            // names
            if (Names == null)
            {
                Names = new List <string>();
            }
            foreach (var name in originalPlayer.Names)
            {
                if (!Names.Contains(name))
                {
                    Names.Add(name);
                }
            }

            // home worlds
            if (HomeWorlds == null)
            {
                HomeWorlds = new List <TrackWorld>();
            }
            var newPlayerWorldIds        = HomeWorlds.Select(world => world.Id).ToList();
            var originalPlayerWorldIds   = originalPlayer.HomeWorlds.Select(world => world.Id).ToList();
            var originalPlayerWorldNames = originalPlayer.HomeWorlds.Select(world => world.Name).ToList();

            foreach (var worldId in originalPlayer.HomeWorlds.Select(world => world.Id).ToList())
            {
                if (!newPlayerWorldIds.Contains(worldId))
                {
                    HomeWorlds.Add(new TrackWorld
                    {
                        Id   = worldId,
                        Name = originalPlayerWorldNames[originalPlayerWorldIds.IndexOf(worldId)]
                    });
                }
            }

            // notes
            Notes = originalPlayer.Notes + " " + Notes;

            // encounters
            if (Encounters == null)
            {
                Encounters = new List <TrackEncounter>();
            }
            Encounters = Encounters.Concat(originalPlayer.Encounters).ToList()
                         .OrderBy(encounter => encounter.Created).ToList();

            // reset to ensure latest props
            ClearBackingFields();
        }
Exemplo n.º 12
0
 private void RegWin()
 {
     enc.clear();
     enc      = null;
     pc.pause = false;
     gc.InEncounter();
     encounterUI.SetActive(false);
     overWorldUI.SetActive(true);
 }
Exemplo n.º 13
0
        public override void Delete()
        {
            base.Delete();

            EndTimer();

            if (Encounters != null)
            {
                Encounters.ForEach(e =>
                {
                    e.Reset();
                });

                ColUtility.Free(Encounters);
                Encounters = null;
            }

            if (Addons != null)
            {
                Addons.IterateReverse(addon =>
                {
                    addon.Delete();
                });

                ColUtility.Free(Addons);
                Addons = null;
            }

            if (Instances != null)
            {
                Instances.ForEach(inst =>
                {
                    if (inst.Region != null)
                    {
                        inst.ClearRegion();
                        inst.Region.Unregister();
                    }
                });

                ColUtility.Free(Instances);
                Instances = null;
            }

            if (Queue != null)
            {
                Queue.Clear();
                Queue = null;
            }

            if (Table != null)
            {
                Table.Clear();
                Table = null;
            }

            Instance = null;
        }
Exemplo n.º 14
0
 public Encounter GetCurrentEncounter()
 {
     if (Encounters.Count == 0)
     {
         return(null);
     }
     else
     {
         return(Encounters.OrderByDescending(e => e.EncounterDate).ThenByDescending(e => e.Id).First());
     }
 }
Exemplo n.º 15
0
 public DateTime?LastEncounterDate()
 {
     if (Encounters.Count == 0)
     {
         return(null);
     }
     else
     {
         return(Encounters.OrderByDescending(e => e.EncounterDate).FirstOrDefault().EncounterDate);
     }
 }
Exemplo n.º 16
0
 public Encounter GetEncounterForToday()
 {
     if (Encounters.Count == 0)
     {
         return(null);
     }
     else
     {
         return(Encounters.SingleOrDefault(e => e.EncounterDate == DateTime.Today));
     }
 }
Exemplo n.º 17
0
 public Encounter GetEncounterForAppointment(Appointment app)
 {
     if (Encounters.Count == 0 || app == null)
     {
         return(null);
     }
     else
     {
         return(Encounters.FirstOrDefault(e => e.EncounterDate >= app.AppointmentDate.AddDays(-3) && e.EncounterDate <= app.AppointmentDate.AddDays(3)));
     }
 }
Exemplo n.º 18
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Exemplo n.º 19
0
    public static List <Encounter> createNewGameEncounterData(int gameId)
    {
        string url          = RestUtil.ENEMY_SERVICE_URI + "createEncounters/" + gameId;
        string jsonResponse = RestUtil.Instance.Get(url);

        jsonResponse = RestUtil.fixJson("encounters", jsonResponse);
        Debug.Log("Json Response: " + jsonResponse);
        Encounters       encounters    = JsonUtility.FromJson <Encounters>(jsonResponse);
        List <Encounter> encounterList = encounters.encounters;

        return(encounterList);
    }
Exemplo n.º 20
0
        public async Task LoadData()
        {
            await LoadPlayerData();

            Encounters.Clear();
            var encounters = await App.Database.Encounters.Get <bool>((e) => e.CampaignID == Id, null);

            foreach (var e in encounters)
            {
                Encounters.Add(new EncounterViewModel(e));
            }
        }
Exemplo n.º 21
0
 public bool IsPartnerContact()
 {
     if (null != PreventEnroll && PreventEnroll.Value)
     {
         var partnerEncounters = Encounters
                                 .Where(x => x.EncounterTypeId == new Guid("B262FDA4-877F-11E7-BB31-BE2E44B68B34") ||
                                        x.EncounterTypeId == new Guid("B262FDA4-877F-11E7-BB31-BE2E44B69B34"))
                                 .ToList();
         return(partnerEncounters.Count > 0);
     }
     return(false);
 }
Exemplo n.º 22
0
    public void StartEncounter(Encounters enc)
    {
        this.enc = enc;

        foreach (var item in drops)
        {
            Debug.Log(item.ToString());
        }
        enemies   = enc.enemies;
        encounter = Encounter();
        StartCoroutine(encounter);
    }
Exemplo n.º 23
0
    void Start()
    {
        shipElements = GetComponent <GravityElements>();
        encounters   = GetComponent <Encounters>();

        spriteRenderer = GetComponentInChildren <SpriteRenderer>(true);
        lineDrawer     = GetComponentInChildren <LineDrawer>();

        perigeeIcons = new List <GameObject>();
        apogeeIcons  = new List <GameObject>();

        updateEncounters();
    }
Exemplo n.º 24
0
        public void OnEncounterComplete(ShadowguardEncounter encounter, bool expired)
        {
            Encounters.Remove(encounter);
            CheckQueue();

            if (!expired)
            {
                foreach (PlayerMobile pm in encounter.Region.GetEnumeratedMobiles().OfType <PlayerMobile>())
                {
                    AddToTable(pm, encounter.Encounter);
                }
            }
        }
Exemplo n.º 25
0
        public static void hallway()
        {
            Console.Clear();
            WriteLine("You start down the Hall.");
            WriteLine("The hall has a few spots where light bulbs would normally be set. However, only one bulb is in and lit, making the hall a bit gloomy.");
            WriteLine("You notice 3 separate doors on your left; they could be closets or storage spaces but all 3 doors are closed.");
            WriteLine("The hall ends at a 'T'-intersection with another hallway; where that hall ends, there is a door leading into another room.");
            WriteLine("Press 'Enter' to continue.");
            Console.ReadLine();

            WriteLine("|       -------------\\---------");
            WriteLine("|                               ");
            WriteLine("|       -----------        -----");
            WriteLine("|       | Util.    \\       |    ");
            WriteLine("|       -----------        |    ");
            WriteLine("|       |         \\        |    ");
            WriteLine("|       | Closet2 |        |    ");
            WriteLine("|       -----------        |    ");
            WriteLine("|       |         \\  Hall  |    ");
            WriteLine("|       | Closet1 |        |    ");
            WriteLine("|       ----------|        |----|");
            WriteLine("|       |           Entry       |");

            WriteLine("What would you like to do?");
            WriteLine("Enter '0' to Quit the program\nEnter '1' to check the nearest Door\nEnter '2' to check the Middle Door\nEnter '3' to check the Far Door\nEnter '4' to continue to the End of the Hall");

            var hallChoice = Int32.Parse(Console.ReadLine());

            switch (hallChoice)
            {
            case 1:
                Encounters.hallCloset2();
                break;

            case 2:
                ItemSearches.nothing();
                break;

            case 3:
                ItemSearches.nothing();             // change/update
                break;

            case 4:
                Backhouse.tHall();
                break;

            default:
                WriteLine("You have exited the program.");
                break;
            }
        }
Exemplo n.º 26
0
        public IActionResult Moves()
        {
            int           PlayerId = (int)HttpContext.Session.GetInt32("PlayerId");
            Player        Player1  = _context.player.SingleOrDefault(p => p.PlayerId == PlayerId);
            List <string> moves    = new List <string>();

            if (Player1.Class == "mage")
            {
                moves.Add("Attack");
                moves.Add("Heal");
                moves.Add("Fireball");
                moves.Add("FrostBolt");
            }
            if (Player1.Class == "samurai")
            {
                moves.Add("Attack");
                moves.Add("Meditate");
                moves.Add("Smash");
                moves.Add("Death Blow");
            }
            if (Player1.Class == "hunter")
            {
                moves.Add("Attack");
                moves.Add("Mend");
                moves.Add("Snipe");
                moves.Add("Silencing Shot");
            }
            if (Player1.Class == "ninja")
            {
                moves.Add("Attack");
                moves.Add("Hide");
                moves.Add("Backstab");
                moves.Add("Rend");
            }
            if (Player1.Class == "priest")
            {
                moves.Add("Attack");
                moves.Add("Holy_Heal");
                moves.Add("Holy_Light");
                moves.Add("Smight");
            }
            SetTemp(0);
            int?           enconId   = HttpContext.Session.GetInt32("EncounterId");
            Encounters     encounter = _context.encounters.SingleOrDefault(e => e.EncountersId == enconId);
            List <Enemies> monsters  = _context.enemies.Where(m => m.EncountersId == enconId && m.life == true).ToList();

            ViewBag.monsters = monsters;
            ViewBag.moves    = moves;
            return(View("Index"));
        }
Exemplo n.º 27
0
        public override async Task Execute()
        {
            string weaponName = Player.CurrentWeapon.BaseName(Data);

            await TextArea.PrintLine("\n");

            if (EncounterState == EncounterState.MonsterReady)
            {
                int dam = attack();

                await TextArea.Print("Attack ", XleColor.White);

                await TextArea.Print(MonstName, XleColor.Cyan);

                await TextArea.PrintLine();

                await TextArea.Print("with ", XleColor.White);

                await TextArea.Print(weaponName, XleColor.Cyan);

                await TextArea.PrintLine();

                if (dam <= 0)
                {
                    SoundMan.PlaySound(LotaSound.PlayerMiss);

                    await TextArea.PrintLine("Your Attack missed.", XleColor.Yellow);

                    return;
                }

                SoundMan.PlaySound(LotaSound.PlayerHit);

                await Encounters.HitMonster(dam);
            }
            else if (EncounterState > 0)
            {
                await TextArea.PrintLine("The unknown creature is not ");

                await TextArea.PrintLine("within range.");

                await GameControl.WaitAsync(300 + 100 *Player.Gamespeed);
            }
            else
            {
                return;
            }

            return;
        }
Exemplo n.º 28
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (_encCur.IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?") != true)
     {
         return;
     }
     Encounters.Delete(_encCur.EncounterNum);
     DialogResult = DialogResult.OK;
 }
        public void OnEncounterComplete(ShadowguardEncounter encounter, bool expired)
        {
            Encounters.Remove(encounter);
            CheckQueue();

            if (!expired)
            {
                Mobile m = encounter.PartyLeader;

                if (m == null)
                {
                    return;
                }

                if (encounter.Encounter == EncounterType.Roof)
                {
                    if (Table != null && Table.ContainsKey(m))
                    {
                        Table.Remove(m);

                        if (Table.Count == 0)
                        {
                            Table = null;
                        }

                        return;
                    }
                }

                if (Table != null && Table.ContainsKey(m))
                {
                    if ((Table[m] & encounter.Encounter) == 0)
                    {
                        Table[m] |= encounter.Encounter;
                    }
                }
                else
                {
                    if (Table == null)
                    {
                        Table = new Dictionary <Mobile, EncounterType>();
                    }

                    Table[m] = encounter.Encounter;
                }
            }
        }
Exemplo n.º 30
0
        public bool IsPos()
        {
            var finalResultEnocunters = Encounters.Where(x => x.EncounterTypeId == new Guid("b262f4ee-852f-11e7-bb31-be2e44b06b34")).ToList();
            var obs = new List <ObsFinalTestResult>();

            foreach (var f in finalResultEnocunters)
            {
                obs.AddRange(f.ObsFinalTestResults);
            }

            if (obs.Count > 0)
            {
                return(obs.Any(x => x.FinalResult == new Guid("B25EFD8A-852F-11E7-BB31-BE2E44B06B34")));
            }

            return(false);
        }