Exemplo n.º 1
0
        public void AddPQuest(PQuest_Info PQuest)
        {
            PQuest.OffX = X;
            PQuest.OffY = Y;

            PublicQuests.Add(PQuest);
        }
Exemplo n.º 2
0
        public PQuestObject CreatePQuest(PQuest_Info Quest)
        {
            PQuestObject Obj = new PQuestObject(Quest);

            AddObject(Obj, Quest.ZoneId);
            return(Obj);
        }
Exemplo n.º 3
0
        public void AddPQuest(PQuest_Info pQuest)
        {
            pQuest.OffX = _x;
            pQuest.OffY = _y;

            PublicQuests.Add(pQuest);
        }
Exemplo n.º 4
0
        public GoldChest(GameObject_spawn spawn, PQuest_Info info, ref Dictionary <uint, ContributionInfo> players, float bagCountMod, RegionMgr region)
        {
            Spawn            = spawn;
            _publicQuestInfo = info;
            //Note: _amountOfBags is the original calulation for generating bags, testing math.min to see if this is the cause of the empty bags (clientside limitations)
            int _amountOfBags = (int)(players.Count * bagCountMod);

            if (info.PQType == 2 && WorldMgr.WorldSettingsMgr.GetGenericSetting(16) == 0)
            {
                //foreach (ContributionInfo contrib in players.Values)
                //{
                //    RollForPersonalBag(contrib, 1f, players, region);

                //}
                EvtInterface.AddEvent(Destroy, 180 * 1000, 1);
                // AssignPersonalLoot(player);
            }
            else  //PQs still use the original roll system
            {
                GenerateLootBags(Math.Min(_amountOfBags, 24));
                // Note - if there are more than 42 players, the lowest rarity bag should be green.

#warning if there are more than 114 players, 25 bags will be awarded. Nalgol has the PQ boards restricted to 24 players, for an unknown reason. This could cause something to break.

                AssignLoot(players);

                foreach (KeyValuePair <uint, ContributionInfo> playerRoll in players)
                {
                    Scoreboard(playerRoll.Value, _preRoll.IndexOf(playerRoll), _postRoll.IndexOf(playerRoll));
                }

                EvtInterface.AddEvent(Destroy, 180 * 1000, 1);
            }
        }
Exemplo n.º 5
0
        public PublicQuest CreatePQuest(PQuest_Info quest)
        {
            if (PublicQuests.ContainsKey(quest.Entry))
            {
                Log.Error("CreatePQuest", "Attempted to create public quest that was already contained: ZoneID:" + quest.ZoneId + " Entry: " + quest.Entry);
            }
            ZoneMgr     zone = GetZoneMgr(quest.ZoneId);
            PublicQuest obj  = new PublicQuest(quest);

            AddObject(obj, quest.ZoneId);
            PublicQuests.Add(quest.Entry, obj);
            return(obj);
        }
Exemplo n.º 6
0
        public PQuestObject(PQuest_Info Info)
            : this()
        {
            this.Info = Info;
            Name      = Info.Name;
            Players   = new List <Player>();
            Stages    = new List <PQuestStage>();

            foreach (PQuest_Objective Obj in Info.Objectives)
            {
                Boolean exists = false;
                foreach (PQuestStage Stage in Stages)
                {
                    if (Stage.StageName == Obj.StageName)
                    {
                        exists = true;
                        break;
                    }
                }

                if (!exists)
                {
                    PQuestStage Stage = new PQuestStage();
                    Stage.StageName = Obj.StageName;
                    Stage.Number    = Stages.Count;

                    Stage.Description = Obj.Description;
                    Stages.Add(Stage);
                }

                foreach (PQuestStage Stage in Stages)
                {
                    if (Stage.StageName == Obj.StageName)
                    {
                        PQuestObjective Objective = new PQuestObjective();
                        Objective.Quest       = this;
                        Objective.Objective   = Obj;
                        Objective.ObjectiveID = Obj.Guid;


                        Objective.Count = 0;

                        Stage.AddObjective(Objective);
                    }
                }
            }
        }
Exemplo n.º 7
0
        static public void GeneratePQuestObjective(PQuest_Objective Obj, PQuest_Info Q)
        {
            switch ((Objective_Type)Obj.Type)
            {
            case Objective_Type.QUEST_KILL_PLAYERS:
            {
                if (Obj.Description.Length < 1)
                {
                    Obj.Description = "Enemy Players";
                }
            } break;

            case Objective_Type.QUEST_SPEACK_TO:
                goto case Objective_Type.QUEST_KILL_MOB;

            case Objective_Type.QUEST_KILL_MOB:
            {
                uint ObjID = 0;
                uint.TryParse(Obj.ObjectId, out ObjID);

                if (ObjID != 0)
                {
                    Obj.Creature = GetCreatureProto(ObjID);
                }

                if (Obj.Description.Length < 1 && Obj.Creature != null)
                {
                    Obj.Description = Obj.Creature.Name;
                }
            } break;

            case Objective_Type.QUEST_GET_ITEM:
            {
                uint ObjID = 0;
                uint.TryParse(Obj.ObjectId, out ObjID);

                if (ObjID != 0)
                {
                    Obj.Item = GetItem_Info(ObjID);
                }
            }
            break;
            }
            ;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes the public quest's objectives and stages.
        /// </summary>
        /// <param name="info"></param>
        public PublicQuest(PQuest_Info info)
            : this()
        {
            Info          = info;
            Name          = info.Name;
            ActivePlayers = new List <uint>();
            Players       = new Dictionary <uint, ContributionInfo>();
            Stages        = new List <PQuestStage>();

            foreach (PQuest_Objective obj in info.Objectives)
            {
                // Create a new public quest stage for this objective, if one did not previously exist.
                bool exists = Stages.Any(x => x.StageName == obj.StageName);

                if (!exists)
                {
                    PQuestStage stage = new PQuestStage
                    {
                        StageName   = obj.StageName,
                        Number      = Stages.Count,
                        Description = obj.Description,
                        Time        = obj.Time
                    };
                    Stages.Add(stage);
                }

                // Assign this objective to its public quest stage.
                foreach (PQuestStage stage in Stages)
                {
                    if (stage.StageName == obj.StageName)
                    {
                        PQuestObjective objective = new PQuestObjective
                        {
                            Quest       = this,
                            Objective   = obj,
                            ObjectiveID = obj.Guid,
                            Count       = 0
                        };
                        stage.AddObjective(objective);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public static void Create(RegionMgr region, PQuest_Info info, ref Dictionary <uint, ContributionInfo> players, float bagCountMod)
        {
            if (region == null)
            {
                Log.Error("GoldChest", "Attempt to create for NULL region");
                return;
            }

            if (info == null)
            {
                Log.Error("GoldChest", "NULL PQuest in Region " + region);
                return;
            }

            if (bagCountMod == 0.0f)
            {
                return;
            }

            GameObject_proto proto = GameObjectService.GetGameObjectProto(188);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = 0,
                WorldY = info.GoldChestWorldY,
                WorldZ = info.GoldChestWorldZ,
                WorldX = info.GoldChestWorldX,
                ZoneId = info.ZoneId
            };

            spawn.BuildFromProto(proto);

            GoldChest chest = new GoldChest(spawn, info, ref players, bagCountMod, region);

            region.AddObject(chest, info.ZoneId);
        }
Exemplo n.º 10
0
        public static void GeneratePQuestObjective(PQuest_Objective Obj, PQuest_Info Q)
        {
            switch ((Objective_Type)Obj.Type)
            {
            case Objective_Type.QUEST_KILL_PLAYERS:
            {
                if (Obj.Description.Length < 1)
                {
                    Obj.Description = "Enemy Players";
                }
            }
            break;

            case Objective_Type.QUEST_SPEAK_TO:
                goto case Objective_Type.QUEST_KILL_MOB;

            case Objective_Type.QUEST_PROTECT_UNIT:
                goto case Objective_Type.QUEST_KILL_MOB;

            case Objective_Type.QUEST_KILL_MOB:
            {
                uint ObjID = 0;
                uint.TryParse(Obj.ObjectId, out ObjID);

                if (ObjID != 0)
                {
                    Obj.Creature = CreatureService.GetCreatureProto(ObjID);
                }

                if (Obj.Description.Length < 1 && Obj.Creature != null)
                {
                    Obj.Description = Obj.Creature.Name;
                }
            }
            break;

            case Objective_Type.QUEST_KILL_GO:
            {
                uint ObjID = 0;
                uint.TryParse(Obj.ObjectId, out ObjID);

                if (ObjID != 0)
                {
                    Obj.GameObject = GameObjectService.GetGameObjectProto(ObjID);
                }

                if (Obj.Description.Length < 1 && Obj.GameObject != null)
                {
                    Obj.Description = "Destroy " + Obj.Creature.Name;
                }
            }
            break;

            case Objective_Type.QUEST_USE_GO:
            {
                uint ObjID = 0;
                uint.TryParse(Obj.ObjectId, out ObjID);

                if (ObjID != 0)
                {
                    Obj.GameObject = GameObjectService.GetGameObjectProto(ObjID);
                }

                if (Obj.Description.Length < 1 && Obj.GameObject != null)
                {
                    Obj.Description = "Use " + Obj.GameObject.Name;
                }
            }
            break;

            case Objective_Type.QUEST_GET_ITEM:
            {
                uint ObjID = 0;
                uint.TryParse(Obj.ObjectId, out ObjID);

                if (ObjID != 0)
                {
                    Obj.Item = ItemService.GetItem_Info(ObjID);
                }
            }
            break;
            }
        }
Exemplo n.º 11
0
 public PQuestObject(PQuest_Info Info)
     : this()
 {
     this.Info = Info;
     Name      = Info.Name;
 }