public void FinalizeDataHolder() { var trigger = AreaTriggerMgr.AreaTriggers.Get(Id); if (trigger == null) { ContentMgr.OnInvalidDBData("AreaTriggerEntry {0} (#{1}, Type: {2}) had invalid AreaTrigger-id.", Name, Id, Type); return; } else { trigger.Template = this; } if (TargetPos.IsSet) { var map = World.GetMapTemplate(TargetMap); if (map != null) { Type = AreaTriggerType.Teleport; ArrayUtil.AddOnlyOne(ref map.EntrancePositions, TargetPos); } } Handler = AreaTriggerMgr.GetHandler(Type); }
private bool AddNewBankTab(int tabId) { if (tabId < 0 || tabId >= GuildMgr.MAX_BANK_TABS) { return(false); } var bankTab = this[tabId]; if (bankTab != null) { return(false); } Guild.PurchasedBankTabCount++; var tab = new GuildBankTab { Bank = this, BankSlot = tabId, Icon = "", Name = "Slot " + (tabId + 1), Text = "" }; ArrayUtil.AddOnlyOne(ref bankTabs, tab); tab.CreateLater(); return(true); }
static WorldStates() { WorldStates.CreateStates(); foreach (WorldState allState in WorldStates.AllStates) { if (allState != null) { WorldState[] arr; if (allState.ZoneId != ZoneId.None) { arr = WorldStates.GetStates(allState.ZoneId) ?? new WorldState[1]; int num = (int)ArrayUtil.AddOnlyOne <WorldState>(ref arr, allState); WorldStates.ZoneStates[(int)allState.MapId] = arr; } else if (allState.MapId != MapId.End) { arr = WorldStates.GetStates(allState.MapId) ?? new WorldState[1]; int num = (int)ArrayUtil.AddOnlyOne <WorldState>(ref arr, allState); WorldStates.MapStates[(int)allState.MapId] = arr; } else { int num = (int)ArrayUtil.AddOnlyOne <WorldState>(ref WorldStates.GlobalStates, allState); arr = WorldStates.GlobalStates; } allState.Index = (uint)(arr.Length - 1); } } }
public void FinalizeDataHolder() { AreaTrigger areaTrigger = AreaTriggerMgr.AreaTriggers.Get <AreaTrigger>(this.Id); if (areaTrigger == null) { ContentMgr.OnInvalidDBData("AreaTriggerEntry {0} (#{1}, Type: {2}) had invalid AreaTrigger-id.", (object)this.Name, (object)this.Id, (object)this.Type); } else { areaTrigger.Template = this; if (this.TargetPos.IsSet) { MapTemplate mapTemplate = WCell.RealmServer.Global.World.GetMapTemplate(this.TargetMap); if (mapTemplate != null) { this.Type = AreaTriggerType.Teleport; int num = (int)ArrayUtil.AddOnlyOne <Vector3>(ref mapTemplate.EntrancePositions, this.TargetPos); } } this.Handler = AreaTriggerMgr.GetHandler(this.Type); } }
/// <summary>Adds a new modifier to this Template</summary> public void AddMod(ItemModType modType, int value) { int num = (int)ArrayUtil.AddOnlyOne <StatModifier>(ref this.Mods, new StatModifier() { Type = modType, Value = value }); }
/// <summary> /// /// </summary> /// <param name="relation"></param> /// <returns>The index of the newly created relation</returns> public int AddRelation(BattlegroundRelation relation) { this._chr.EnsureContext(); int index = (int)ArrayUtil.AddOnlyOne <BattlegroundRelation>(ref this._relations, relation); ++this._relationCount; BattlegroundQueue parentQueue = relation.Queue.ParentQueue; if (parentQueue != null) { BattlegroundHandler.SendStatusEnqueued(this._chr, index, relation, parentQueue); } return(index); }
/// <summary> /// /// </summary> /// <param name="relation"></param> /// <returns>The index of the newly created relation</returns> public int AddRelation(BattlegroundRelation relation) { _chr.EnsureContext(); var index = (int)ArrayUtil.AddOnlyOne(ref _relations, relation); _relationCount++; var queue = relation.Queue.ParentQueue; if (queue != null) { BattlegroundHandler.SendStatusEnqueued(_chr, index, relation, queue); } return(index); }
static WorldStates() { CreateStates(); foreach (var state in AllStates) { if (state != null) { WorldState[] arr; if (state.ZoneId != ZoneId.None) { arr = GetStates(state.ZoneId); if (arr == null) { arr = new WorldState[1]; } ArrayUtil.AddOnlyOne(ref arr, state); ZoneStates[(int)state.MapId] = arr; } else if (state.MapId != MapId.End) { arr = GetStates(state.MapId); if (arr == null) { arr = new WorldState[1]; } ArrayUtil.AddOnlyOne(ref arr, state); MapStates[(int)state.MapId] = arr; } else { ArrayUtil.AddOnlyOne(ref GlobalStates, state); arr = GlobalStates; } state.Index = (uint)arr.Length - 1; } } }
private bool AddNewBankTab(int tabId) { if (tabId < 0 || tabId >= 6 || this[tabId] != null) { return(false); } ++this.Guild.PurchasedBankTabCount; ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => { GuildBankTab guildBankTab = new GuildBankTab() { Bank = this, BankSlot = tabId, Icon = "", Name = "Slot " + (object)(tabId + 1), Text = "" }; int num = (int)ArrayUtil.AddOnlyOne <GuildBankTab>(ref this.bankTabs, guildBankTab); guildBankTab.CreateLater(); })); return(true); }
internal static void EnsureItemQuestRelations() { foreach (QuestTemplate template1 in QuestMgr.Templates) { if (template1 != null && template1.CollectableItems != null) { foreach (Asda2ItemStackDescription collectableItem in template1.CollectableItems) { ItemTemplate template2 = GetTemplate(collectableItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne(ref template2.CollectQuests, template1); } } foreach (Asda2ItemStackDescription collectableSourceItem in template1.CollectableSourceItems) { ItemTemplate template2 = GetTemplate(collectableSourceItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableSourceItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne(ref template2.CollectQuests, template1); } } } } foreach (ItemTemplate template1 in Templates) { if (template1 != null && template1.QuestId != 0U) { QuestTemplate template2 = QuestMgr.GetTemplate(template1.QuestId); if (template2 == null) { ContentMgr.OnInvalidDBData("Item {0} had invalid QuestId: {1}", (object)template1, (object)template1.QuestId); } else { template2.Starters.Add(template1); } } } }
internal static void EnsureItemQuestRelations() { // Collect quests foreach (var quest in QuestMgr.Templates) { if (quest == null) { continue; } if (quest.CollectableItems == null) { continue; } foreach (var itemInfo in quest.CollectableItems) { var item = GetTemplate(itemInfo.ItemId); if (item == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", quest, itemInfo); } else { if (item.CollectQuests == null) { item.CollectQuests = new[] { quest }; } else { ArrayUtil.AddOnlyOne(ref item.CollectQuests, quest); } } } foreach (var itemInfo in quest.CollectableSourceItems) { var item = GetTemplate(itemInfo.ItemId); if (item == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", quest, itemInfo); } else { if (item.CollectQuests == null) { item.CollectQuests = new[] { quest }; } else { ArrayUtil.AddOnlyOne(ref item.CollectQuests, quest); } } } } // Item QuestGivers foreach (var item in Templates) { if (item != null && item.QuestId != 0) { var quest = QuestMgr.GetTemplate(item.QuestId); if (quest == null) { ContentMgr.OnInvalidDBData("Item {0} had invalid QuestId: {1}", item, item.QuestId); continue; } quest.Starters.Add(item); } } }
/// <summary> /// Adds a new modifier to this Template /// </summary> public void AddMod(ItemModType modType, int value) { ArrayUtil.AddOnlyOne(ref Mods, new StatModifier { Type = modType, Value = value }); }