static void Main(string[] args) { LogThread.AlwaysPrintToConsole = true; _server = new ServerBase(11299, "server=127.0.0.1;uid=DecoServer;pwd=dspass;database=deco;"); _server.TaskProcessor = new TaskProcessor(_server); _server.Run(); LogThread.GetLog().Shutdown(); }
public TaskProcessor(ServerBase server) { _server = server; _tasks = new List<Task>(); _tasksLock = new Mutex(); _taskHandlers = new Dictionary<Task.TaskType, TaskHandler>(); _taskHandlers[Task.TaskType.LoadPlayMaps_Fetch] = LoadPlayMaps_Fetch_Handler; _taskHandlers[Task.TaskType.LoadPlayMaps_Process] = LoadPlayMaps_Process_Handler; _taskHandlers[Task.TaskType.LoadNPCs_Fetch] = LoadNPCs_Fetch_Handler; _taskHandlers[Task.TaskType.LoadNPCs_Process] = LoadNPCs_Process_Handler; _taskHandlers[Task.TaskType.LoadLevelData_Process] = LoadLevelData_Process_Handler; _taskHandlers[Task.TaskType.LoadItems_Process] = LoadItems_Process_Handler; _taskHandlers[Task.TaskType.LoadLootTables_Process] = LoadLootTables_Process_Handler; _taskHandlers[Task.TaskType.LoadLocations_Process] = LoadLocations_Process_Handler; _taskHandlers[Task.TaskType.LoadMonsterTemplates_Process] = LoadMonsterTemplates_Process_Handler; _taskHandlers[Task.TaskType.LoadMonsterSpawners_Process] = LoadMonsterSpawners_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestLines_Process] = LoadQuestLines_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestSteps_Process] = LoadQuestSteps_Process_Handler; _taskHandlers[Task.TaskType.LoginRequest_Fetch] = LoginRequest_Fetch_Handler; _taskHandlers[Task.TaskType.LoginRequest_Process] = LoginRequest_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestRewards_Process] = LoadQuestRewards_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestRequirements_Process] = LoadQuestRequirements_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestInfo_Process] = LoadQuestInfo_Process_Handler; _taskHandlers[Task.TaskType.CharacterList_Fetch] = CharacterList_Fetch_Handler; _taskHandlers[Task.TaskType.CharacterList_Process] = CharacterList_Process_Handler; _taskHandlers[Task.TaskType.CreateCharacter] = CreateCharacter_Handler; _taskHandlers[Task.TaskType.CreateCharacter_Finish] = CreateCharacter_Finish_Handler; _taskHandlers[Task.TaskType.DeleteCharacter] = DeleteCharacter_Handler; _taskHandlers[Task.TaskType.SelectCharacter] = SelectCharacter_Handler; _taskHandlers[Task.TaskType.SelectedCharacter_Fetch] = SelectedCharacter_Fetch_Handler; _taskHandlers[Task.TaskType.CharacterDataHV_Process] = CharacterDataHV_Process_Handler; _taskHandlers[Task.TaskType.CharacterDataLV_Process] = CharacterDataLV_Process_Handler; _taskHandlers[Task.TaskType.CharacterDataItems_Process] = CharacterDataItems_Process_Handler; _taskHandlers[Task.TaskType.CharacterFrontierData_Process] = CharacterFrontierData_Process_Handler; _taskHandlers[Task.TaskType.CharacterSkills_Process] = CharacterSkills_Process_Handler; _taskHandlers[Task.TaskType.CharacterActiveQuests_Process] = CharacterActiveQuests_Process_Handler; _taskHandlers[Task.TaskType.CharacterCompletedQuests_Process] = CharacterCompletedQuests_Process_Handler; _taskHandlers[Task.TaskType.CharacterToolbar_Process] = CharacterToolbar_Process_Handler; _taskHandlers[Task.TaskType.CharacterActiveQuest_Save] = CharacterActiveQuest_Save_Handler; _taskHandlers[Task.TaskType.PlayerEnterMap] = PlayerEnterMap_Handler; _taskHandlers[Task.TaskType.PlayerMove] = PlayerMove_Handler; _taskHandlers[Task.TaskType.PlayerUpdatePosition] = PlayerUpdatePosition_Handler; _taskHandlers[Task.TaskType.NPCDialogNextButton] = NPCDialogNextButton_Handler; _taskHandlers[Task.TaskType.GiveGoldExpFame] = GiveGoldExpFame_Handler; _taskHandlers[Task.TaskType.GiveItem] = GiveItem_Handler; _taskHandlers[Task.TaskType.GiveItem_Finish] = GiveItem_Finish_Handler; _taskHandlers[Task.TaskType.RemoveCharacter] = RemoveCharacter_Handler; _taskHandlers[Task.TaskType.GMCommand_Process] = GMCommand_Process_Handler; _taskHandlers[Task.TaskType.MoveItem] = MoveItem_Handler; _taskHandlers[Task.TaskType.EquipItem] = EquipItem_Handler; _taskHandlers[Task.TaskType.UnEquipItem] = UnEquipItem_Handler; _taskHandlers[Task.TaskType.Teleport] = Teleport_Handler; _taskHandlers[Task.TaskType.UpdateNPCPosition] = UpdateNPCPosition_Handler; _taskHandlers[Task.TaskType.DoAttack] = DoAttack_Handler; _taskHandlers[Task.TaskType.MonsterAttackPlayer] = MonsterAttackPlayer_Handler; _taskHandlers[Task.TaskType.UseItem] = UseItem_Handler; _taskHandlers[Task.TaskType.ToolbarItemSet] = ToolbarItemSet_Handler; _taskHandlers[Task.TaskType.ToolbarItemClear] = ToolbarItemClear_Handler; _pendingQueries = new Dictionary<long, Task>(); _pqLock = new Mutex(); }
public TaskProcessor(ServerBase server) { _server = server; _tasks = new List <Task>(); _tasksLock = new Mutex(); _taskHandlers = new Dictionary <Task.TaskType, TaskHandler>(); _taskHandlers[Task.TaskType.LoadPlayMaps_Fetch] = LoadPlayMaps_Fetch_Handler; _taskHandlers[Task.TaskType.LoadPlayMaps_Process] = LoadPlayMaps_Process_Handler; _taskHandlers[Task.TaskType.LoadNPCs_Fetch] = LoadNPCs_Fetch_Handler; _taskHandlers[Task.TaskType.LoadNPCs_Process] = LoadNPCs_Process_Handler; _taskHandlers[Task.TaskType.LoadLevelData_Process] = LoadLevelData_Process_Handler; _taskHandlers[Task.TaskType.LoadItems_Process] = LoadItems_Process_Handler; _taskHandlers[Task.TaskType.LoadLootTables_Process] = LoadLootTables_Process_Handler; _taskHandlers[Task.TaskType.LoadLocations_Process] = LoadLocations_Process_Handler; _taskHandlers[Task.TaskType.LoadMonsterTemplates_Process] = LoadMonsterTemplates_Process_Handler; _taskHandlers[Task.TaskType.LoadMonsterSpawners_Process] = LoadMonsterSpawners_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestLines_Process] = LoadQuestLines_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestSteps_Process] = LoadQuestSteps_Process_Handler; _taskHandlers[Task.TaskType.LoginRequest_Fetch] = LoginRequest_Fetch_Handler; _taskHandlers[Task.TaskType.LoginRequest_Process] = LoginRequest_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestRewards_Process] = LoadQuestRewards_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestRequirements_Process] = LoadQuestRequirements_Process_Handler; _taskHandlers[Task.TaskType.LoadQuestInfo_Process] = LoadQuestInfo_Process_Handler; _taskHandlers[Task.TaskType.CharacterList_Fetch] = CharacterList_Fetch_Handler; _taskHandlers[Task.TaskType.CharacterList_Process] = CharacterList_Process_Handler; _taskHandlers[Task.TaskType.CreateCharacter] = CreateCharacter_Handler; _taskHandlers[Task.TaskType.CreateCharacter_Finish] = CreateCharacter_Finish_Handler; _taskHandlers[Task.TaskType.DeleteCharacter] = DeleteCharacter_Handler; _taskHandlers[Task.TaskType.SelectCharacter] = SelectCharacter_Handler; _taskHandlers[Task.TaskType.SelectedCharacter_Fetch] = SelectedCharacter_Fetch_Handler; _taskHandlers[Task.TaskType.CharacterDataHV_Process] = CharacterDataHV_Process_Handler; _taskHandlers[Task.TaskType.CharacterDataLV_Process] = CharacterDataLV_Process_Handler; _taskHandlers[Task.TaskType.CharacterDataItems_Process] = CharacterDataItems_Process_Handler; _taskHandlers[Task.TaskType.CharacterFrontierData_Process] = CharacterFrontierData_Process_Handler; _taskHandlers[Task.TaskType.CharacterSkills_Process] = CharacterSkills_Process_Handler; _taskHandlers[Task.TaskType.CharacterActiveQuests_Process] = CharacterActiveQuests_Process_Handler; _taskHandlers[Task.TaskType.CharacterCompletedQuests_Process] = CharacterCompletedQuests_Process_Handler; _taskHandlers[Task.TaskType.CharacterToolbar_Process] = CharacterToolbar_Process_Handler; _taskHandlers[Task.TaskType.CharacterActiveQuest_Save] = CharacterActiveQuest_Save_Handler; _taskHandlers[Task.TaskType.PlayerEnterMap] = PlayerEnterMap_Handler; _taskHandlers[Task.TaskType.PlayerMove] = PlayerMove_Handler; _taskHandlers[Task.TaskType.PlayerUpdatePosition] = PlayerUpdatePosition_Handler; _taskHandlers[Task.TaskType.NPCDialogNextButton] = NPCDialogNextButton_Handler; _taskHandlers[Task.TaskType.GiveGoldExpFame] = GiveGoldExpFame_Handler; _taskHandlers[Task.TaskType.GiveItem] = GiveItem_Handler; _taskHandlers[Task.TaskType.GiveItem_Finish] = GiveItem_Finish_Handler; _taskHandlers[Task.TaskType.RemoveCharacter] = RemoveCharacter_Handler; _taskHandlers[Task.TaskType.GMCommand_Process] = GMCommand_Process_Handler; _taskHandlers[Task.TaskType.MoveItem] = MoveItem_Handler; _taskHandlers[Task.TaskType.EquipItem] = EquipItem_Handler; _taskHandlers[Task.TaskType.UnEquipItem] = UnEquipItem_Handler; _taskHandlers[Task.TaskType.Teleport] = Teleport_Handler; _taskHandlers[Task.TaskType.UpdateNPCPosition] = UpdateNPCPosition_Handler; _taskHandlers[Task.TaskType.DoAttack] = DoAttack_Handler; _taskHandlers[Task.TaskType.MonsterAttackPlayer] = MonsterAttackPlayer_Handler; _taskHandlers[Task.TaskType.UseItem] = UseItem_Handler; _taskHandlers[Task.TaskType.ToolbarItemSet] = ToolbarItemSet_Handler; _taskHandlers[Task.TaskType.ToolbarItemClear] = ToolbarItemClear_Handler; _pendingQueries = new Dictionary <long, Task>(); _pqLock = new Mutex(); }