Exemplo n.º 1
0
 public Guild(string name, WorldID world, int guildID)
 {
     Name    = name;
     World   = world;
     GuildID = guildID;
     Members = new List <GuildMember>();
 }
Exemplo n.º 2
0
        private static Guild FindGuildInHtml(HtmlDocument html, WorldID world)
        {
            try
            {
                HtmlNode rankNode = html.DocumentNode.SelectSingleNode("//table[@class=\"rank_table2\"]/tbody");

                if (rankNode is null)
                {
                    return(null);
                }

                foreach (HtmlNode item in rankNode.SelectNodes("./tr"))
                {
                    HtmlNode guildNode = item.SelectSingleNode("./td[2]/span//a");
                    string   guildName = guildNode.InnerText.Trim();
                    string   guildLink = guildNode.GetAttributeValue("href", string.Empty);

                    int guildLevel = item.SelectSingleNode("./td[3]").InnerText.ParseInt() ?? 0;
                    (int gid, WorldID wid) = ParseValueFromGuildLink(guildLink);

                    if (wid == world)
                    {
                        return(new Guild(guildName, wid, gid)
                        {
                            Level = guildLevel
                        });
                    }
                }

                return(null);
            }
            catch (NullReferenceException e)
            {
                throw new ParseException("Failed to parse guild search html", e);
            }
Exemplo n.º 3
0
        public WorldObject(DatabaseID dbID, bool addToWorld)
        {
            mDatabaseID = dbID;
            mAddToWorld = addToWorld;

            WorldID = WorldID.Dynamic(dbID.Type);
        }
Exemplo n.º 4
0
 public Level(WorldID world, int levelID, string levelName)
 {
     World       = world;
     LevelID     = levelID;
     LevelName   = levelName;
     ItemLots    = new List <ItemLot>();
     ShopKeepers = new List <NPCShopkeeper>();
 }
Exemplo n.º 5
0
 public AbstractWorld(GameplayScreen gameplayScreen, Vector2 bgUpperLeft, string bgTextureName, WorldID id)
 {
     _id             = id;
     _gameplayScreen = gameplayScreen;
     mBGUpperLeft    = bgUpperLeft;
     mBGTextureName  = bgTextureName;
     initTiles();
 }
		public WorldObject this[WorldID key] {
			get {
				WorldObject obj;
				if (TryGetValue(key, out obj) == false) {
					return null;
				}
				return obj;
			}
		}
Exemplo n.º 7
0
        public static async Task <HtmlDocument> RequestGuildHtmlAsync(int gid, WorldID wid, int page = 1, CancellationToken cancellation = default)
        {
            if (gid < 0)
            {
                throw new ArgumentException("Guild ID cannot be negative.", nameof(gid));
            }

            return(await s_web.LoadFromWebAsync(string.Format(GuildOrganizationLink, gid, (int)wid, page), cancellation));
        }
Exemplo n.º 8
0
 public Color GetColor(WorldColorSet set, WorldID world)
 {
     if (world == WorldID.Default)
     {
         return(set.defaultColor);
     }
     else
     {
         return(set.colors[(int)world]);
     }
 }
 public bool Search(string str)
 {
     if (WorldID.ToString().Contains(str) || PathID.ToString().Contains(str) || PathIDType.ToString().Contains(str) ||
         PatrolType.ToString().Contains(str) || SpeedType.ToString().Contains(str))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 10
0
        void Update()
        {
            if (!Application.isPlaying && gameObject.scene != null && prefabSet != null)
            {
                if (testWorld != lastTestWorld || prefabSet != lastPrefabSet)
                {
                    lastTestWorld = testWorld;
                    lastPrefabSet = prefabSet;

                    var prefab = WorldManager.I.GetPrefab(prefabSet, testWorld);

                    UpdatePrefab(prefab);
                }
            }
        }
Exemplo n.º 11
0
        public Level GetLevel(WorldID worldId, int level)
        {
            Level returnLevel = null;

            foreach (var item in GameLevels)
            {
                if (item.World == worldId && item.LevelID == level)
                {
                    returnLevel = item;
                    break;
                }
            }

            return(returnLevel);
        }
Exemplo n.º 12
0
        void Update()
        {
            if (!Application.isPlaying && backgroundColorSet != null)
            {
                if (testWorld != lastTestWorld || backgroundColorSet != lastColorSet)
                {
                    lastTestWorld = testWorld;
                    lastColorSet  = backgroundColorSet;

                    var color = WorldManager.I.GetColor(backgroundColorSet, testWorld);

                    UpdateCamera(color);
                }
            }
        }
Exemplo n.º 13
0
        public GameObject GetPrefab(WorldPrefabSet prefabSet, WorldID world)
        {
            if (world == WorldID.Default)
            {
                if (prefabSet.defaultPrefab != null)
                {
                    return(prefabSet.defaultPrefab);
                }

                return(prefabSet.worldPrefabs[0]);
            }
            else
            {
                return(prefabSet.worldPrefabs[(int)world]);
            }
        }
Exemplo n.º 14
0
    void OnGUI()
    {
        world = (WorldID)EditorGUILayout.EnumPopup(world);

        if (world != lastWorld)
        {
            var prefabs = FindObjectsOfType <AutoWorldPrefab>();
            var cameras = FindObjectsOfType <AutoWorldCameraColor>();

            foreach (var p in prefabs)
            {
                p.testWorld = world;
                p.SendMessage("Update");
            }

            foreach (var c in cameras)
            {
                c.testWorld = world;
                c.SendMessage("Update");
            }
        }
        lastWorld = world;
    }
Exemplo n.º 15
0
 public static string ToLocalizedString(this WorldID world) => world switch
 {
Exemplo n.º 16
0
        protected override bool LoadFromDatabase(DataRow row)
        {
            // Load serials
            base.Serial = new DatabaseID(row.Field <uint>("charID"), EDatabaseType.Char);
            if (row.Field <uint>("partyID") > 0)
            {
                PartyID = new WorldID(row.Field <uint>("partyID"), EDatabaseType.Party);
            }
            if (row.Field <uint>("guildID") > 0)
            {
                GuildID = new WorldID(row.Field <uint>("guildID"), EDatabaseType.Guild);
            }
            if (row.Field <uint>("petID") > 0)
            {
                PetID = new WorldID(row.Field <uint>("petID"), EDatabaseType.Pet);
            }
            if (row.Field <uint>("homunID") > 0)
            {
                HomID = new WorldID(row.Field <uint>("homunID"), EDatabaseType.Homunculus);
            }
            if (row.Field <uint>("partnerID") > 0)
            {
                PartnerID = new WorldID(row.Field <uint>("partnerID"), EDatabaseType.Char);
            }
            if (row.Field <uint>("fatherID") > 0)
            {
                FatherID = new WorldID(row.Field <uint>("fatherID"), EDatabaseType.Char);
            }
            if (row.Field <uint>("motherID") > 0)
            {
                MotherID = new WorldID(row.Field <uint>("motherID"), EDatabaseType.Char);
            }
            if (row.Field <uint>("childID") > 0)
            {
                ChildrenID = new WorldID(row.Field <uint>("childID"), EDatabaseType.Char);
            }
            if (row.Field <uint>("childID") > 0)
            {
                MercenaryID = new WorldID(row.Field <uint>("mercID"), EDatabaseType.Mercenary);
            }

            Name      = row.Field <string>("name");
            LevelBase = row.Field <ushort>("levelBase");
            LevelJob  = row.Field <ushort>("levelJob");
            // TODO: rework all datatypes..
            Str  = (short)row.Field <ushort>("str");
            Agi  = (short)row.Field <ushort>("agi");
            Vit  = (short)row.Field <ushort>("vit");
            Int  = (short)row.Field <ushort>("int");
            Dex  = (short)row.Field <ushort>("dex");
            Luk  = (short)row.Field <ushort>("luk");
            Slot = (byte)row.Field <short>("slot");
            //Sex = (EAccountSex)row.Field<int>("sex");
            ExpBase      = (uint)row.Field <ulong>("expBase");
            ExpJob       = (uint)row.Field <ulong>("expJob");
            Zeny         = (int)row.Field <uint>("zeny");
            Class        = (EClientClass)row.Field <ushort>("class");
            StatusPoints = row.Field <uint>("statusPoint");
            SkillPoints  = row.Field <uint>("skillPoint");
            HP           = (int)row.Field <uint>("hp");
            HPMax        = (int)row.Field <uint>("hpMax");
            SP           = (int)row.Field <uint>("sp");
            SPMax        = (int)row.Field <uint>("spMax");
            Option       = (EStatusOption)row.Field <int>("option");
            Manner       = row.Field <short>("manner");
            Karma        = (byte)row.Field <sbyte>("karma");
            HairStyle    = row.Field <byte>("hair");
            HairColor    = (short)row.Field <ushort>("hairColor");
            ClothColor   = (short)row.Field <ushort>("clothesColor");
            IsOnline     = (row.Field <sbyte>("isOnline") > 0? true : false);
            Fame         = (int)row.Field <uint>("fame");

            // Mercenary Guilds Rank

            /*
             * int arch_faith, arch_calls;
             * int spear_faith, spear_calls;
             * int sword_faith, sword_calls;
             */

            Weapon     = (EWeaponType)row.Field <ushort>("weapon");
            Shield     = (short)row.Field <ushort>("shield");
            HeadTop    = (short)row.Field <ushort>("headTop");
            HeadMid    = (short)row.Field <ushort>("headMid");
            HeadBottom = (short)row.Field <ushort>("headBottom");
            Rename     = (short)row.Field <ushort>("rename");


            // Load locations
            Location  = new Location(Mapcache.GetID(row.Field <string>("lastMap")), row.Field <ushort>("lastX"), row.Field <ushort>("lastY"));
            SavePoint = new Location(Mapcache.GetID(row.Field <string>("saveMap")), row.Field <ushort>("saveX"), row.Field <ushort>("saveY"));

            // Other crap
            DeleteDate = row.FieldDateTime("deleteDate");

            return(true);
        }
Exemplo n.º 17
0
		protected override bool LoadFromDatabase(DataRow row) {
			// Load serials
			base.Serial = new DatabaseID(row.Field<uint>("charID"), EDatabaseType.Char);
			if (row.Field<uint>("partyID") > 0) {
				PartyID = new WorldID(row.Field<uint>("partyID"), EDatabaseType.Party);
			}
			if (row.Field<uint>("guildID") > 0) {
				GuildID = new WorldID(row.Field<uint>("guildID"), EDatabaseType.Guild);
			}
			if (row.Field<uint>("petID") > 0) {
				PetID = new WorldID(row.Field<uint>("petID"), EDatabaseType.Pet);
			}
			if (row.Field<uint>("homunID") > 0) {
				HomID = new WorldID(row.Field<uint>("homunID"), EDatabaseType.Homunculus);
			}
			if (row.Field<uint>("partnerID") > 0) {
				PartnerID = new WorldID(row.Field<uint>("partnerID"), EDatabaseType.Char);
			}
			if (row.Field<uint>("fatherID") > 0) {
				FatherID = new WorldID(row.Field<uint>("fatherID"), EDatabaseType.Char);
			}
			if (row.Field<uint>("motherID") > 0) {
				MotherID = new WorldID(row.Field<uint>("motherID"), EDatabaseType.Char);
			}
			if (row.Field<uint>("childID") > 0) {
				ChildrenID = new WorldID(row.Field<uint>("childID"), EDatabaseType.Char);
			}
			if (row.Field<uint>("childID") > 0) {
				MercenaryID = new WorldID(row.Field<uint>("mercID"), EDatabaseType.Mercenary);
			}

			Name = row.Field<string>("name");
			LevelBase = row.Field<ushort>("levelBase");
			LevelJob = row.Field<ushort>("levelJob");
			// TODO: rework all datatypes..
			Str = (short)row.Field<ushort>("str");
			Agi = (short)row.Field<ushort>("agi");
			Vit = (short)row.Field<ushort>("vit");
			Int = (short)row.Field<ushort>("int");
			Dex = (short)row.Field<ushort>("dex");
			Luk = (short)row.Field<ushort>("luk");
			Slot = (byte)row.Field<short>("slot");
			//Sex = (EAccountSex)row.Field<int>("sex");
			ExpBase = (uint)row.Field<ulong>("expBase");
			ExpJob = (uint)row.Field<ulong>("expJob");
			Zeny = (int)row.Field<uint>("zeny");
			Class = (EClientClass)row.Field<ushort>("class");
			StatusPoints = row.Field<uint>("statusPoint");
			SkillPoints = row.Field<uint>("skillPoint");
			HP = (int)row.Field<uint>("hp");
			HPMax = (int)row.Field<uint>("hpMax");
			SP = (int)row.Field<uint>("sp");
			SPMax = (int)row.Field<uint>("spMax");
			Option = (EStatusOption)row.Field<int>("option");
			Manner = row.Field<short>("manner");
			Karma = (byte)row.Field<sbyte>("karma");
			HairStyle = row.Field<byte>("hair");
			HairColor = (short)row.Field<ushort>("hairColor");
			ClothColor = (short)row.Field<ushort>("clothesColor");
			IsOnline = (row.Field<sbyte>("isOnline") > 0? true : false);
			Fame = (int)row.Field<uint>("fame");

			// Mercenary Guilds Rank
			/*
			int arch_faith, arch_calls;
			int spear_faith, spear_calls;
			int sword_faith, sword_calls;
			*/

			Weapon = (EWeaponType)row.Field<ushort>("weapon");
			Shield = (short)row.Field<ushort>("shield");
			HeadTop = (short)row.Field<ushort>("headTop");
			HeadMid = (short)row.Field<ushort>("headMid");
			HeadBottom = (short)row.Field<ushort>("headBottom");
			Rename = (short)row.Field<ushort>("rename");


			// Load locations
			Location = new Location(Mapcache.GetID(row.Field<string>("lastMap")), row.Field<ushort>("lastX"), row.Field<ushort>("lastY"));
			SavePoint = new Location(Mapcache.GetID(row.Field<string>("saveMap")), row.Field<ushort>("saveX"), row.Field<ushort>("saveY"));

			// Other crap
			DeleteDate = row.FieldDateTime("deleteDate");

			return true;
		}
Exemplo n.º 18
0
		public WorldObjectUnit(WorldID dbID, bool addToWorld)
			: base(dbID, addToWorld) {
		}
Exemplo n.º 19
0
		public bool Remove(WorldID key) {
			switch (key.Type) {
				case EDatabaseType.Account:
					return mAccount.Remove(key);
				case EDatabaseType.Char:
					return mCharacter.Remove(key);
				case EDatabaseType.Guild:
					return mGuild.Remove(key);
				case EDatabaseType.Homunculus:
					return mHomonculus.Remove(key);
				case EDatabaseType.Item:
					return mItem.Remove(key);
				case EDatabaseType.Mob:
					return mMonster.Remove(key);
				case EDatabaseType.Npc:
					return mNpc.Remove(key);
				case EDatabaseType.Party:
					return mParty.Remove(key);
				case EDatabaseType.Pet:
					return mPet.Remove(key);
				case EDatabaseType.Skill:
					return mSkill.Remove(key);
			}

			return false;
		}
Exemplo n.º 20
0
		public WorldObjectUnit(WorldID dbID)
			: this(dbID, false) {
		}
Exemplo n.º 21
0
    public void NotifyInWorld(WorldID newWorld)
    {
        WorldID prevWorld = _curWorld;

        _curWorld = newWorld;
        if(newWorld == WorldID.AltWorld1)
            Nights2AudioMgr.Instance.ActivateBackingLoop(Nights2AudioMgr.BackingLoops.kCaveWorldTheme);
        else if(newWorld == WorldID.AltWorld2)
            Nights2AudioMgr.Instance.ActivateBackingLoop(Nights2AudioMgr.BackingLoops.kOpenWorldTheme);
        else if (newWorld == WorldID.RoomWorld)
        {
           //came through return portal
           if ((prevWorld == WorldID.AltWorld1) || (prevWorld == WorldID.AltWorld2))
           {
              Nights2AudioMgr.Instance.ActivateBackingLoop(Nights2AudioMgr.BackingLoops.kNone);
           }
        }

        //stop shamash narration when player teleports
        //if (_curWorld != WorldID.RoomWorld)
        //   StopShamashNarration();

        if (OnTeleported != null)
           OnTeleported(this, new TeleportedEventArgs(prevWorld, _curWorld));
    }
Exemplo n.º 22
0
 public TeleportedEventArgs(WorldID oldWorld, WorldID newWorld)
 {
     OldWorld = oldWorld; NewWorld = newWorld;
 }
Exemplo n.º 23
0
		public bool TryGetValue(WorldID key, out WorldObject obj) {
			switch (key.Type) {
				case EDatabaseType.Account:
					return mAccount.TryGetValue(key, out obj);
				case EDatabaseType.Char:
					return mCharacter.TryGetValue(key, out obj);
				case EDatabaseType.Guild:
					return mGuild.TryGetValue(key, out obj);
				case EDatabaseType.Homunculus:
					return mHomonculus.TryGetValue(key, out obj);
				case EDatabaseType.Item:
					return mItem.TryGetValue(key, out obj);
				case EDatabaseType.Mob:
					return mMonster.TryGetValue(key, out obj);
				case EDatabaseType.Npc:
					return mNpc.TryGetValue(key, out obj);
				case EDatabaseType.Party:
					return mParty.TryGetValue(key, out obj);
				case EDatabaseType.Pet:
					return mPet.TryGetValue(key, out obj);
				case EDatabaseType.Skill:
					return mSkill.TryGetValue(key, out obj);
			}

			obj = null;
			return false;
		}
Exemplo n.º 24
0
        public static async Task <Guild> SearchAsync(string name, WorldID wid, CancellationToken cancellation = default)
        {
            HtmlDocument html = await GuildDataRequester.RequestGuildSearchHtmlAsync(name, cancellation);

            return(FindGuildInHtml(html, wid));
        }
Exemplo n.º 25
0
 public User(string name, WorldID world)
 {
     Name  = name;
     World = world;
 }
Exemplo n.º 26
0
		public void Add(WorldID key, WorldObject obj) {
			switch (key.Type) {
				case EDatabaseType.Account:
					mAccount.Add(key, obj);
					break;
				case EDatabaseType.Char:
					mCharacter.Add(key, obj);
					break;
				case EDatabaseType.Guild:
					mGuild.Add(key, obj);
					break;
				case EDatabaseType.Homunculus:
					mHomonculus.Add(key, obj);
					break;
				case EDatabaseType.Item:
					mItem.Add(key, obj);
					break;
				case EDatabaseType.Mob:
					mMonster.Add(key, obj);
					break;
				case EDatabaseType.Npc:
					mNpc.Add(key, obj);
					break;
				case EDatabaseType.Party:
					mParty.Add(key, obj);
					break;
				case EDatabaseType.Pet:
					mPet.Add(key, obj);
					break;
				case EDatabaseType.Skill:
					mSkill.Add(key, obj);
					break;
			}
		}