public void HandleEvent(Objective_Type Type, uint Entry, int Count) { foreach (Character_quest Quest in _Quests.Values) { foreach (Character_Objectives Objective in Quest._Objectives) { if (Objective.Objective.ObjType == (uint)Type && !Objective.IsDone()) { bool CanAdd = false; if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT) { if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry) { CanAdd = true; } } else if (Type == Objective_Type.QUEST_GET_ITEM) { if (Objective.Objective.Item != null && Entry == Objective.Objective.Item.Entry) { CanAdd = true; } } else if (Type == Objective_Type.QUEST_USE_GO) { CanAdd = true; } if (CanAdd) { Objective.Count += Count; Quest.Dirty = true; SendQuestUpdate(Quest, Objective); CharMgr.Database.SaveObject(Quest); } } } } }
public void HandleEvent(Objective_Type Type, uint Entry, int Count, bool Group = false) { if (!Group && _Owner.IsPlayer() && _Owner.GetPlayer().GetGroup() != null) { Group Current = _Owner.GetPlayer().GetGroup(); lock (Current.Members) { foreach (Player SubPlayer in Current.Members) { if (SubPlayer != _Owner && SubPlayer.GetDistance(_Owner) < 150) { SubPlayer.QtsInterface.HandleEvent(Type, Entry, Count, true); } } } } foreach (KeyValuePair <ushort, Character_quest> QuestKp in _Quests) { foreach (Character_Objectives Objective in QuestKp.Value._Objectives) { if (Objective.Objective.ObjType == (uint)Type && !Objective.IsDone()) { bool CanAdd = false; int NewCount = Objective.Count; if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT) { if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry) { CanAdd = true; NewCount += Count; } } else if (Type == Objective_Type.QUEST_GET_ITEM) { if (Objective.Objective.Item != null && Entry == Objective.Objective.Item.Entry) { CanAdd = true; NewCount = _Owner.GetPlayer().ItmInterface.GetItemCount(Entry); } } else if (Type == Objective_Type.QUEST_USE_GO) { if (Objective.Objective.GameObject != null && Entry == Objective.Objective.GameObject.Entry) { CanAdd = true; NewCount += Count; } } else if (Type == Objective_Type.QUEST_UNKNOWN) { if (Objective.Objective.Guid == Entry) { CanAdd = true; NewCount += Count; } } if (CanAdd) { Objective.Count = NewCount; QuestKp.Value.Dirty = true; SendQuestUpdate(QuestKp.Value); CharMgr.Database.SaveObject(QuestKp.Value); if (Objective.IsDone()) { Creature Finisher; foreach (Object Obj in _Owner._ObjectRanged) { if (Obj.IsCreature()) { Finisher = Obj.GetCreature(); if (WorldMgr.HasQuestToFinish(Finisher.Entry, QuestKp.Value.Quest.Entry)) { Finisher.SendMeTo(_Owner.GetPlayer()); } } } } } } } } }
public void HandleEvent(Objective_Type type, uint entry, int count, bool suppressGroupBroadcast = false) { Player player = _Owner as Player; if (!suppressGroupBroadcast) { if (player?.PriorityGroup != null) { Group currentGroup = player.PriorityGroup; foreach (Player member in currentGroup.GetPlayersCloseTo(player, 150)) { if (member != player) { member.QtsInterface.HandleEvent(type, entry, count, true); } } } } if (_Owner is Pet && _Owner.GetPet().Owner != null) { _Owner.GetPet().Owner.QtsInterface.HandleEvent(type, entry, count, true); } // Check every quest a player has... foreach (KeyValuePair <ushort, Character_quest> questKp in Quests) { // For each objective in every quest... foreach (Character_Objectives objective in questKp.Value._Objectives) { if (objective.Objective == null) { continue; } // RB 7/4/2016 Allow objectives to be completed in an order if (objective.Objective.PreviousObj > 0) { Character_Objectives previousObjective = questKp.Value._Objectives.FirstOrDefault(o => o.Objective.Guid == objective.Objective.PreviousObj); if (previousObjective != null && !previousObjective.IsDone()) { continue; } } if (objective.Objective.ObjType == (uint)type && !objective.IsDone()) { if (objective.Objective.PQArea > 0) { bool skip = true; if (player.CurrentKeep != null && player.CurrentKeep.Realm == player.Realm && player.CurrentKeep.Info.PQuest != null && player.CurrentKeep.Info.PQuest.Entry == objective.Objective.PQArea) { skip = false; } else if (PublicQuest != null && PublicQuest.Info.Entry == objective.Objective.PQArea) { skip = false; } if (skip) { continue; } } if (!string.IsNullOrEmpty(objective.Objective.inZones)) { string[] temp = objective.Objective.inZones.Split(','); if (temp != null && (player.Zone == null || !temp.Contains("" + player.Zone.ZoneId))) { continue; } } bool canAdd = false; int newCount = objective.Count; switch (type) { case Objective_Type.QUEST_SPEAK_TO: case Objective_Type.QUEST_KILL_MOB: case Objective_Type.QUEST_PROTECT_UNIT: if (objective.Objective.Creature != null && entry == objective.Objective.Creature.Entry) { canAdd = true; newCount += count; } break; case Objective_Type.QUEST_KILL_GO: if (objective.Objective.GameObject != null && entry == objective.Objective.GameObject.Entry) { canAdd = true; newCount += count; } break; case Objective_Type.QUEST_KILL_PLAYERS: if (objective.Objective != null) { int result; if (int.TryParse(objective.Objective.ObjID, out result)) { if (result == 0 || ((result >> ((byte)entry - 1)) & 1) == 1) { canAdd = true; newCount += count; } } } break; case Objective_Type.QUEST_GET_ITEM: case Objective_Type.QUEST_USE_ITEM: if (objective.Objective.Item != null && entry == objective.Objective.Item.Entry) { canAdd = true; newCount = _Owner.GetPlayer().ItmInterface.GetItemCount(entry); } break; case Objective_Type.QUEST_USE_GO: if (objective.Objective.GameObject != null && entry == objective.Objective.GameObject.Entry) { // This will turn off Interactable flag on clicked GO, some more work can be // done with GO despawning and UNKs[3] unk modification // Default respawn time: 60 seconds Object target = player.CbtInterface.GetCurrentTarget(); if (target != null) { GameObject go = target.GetGameObject(); if (go != null && go.IsGameObject()) { if (go.Spawn.AllowVfxUpdate == 1) { go.VfxState = 1; } go.Interactable = false; go.EvtInterface.AddEvent(MakeGOInteractable, 60000, 1, target); } } canAdd = true; newCount += count; } break; case Objective_Type.QUEST_WIN_SCENARIO: if (objective.Objective.Scenario != null && entry == objective.Objective.Scenario.ScenarioId) { canAdd = true; newCount += count; } break; case Objective_Type.QUEST_CAPTURE_BO: if (objective.Objective.BattleFrontObjective != null && entry == objective.Objective.BattleFrontObjective.Entry) { canAdd = true; newCount += count; } break; case Objective_Type.QUEST_CAPTURE_KEEP: if (objective.Objective.Keep != null && entry == objective.Objective.Keep.KeepId) { canAdd = true; newCount += count; } break; default: if (objective.Objective.Guid == entry) { canAdd = true; newCount += count; } break; } if (canAdd) { objective.Count = newCount; questKp.Value.Dirty = true; SendQuestUpdate(questKp.Value); CharMgr.Database.SaveObject(questKp.Value); if (objective.IsDone()) { Creature finisher; foreach (Object obj in _Owner.ObjectsInRange) { if (obj.IsCreature()) { finisher = obj.GetCreature(); if (QuestService.HasQuestToFinish(finisher.Entry, questKp.Value.Quest.Entry)) { finisher.SendMeTo(_Owner.GetPlayer()); } } } } } } } } }
public void setDefendCity(Point city, int fturn) { type = Objective_Type.DEFEND_CITY; p = city; turn = fturn; }
public void setDefeatUnit(Unit fu) { type = Objective_Type.DEFEAT_UNIT; u = fu; }
public void setDefeatBoss(Character fc) { type = Objective_Type.DEFEAT_BOSS; c = fc; }
public void setDefeatAll() { type = Objective_Type.DEFEAT_ALL; }
public void setCaptureCity(Point city) { type = Objective_Type.CAPTURE_CITY; p = city; }
public void HandleEvent(Player player, Objective_Type type, uint entry, int count, ushort contributionGain, string pqGoClicked = null) { if (Stage == null) { return; } byte objid = 0; string objectID = "0"; foreach (PQuestObjective obj in Stage.Objectives) { if (obj.IsDone()) { objid++; continue; } if (obj.Objective.Type != (int)type) { objid++; continue; } int oldCount = obj.Count; switch (type) { case Objective_Type.QUEST_SPEAK_TO: case Objective_Type.QUEST_KILL_MOB: uint outVal = 0; //More than one type of NPC can count to the same PQ objective kill count if (obj.Objective.Creature != null && (UInt32.TryParse(obj.Objective.ObjectId, out outVal) && Convert.ToUInt32(obj.Objective.ObjectId) == entry)) { objectID = obj.Objective.ObjectId; obj.Count += count; break; } if (obj.Objective.Creature != null && (UInt32.TryParse(obj.Objective.ObjectId2, out outVal) && Convert.ToUInt32(obj.Objective.ObjectId2) == entry)) { objectID = obj.Objective.ObjectId2; obj.Count += count; break; } if (obj.Objective.Creature != null && (UInt32.TryParse(obj.Objective.ObjectId3, out outVal) && Convert.ToUInt32(obj.Objective.ObjectId3) == entry)) { objectID = obj.Objective.ObjectId3; obj.Count += count; break; } if (obj.Objective.Creature != null && (UInt32.TryParse(obj.Objective.ObjectId4, out outVal) && Convert.ToUInt32(obj.Objective.ObjectId4) == entry)) { objectID = obj.Objective.ObjectId4; obj.Count += count; break; } break; case Objective_Type.QUEST_PROTECT_UNIT: if (obj.Objective.Creature != null && entry == obj.Objective.Creature.Entry) { obj.Count += count; } break; case Objective_Type.QUEST_USE_GO: if (obj.Objective.GameObject != null && entry == obj.Objective.GameObject.Entry) { // This will turn off Interactable flag on clicked GO, some more work can be // done with GO despawning and UNKs[3] unk modification // Default respawn time: 60 seconds Object target = player.CbtInterface.GetCurrentTarget(); if (target != null) { GameObject go = target.GetGameObject(); if (go != null && go.IsGameObject()) { if (go.Spawn.AllowVfxUpdate == 1) { go.VfxState = 1; } go.Interactable = false; go.EvtInterface.AddEvent(MakeGOInteractable, 60000, 1, target); } } obj.Count += count; } break; case Objective_Type.QUEST_KILL_GO: if (obj.Objective.GameObject != null && entry == obj.Objective.GameObject.Entry) { obj.Count += count; } break; case Objective_Type.QUEST_UNKNOWN: if (obj.Objective.Guid == entry) { obj.Count += count; } break; } if (obj.Count != oldCount) { if (player != null) { uint influenceid; if (Info.Type == 0 && player.CurrentArea != null) { if (player.Realm == GameData.Realms.REALMS_REALM_ORDER) { influenceid = player.CurrentArea.OrderInfluenceId; } else { influenceid = player.CurrentArea.DestroInfluenceId; } } else // normaly we should only use the area inf but to not break every pq we keep it like this for now { influenceid = Info.ChapterId; } if (player.WorldGroup == null) { player.AddInfluence((ushort)influenceid, (ushort)(100)); } else { player.WorldGroup.AddInfluenceCount(player, (ushort)influenceid, (ushort)(100 * player.WorldGroup.GetPlayersCloseTo(player, 300).Count)); } if (!Players.ContainsKey(player.CharacterId)) { Players.Add(player.CharacterId, new ContributionInfo(player)); } if (Players.ContainsKey(player.CharacterId)) { Players[player.CharacterId].BaseContribution += contributionGain; Players[player.CharacterId].ActiveTimeEnd = TCPManager.GetTimeStamp() + 5; } } else { foreach (uint plr in ActivePlayers) { if (Players.ContainsKey(plr)) { Players[plr].BaseContribution += contributionGain; } } } foreach (uint plr in ActivePlayers) { Player targPlayer = Player.GetPlayer(plr); if (targPlayer != null) { PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE); Out.WriteUInt32(Info.Entry); Out.WriteByte(1); Out.WriteByte(Info.Type); //realm Out.WriteUInt32(UInt32.Parse(Stage.Objectives.First().Objective.ObjectId)); //ephermal id, sent in main packet for PQ_INFO Out.WriteByte(objid); //index of objective to update Out.WriteUInt16((ushort)obj.Count); // new total targPlayer.SendPacket(Out); } } } objid++; } if (Stage.IsDone()) { NextStage(); } }
void Start() { Cursor.visible = false; Time.timeScale = 1f; start_Time = Time.time; number_Of_Red_Enemies = Red_Enemies.Length; number_Of_Blue_Enemies = Blue_Enemies.Length; number_Of_Yellow_Enemies = Yellow_Enemies.Length; number_Of_Purple_Enemies = Purple_Enemies.Length; number_Of_Green_Enemies = Green_Enemies.Length; number_Of_Orange_Enemies = Orange_Enemies.Length; total_Number_Of_Enemies_Left_To_Spawn = number_Of_Red_Enemies + number_Of_Blue_Enemies + number_Of_Yellow_Enemies + number_Of_Purple_Enemies + number_Of_Green_Enemies + number_Of_Orange_Enemies; number_Of_Special_Enemies = number_Of_Purple_Enemies + number_Of_Green_Enemies + number_Of_Orange_Enemies; total_Number_Of_Enemies = total_Number_Of_Enemies_Left_To_Spawn; enemies_Remaining = total_Number_Of_Enemies_Left_To_Spawn; special_Enemy_Start_Point = total_Number_Of_Enemies_Left_To_Spawn - enemies_Spawned_Until_Special_Enemies; local_UI_Manager.current_Combo.text = current_Combo_Count.ToString(); //current_Objective = objective_GameObjects[current_Active_Objective_Index].gameObject; enemies_Left_On_Current_Wave = enemies_Per_Wave; int random_Objective = Random.Range(0, 4); switch (random_Objective) { case 0: local_Objective_Type = Objective_Type.BLOCK_COLOURED_ATTACKS; bonus_Objective = "Block " + target_Number_Of_Enemies_To_Block + " attacks with the same colour shield"; break; case 1: local_Objective_Type = Objective_Type.KILL_SLOWED_ENEMIES; bonus_Objective = "Kill " + target_Number_Of_Slowed_Enemies_To_Kill + " slowed enemies"; break; case 2: local_Objective_Type = Objective_Type.LOSE_NO_TOTEMS; bonus_Objective = "Do not let any totems be destroyed"; break; case 3: local_Objective_Type = Objective_Type.HIT_A_GROUP_OF_ENEMIES_AT_ONCE; bonus_Objective = "Hit " + number_Of_Enemies_To_Hit_At_Once + " enemies at once with your AOE attack"; break; } local_UI_Manager.Bonus_Objective_Text.text = bonus_Objective; if (!tutorial_Level) { StartCoroutine("Delay_Start_Of_Level"); } else { local_UI_Manager.Display_Current_Level("Level " + SceneManager.GetActiveScene().buildIndex); StartCoroutine("Remove_Tutorial_Heading"); } // StartCoroutine("Change_Between_Objectives"); if (number_Of_Purple_Enemies <= 0) { purple_Enemies_All_Spawned = true; } if (number_Of_Green_Enemies <= 0) { green_Enemies_All_Spawned = true; } if (number_Of_Orange_Enemies <= 0) { orange_Enemies_All_Spawned = true; } }
public void HandleEvent(Objective_Type Type, uint Entry, int Count, bool Group = false) { if (!Group && _Owner.IsPlayer() && _Owner.GetPlayer().GetGroup() != null) { Group Current = _Owner.GetPlayer().GetGroup(); lock (Current.Members) { foreach (Player SubPlayer in Current.Members) if (SubPlayer != _Owner && SubPlayer.GetDistance(_Owner) < 150) { SubPlayer.QtsInterface.HandleEvent(Type, Entry, Count, true); } } } foreach (KeyValuePair<ushort, Character_quest> QuestKp in _Quests) { foreach (Character_Objectives Objective in QuestKp.Value._Objectives) { if (Objective.Objective.ObjType == (uint)Type && !Objective.IsDone()) { bool CanAdd = false; int NewCount = Objective.Count; if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT) { if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry) { CanAdd = true; NewCount += Count; } } else if (Type == Objective_Type.QUEST_GET_ITEM) { if (Objective.Objective.Item != null && Entry == Objective.Objective.Item.Entry) { CanAdd = true; NewCount = _Owner.GetPlayer().ItmInterface.GetItemCount(Entry); } } else if (Type == Objective_Type.QUEST_USE_GO) { if (Objective.Objective.GameObject != null && Entry == Objective.Objective.GameObject.Entry) { CanAdd = true; NewCount += Count; } } else if (Type == Objective_Type.QUEST_UNKNOWN) { if (Objective.Objective.Guid == Entry) { CanAdd = true; NewCount += Count; } } if (CanAdd) { Objective.Count = NewCount; QuestKp.Value.Dirty = true; SendQuestUpdate(QuestKp.Value); CharMgr.Database.SaveObject(QuestKp.Value); if (Objective.IsDone()) { Creature Finisher; foreach (Object Obj in _Owner._ObjectRanged) { if (Obj.IsCreature()) { Finisher = Obj.GetCreature(); if (WorldMgr.HasQuestToFinish(Finisher.Entry, QuestKp.Value.Quest.Entry)) Finisher.SendMeTo(_Owner.GetPlayer()); } } } } } } } }
public void HandleEvent(Objective_Type Type, uint Entry, int Count) { if (Stage == null) { return; } foreach (PQuestObjective Objective in Stage.Objectives) { if (Objective.IsDone()) { continue; } if (Objective.Objective.Type != (int)Type) { continue; } bool CanAdd = false; int NewCount = Objective.Count; if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT) { if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry) { CanAdd = true; NewCount += Count; } } else if (Type == Objective_Type.QUEST_USE_GO) { if (Objective.Objective.GameObject != null && Entry == Objective.Objective.GameObject.Entry) { CanAdd = true; NewCount += Count; } } else if (Type == Objective_Type.QUEST_UNKNOWN) { if (Objective.Objective.Guid == Entry) { CanAdd = true; NewCount += Count; } } if (CanAdd) { Objective.Count = NewCount; foreach (Player Plr in Players) { //PQ UPDATE KILLS PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE); Out.WriteUInt32(Info.Entry); Out.WriteByte((byte)Plr.Realm); Out.WriteByte(Info.Type); Out.WriteUInt32(Objective.Objective.Guid); //(0x000002F3); Out.WriteByte((byte)Objective.Objective.Dotupdater); // some kind of reset ?// 1= update 2nd counter dot Out.WriteUInt16((ushort)Objective.Count); // kill counter DispatchPacket(Out, true); // SENDS THE 100 INFLUNCE ? Out = new PacketOut((byte)Opcodes.F_INFLUENCE_UPDATE); Out.WriteUInt16((ushort)48); //AreaInfluence);// 48 info.infuluce id table player influnce id Out.WriteUInt16(0); Out.WriteUInt32(0x00000064); //(Info.infuluce);// 64 =100 c8 =200 influnce Out.WriteByte(1); // 1 Out.Fill(0, 3); DispatchPacket(Out, true); Plr.SendLocalizeString(Objective.Objective.Objective + " " + Objective.Count + "/" + Objective.Objective.Count, GameData.Localized_text.CHAT_TAG_MONSTER_EMOTE); } } } if (Stage.IsDone()) { NextStage(); } }
public void HandleEvent(Objective_Type Type, uint Entry, int Count) { foreach (Character_quest Quest in _Quests.Values) { { foreach (Character_Objectives Objective in Quest._Objectives) { if (Objective.Objective.ObjType == (uint)Type && !Objective.IsDone()) { bool CanAdd = false; if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT) { if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry) CanAdd = true; } else if (Type == Objective_Type.QUEST_GET_ITEM) { if (Objective.Objective.Item != null && Entry == Objective.Objective.Item.Entry) CanAdd = true; } else if (Type == Objective_Type.QUEST_USE_GO) { CanAdd = true; } if (CanAdd) { Objective.Count += Count; Quest.Dirty = true; SendQuestUpdate(Quest, Objective); CharMgr.Database.SaveObject(Quest); } } } } } // Quest Objectives display on F_QUEST_LIST foreach (Character_quest_inprogress Quest in _InProgressQuests.Values) { { foreach (Character_InProgressObjectives Objective in Quest._InProgressObjectives) { if (Objective.Objective.ObjType == (uint)Type && !Objective.IsDone()) { bool CanAdd = false; if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT) { if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry) CanAdd = true; } else if (Type == Objective_Type.QUEST_GET_ITEM) { if (Objective.Objective.Item != null && Entry == Objective.Objective.Item.Entry) CanAdd = true; } else if (Type == Objective_Type.QUEST_USE_GO) { CanAdd = true; } if (CanAdd) { Objective.Count += Count; Quest.Dirty = true; CharMgr.Database.SaveObject(Quest); } } } } } }