public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { int level = 0; int.TryParse(session.State["level"] as string, out level); if (Global.ArenaRegistrationLevel > level && Global.ArenaRegistrationLevel > 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_ARENA_LEVEL"); return(PacketProcessResult.ContinueLoop); } if (Global.DisableBotArenaRegistration) { bool isBot = false; bool.TryParse(session.State["isBot"] as string, out isBot); //регистрация на арену if (isBot) { session.SendClientNotice("UIIT_STT_ANTICHEAT_USE_FUNCTION"); return(PacketProcessResult.ContinueLoop); } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleModule(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableArenaStatusNotify) { if (pck.ReadInt8() == 9) { pck.ReadInt8(); int status = pck.ReadInt8(); string cname = session.State["charname"] as string; //передаем в базу данные о статусе боя Global.dbmgr.AnticheatArenaStatusNotify(cname, status); if (status == 1) { //Вам бЫли начислены очки славы textu'system lel ye perfect. session.SendClientNotice("UIIT_STT_ANTICHEAT_ADDED_HONOR_POINT"); } else { //Вы потеряли очки славы session.SendClientNotice("UIIT_STT_ANTICHEAT_MISSING_HONOR_POINT"); } } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleModule(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableArenaStatusNotify) { if (pck.ReadInt8() == 9) { pck.ReadInt8(); int status = pck.ReadInt8(); string cname = session.State["charname"] as string; //передаем в базу данные о статусе боя Global.dbmgr.AnticheatArenaStatusNotify(cname, status); if (status == 1) { //Вам бЫли начислены очки славы textu'system lel ye perfect. session.SendClientNotice("UIIT_STT_ANTICHEAT_ADDED_HONOR_POINT"); } else { //Вы потеряли очки славы session.SendClientNotice("UIIT_STT_ANTICHEAT_MISSING_HONOR_POINT"); } } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { int level = 0; int.TryParse(session.State["level"] as string, out level); if(Global.ArenaRegistrationLevel > level && Global.ArenaRegistrationLevel > 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_ARENA_LEVEL"); return PacketProcessResult.ContinueLoop; } if (Global.DisableBotArenaRegistration) { bool isBot = false; bool.TryParse(session.State["isBot"] as string, out isBot); //регистрация на арену if (isBot) { session.SendClientNotice("UIIT_STT_ANTICHEAT_USE_FUNCTION"); return PacketProcessResult.ContinueLoop; } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.UseSafeRegion) { bool isSafe = false; bool.TryParse(session.State["isSafe"] as string, out isSafe); bool isBot = false; bool.TryParse(session.State["isBot"] as string, out isBot); //Запрет использования скилов в регионе if (isSafe) { if (pck.ReadUInt8() == 1) { //запрет на использование скилов и (обычная атака ==1) if (pck.ReadUInt8() == 4) { session.SendClientNotice("UIIT_STT_ANTICHEAT_USE_SKILL"); return(PacketProcessResult.ContinueLoop); } } } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.FixWaterTampleTeleport) { pck.ReadUInt32(); byte teleport_type = pck.ReadUInt8(); if (teleport_type == 2) { uint teleport_id = pck.ReadUInt32(); string cname = session.State["charname"] as string; if (cname.Length == 0) { Global.logmgr.WriteLog(LogLevel.Warning, "charname len == 0 ! (teleport fix)"); return PacketProcessResult.ContinueLoop; } //проверка прав доступа на второй уровень if (teleport_id == 166 || teleport_id == 167) { if (Global.dbmgr.AnticheatCheckTeleportAccess(cname, (int)teleport_id) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_TELEPORT_TAMPLE"); return PacketProcessResult.ContinueLoop; } } } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.UseSafeRegion) { bool isSafe = false; bool.TryParse(session.State["isSafe"] as string, out isSafe); bool isBot = false; bool.TryParse(session.State["isBot"] as string, out isBot); //Запрет использования скилов в регионе if (isSafe) { if (pck.ReadUInt8() == 1) { //запрет на использование скилов и (обычная атака ==1) if (pck.ReadUInt8() == 4) { session.SendClientNotice("UIIT_STT_ANTICHEAT_USE_SKILL"); return PacketProcessResult.ContinueLoop; } } } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.FixWaterTampleTeleport) { pck.ReadUInt32(); byte teleport_type = pck.ReadUInt8(); if (teleport_type == 2) { uint teleport_id = pck.ReadUInt32(); string cname = session.State["charname"] as string; if (cname.Length == 0) { Global.logmgr.WriteLog(LogLevel.Warning, "charname len == 0 ! (teleport fix)"); return(PacketProcessResult.ContinueLoop); } //проверка прав доступа на второй уровень if (teleport_id == 166 || teleport_id == 167) { if (Global.dbmgr.AnticheatCheckTeleportAccess(cname, (int)teleport_id) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_TELEPORT_TAMPLE"); return(PacketProcessResult.ContinueLoop); } } } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableGmAccessControl) { //Делаем запрос в базу и проверяем разрешеная ли команда uint commandID = pck.ReadUInt16(); string uname = session.State["username"] as string; if (Global.dbmgr.checkGmAccessControl(uname, commandID) == 1) { if (commandID == 6 || commandID == 7) { //Делаем проверку на разрешение использовать этот ID uint obj_id = pck.ReadUInt32(); uint amountOrOptLevel = pck.ReadUInt8(); if (Global.dbmgr.checkGmObjAccessControl(uname, obj_id, amountOrOptLevel) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_GM_USE_CREATE"); return PacketProcessResult.ContinueLoop; } } //Убираем возможность полноценно килять мобов гму. if (commandID == 20) { uint k_mob_id = pck.ReadUInt32(); Packet p = new Packet(0x7010); p.WriteUInt16(20); p.WriteUInt32(k_mob_id); p.WriteUInt8(1); session.SendPacketToModule(p); return PacketProcessResult.ContinueLoop; } } else { session.SendClientNotice("UIIT_STT_ANTICHEAT_GM_USE_COMMAND"); return PacketProcessResult.ContinueLoop; } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.DisableAcademyInvite) { session.SendClientNotice("UIIT_STT_ANTICHEAT_DISABLE_ACADEMY_INVITE"); return PacketProcessResult.ContinueLoop; } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.DisableAcademyInvite) { session.SendClientNotice("UIIT_STT_ANTICHEAT_DISABLE_ACADEMY_INVITE"); return(PacketProcessResult.ContinueLoop); } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { string charname = session.State["charname"] as string; if (Global.MaxGuildInUnion > 0 && Global.dbmgr.GuildMembers(charname, 2, Global.MaxGuildInUnion) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_MAX_GUILD_IN_UNION"); return PacketProcessResult.ContinueLoop; } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableGmAccessControl) { //Делаем запрос в базу и проверяем разрешеная ли команда uint commandID = pck.ReadUInt16(); string uname = session.State["username"] as string; if (Global.dbmgr.checkGmAccessControl(uname, commandID) == 1) { if (commandID == 6 || commandID == 7) { //Делаем проверку на разрешение использовать этот ID uint obj_id = pck.ReadUInt32(); uint amountOrOptLevel = pck.ReadUInt8(); if (Global.dbmgr.checkGmObjAccessControl(uname, obj_id, amountOrOptLevel) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_GM_USE_CREATE"); return(PacketProcessResult.ContinueLoop); } } //Убираем возможность полноценно килять мобов гму. if (commandID == 20) { uint k_mob_id = pck.ReadUInt32(); Packet p = new Packet(0x7010); p.WriteUInt16(20); p.WriteUInt32(k_mob_id); p.WriteUInt8(1); session.SendPacketToModule(p); return(PacketProcessResult.ContinueLoop); } } else { session.SendClientNotice("UIIT_STT_ANTICHEAT_GM_USE_COMMAND"); return(PacketProcessResult.ContinueLoop); } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { string charname = session.State["charname"] as string; if (Global.MaxGuildInUnion > 0 && Global.dbmgr.GuildMembers(charname, 2, Global.MaxGuildInUnion) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_MAX_GUILD_IN_UNION"); return(PacketProcessResult.ContinueLoop); } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { //лоток if (Global.EnableStallCooldown) { if (Convert.ToDateTime(session.State["lastStall"]) < DateTime.Now) { session.State["lastStall"] = DateTime.Now.AddSeconds(Global.StallCooldownInSecond); } else { session.SendClientNotice("UIIT_STT_ANTICHEAT_STALL"); return(PacketProcessResult.ContinueLoop); } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { //лоток if (Global.EnableStallCooldown) { if (Convert.ToDateTime(session.State["lastStall"]) < DateTime.Now) { session.State["lastStall"] = DateTime.Now.AddSeconds(Global.StallCooldownInSecond); } else { session.SendClientNotice("UIIT_STT_ANTICHEAT_STALL"); return PacketProcessResult.ContinueLoop; } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableLogOutCooldown) { if (Convert.ToDateTime(session.State["lastLogOut"]) < DateTime.Now) { session.State["lastLogOut"] = DateTime.Now.AddSeconds(Global.LogOutCooldownInSecond); } else { session.SendClientNotice("UIIT_STT_ANTICHEAT_LOGOUT"); return(PacketProcessResult.ContinueLoop); } } session.State["proper_logout"] = true; return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableLogOutCooldown) { if (Convert.ToDateTime(session.State["lastLogOut"]) < DateTime.Now) { session.State["lastLogOut"] = DateTime.Now.AddSeconds(Global.LogOutCooldownInSecond); } else { session.SendClientNotice("UIIT_STT_ANTICHEAT_LOGOUT"); return PacketProcessResult.ContinueLoop; } } session.State["proper_logout"] = true; return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { byte type_1 = pck.ReadUInt8(); if (Global.MaxOptLevel > 0 && type_1 == 2) { byte type_2 = pck.ReadUInt8(); if (type_2 == 3) { pck.ReadUInt8(); byte slot = pck.ReadUInt8(); string charname = session.State["charname"] as string; if (Global.dbmgr.checkOptLevel(charname, slot, Global.MaxOptLevel) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_MAX_OPT_LEVEL"); return(PacketProcessResult.ContinueLoop); } } } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableItemMallBuyFix) { string uname = session.State["username"] as string; if (uname.Length == 0) { Global.logmgr.WriteLog(LogLevel.Error, "username len == 0 (request buy mall item)"); return PacketProcessResult.Disconnect; } byte ShopType = pck.ReadUInt8(); if (ShopType == 24) { //------------------------------------------ UInt16 uint1 = pck.ReadUInt16(); byte b1 = pck.ReadUInt8(); byte b2 = pck.ReadUInt8(); byte b3 = pck.ReadUInt8(); string package_item_codename = pck.ReadAscii(); ushort nItems = pck.ReadUInt16(); pck.ReadUInt64(); uint refpackage_id = pck.ReadUInt32(); //------------------------------------------ string charname = session.State["charname"] as string; if (charname.Length == 0) { Global.logmgr.WriteLog(LogLevel.Error, "charname len == 0 (buy in item mall)"); return PacketProcessResult.Disconnect; } int res = Global.dbmgr.GetBuyMallResult(charname, package_item_codename, nItems); if (res == -1) { //------------------------------------------ session.SendClientNotice("UIIT_STT_ANTICHEAT_ITEM_MALL_ERROR"); //------------------------------------------ } else { //update silk List<int> silk_info = Global.dbmgr.GetSilkDataByUsername(uname); //------------------------------------------ Packet resp = new Packet(0x3153); resp.WriteUInt32(silk_info[0]); resp.WriteUInt32(silk_info[1]); resp.WriteUInt32(silk_info[2]); // m_ClientSecurity.Send(resp); session.SendPacketToClient(resp); //------------------------------------------ Packet inventory = new Packet(0xB034); inventory.WriteUInt8(1); inventory.WriteUInt8(24); inventory.WriteUInt16(uint1); inventory.WriteUInt8(b1); inventory.WriteUInt8(b2); inventory.WriteUInt8(b3); inventory.WriteUInt8(1); inventory.WriteUInt8(res); inventory.WriteUInt16(nItems); inventory.WriteUInt32(0); //m_ClientSecurity.Send(inventory); session.SendPacketToClient(inventory); //------------------------------------------ Packet inventory2 = new Packet(0xB034); inventory2.WriteUInt8(1); inventory2.WriteUInt8(7); inventory2.WriteUInt8((byte)(res)); // m_ClientSecurity.Send(inventory2); session.SendPacketToClient(inventory2); //------------------------------------------ // Global.g_LogManager.WriteLog(LogLevel.Notify, "GetBuyMallResult OK slot {0}", res); } return PacketProcessResult.ContinueLoop; } } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { string username = session.State["username"] as string; string charname = session.State["charname"] as string; //Read type byte msgTypeId = pck.ReadUInt8(); byte msgCount = pck.ReadUInt8(); ChatType msgType = (ChatType)(msgTypeId); string msg = string.Empty; switch (msgType) { case ChatType.Normal: { msg = pck.ReadAscii(); //ProcessChatCommand(msg); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } if (ProcessChatCommand(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Private: { string name = pck.ReadAscii(); msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, name, msg); } break; case ChatType.Academy: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Gm: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Group: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Guild: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Union: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Stall: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return PacketProcessResult.ContinueLoop; } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Anounce: { if (Global.EnableGmAccessControl) { if (Global.dbmgr.checkGmAccessControl(username, 3000) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_GM_USE_COMMAND"); //Block this packet, since we spoof it return PacketProcessResult.ContinueLoop; } } } break; default: { Global.logmgr.WriteLog(LogLevel.Notify, "Unknown chat msg id {0}", msgTypeId); } break; } return PacketProcessResult.DoNothing; }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { string username = session.State["username"] as string; string charname = session.State["charname"] as string; //Read type byte msgTypeId = pck.ReadUInt8(); byte msgCount = pck.ReadUInt8(); ChatType msgType = (ChatType)(msgTypeId); string msg = string.Empty; switch (msgType) { case ChatType.Normal: { msg = pck.ReadAscii(); //ProcessChatCommand(msg); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } if (ProcessChatCommand(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Private: { string name = pck.ReadAscii(); msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, name, msg); } break; case ChatType.Academy: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Gm: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Group: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Guild: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Union: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Stall: { msg = pck.ReadAscii(); if (AbuseFilter(msg, session)) { return(PacketProcessResult.ContinueLoop); } msg = FilterMsg(msg); Global.logmgr.WriteChatLog(msgType, charname, msg); } break; case ChatType.Anounce: { if (Global.EnableGmAccessControl) { if (Global.dbmgr.checkGmAccessControl(username, 3000) == 0) { session.SendClientNotice("UIIT_STT_ANTICHEAT_GM_USE_COMMAND"); //Block this packet, since we spoof it return(PacketProcessResult.ContinueLoop); } } } break; default: { Global.logmgr.WriteLog(LogLevel.Notify, "Unknown chat msg id {0}", msgTypeId); } break; } return(PacketProcessResult.DoNothing); }
public static PacketProcessResult HandleClient(Packet pck, RelaySession session, SilkroadServer server) { if (Global.EnableItemMallBuyFix) { string uname = session.State["username"] as string; if (uname.Length == 0) { Global.logmgr.WriteLog(LogLevel.Error, "username len == 0 (request buy mall item)"); return(PacketProcessResult.Disconnect); } byte ShopType = pck.ReadUInt8(); if (ShopType == 24) { //------------------------------------------ UInt16 uint1 = pck.ReadUInt16(); byte b1 = pck.ReadUInt8(); byte b2 = pck.ReadUInt8(); byte b3 = pck.ReadUInt8(); string package_item_codename = pck.ReadAscii(); ushort nItems = pck.ReadUInt16(); pck.ReadUInt64(); uint refpackage_id = pck.ReadUInt32(); //------------------------------------------ string charname = session.State["charname"] as string; if (charname.Length == 0) { Global.logmgr.WriteLog(LogLevel.Error, "charname len == 0 (buy in item mall)"); return(PacketProcessResult.Disconnect); } int res = Global.dbmgr.GetBuyMallResult(charname, package_item_codename, nItems); if (res == -1) { //------------------------------------------ session.SendClientNotice("UIIT_STT_ANTICHEAT_ITEM_MALL_ERROR"); //------------------------------------------ } else { //update silk List <int> silk_info = Global.dbmgr.GetSilkDataByUsername(uname); //------------------------------------------ Packet resp = new Packet(0x3153); resp.WriteUInt32(silk_info[0]); resp.WriteUInt32(silk_info[1]); resp.WriteUInt32(silk_info[2]); // m_ClientSecurity.Send(resp); session.SendPacketToClient(resp); //------------------------------------------ Packet inventory = new Packet(0xB034); inventory.WriteUInt8(1); inventory.WriteUInt8(24); inventory.WriteUInt16(uint1); inventory.WriteUInt8(b1); inventory.WriteUInt8(b2); inventory.WriteUInt8(b3); inventory.WriteUInt8(1); inventory.WriteUInt8(res); inventory.WriteUInt16(nItems); inventory.WriteUInt32(0); //m_ClientSecurity.Send(inventory); session.SendPacketToClient(inventory); //------------------------------------------ Packet inventory2 = new Packet(0xB034); inventory2.WriteUInt8(1); inventory2.WriteUInt8(7); inventory2.WriteUInt8((byte)(res)); // m_ClientSecurity.Send(inventory2); session.SendPacketToClient(inventory2); //------------------------------------------ // Global.g_LogManager.WriteLog(LogLevel.Notify, "GetBuyMallResult OK slot {0}", res); } return(PacketProcessResult.ContinueLoop); } } return(PacketProcessResult.DoNothing); }