public void Initialize() { log.Info("Initializing Realm Manager..."); GameData = new XmlData(); Behaviors = new BehaviorDb(this); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); Monitor = new RealmPortalMonitor(this); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.NEXUS_LIMBO, new NexusLimbo()); AddWorld(World.VAULT_ID, new Vault(true)); AddWorld(World.TEST_ID, new Test()); AddWorld(World.RAND_REALM, new RandomRealm()); AddWorld(World.PVP, new PVPArena()); AddWorld(World.SHOP_ID, new Shop()); if (Program.Settings.GetValue <bool>("hasRealm")) { AddWorld(GameWorld.AutoName(1, true)); } Chat = new ChatManager(this); Commands = new CommandManager(this); UnusualEffects.Init(); log.Info("Realm Manager initialized."); }
public void Initialize() { log.Info("Initializing Realm Manager..."); GameData = new XmlData(); Behaviors = new BehaviorDb(this); AddWorld(World.NEXUS_ID, Worlds[0] = new Nexus()); Monitor = new RealmPortalMonitor(this); AddWorld(World.TUT_ID, new Tutorial(true)); AddWorld(World.NEXUS_LIMBO, new NexusLimbo()); AddWorld(World.VAULT_ID, new Vault(true)); AddWorld(World.TEST_ID, new Test()); AddWorld(World.RAND_REALM, new RandomRealm()); AddWorld(World.MARKET_ID, new Market()); AddWorld(World.EARENA_ID, new EventArena()); AddWorld(World.ARENA_ID, new Arena()); AddWorld(World.GMARKET_ID, new GoldMarket()); AddWorld(World.XP_GIFT, new XpGift()); AddWorld(World.VIPLOUNGE, new VIPLounge()); AddWorld(World.DONORPETS_ID, new DonorPets()); AddWorld(World.RAIDONE_ID, new RaidOne()); AddWorld(World.RAIDTWO_ID, new RaidTwo()); AddWorld(World.CMARKET_ID, new ClothMarket()); AddWorld(World.RAIDLOBBY_ID, new RaidLobby()); if (Program.Settings.GetValue <bool>("hasRealm")) { Task.Factory.StartNew(() => { AddWorld(GameWorld.AutoName(1, true)); }); //I added this in so the server doesn't wait for the realm to finish loading. This speeds up starting a lot. :) } Chat = new ChatManager(this); Commands = new CommandManager(this); UnusualEffects.Init(); log.Info("Realm Manager initialized."); }
protected override void ExportStats(IDictionary <StatsType, object> stats) { base.ExportStats(stats); stats[StatsType.AccountId] = AccountId; stats[StatsType.Experience] = Experience - GetLevelExp(Level); stats[StatsType.ExperienceGoal] = ExperienceGoal; stats[StatsType.Level] = Level; stats[StatsType.CurrentFame] = CurrentFame; stats[StatsType.Fame] = Fame; stats[StatsType.FameGoal] = FameGoal; stats[StatsType.Stars] = Stars; stats[StatsType.Guild] = Guild; stats[StatsType.GuildRank] = GuildRank; stats[StatsType.Credits] = Credits; stats[StatsType.Souls] = Souls; stats[StatsType.NameChosen] = NameChosen ? 1 : 0; stats[StatsType.Texture1] = Texture1; stats[StatsType.Texture2] = Texture2; stats[StatsType.Skin] = Skin; stats[StatsType.Glowing] = Glowing; stats[StatsType.HP] = HP; stats[StatsType.MP] = MP; stats[StatsType.InvData0] = (Inventory.Data[0] != null ? Inventory.Data[0].GetJson() : "{}"); stats[StatsType.InvData1] = (Inventory.Data[1] != null ? Inventory.Data[1].GetJson() : "{}"); stats[StatsType.InvData2] = (Inventory.Data[2] != null ? Inventory.Data[2].GetJson() : "{}"); stats[StatsType.InvData3] = (Inventory.Data[3] != null ? Inventory.Data[3].GetJson() : "{}"); stats[StatsType.InvData4] = (Inventory.Data[4] != null ? Inventory.Data[4].GetJson() : "{}"); stats[StatsType.InvData5] = (Inventory.Data[5] != null ? Inventory.Data[5].GetJson() : "{}"); stats[StatsType.InvData6] = (Inventory.Data[6] != null ? Inventory.Data[6].GetJson() : "{}"); stats[StatsType.InvData7] = (Inventory.Data[7] != null ? Inventory.Data[7].GetJson() : "{}"); stats[StatsType.InvData8] = (Inventory.Data[8] != null ? Inventory.Data[8].GetJson() : "{}"); stats[StatsType.InvData9] = (Inventory.Data[9] != null ? Inventory.Data[9].GetJson() : "{}"); stats[StatsType.InvData10] = (Inventory.Data[10] != null ? Inventory.Data[10].GetJson() : "{}"); stats[StatsType.InvData11] = (Inventory.Data[11] != null ? Inventory.Data[11].GetJson() : "{}"); stats[StatsType.Inventory0] = (Inventory[0] != null ? Inventory[0].ObjectType : -1); stats[StatsType.Inventory1] = (Inventory[1] != null ? Inventory[1].ObjectType : -1); stats[StatsType.Inventory2] = (Inventory[2] != null ? Inventory[2].ObjectType : -1); stats[StatsType.Inventory3] = (Inventory[3] != null ? Inventory[3].ObjectType : -1); stats[StatsType.Inventory4] = (Inventory[4] != null ? Inventory[4].ObjectType : -1); stats[StatsType.Inventory5] = (Inventory[5] != null ? Inventory[5].ObjectType : -1); stats[StatsType.Inventory6] = (Inventory[6] != null ? Inventory[6].ObjectType : -1); stats[StatsType.Inventory7] = (Inventory[7] != null ? Inventory[7].ObjectType : -1); stats[StatsType.Inventory8] = (Inventory[8] != null ? Inventory[8].ObjectType : -1); stats[StatsType.Inventory9] = (Inventory[9] != null ? Inventory[9].ObjectType : -1); stats[StatsType.Inventory10] = (Inventory[10] != null ? Inventory[10].ObjectType : -1); stats[StatsType.Inventory11] = (Inventory[11] != null ? Inventory[11].ObjectType : -1); if (Boost == null) { CalculateBoost(); } stats[StatsType.MaximumHP] = Stats[0] + Boost[0]; stats[StatsType.MaximumMP] = Stats[1] + Boost[1]; stats[StatsType.Attack] = Stats[2] + Boost[2]; stats[StatsType.Defense] = Stats[3] + Boost[3]; stats[StatsType.Speed] = Stats[4] + Boost[4]; stats[StatsType.Vitality] = Stats[5] + Boost[5]; stats[StatsType.Wisdom] = Stats[6] + Boost[6]; stats[StatsType.Dexterity] = Stats[7] + Boost[7]; if (Owner != null && Owner.Name == "Ocean Trench") { stats[StatsType.OxygenBar] = OxygenBar; } stats[StatsType.HPBoost] = Boost[0]; stats[StatsType.MPBoost] = Boost[1]; stats[StatsType.AttackBonus] = Boost[2]; stats[StatsType.DefenseBonus] = Boost[3]; stats[StatsType.SpeedBonus] = Boost[4]; stats[StatsType.VitalityBonus] = Boost[5]; stats[StatsType.WisdomBonus] = Boost[6]; stats[StatsType.DexterityBonus] = Boost[7]; stats[StatsType.XpBoost] = XpBoost; stats[StatsType.PvP] = PvP ? 1 : 0; stats[StatsType.Team] = Team; stats[StatsType.CanNexus] = CanNexus ? 1 : 0; stats[StatsType.Party] = Party != null ? Party.ID : -1; stats[StatsType.PartyLeader] = Party != null ? (Party.Leader == this ? 1 : 0) : 0; stats[StatsType.Effect] = XmlEffect == "" ? UnusualEffects.GetXML(Effect) : XmlEffect; }
protected override void ExportStats(IDictionary <StatsType, object> stats) { base.ExportStats(stats); stats[StatsType.AccountId] = AccountId; stats[StatsType.Experience] = Experience - GetLevelExp(Level); stats[StatsType.ExperienceGoal] = ExperienceGoal; stats[StatsType.Level] = Level; stats[StatsType.CurrentFame] = CurrentFame; stats[StatsType.Fame] = Fame; stats[StatsType.FameGoal] = FameGoal; stats[StatsType.Stars] = Stars; stats[StatsType.Guild] = Guild[AccountId].Name; stats[StatsType.GuildRank] = Guild[AccountId].Rank; stats[StatsType.Credits] = Credits; stats[StatsType.Keys] = Keys; stats[StatsType.NameChosen] = NameChosen ? 1 : 0; stats[StatsType.Texture1] = Texture1; stats[StatsType.Texture2] = Texture2; stats[StatsType.Skin] = Skin; stats[StatsType.Glowing] = Glowing; stats[StatsType.HP] = HP; stats[StatsType.MP] = MP; stats[StatsType.InvData0] = (Inventory.Data[0] != null ? Inventory.Data[0].GetJson() : "{}"); stats[StatsType.InvData1] = (Inventory.Data[1] != null ? Inventory.Data[1].GetJson() : "{}"); stats[StatsType.InvData2] = (Inventory.Data[2] != null ? Inventory.Data[2].GetJson() : "{}"); stats[StatsType.InvData3] = (Inventory.Data[3] != null ? Inventory.Data[3].GetJson() : "{}"); stats[StatsType.InvData4] = (Inventory.Data[4] != null ? Inventory.Data[4].GetJson() : "{}"); stats[StatsType.InvData5] = (Inventory.Data[5] != null ? Inventory.Data[5].GetJson() : "{}"); stats[StatsType.InvData6] = (Inventory.Data[6] != null ? Inventory.Data[6].GetJson() : "{}"); stats[StatsType.InvData7] = (Inventory.Data[7] != null ? Inventory.Data[7].GetJson() : "{}"); stats[StatsType.InvData8] = (Inventory.Data[8] != null ? Inventory.Data[8].GetJson() : "{}"); stats[StatsType.InvData9] = (Inventory.Data[9] != null ? Inventory.Data[9].GetJson() : "{}"); stats[StatsType.InvData10] = (Inventory.Data[10] != null ? Inventory.Data[10].GetJson() : "{}"); stats[StatsType.InvData11] = (Inventory.Data[11] != null ? Inventory.Data[11].GetJson() : "{}"); stats[StatsType.Inventory0] = (Inventory[0] != null ? Inventory[0].ObjectType : -1); stats[StatsType.Inventory1] = (Inventory[1] != null ? Inventory[1].ObjectType : -1); stats[StatsType.Inventory2] = (Inventory[2] != null ? Inventory[2].ObjectType : -1); stats[StatsType.Inventory3] = (Inventory[3] != null ? Inventory[3].ObjectType : -1); stats[StatsType.Inventory4] = (Inventory[4] != null ? Inventory[4].ObjectType : -1); stats[StatsType.Inventory5] = (Inventory[5] != null ? Inventory[5].ObjectType : -1); stats[StatsType.Inventory6] = (Inventory[6] != null ? Inventory[6].ObjectType : -1); stats[StatsType.Inventory7] = (Inventory[7] != null ? Inventory[7].ObjectType : -1); stats[StatsType.Inventory8] = (Inventory[8] != null ? Inventory[8].ObjectType : -1); stats[StatsType.Inventory9] = (Inventory[9] != null ? Inventory[9].ObjectType : -1); stats[StatsType.Inventory10] = (Inventory[10] != null ? Inventory[10].ObjectType : -1); stats[StatsType.Inventory11] = (Inventory[11] != null ? Inventory[11].ObjectType : -1); /* stats[StatsType.HasBackpack1] = Inventory.Length > 12 ? 1 : 0; * stats[StatsType.HasBackpack2] = Inventory.Length > 20 ? 1 : 0; */ /* if (Inventory.Length > 12) * { * stats[StatsType.Backpack1_0] = (Inventory[12] != null ? Inventory[12].ObjectType : -1); * stats[StatsType.Backpack1_1] = (Inventory[13] != null ? Inventory[13].ObjectType : -1); * stats[StatsType.Backpack1_2] = (Inventory[14] != null ? Inventory[14].ObjectType : -1); * stats[StatsType.Backpack1_3] = (Inventory[15] != null ? Inventory[15].ObjectType : -1); * stats[StatsType.Backpack1_4] = (Inventory[16] != null ? Inventory[16].ObjectType : -1); * stats[StatsType.Backpack1_5] = (Inventory[17] != null ? Inventory[17].ObjectType : -1); * stats[StatsType.Backpack1_6] = (Inventory[18] != null ? Inventory[18].ObjectType : -1); * stats[StatsType.Backpack1_7] = (Inventory[19] != null ? Inventory[19].ObjectType : -1); * * stats[StatsType.InvData0] = (Inventory.Data[12] != null ? Inventory.Data[12].GetJson() : "{}"); * stats[StatsType.InvData1] = (Inventory.Data[13] != null ? Inventory.Data[13].GetJson() : "{}"); * stats[StatsType.InvData2] = (Inventory.Data[14] != null ? Inventory.Data[14].GetJson() : "{}"); * stats[StatsType.InvData3] = (Inventory.Data[15] != null ? Inventory.Data[15].GetJson() : "{}"); * stats[StatsType.InvData4] = (Inventory.Data[16] != null ? Inventory.Data[16].GetJson() : "{}"); * stats[StatsType.InvData5] = (Inventory.Data[17] != null ? Inventory.Data[17].GetJson() : "{}"); * stats[StatsType.InvData6] = (Inventory.Data[18] != null ? Inventory.Data[18].GetJson() : "{}"); * stats[StatsType.InvData7] = (Inventory.Data[19] != null ? Inventory.Data[19].GetJson() : "{}"); * } * if (Inventory.Length > 20) * { * stats[StatsType.Backpack2_0] = (Inventory[20] != null ? Inventory[20].ObjectType : -1); * stats[StatsType.Backpack2_1] = (Inventory[21] != null ? Inventory[21].ObjectType : -1); * stats[StatsType.Backpack2_2] = (Inventory[22] != null ? Inventory[22].ObjectType : -1); * stats[StatsType.Backpack2_3] = (Inventory[23] != null ? Inventory[23].ObjectType : -1); * stats[StatsType.Backpack2_4] = (Inventory[24] != null ? Inventory[24].ObjectType : -1); * stats[StatsType.Backpack2_5] = (Inventory[25] != null ? Inventory[25].ObjectType : -1); * stats[StatsType.Backpack2_6] = (Inventory[26] != null ? Inventory[26].ObjectType : -1); * stats[StatsType.Backpack2_7] = (Inventory[27] != null ? Inventory[27].ObjectType : -1); * * stats[StatsType.InvData0] = (Inventory.Data[20] != null ? Inventory.Data[20].GetJson() : "{}"); * stats[StatsType.InvData1] = (Inventory.Data[21] != null ? Inventory.Data[21].GetJson() : "{}"); * stats[StatsType.InvData2] = (Inventory.Data[22] != null ? Inventory.Data[22].GetJson() : "{}"); * stats[StatsType.InvData3] = (Inventory.Data[23] != null ? Inventory.Data[23].GetJson() : "{}"); * stats[StatsType.InvData4] = (Inventory.Data[24] != null ? Inventory.Data[24].GetJson() : "{}"); * stats[StatsType.InvData5] = (Inventory.Data[25] != null ? Inventory.Data[25].GetJson() : "{}"); * stats[StatsType.InvData6] = (Inventory.Data[26] != null ? Inventory.Data[26].GetJson() : "{}"); * stats[StatsType.InvData7] = (Inventory.Data[27] != null ? Inventory.Data[27].GetJson() : "{}"); * } */ if (Boost == null) { CalculateBoost(); } stats[StatsType.MaximumHP] = Stats[0] + Boost[0]; stats[StatsType.MaximumMP] = Stats[1] + Boost[1]; stats[StatsType.Attack] = Stats[2] + Boost[2]; stats[StatsType.Defense] = Stats[3] + Boost[3]; stats[StatsType.Speed] = Stats[4] + Boost[4]; stats[StatsType.Vitality] = Stats[5] + Boost[5]; stats[StatsType.Wisdom] = Stats[6] + Boost[6]; stats[StatsType.Dexterity] = Stats[7] + Boost[7]; stats[StatsType.Luck] = Stats[8] + Boost[8]; stats[StatsType.Crit] = Stats[9] + Boost[9]; if (Owner.Name == "Ocean Trench" && Owner != null) { stats[StatsType.OxygenBar] = OxygenBar; } stats[StatsType.HPBoost] = Boost[0]; stats[StatsType.MPBoost] = Boost[1]; stats[StatsType.AttackBonus] = Boost[2]; stats[StatsType.DefenseBonus] = Boost[3]; stats[StatsType.SpeedBonus] = Boost[4]; stats[StatsType.VitalityBonus] = Boost[5]; stats[StatsType.WisdomBonus] = Boost[6]; stats[StatsType.DexterityBonus] = Boost[7]; stats[StatsType.LuckBonus] = Boost[8]; stats[StatsType.CritBonus] = Boost[9]; stats[StatsType.XpBoost] = XpBoost; stats[StatsType.PvP] = PvP ? 1 : 0; stats[StatsType.Team] = Team; stats[StatsType.CanNexus] = CanNexus ? 1 : 0; stats[StatsType.Party] = Party != null ? Party.ID : -1; stats[StatsType.PartyLeader] = Party != null ? (Party.Leader == this ? 1 : 0) : 0; stats[StatsType.Effect] = XmlEffect == string.Empty ? UnusualEffects.GetXML(Effect) : XmlEffect; }
public Tuple <Item, ItemData> GetCrateLoot(CrateLoot crateLoot, Random rand) { if (rand == null) { rand = new Random(); } Item item = null; ItemData itemData = null; switch (crateLoot.Type) { case CrateLootTypes.Item: { itemData = new ItemData(); if (crateLoot.Strange) { itemData.NameColor = 0xFF5A28; itemData.NamePrefix = "Strange"; itemData.Kills = 0; itemData.Strange = true; } if (crateLoot.NameColor != 0xFFFFFF) { itemData.NameColor = crateLoot.NameColor; } item = Manager.GameData.Items[Manager.GameData.IdToObjectType[crateLoot.Name]]; } break; case CrateLootTypes.Skin: { if (crateLoot.Unusual) { itemData = new ItemData(); List <string> effects = new List <string>(); if (crateLoot.Series != 0) { effects = UnusualEffects.Series[crateLoot.Series]; } else { foreach (var i in UnusualEffects.Series) { if (i.Key != 0) { effects.AddRange(i.Value); } } } itemData.NamePrefix = "Unusual"; itemData.NameColor = 0x8000FF; itemData.Effect = effects.RandomElement(rand); itemData.FullEffect = UnusualEffects.Save(itemData.Effect); } List <Item> candidates = Manager.GameData.Items .Where(_item => { foreach (var activEff in _item.Value.ActivateEffects) { if (activEff.Effect == ActivateEffects.UnlockSkin) { return(true); } } return(false); }) .Where(_item => { if (crateLoot.Premium && !_item.Value.Premium) { return(false); } if (!crateLoot.Premium && _item.Value.Premium) { return(false); } return(true); }) .Where(_item => !_item.Value.AdminOnly) .Select(_item => _item.Value) .ToList(); item = candidates.RandomElement(rand); } break; case CrateLootTypes.StrangePart: { item = Manager.GameData.Items[Manager.GameData.IdToObjectType["Strange Part"]]; itemData = new ItemData(); if (crateLoot.Name != null) { itemData.NamePrefix = crateLoot.Name; } else { string randPart = ItemData.StrangePartTypes.RandomElement(rand); itemData.NamePrefix = randPart; } } break; case CrateLootTypes.TieredStrangifier: { item = Manager.GameData.Items[Manager.GameData.IdToObjectType["Strangifier"]]; itemData = new ItemData(); int[] types = new int[] { 1, 2, 3, 8, 17, 24 }; List <Item> candidates = Manager.GameData.Items .Where(_item => Array.IndexOf(types, _item.Value.SlotType) != -1) .Where(_item => _item.Value.Tier == rand.Next(crateLoot.MinTier, crateLoot.MaxTier + 1)) .Select(_item => _item.Value) .ToList(); itemData.NamePrefix = candidates.RandomElement(rand).ObjectId; itemData.NameColor = 0xFF5A28; } break; } return(Tuple.Create(item, itemData)); }