public WorldServer(XmlConfigurationProvider <WorldServerConfiguration> xmlConfigurationProvider) { CLIENTs = new Dictionary <uint, WS_Network.ClientClass>(); CHARACTERs = new Dictionary <ulong, WS_PlayerData.CharacterObject>(); CHARACTERs_Lock = new System.Threading.ReaderWriterLock(); ALLQUESTS = new WS_Quests(); AllGraveYards = new WS_GraveYards(WorldServiceLocator._DataStoreProvider); CreatureQuestStarters = new Dictionary <int, List <int> >(); CreatureQuestFinishers = new Dictionary <int, List <int> >(); GameobjectQuestStarters = new Dictionary <int, List <int> >(); GameobjectQuestFinishers = new Dictionary <int, List <int> >(); WORLD_CREATUREs_Lock = new System.Threading.ReaderWriterLock(); WORLD_CREATUREs = new Dictionary <ulong, WS_Creatures.CreatureObject>(); WORLD_CREATUREsKeys = new ArrayList(); WORLD_GAMEOBJECTs = new Dictionary <ulong, WS_GameObjects.GameObject>(); WORLD_CORPSEOBJECTs = new Dictionary <ulong, WS_Corpses.CorpseObject>(); WORLD_DYNAMICOBJECTs_Lock = new System.Threading.ReaderWriterLock(); WORLD_DYNAMICOBJECTs = new Dictionary <ulong, WS_DynamicObjects.DynamicObject>(); WORLD_TRANSPORTs_Lock = new System.Threading.ReaderWriterLock(); WORLD_TRANSPORTs = new Dictionary <ulong, WS_Transports.TransportObject>(); WORLD_ITEMs = new Dictionary <ulong, ItemObject>(); ITEMDatabase = new Dictionary <int, WS_Items.ItemInfo>(); CREATURESDatabase = new Dictionary <int, CreatureInfo>(); GAMEOBJECTSDatabase = new Dictionary <int, WS_GameObjects.GameObjectInfo>(); itemGuidCounter = WorldServiceLocator._Global_Constants.GUID_ITEM; CreatureGUIDCounter = WorldServiceLocator._Global_Constants.GUID_UNIT; GameObjectsGUIDCounter = WorldServiceLocator._Global_Constants.GUID_GAMEOBJECT; CorpseGUIDCounter = WorldServiceLocator._Global_Constants.GUID_CORPSE; DynamicObjectsGUIDCounter = WorldServiceLocator._Global_Constants.GUID_DYNAMICOBJECT; TransportGUIDCounter = WorldServiceLocator._Global_Constants.GUID_MO_TRANSPORT; Log = new BaseWriter(); PacketHandlers = new Dictionary <Opcodes, HandlePacket>(); Rnd = new Random(); AccountDatabase = new SQL(); CharacterDatabase = new SQL(); WorldDatabase = new SQL(); this.xmlConfigurationProvider = xmlConfigurationProvider; }
public bool CanSeeQuest(ref WS_PlayerData.CharacterObject objCharacter) { bool retValue = true; checked { if (objCharacter.Level + 6 < Level_Start) { retValue = false; } } if (RequiredClass > 0 && RequiredClass != (int)objCharacter.Classe) { retValue = false; } if (ZoneOrSort < 0) { WS_Quests tmpQuest = new WS_Quests(); byte reqSort = tmpQuest.ClassByQuestSort(checked (-ZoneOrSort)); if (reqSort > 0 && reqSort != (uint)objCharacter.Classe) { retValue = false; } } if (RequiredRace != 0 && (RequiredRace & objCharacter.RaceMask) == 0) { retValue = false; } if (RequiredTradeSkill > 0) { if (!objCharacter.Skills.ContainsKey(RequiredTradeSkill)) { retValue = false; } if (objCharacter.Skills[RequiredTradeSkill].Current < RequiredTradeSkillValue) { retValue = false; } } if (RequiredMinReputation_Faction > 0 && objCharacter.GetReputationValue(RequiredMinReputation_Faction) < RequiredMinReputation) { retValue = false; } if (RequiredMaxReputation_Faction > 0 && objCharacter.GetReputationValue(RequiredMaxReputation_Faction) >= RequiredMaxReputation) { retValue = false; } if (PreQuests.Count > 0) { foreach (int QuestID in PreQuests) { if (QuestID > 0) { if (!objCharacter.QuestsCompleted.Contains(QuestID)) { retValue = false; } } else if (QuestID < 0 && objCharacter.QuestsCompleted.Contains(QuestID)) { retValue = false; } } } if (objCharacter.QuestsCompleted.Contains(ID)) { retValue = false; } if (objCharacter.IsQuestInProgress(ID)) { retValue = false; } return(retValue); }
public void On_CMSG_TEXT_EMOTE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client) { checked { if (packet.Data.Length - 1 < 21 && client.Character != null) { return; } packet.GetInt16(); int TextEmote = packet.GetInt32(); int Unk = packet.GetInt32(); ulong GUID = packet.GetUInt64(); WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TEXT_EMOTE [TextEmote={2} Unk={3}]", client.IP, client.Port, TextEmote, Unk); if (WorldServiceLocator._CommonGlobalFunctions.GuidIsCreature(GUID) && WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID)) { WS_Quests aLLQUESTS = WorldServiceLocator._WorldServer.ALLQUESTS; ref WS_PlayerData.CharacterObject character = ref client.Character; Dictionary <ulong, WS_Creatures.CreatureObject> wORLD_CREATUREs; ulong key; WS_Creatures.CreatureObject creature = (wORLD_CREATUREs = WorldServiceLocator._WorldServer.WORLD_CREATUREs)[key = GUID]; aLLQUESTS.OnQuestDoEmote(ref character, ref creature, TextEmote); wORLD_CREATUREs[key] = creature; if (WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript != null && WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript is WS_Creatures_AI.GuardAI) { ((WS_Creatures_AI.GuardAI)WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript).OnEmote(TextEmote); } } if (WorldServiceLocator._WS_DBCDatabase.EmotesText.ContainsKey(TextEmote)) { if (WorldServiceLocator._WS_DBCDatabase.EmotesState[WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]] == 0) { client.Character.DoEmote(WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]); } else if (WorldServiceLocator._WS_DBCDatabase.EmotesState[WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]] == 2) { client.Character.cEmoteState = WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]; client.Character.SetUpdateFlag(148, client.Character.cEmoteState); client.Character.SendCharacterUpdate(); } } string secondName = ""; if (decimal.Compare(new decimal(GUID), 0m) > 0) { if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(GUID)) { secondName = WorldServiceLocator._WorldServer.CHARACTERs[GUID].Name; } else if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID)) { secondName = WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].Name; } } Packets.PacketClass SMSG_TEXT_EMOTE = new Packets.PacketClass(Opcodes.SMSG_TEXT_EMOTE); try { SMSG_TEXT_EMOTE.AddUInt64(client.Character.GUID); SMSG_TEXT_EMOTE.AddInt32(TextEmote); SMSG_TEXT_EMOTE.AddInt32(255); SMSG_TEXT_EMOTE.AddInt32(secondName.Length + 1); SMSG_TEXT_EMOTE.AddString(secondName); client.Character.SendToNearPlayers(ref SMSG_TEXT_EMOTE); } finally { SMSG_TEXT_EMOTE.Dispose(); } }