diff --git a/AOprivateServer.pbp b/AOprivateServer.pbp new file mode 100644 index 0000000..2df01de --- /dev/null +++ b/AOprivateServer.pbp @@ -0,0 +1,116 @@ + + + +
+ +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + ../stoneddiscord.ico + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + owner.ico + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/Common.pb b/Common.pb new file mode 100644 index 0000000..9ff2260 --- /dev/null +++ b/Common.pb @@ -0,0 +1,202 @@ +; PureBasic Visual Designer v3.95 build 1485 (PB4Code) + + +;- Window Constants +; +Enumeration + #Window_0 + #Window_1 + #Window_2 + #Window_3 +EndEnumeration + +;- Gadget Constants +; +Enumeration + #Frame3D_0 + #String_5 + #Button_4 + #Button_2 + #Button_5 + #Frame3D_2 + #Frame3D_3 + #String_7 + #String_8 + #Button_6 + #Button_7 + #Button_8 + #CheckBox_4 + #Button_9 + #Combo_0 + #Combo_1 + #String_9 + #String_10 + #Button_kk + #Button_dc + #Button_kb + #Button_mu + #Button_um + #Button_ig + #Button_hd + #Button_sw + #Button_si + #Listview_0 + #Button_dj + #Button_ndj + #Text_3 + #String_12 + #Button_27 + #Button_28 + #Button_29 + #Frame3D_4 + #CheckBox_6 + #TrackBar_1 + #ListIcon_2 + #CheckBox_MS + #Text_6 + #String_OP + #Frame3D_5 + #Listview_2 + #Button_BG + #Text_7 + #Combo_3 + #Text_8 + #Combo_4 + #Checkbox_BlockIni +EndEnumeration + + +Procedure BalloonTip(WindowID, Gadget, Text$ , Title$, Icon) + CompilerIf #PB_Compiler_OS = #PB_OS_Windows + Define ToolTip=0 + Define Balloon.TOOLINFO + ToolTip=CreateWindowEx_(0,"ToolTips_Class32","",#WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON,0,0,0,0,WindowID,0,GetModuleHandle_(0),0) + SendMessage_(ToolTip,#TTM_SETTIPTEXTCOLOR,GetSysColor_(#COLOR_INFOTEXT),0) + SendMessage_(ToolTip,#TTM_SETTIPBKCOLOR,GetSysColor_(#COLOR_INFOBK),0) + SendMessage_(ToolTip,#TTM_SETMAXTIPWIDTH,0,180) + Balloon.TOOLINFO\cbSize=SizeOf(TOOLINFO) + Balloon\uFlags=#TTF_IDISHWND | #TTF_SUBCLASS + Balloon\hWnd=GadgetID(Gadget) + Balloon\uId=GadgetID(Gadget) + Balloon\lpszText=@Text$ + SendMessage_(ToolTip, #TTM_ADDTOOL, 0, Balloon) + If Title$ > "" + SendMessage_(ToolTip, #TTM_SETTITLE, Icon, @Title$) + EndIf + CompilerElse + #TOOLTIP_NO_ICON=0 + #TOOLTIP_INFO_ICON=0 + #TOOLTIP_WARNING_ICON=0 + #TOOLTIP_ERROR_ICON=0 + CompilerEndIf +EndProcedure + +Procedure Open_Window_0() + If OpenWindow(#Window_0 , 301, 185, 730, 339, "serverD", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar ) + ;If CreateGadgetList(WindowID(#Window_0 )) + Frame3DGadget(#Frame3D_0, 0, 0, 290, 350, "Serverside") + StringGadget(#String_5, 210, 15, 70, 22, "27015", #PB_String_Numeric) + BalloonTip(GadgetID(#String_5), #String_5, "The public port goes here", "", #TOOLTIP_NO_ICON) + ButtonGadget(#Button_4, -30, 280, 100, 30, "CONFIG", #PB_Button_Right) + BalloonTip(GadgetID(#Button_4), #Button_4, "Opens the configuration page", "", #TOOLTIP_NO_ICON) + ButtonGadget(#Button_2, 120, 15, 90, 22, "START") + BalloonTip(GadgetID(#Button_2), #Button_2, "Start listening for connections", "", #TOOLTIP_NO_ICON) + ButtonGadget(#Button_kk, -10, 40, 80, 30, "KICK", #PB_Button_Right) + BalloonTip(GadgetID(#Button_kk), #Button_kk, "Send KB to the client and close the connection", "", #TOOLTIP_INFO_ICON) + ButtonGadget(#Button_dc, -10, 70, 80, 30, "DISCONNECT", #PB_Button_Right) + BalloonTip(GadgetID(#Button_dc), #Button_dc, "Disconnects this client from the server", "", #TOOLTIP_WARNING_ICON) + ButtonGadget(#Button_kb, -10, 100, 80, 30, "BAN", #PB_Button_Right) + BalloonTip(GadgetID(#Button_kb), #Button_kb, "Send KB to the client and add him to the banlist", "For this IP", #TOOLTIP_WARNING_ICON) + ButtonGadget(#Button_mu, 30, 190, 40, 30, "MUTE", #PB_Button_Right) + BalloonTip(GadgetID(#Button_mu), #Button_mu, "Send MU#-1#% to the client", "", #TOOLTIP_INFO_ICON) + ButtonGadget(#Button_um, 0, 190, 30, 30, "UN", #PB_Button_Right) + BalloonTip(GadgetID(#Button_um), #Button_um, "Send UM#-1#% to the client", "", #TOOLTIP_INFO_ICON) + ButtonGadget(#Button_ig, 20, 160, 50, 30, "IGNORE") + BalloonTip(GadgetID(#Button_ig), #Button_ig, "Ignore this clients commands", "", #TOOLTIP_INFO_ICON) + ButtonGadget(#Button_hd, -10, 130, 80, 30, "HDBAN", #PB_Button_Right) + BalloonTip(GadgetID(#Button_hd), #Button_hd, "Send KB to the client and add him to the HDbanlist", "PERMANENT", #TOOLTIP_ERROR_ICON) + ButtonGadget(#Button_sw, -10, 220, 80, 30, "SWITCH", #PB_Button_Right) + BalloonTip(GadgetID(#Button_sw), #Button_sw, "Drops this client to character selection", "", #TOOLTIP_INFO_ICON) + ButtonGadget(#Button_si, 0, 160, 20, 30, "S") + BalloonTip(GadgetID(#Button_si), #Button_si, "Stop ignoring this client", "", #TOOLTIP_INFO_ICON) + ButtonGadget(1337, -30, 310, 100, 30, "ABOUT", #PB_Button_Right) + ;- + ListIconGadget(#Listview_0, 70, 40, 220, 300, "IP", 100, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection) + CompilerIf #PB_Compiler_OS=#PB_OS_Windows + SendMessage_ (GadgetID(#Listview_0), #LVS_SHOWSELALWAYS, 1, 0) + CompilerEndIf + AddGadgetColumn(#Listview_0, 1, "Character", 50) + AddGadgetColumn(#Listview_0, 2, "PV", 60) + BalloonTip(GadgetID(#Listview_0), #Listview_0, "Shows all connected clients", "", #TOOLTIP_NO_ICON) + ButtonGadget(#Button_dj, 40, 250, 30, 30, "DJ") + BalloonTip(GadgetID(#Button_dj), #Button_dj, "Allows this client to change the music", "", #TOOLTIP_INFO_ICON) + ButtonGadget(#Button_ndj, -20, 250, 60, 30, "UN", #PB_Button_Right) + BalloonTip(GadgetID(#Button_ndj), #Button_ndj, "Stops this client from changing the music", "", #TOOLTIP_INFO_ICON) + Frame3DGadget(#Frame3D_4, 290, 0, 230, 340, "Log") + + ;- + ListIconGadget(#ListIcon_2, 520, 20, 210, 320, "Name", 80, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection) + AddGadgetColumn(#ListIcon_2, 1, "Message", 100) + BalloonTip(GadgetID(#ListIcon_2), #ListIcon_2, "Shows the OOC chat history", "", #TOOLTIP_NO_ICON) + CheckBoxGadget(#CheckBox_MS, 10, 15, 110, 20, "Public server mode") + BalloonTip(GadgetID(#CheckBox_MS), #CheckBox_MS, "Makes this server appear on the Masterserver list", "", #TOOLTIP_NO_ICON) + Frame3DGadget(#Frame3D_5, 520, 0, 210, 340, "OOC") + CompilerIf #EASYLOG + ListViewGadget(#Listview_2, 290, 20, 230, 320) + AddGadgetItem(#Listview_2,0,"serverD "+Str(#PB_Editor_CompileCount)+"."+Str(#PB_Editor_BuildCount)) + AddGadgetItem(#Listview_2,0,"Check out http://www.weedlan.de/serverd/ for updates") + If update + AddGadgetItem(#Listview_2,0,"UPDATE AVAILABLE",#PB_ListIcon_AlwaysShowSelection) + EndIf + CompilerElse + EditorGadget(#Listview_2, 290, 20, 230, 320) + CompilerEndIf + BalloonTip(GadgetID(#Listview_2), #Listview_2, "Shows all activity", "", #TOOLTIP_NO_ICON) + + ;EndIf + EndIf +EndProcedure + +Procedure Open_Window_1() + If OpenWindow(#Window_1, 303, 568, 150, 180, "Config", #PB_Window_SystemMenu | #PB_Window_TitleBar ) + ; If CreateGadgetList(WindowID(#Window_1)) + ButtonGadget(#Button_5, 0, 150, 150, 30, "DONE") + CheckBoxGadget(#CheckBox_4, 10, 40, 60, 20, "Logging") + BalloonTip(GadgetID(#CheckBox_4), #CheckBox_4, "Log all network traffic to a file", "", #TOOLTIP_NO_ICON) + ButtonGadget(#Button_9, 70, 40, 70, 20, "Log file...") + TextGadget(#Text_6, 10, 10, 41, 20, "OP pass") + StringGadget(#String_OP, 60, 10, 80, 20, "", #PB_String_Password) + BalloonTip(GadgetID(#String_OP), #String_OP, "Enter the OOC password here", "", #TOOLTIP_NO_ICON) + TextGadget(#Text_7, 10, 70, 60, 20, "Mod colour:") + ComboBoxGadget(#Combo_3, 70, 70, 70, 20) + TextGadget(#Text_8, 10, 90, 50, 30, "MOTD evidence:") + ComboBoxGadget(#Combo_4, 60, 100, 80, 20) + CheckBoxGadget(#Checkbox_BlockIni,10,130,120,20,"Block Ini char swap") + + ; EndIf + EndIf +EndProcedure + +CompilerIf #SPAM + Procedure Open_Window_3() + If OpenWindow(#Window_3, -202, 508, 150, 220, "Spam", #PB_Window_SystemMenu | #PB_Window_TitleBar ) + ; If CreateGadgetList(WindowID(#Window_3)) + TextGadget(#Text_3, 10, 10, 100, 30, "TURN DOWN FOR WHAT ?", #PB_Text_Center) + StringGadget(#String_12, 0, 40, 120, 35, "") + ButtonGadget(#Button_27, 0, 100, 120, 40, "START") + ButtonGadget(#Button_28, 0, 140, 120, 40, "PAUSE") + ButtonGadget(#Button_29, 0, 180, 120, 40, "STOP") + CheckBoxGadget(#CheckBox_6, 0, 80, 120, 20, "ÜBERCHARGE") + TrackBarGadget(#TrackBar_1, 120, 0, 30, 220, 0, 1000, #PB_TrackBar_Vertical) + + ; EndIf + EndIf + EndProcedure +CompilerEndIf +; IDE Options = PureBasic 5.11 (Windows - x86) +; CursorPosition = 71 +; FirstLine = 61 +; Folding = - +; EnableXP +; EnableCompileCount = 0 +; EnableBuildCount = 0 \ No newline at end of file diff --git a/base/HDbanlist.txt b/base/HDbanlist.txt new file mode 100644 index 0000000..e69de29 diff --git a/base/gimp.txt b/base/gimp.txt new file mode 100644 index 0000000..ef0ac43 --- /dev/null +++ b/base/gimp.txt @@ -0,0 +1,9 @@ +I love the admins on this server! +I'm So happy!! :) +I forgot how to AO +I <3 you guys :) +what is this i am kebab +I love the first generation of MLP +If I don't take my meds soon I may die. +Please Kick me i hack +glory to arstotzka \ No newline at end of file diff --git a/base/hd.txt b/base/hd.txt new file mode 100644 index 0000000..55e4e10 --- /dev/null +++ b/base/hd.txt @@ -0,0 +1,2 @@ +127.0.0.1 +SUCKS70B3Y0UGG diff --git a/base/masterserver.ini b/base/masterserver.ini new file mode 100644 index 0000000..10f21b4 --- /dev/null +++ b/base/masterserver.ini @@ -0,0 +1,5 @@ +[list] +0 = 46.188.16.205 +1 = 54.72.209.44 +2 = 37.120.168.157 +3 = 127.0.0.1 \ No newline at end of file diff --git a/base/musiclist.txt b/base/musiclist.txt new file mode 100644 index 0000000..482f909 --- /dev/null +++ b/base/musiclist.txt @@ -0,0 +1,53 @@ +~stop.mp3 +01_turnabout_courtroom_-_prologue.mp3 +113 Confrontation ~ Presto 2009.mp3 +114 Pursuit(Miles).mp3 +>mlp +>gs4 +http://8tracks.s3.amazonaws.com/tf/003/891/309/75308.mp3 +http://www.youtube-mp3.org/a2/c/getData?pid=5483687662583808&h=123123&r=1413987290921 +Annonce The Truth(AA).mp3 +Annonce The Truth(AJ).mp3 +Annonce The Truth(JFA).mp3 +Annonce The Truth(Miles).mp3 +Annonce The Truth(T&T).mp3 +Crises of Fate.mp3 +Forgotten Legend.mp3 +Ghost Trick - 4 Minutes Before Death.mp3 +Ghost Trick - Countdown.mp3 +Ghost Trick - The World of the Dead.mp3 +Godot - The Fragrance of Dark Coffee.mp3 +Great Revival ~ Franziska von Karma.mp3 +Great Revival ~ Miles Edgeworth.mp3 +Hotline of Fate.mp3 +Interesting People.mp3 +logic_and_trick.mp3 +Luke Atmey ~ I Just Want Love.mp3 +Noisy People.mp3 +OBJECTIOM(AJ).mp3 +OBJECTION (AA).mp3 +OBJECTON (JFA).mp3 +OBJECTION (T&T).mp3 +OBJECTION(Miles).mp3 +Others ~ Guilty love.mp3 +Prelude(AA).mp3 +Prelude(AJ).mp3 +Pursuit ~ I Want to Find the Truth(Orchestra).mp3 +PURSUIT(AA) - variation.mp3 +PURSUIT(AA).mp3 +PURSUIT(AJ).mp3 +PURSUIT(JFA) - variation.mp3 +PURSUIT(JFA).mp3 +PURSUIT(T&T) - variation.mp3 +PURSUIT(T&T).mp3 +Questioning(AA-allergo).mp3 +Questioning(AA-normal).mp3 +Speak up, Pup!.mp3 +Super Trixie.mp3 +Suspence(AA).mp3 +The Great Truth Burglar.mp3 +Trial(AA).mp3 +Trial(AJ).mp3ne of Fate.mp3 +ok this is the end +for real +here \ No newline at end of file diff --git a/base/op.txt b/base/op.txt new file mode 100644 index 0000000..e69de29 diff --git a/green.png b/green.png new file mode 100644 index 0000000..4793b54 Binary files /dev/null and b/green.png differ diff --git a/gui.pbv b/gui.pbv new file mode 100644 index 0000000..58f7c71 Binary files /dev/null and b/gui.pbv differ diff --git a/hacker.png b/hacker.png new file mode 100644 index 0000000..ce38b9a Binary files /dev/null and b/hacker.png differ diff --git a/main.pb b/main.pb new file mode 100644 index 0000000..6183a5b --- /dev/null +++ b/main.pb @@ -0,0 +1,2061 @@ +;EnableExplicit + +CompilerIf #PB_Compiler_OS <> #PB_OS_Windows + #MB_ICONERROR=0 +CompilerEndIf + +Structure CharacterArray + StructureUnion + c.c[0] + s.s{1}[0] + EndStructureUnion +EndStructure + +Structure Evidence + type.w + name.s + desc.s + image.s +EndStructure + +Structure room + bg.s + wait.l + lock.l + mlock.w +EndStructure + +Structure ACharacter + name.s + desc.s + taken.b + dj.b + evinumber.w + evidence.s + pw.s +EndStructure + +Structure Client + ClientID.l + IP.s + AID.w + CID.w + sHD.b + HD.s + perm.w + ignore.b + ignoremc.b + hack.b + room.w + last.s + cconnect.b + gimp.b +EndStructure + +Enumeration + #KICK + #BAN + #MUTE + #UNMUTE + #CIGNORE + #UNIGNORE + #UNDJ + #DJ + #GIMP + #UNGIMP +EndEnumeration + +Global *Buffer = AllocateMemory(1024) +Global NetworkMode=#PB_Network_TCP +Global EmptyMode.b=0 +Global Logging.b=0 +Global public.b=0 +Global LogFile$="poker.log" +Global ServerEXP=0 +Global ServerReg$="" +Global ClientEXP=0 +Global ClientReg$="" +Global decryptor$="" +Global oppass$="" +Global adminpass$="" +Global opppass$="" +Global key +Global defbar$="10" +Global probar$="10" +Global port +Global ListMutex +Global str.s +Global scene$="AAOPublic2" +Global StringToHexR.s +Global Result.s="" +Global characternumber=0 +Global oBG.s="gs4" +Global rt.b=1 +Global loghd.b=0 +Global background.s +Global PV=0 +Global rf.b=0 +Global Replays.b=0 +Global rline=0 +Global replaylines=0 +Global replayopen.b +Global modcol=0 +Global blockini.b=0 +Global MOTDevi=0 +Global tracks=0 +Global LoginReply$="CT#sD#got it#%" +Global roomc=9 +Global musicpage=0 +Global EviNumber +Global NewMap Clients.Client() +Global NewList HDbans.s() +Global NewList HDmods.s() +Global NewList IPbans.s() +Global NewList SDbans.s() +Global NewList gimp.s() +Global NewList Music.s() +Global Dim Evidences.Evidence(EviNumber) +Global Dim Rooms.room(roomc) +Global ChatMutex = CreateMutex() +Global ListMutex = CreateMutex() +Global musicmode=1 +Global update=0 +Global Dim Icons.l(2) +Global Dim ReadyChar.s(10) +Global Dim ReadyEvidence.s(50) +Global Dim ReadyMusic.s(400) + +If InitNetwork() = 0 + CompilerIf #CONSOLE=0 + MessageRequester("serverD", "Can't initialize the network!",#MB_ICONERROR) + CompilerEndIf + End +EndIf +CompilerIf #CONSOLE=0 + IncludeFile "Common.pb" +CompilerEndIf +Procedure MSWait(*p) + Define par.s + Define roomw + Define time + par.s=PeekS(*p) + roomw=Val(Left(par.s,1)) + time=Val(Right(par.s,Len(par.s)-1)) + LockMutex(Rooms(roomw)\wait) + Delay(time) + UnlockMutex(Rooms(roomw)\wait) +EndProcedure + +Procedure WriteLog(string$,mod.b,ip$) + Define mstr$ + ; [23:21:05] David Skoland: (If mod)[M][IP][Timestamp, YYYYMMDDHHMM][Character]:[Message] + If mod + mstr$="[M]" + Else + mstr$="[U]" + EndIf + + If Logging + WriteStringN(1,mstr$+"["+LSet(ip$,15)+"]"+"["+FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss",Date())+"]"+string$) + CompilerIf #CONSOLE=1 + PrintN(mstr$+"["+LSet(ip$,15)+"]"+"["+FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss",Date())+"]"+string$) + CompilerEndIf + EndIf +EndProcedure + +Procedure WriteReplay(string$) + If Replays + If ReplayOpen + WriteStringN(3,string$) + WriteStringN(3,"wait") + rline+1 + If rline>replaylines + CloseFile(3) + ReplayOpen=0 + EndIf + Else + OpenFile(3,"base/replays/AAO replay "+FormatDate("%dd-%mm-%yy %hh-%ii-%ss",Date())+".txt") + WriteStringN(3,"decryptor#"+decryptor$+"#%") + ReplayOpen=1 + EndIf + EndIf +EndProcedure + +Procedure IsNumeric(in_str.s) + Define rex_IsNumeric + Define Is_Numeric.b + rex_IsNumeric = CreateRegularExpression(#PB_Any,"^[[:digit:]]+$") + Is_Numeric.b = MatchRegularExpression(rex_IsNumeric, in_str) + FreeRegularExpression(rex_IsNumeric) + ProcedureReturn Is_Numeric +EndProcedure + +Procedure IsAlpha(in_str.s) + Define rex_isAlpha + Define is_Alpha.b + rex_isAlpha = CreateRegularExpression(#PB_Any,"^[[:alpha:]]+$") ; A-Z and a-z + is_Alpha.b = MatchRegularExpression(rex_isAlpha, in_str) + FreeRegularExpression(rex_isAlpha) + ProcedureReturn is_Alpha +EndProcedure + +Procedure LoadSettings(reload) + Define loadchars + Define loadcharsettings + Define loaddesc + Define loadevi + Define iniroom + Define track$ + Define hdmod$ + Define hdban$ + Define ipban$ + If OpenPreferences("base/settings.ini")=0 + If CreatePreferences("base/settings.ini")=0 + CompilerIf #CONSOLE=0 + MessageRequester("serverD","dude i can't create the settings file",#MB_ICONERROR) + CompilerElse + PrintN("Cant create the settings file (folder missing/wrong permissions?)") + CompilerEndIf + Else + PreferenceGroup("Net") + WritePreferenceInteger("public",0) + WritePreferenceString("oppassword", "DEFAULT") + WritePreferenceInteger("port",27016) + PreferenceGroup("server") + WritePreferenceString("Name", "DEFAULT") + WritePreferenceString("Desc", "DEFAULT") + WritePreferenceInteger("musicmode",1) + WritePreferenceInteger("replaysave",1) + WritePreferenceInteger("replayline",400) + WritePreferenceString("case", "AAOPublic2") + EndIf + EndIf + PreferenceGroup("net") + opppass$=ReadPreferenceString("oppassword","1333333337") + port=ReadPreferenceInteger("port",27016) + + public=ReadPreferenceInteger("public",0) + CompilerIf #CONSOLE=0 + SetGadgetText(#String_5,Str(port)) + SetGadgetState(#CheckBox_MS,public) + CompilerElse + PrintN("Loading serverD "+Str(#PB_Editor_BuildCount)+"."+Str(#PB_Editor_CompileCount)+" settings") + PrintN("OP pass:"+opppass$) + PrintN("Server port:"+Str(port)) + PrintN("Public server:"+Str(public)) + CompilerEndIf + PreferenceGroup("server") + musicmode=ReadPreferenceInteger("musicmode",1) + Replays=ReadPreferenceInteger("replaysave",0) + replaylines=ReadPreferenceInteger("replaylines",400) + scene$=ReadPreferenceString("case","AAOPublic2") + CompilerIf #CONSOLE=0 + SetWindowTitle(0,ReadPreferenceString("Name","serverD")) + CompilerElse + PrintN("Musicmode:"+Str(musicmode)) + PrintN("Scene:"+scene$) + CompilerEndIf + + + OpenPreferences("poker.ini") + PreferenceGroup("cfg") + oppass$=ReadPreferenceString("oppass","") + adminpass$=ReadPreferenceString("adminpass","") + blockini=ReadPreferenceInteger("BlockIni",0) + modcol=ReadPreferenceInteger("modcol",0) + MOTDevi=ReadPreferenceInteger("motdevi",0) + LoginReply$=ReadPreferenceString("LoginReply","CT#sD#got it#%") + LogFile$=ReadPreferenceString("LogFile","base/serverlog.log") + If Logging + CloseFile(1) + EndIf + Logging=ReadPreferenceInteger("Logging",1) + If Logging + If OpenFile(1,LogFile$) + FileSeek(1,Lof(1)) + WriteLog("LOGGING STARTED",1,"SERVER") + Else + Logging=0 + EndIf + EndIf + + ClosePreferences() + + OpenPreferences("base/scene/"+scene$+"/init.ini") + CompilerIf #CONSOLE + PrintN("OOC pass:"+oppass$) + PrintN("Block INI edit:"+Str(blockini)) + PrintN("Moderator color:"+Str(modcol)) + PrintN("MOTD evidence:"+Str(MOTDevi)) + PrintN("Login reply:"+LoginReply$) + PrintN("Logfile:"+LogFile$) + PrintN("Logging:"+Str(Logging)) + CompilerEndIf + PreferenceGroup("Global") + EviNumber=ReadPreferenceInteger("EviNumber",0) + oBG.s=ReadPreferenceString("BackGround","gs4") + background.s=oBG.s + PreferenceGroup("chars") + Global characternumber=ReadPreferenceInteger("number",1) + If reload=0 + Global Dim Characters.ACharacter(characternumber) + EndIf + For loadchars=0 To characternumber + Characters(loadchars)\name=ReadPreferenceString(Str(loadchars),"zettaslow") + If reload=0 + Characters(loadchars)\taken=0 + EndIf + Next + + PreferenceGroup("desc") + For loaddesc=0 To characternumber + Characters(loaddesc)\desc=ReadPreferenceString(Str(loadchars),"No description") + Next + ReDim Evidences(EviNumber) + ReDim ReadyEvidence(EviNumber-1) + For loadevi=1 To EviNumber + PreferenceGroup("evi"+Str(loadevi)) + Evidences(loadevi)\type=ReadPreferenceInteger("type",1) + Evidences(loadevi)\name=ReadPreferenceString("name","DEFAULT") + Evidences(loadevi)\desc=ReadPreferenceString("desc","This is the default evidence") + Evidences(loadevi)\image=ReadPreferenceString("image","2.png") + + ReadyEvidence(loadevi-1)="EI#" + Str(loadevi)+"#"+Evidences(loadevi)\name+"&"+Evidences(loadevi)\desc+"&"+Str(Evidences(loadevi)\type)+"&"+Evidences(loadevi)\image+"&##%" + + Next + ClosePreferences() + + For iniroom=0 To 9 + Rooms(iniroom)\wait=CreateMutex() + Rooms(iniroom)\bg=background + Next + + ready$="CI#" + charpage=0 + For loadcharsettings=0 To characternumber + OpenPreferences("base/scene/"+scene$+"/char"+Str(loadcharsettings)+".ini") + PreferenceGroup("desc") + Characters(loadcharsettings)\desc=ReadPreferenceString("text","No description") + Characters(loadcharsettings)\dj=ReadPreferenceInteger("dj",musicmode) + Characters(loadcharsettings)\evinumber=ReadPreferenceInteger("evinumber",0) + Characters(loadcharsettings)\evidence=ReadPreferenceString("evi","") + Characters(loadcharsettings)\pw=ReadPreferenceString("pass","") + ClosePreferences() + Delay(10) + + ready$ = ready$ + Str(loadcharsettings)+"#"+Characters(loadcharsettings)\name+"&"+Characters(loadcharsettings)\desc+"&0&"+Characters(loadcharsettings)\evidence+"&"+Characters(loadcharsettings)\pw+"&0&#" + + If loadcharsettings%10 = 9 + ReadyChar(charpage)=ready$+"#%" + charpage+1 + ready$="CI#" + EndIf + Next + + If Not loadcharsettings%10 = 9 + ReadyChar(charpage)=ready$+"#%" + EndIf + + Debug ReadyChar(0) + Debug ReadyChar(1) + Debug ReadyChar(2) + + If ReadFile(2, "base/musiclist.txt") ; wenn die Datei geöffnet werden konnte, setzen wir fort... + tracks=0 + musicpage=0 + ready$="EM#" + While Eof(2) = 0 ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist + AddElement(Music()) + track$=ReadString(2) + track$=ReplaceString(track$,"#","") + track$ = ReplaceString(track$,"%","") + Music() = track$ + ready$ = ready$ + Str(tracks) + "#" + track$ + "#" + If tracks%10 = 9 + ReadyMusic(musicpage)=ready$+"#%" + musicpage+1 + If page>10 + ReDim ReadyMusic(musicpage) + EndIf + ready$="EM#" + EndIf + tracks+1 + Wend + ReDim ReadyMusic(musicpage) + + If Not tracks%10 = 9 + ReadyMusic(musicpage)=ready$+"#%" + EndIf + + CloseFile(2) + + Else + CompilerIf #CONSOLE=0 + MessageRequester("AO server","No music list!") + CompilerEndIf + EndIf + + + If ReadFile(2, "base/op.txt") ; wenn die Datei geöffnet werden konnte, setzen wir fort... + ClearList(HDmods()) + While Eof(2) = 0 ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist + hdmod$=ReadString(2) + If hdmod$<>"" + AddElement(HDmods()) + HDmods()=hdmod$ + EndIf + Wend + CloseFile(2) ; schließen der zuvor geöffneten Datei + EndIf + + If ReadFile(2, "base/HDbanlist.txt") ; wenn die Datei geöffnet werden konnte, setzen wir fort... + ClearList(HDbans()) + While Eof(2) = 0 ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist + hdban$=ReadString(2) + If hdban$<>"" + AddElement(HDbans()) + HDbans()=hdban$ + EndIf + Wend + CloseFile(2) ; schließen der zuvor geöffneten Datei + EndIf + + If ReadFile(2, "serverd.txt") ; wenn die Datei geöffnet werden konnte, setzen wir fort... + ReadString(2) + ReadString(2) + ReadString(2) + ClearList(SDbans()) + While Eof(2) = 0 ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist + hdban$=ReadString(2) + If hdban$<>"" + AddElement(SDbans()) + SDbans()=hdban$ + EndIf + Wend + CloseFile(2) ; schließen der zuvor geöffneten Datei + EndIf + + If ReadFile(2, "base/banlist.txt") ; wenn die Datei geöffnet werden konnte, setzen wir fort... + ClearList(IPbans()) + While Eof(2) = 0 ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist + ipban$=ReadString(2) + If ipban$<>"" + AddElement(IPbans()) + IPbans()=ipban$ + EndIf + Wend + CloseFile(2) ; schließen der zuvor geöffneten Datei + EndIf + + If ReadFile(2, "base/gimp.txt") ; wenn die Datei geöffnet werden konnte, setzen wir fort... + ClearList(gimp()) + While Eof(2) = 0 ; sich wiederholende Schleife bis das Ende der Datei ("end of file") erreicht ist + AddElement(gimp()) + gimp()=ReadString(2) + Wend + CloseFile(2) ; schließen der zuvor geöffneten Datei + EndIf + +EndProcedure + +Procedure SendToAll(*p) + Define replay$ + reply$=PeekS(*p) + Debug PeekS(*p) + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + SendNetworkString(Clients()\ClientID,reply$) ;;;;; SERVER REPLY + Wend + UnlockMutex(ListMutex) +EndProcedure + +Procedure ListIP(ClientID) + Define send.b + Define iplist$ + Define charname$ + send=0 + iplist$="IL#" + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + char=Clients()\CID + If char<=100 And char>=0 + If char>characternumber ; the character id is greater than the amount of characters + charname$="HACKER" ; OBVIUOSLY + Clients()\hack=1 + Else + If Clients()\perm + charname$=Characters(char)\name+"(mod)" + Else + charname$=Characters(char)\name + EndIf + EndIf + Else + charname$="nobody" + EndIf + iplist$=iplist$+Clients()\IP+"|"+charname$+"|"+Str(char)+"|*" + Wend + UnlockMutex(ListMutex) + iplist$=iplist$+"#%" + SendNetworkString(ClientID,iplist$) +EndProcedure + +Procedure KickBan(kick$,action,perm) + Define akck + Define everybody.b + Define i + akck=0 + If kick$="everybody" + everybody.b=1 + EndIf + For i=0 To characternumber + If Characters(i)\name=kick$ + kick$=Str(i) + Break + EndIf + Next + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If kick$=Str(Clients()\CID) Or kick$=Clients()\HD Or kick$=Clients()\IP Or everybody + If Clients()\perm=0 + Characters(Clients()\CID)\taken=0 + EndIf + kclid=Clients()\ClientID + DeleteMapElement(Clients()) + Delay(10) + CloseNetworkConnection(kclid) + akck+1 + + Case #BAN + SendNetworkString(Clients()\ClientID,"KB#"+Str(Clients()\CID)+"#%") + + If kick$=Clients()\HD + AddElement(HDbans()) + HDbans()=Clients()\HD + If OpenFile(2,"base/HDbanlist.txt") + FileSeek(2,Lof(2)) + WriteStringN(2,Clients()\HD) + CloseFile(2) + EndIf + Else + AddElement(IPbans()) + IPbans()=Clients()\IP + If OpenFile(2,"base/banlist.txt") + FileSeek(2,Lof(2)) + WriteStringN(2,Clients()\IP) + CloseFile(2) + EndIf + EndIf + If Clients()\CID>=0 + Characters(Clients()\CID)\taken=0 + EndIf + kclid=Clients()\ClientID + DeleteMapElement(Clients()) + Delay(10) + CloseNetworkConnection(kclid) + akck+1 + Case #MUTE + SendNetworkString(Clients()\ClientID,"MU#"+Str(Clients()\CID)+"#%") + akck+1 + Case #UNMUTE + SendNetworkString(Clients()\ClientID,"UM#"+Str(Clients()\CID)+"#%") + akck+1 + Case #CIGNORE + Clients()\ignore=1 + akck+1 + Case #UNIGNORE + Clients()\ignore=0 + akck+1 + Case #UNDJ + Clients()\ignoremc=1 + akck+1 + Case #DJ + Clients()\ignoremc=0 + akck+1 + Case #GIMP + Clients()\gimp=1 + akck+1 + Case #UNGIMP + Clients()\gimp=0 + akck+1 + EndSelect + EndIf + EndIf + Wend + UnlockMutex(ListMutex) + rf=1 + ProcedureReturn akck +EndProcedure + + +Procedure SendTarget(user$,room,message$) + Debug user$ + Debug room + Debug message$ + + + If user$="*" + everybody.b=1 + EndIf + + For i=0 To characternumber + If Characters(i)\name=user$ + user$=Str(i) + Break + EndIf + Next + + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If user$=Str(Clients()\CID) Or user$=Clients()\HD Or user$=Clients()\IP Or (everybody And room=Clients()\room) + SendNetworkString(Clients()\ClientID,message$) + EndIf + Wend + UnlockMutex(ListMutex) + ProcedureReturn akck +EndProcedure + +Procedure.s Escape(smes$) + smes$=ReplaceString(smes$,"","#") + smes$=ReplaceString(smes$,"","&") + smes$=ReplaceString(smes$,"","%") + smes$=ReplaceString(smes$,"","$") + ProcedureReturn smes$ +EndProcedure + +ProcedureDLL.s HexToString(hex.s) + str.s="" + For i = 1 To Len(hex.s) Step 2 + str.s = str.s + Chr(Val("$"+Mid(hex.s, i, 2))) + Next i + ProcedureReturn str.s +EndProcedure + +ProcedureDLL.s StringToHex(str.s) + StringToHexR.s = "" + hexchar.s = "" + + For x.l = 1 To Len(str) + hexchar.s = Hex(Asc(Mid(str, x, 1))) + If Len(hexchar) = 1 + hexchar = "0" + hexchar + EndIf + StringToHexR.s = StringToHexR + hexchar + Next x + ProcedureReturn StringToHexR.s +EndProcedure + +Procedure.s EncryptStr(S.s, Key.u) + C1 = 53761 + C2 = 32618 + + Result.s = S.s + + Define *S.CharacterArray = @S + Define *Result.CharacterArray = @Result + + For I = 0 To Len(S.s)-1 + *Result\c[I] = (*S\c[I] ! (Key >> 8)) + Key = ((*Result\c[I] + Key) * C1) + C2 + Next + + ProcedureReturn Result.s +EndProcedure + +ProcedureDLL.s DecryptStr(S.s, Key.u) + C1 = 53761 + C2 = 32618 + Result.s = S.s + + Define *S.CharacterArray = @S + Define *Result.CharacterArray = @Result + + For I = 0 To Len(S.s)-1 + *Result\c[I] = (*S\c[I] ! (Key >> 8)) + Key = ((*S\c[I] + Key) * C1) + C2 + Next + + ProcedureReturn Result.s +EndProcedure + +ProcedureDLL MasterAdvert(msport) + WriteLog("Masterserver adverter thread started",1,"SERVER") + msID=0 + mstick=0 + *null=AllocateMemory(100) + OpenPreferences("base/masterserver.ini") + PreferenceGroup("list") + master$=ReadPreferenceString("0","46.188.16.205") + ClosePreferences() + OpenPreferences("base/settings.ini") + PreferenceGroup("server") + name$=ReadPreferenceString("Name","Public Discord server") + desc$=ReadPreferenceString("Desc","This server is powered by serverD") + desc$=ReplaceString(desc$,"$n",Chr(13)+Chr(10)) + desc$=ReplaceString(desc$,"%n",Chr(13)+Chr(10)) + + ClosePreferences() + + Repeat + + If msID + If NetworkClientEvent(msID)=#PB_NetworkEvent_Data + msinfo=ReceiveNetworkData(msID,*null,100) + If msinfo=-1 + tick=200 + Else + msrec$=PeekS(*null,msinfo) + If Left(msrec$,7) ="CHECK#%" + tick=0 + EndIf + EndIf + EndIf + + If tick>=200 + WriteLog("Masterserver adverter timer exceeded, reconnecting",1,"SERVER") + CloseNetworkConnection(msID) + msID=OpenNetworkConnection(master$,27016) + + If msID + SendNetworkString(msID,"SCC#"+Str(port)+"#"+name$+"#"+desc$+"#%") + tick=0 + EndIf + EndIf + + Else + msID=OpenNetworkConnection(master$,27016) + If msID + Debug "SCC#"+Str(port)+"#"+name$+"#"+desc$+"#%" + SendNetworkString(msID,"SCC#"+Str(msport)+"#"+name$+"#"+desc$+"#%") + tick=0 + EndIf + EndIf + + Delay(100) + tick+1 + Until public=0 + + WriteLog("Masterserver adverter thread stopped",1,"SERVER") + If msID + CloseNetworkConnection(msID) + EndIf + FreeMemory(*null) + msthread=0 +EndProcedure + + +Procedure SendDone(ClientID) + send$="CharsCheck" + For sentchar=0 To characternumber + If Characters(sentchar)\taken Or Characters(sentchar)\pw<>"" + send$ = send$ + "#-1" + Else + send$ = send$ + "#0" + EndIf + Next + send$ = send$ + "#%" + SendNetworkString(ClientID,send$) + SendNetworkString(ClientID,"BN#"+Rooms(0)\bg+"#%") + SendNetworkString(ClientID,"OPPASS#"+StringToHex(EncryptStr(opppass$,key))+"#%") + SendNetworkString(ClientID,"MM#"+Str(musicmode)+"#%") + Delay(10) + SendNetworkString(ClientID,"DONE#%") +EndProcedure + + + + +CompilerIf #PB_Compiler_Debugger=0 + OnErrorGoto(?start) +CompilerEndIf + +CompilerIf #CONSOLE=0 + Procedure RefreshList(var) + lstate=GetGadgetState(#Listview_0) + ClearGadgetItems(#Listview_0) + i=0 + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + AddGadgetItem(#Listview_0,i,Clients()\IP+Chr(10)+Str(Clients()\CID)+Chr(10)+Str(Clients()\AID),Icons(Clients()\perm)) + SetGadgetItemData(#Listview_0,i,Clients()\ClientID) + ;SetGadgetItemColor(#Listview_0,i,#PB_Gadget_BackColor,$EEEEEE/(Clients()\icon+1)) + i+1 + Debug "clients: "+Str(i) + Wend + UnlockMutex(ListMutex) + SetGadgetState(#Listview_0,lstate) + EndProcedure + + + Procedure ConfigWindow(var) + Open_Window_1() + AddGadgetItem(#Combo_3,0,"None") + AddGadgetItem(#Combo_3,1,"Green") + AddGadgetItem(#Combo_3,2,"Red") + AddGadgetItem(#Combo_3,3,"Orange") + AddGadgetItem(#Combo_3,4,"Blue") + SetGadgetText(#String_OP,oppass$) + SetGadgetState(#CheckBox_4,Logging) + SetGadgetState(#Checkbox_BlockIni,blockini) + SetGadgetState(#Combo_3,modcol) + AddGadgetItem(#Combo_4,0,"NONE") + For loadevi=1 To EviNumber + AddGadgetItem(#Combo_4,loadevi,Evidences(loadevi)\name) + Next + SetGadgetState(#Combo_4,MOTDevi) + Repeat ; Start of the event loop + Event = WaitWindowEvent() ; This line waits until an event is received from Windows + WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures + GadgetID = EventGadget() ; Is it a gadget event? + EventType = EventType() ; The event type + If Event = #PB_Event_Gadget + If GadgetID = #String_OP + oppass$ = GetGadgetText(#String_OP) + CompilerIf #SPAM + If oppass$="spam" + CreateThread(@SpamWindow(),0) + oppass$="" + SetGadgetText(#String_OP,"") + EndIf + CompilerEndIf + ElseIf GadgetID = #CheckBox_4 + If GetGadgetState(#CheckBox_4) + If OpenFile(1,LogFile$) + Logging = 1 + FileSeek(1,Lof(1)) + WriteLog("LOGGING STARTED",1,"SERVER") + Else + SetGadgetState(#CheckBox_4,0) + EndIf + Else + CloseFile(1) + Logging = 0 + EndIf + ElseIf GadgetID = #Button_5 + Event = #PB_Event_CloseWindow + ElseIf GadgetID = #Combo_3 + modcol=GetGadgetState(#Combo_3) + ElseIf GadgetID = #Combo_4 + motdevi=GetGadgetState(#Combo_4) + ElseIf GadgetID = #Checkbox_BlockIni + blockini=GetGadgetState(#Checkbox_BlockIni) + ElseIf GadgetID = #Button_9 + LogFile$=SaveFileRequester("Choose log file",LogFile$,"Log files (*.log)|*.log",0) + EndIf + EndIf + Until Event = #PB_Event_CloseWindow ; End of the event loop + OpenPreferences("poker.ini") + PreferenceGroup("cfg") + WritePreferenceString("LogFile",LogFile$) + WritePreferenceInteger("Logging",GetGadgetState(#CheckBox_4)) + WritePreferenceString("oppass",GetGadgetText(#String_OP)) + WritePreferenceInteger("ModCol",GetGadgetState(#Combo_3)) + WritePreferenceInteger("motdevi",GetGadgetState(#Combo_4)) + WritePreferenceInteger("BlockIni",GetGadgetState(#Checkbox_BlockIni)) + ClosePreferences() + EndProcedure + + Procedure Network(var) + CompilerElse + start: + CompilerIf #PB_Compiler_Debugger=0 + If ErrorLine() + + lpublic=public + public=0 + PrintN("well fuck it crashed,tell sD this stuff: #"+ErrorMessage()+" @"+Str(ErrorAddress())) + + LoadSettings(0) + Delay(500) + public=lpublic + + Else + CompilerElse + If 1 + CompilerEndIf + CompilerIf #PB_Compiler_OS = #PB_OS_Windows + OpenConsole("serverD") + CompilerEndIf + LoadSettings(0) + + decryptor$="33" + key=2 + + CreateNetworkServer(0,port,#PB_Network_TCP) + + If public And msthread=0 + msthread=CreateThread(@Masteradvert(),port) + EndIf + EndIf + CompilerEndIf + Quit=0 + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CLIENT + + + Repeat + + SEvent = NetworkServerEvent() + + ClientID = EventClient() + + Select SEvent + + Case #PB_NetworkEvent_Connect + send=1 + ip$=IPString(GetClientIP(ClientID)) + + WriteLog("CLIENT CONNECTED ",0,ip$) + + ForEach IPbans() + If ip$ = IPbans() + send=0 + SendNetworkString(ClientID,"BD#%") + WriteLog("IP: "+ip$+" is banned, disconnecting",0,ip$) + CloseNetworkConnection(ClientID) + Break + EndIf + Next + If send + LockMutex(ListMutex) + Clients(Str(ClientID))\ClientID = ClientID + Clients()\IP = ip$ + Clients()\AID=PV + PV+1 + Clients()\CID=-1 + Clients()\hack=0 + CLients()\perm=0 + ForEach HDmods() + If ip$ = HDmods() + CLients()\perm=1 + EndIf + Next + Clients()\room=0 + Clients()\ignore=0 + Clients()\gimp=0 + UnlockMutex(ListMutex) + CompilerIf #CONSOLE=0 + AddGadgetItem(#Listview_0,-1,ip$+Chr(10)+"-1"+Chr(10)+"-1",Icons(0)) + CompilerEndIf + SendNetworkString(ClientID,"decryptor#"+decryptor$+"#%") + EndIf + + + Case #PB_NetworkEvent_Data ;//////////////////////////Data + ;Debug "data lock" + *usagePointer.Client=FindMapElement(Clients(),Str(ClientID)) + length=ReceiveNetworkData(ClientID, *Buffer, 1024) + If length + rawreceive$=PeekS(*Buffer,length) + If Not *usagePointer\last.s=rawreceive$ And *usagePointer\ignore=0 + *usagePointer\last.s=rawreceive$ + If length>=0 And Left(rawreceive$,1)="#" + comm$=DecryptStr(HexToString(StringField(rawreceive$,2,"#")),key) + Debug rawreceive$ + + Select comm$ + Case "HI" ;what is this server + hdbanned=0 + *usagePointer\HD = StringField(rawreceive$,3,"#") + WriteLog("HdId="+*usagePointer\HD,*usagePointer\perm,*usagePointer\IP) + *usagePointer\sHD = 1 + + If loghd + OpenFile(8,"base/hd.txt") + WriteStringN(8,*usagePointer\IP) + WriteStringN(8,*usagePointer\HD) + CloseFile(8) + EndIf + + ForEach SDBans() + Debug SDBans() + Debug *usagePointer\HD + If *usagePointer\HD = SDbans() Or *usagePointer\IP=SDBans() + SendNetworkString(ClientID,"BD#%") + Delay(10) + CloseNetworkConnection(ClientID) + + DeleteMapElement(Clients(),Str(ClientID)) + hdbanned=1 + + rf=1 + EndIf + Next + If hdbanned=0 + ForEach HDbans() + If *usagePointer\HD = HDbans() + send=0 + WriteLog("HdId: "+*usagePointer\HD+" is banned, disconnecting",*usagePointer\perm,*usagePointer\IP) + SendNetworkString(ClientID,"BD#%") + Delay(10) + CloseNetworkConnection(ClientID) + DeleteMapElement(Clients(),Str(ClientID)) + hdbanned=1 + rf=1 + Break + EndIf + Next + EndIf + If hdbanned=0 + ForEach HDmods() + If *usagePointer\HD = HDmods() + *usagePointer\perm=1 + EndIf + Next + SendNetworkString(ClientID,"ID#"+Str(PV)+"#"+scene$+"#%") + players=0 + For i=0 To characternumber + If Characters(i)\taken + players+1 + EndIf + Next + SendNetworkString(ClientID,"PN#"+Str(players)+"#"+Str(characternumber)+"#%") + EndIf + + Case "askchaa" ;what is left to load + *usagePointer\cconnect=1 + SendNetworkString(ClientID,"SI#"+Str(characternumber)+"#"+Str(EviNumber)+"#"+Str(tracks)+"#%") + send=0 + + Case "askchar2" ; character list + SendNetworkString(ClientID,ReadyChar(0)) + + Case "AN" ; character list + start=Val(StringField(rawreceive$,3,"#")) + If start*100 + SendNetworkString(ClientID,ReadyEvidence(0)) + ElseIf tracks>0 + SendNetworkString(ClientID,ReadyMusic(0)) + Else ;MUSIC DONE + CreateThread(@SendDone(),ClientID) + EndIf + + + Case "AE" ; evidence list + Debug Evidences(0)\name + sentevi=Val(StringField(rawreceive$,3,"#")) + send=0 + If sentevi0 + SendNetworkString(ClientID,ReadyMusic(0)) + Else ;MUSIC DONE + CreateThread(@SendDone(),ClientID) + EndIf + + Case "AM" ;music list + start=Val(StringField(rawreceive$,3,"#")) + send=0 + + If start<=musicpage + SendNetworkString(ClientID,ReadyMusic(start)) + Else ;MUSIC DONE + CreateThread(@SendDone(),ClientID) + EndIf + + Case "CC" + send=0 + Debug rawreceive$ + char=Val(StringField(rawreceive$,4,"#")) + If Characters(char)\taken=0 Or *usagePointer\CID=char + SendNetworkString(ClientID,"PV#"+StringField(rawreceive$,3,"#")+"#CID#"+Str(char)+"#%") + If *usagePointer\CID>=0 + Characters(*usagePointer\CID)\taken=0 + EndIf + *usagePointer\CID=Val(StringField(rawreceive$,4,"#")) + Characters(*usagePointer\CID)\taken=1 + WriteLog("chose character: "+Characters(char)\name,*usagePointer\perm,*usagePointer\IP) + SendNetworkString(ClientID,"HP#1#"+defbar$+"#%") + SendNetworkString(ClientID,"HP#2#"+probar$+"#%") + If MOTDevi + SendNetworkString(ClientID,"MS#chat#dolannormal#Dolan#dolannormal# #jud#1#0#"+Str(characternumber-1)+"#0#0#"+Str(MOTDevi)+"#"+Str(characternumber-1)+"#0#"+Str(modcol)+"#%") + EndIf + EndIf + rf=1 + + ; + + Case "HP" + If *usagePointer\CID>=0 And Val(StringField(rawreceive$,4,"#"))>=0 And Val(StringField(rawreceive$,4,"#"))<=10 + CompilerIf #EASYLOG + AddGadgetItem(#Listview_2,-1,Characters(*usagePointer\CID)\name+" set bar "+StringField(rawreceive$,3,"#")+" to "+StringField(rawreceive$,4,"#")) + SetGadgetItemData(#Listview_2,CountGadgetItems(#Listview_2)-1,ClientID) + CompilerEndIf + WriteLog("["+Characters(*usagePointer\CID)\name+"] changed the bars",*usagePointer\perm,*usagePointer\IP) + If StringField(rawreceive$,3,"#")="1" + defbar$=StringField(rawreceive$,4,"#") + reply$="HP#1#"+defbar$+"#%" + ElseIf StringField(rawreceive$,3,"#")="2" + probar$=StringField(rawreceive$,4,"#") + reply$="HP#2#"+probar$+"#%" + EndIf + + EndIf + + Case "RT" + If rt=1 + Sendtarget("*",*usagePointer\room,"RT#"+Right(rawreceive$,length-6)) + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] WT/CE button",*usagePointer\perm,*usagePointer\IP) + CompilerIf #EASYLOG + AddGadgetItem(#Listview_2,-1,Characters(*usagePointer\CID)\name+" pressed WT%CE button") + SetGadgetItemData(#Listview_2,CountGadgetItems(#Listview_2)-1,ClientID) + CompilerEndIf + Else + *usagePointer\hack=1 + EndIf + + Case "MS" + CompilerIf #EASYLOG + AddGadgetItem(#Listview_2,-1,StringField(rawreceive$,5,"#")+": "+StringField(rawreceive$,7,"#")) + SetGadgetItemData(#Listview_2,CountGadgetItems(#Listview_2)-1,*usagePointer\ClientID) + CompilerEndIf + + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"]["+StringField(rawreceive$,7,"#")+"]",*usagePointer\perm,*usagePointer\IP) + Else + *usagePointer\hack=1 + EndIf + + ;If modcol And StringField(rawreceive$,17,"#")=Str(modcol) And Not *usagePointer\perm + ; Sendtarget("*",*usagePointer\room,"MS#"+ReplaceString(Right(rawreceive$,length-6),Str(modcol)+"#%","0#%") ) + ;Else + If TryLockMutex(Rooms(*usagePointer\room)\wait) + UnlockMutex(Rooms(*usagePointer\room)\wait) + wttime=Len(Trim(StringField(rawreceive$,7,"#")))*40 + If wttime>=10000 + wttime=9999 + EndIf + waitins$=Str(*usagePointer\room)+Str(wttime) + CreateThread(@MSWait(),@waitins$) + ;reply$="MS#"+Right(rawreceive$,length-6) + ; #MS#chat#normal#Phoenix#thinking#I panic easily#def#1#0#0#1#0#0#0#0#0#% + msreply$="MS#" + For i=3 To 17 + mss$=StringField(rawreceive$,i,"#") + If i=17 And mss$=Str(modcol) And Not *usagePointer\perm + msreply$=msreply$+"0#" + ElseIf i=5 And blockini And mss$<>Characters(*usagePointer\CID)\name + msreply$=msreply$+Characters(*usagePointer\CID)\name+"#" + ElseIf i=7 And *usagePointer\gimp + If ListSize(gimp()) + SelectElement(gimp(),Random(ListSize(gimp()))) + msreply$=msreply$+gimp()+"#" + Else + msreply$=msreply$+"<3"+"#" + EndIf + Else + msreply$=msreply$+mss$+"#" + EndIf + Next + msreply$=msreply$+"%" + Sendtarget("*",*usagePointer\room,msreply$) + WriteReplay(rawreceive$) + + EndIf + ;EndIf + send=0 + ; CompilerEndIf + + Case "MC" + music=0 + Debug Right(rawreceive$,length-6) + ForEach Music() + If StringField(rawreceive$,3,"#")=Music() + music=1 + Break + EndIf + Next + + If Not (music=0 Or *usagePointer\CID=-1 Or *usagePointer\CID <> Val(StringField(rawreceive$,4,"#"))) + If Left(StringField(rawreceive$,3,"#"),1)=">" + Rooms(*usagePointer\room)\bg=Right(StringField(rawreceive$,3,"#"),Len(StringField(rawreceive$,3,"#"))-1) + Sendtarget("*",*usagePointer\room,"BN#"+Right(rawreceive$,length-7)) + + Else + If *usagePointer\ignoremc=0 + If Characters(*usagePointer\CID)\dj + Sendtarget("*",*usagePointer\room,"MC#"+Right(rawreceive$,length-6)) + WriteReplay(rawreceive$) + EndIf + EndIf + EndIf + WriteLog("["+Characters(*usagePointer\CID)\name+"] changed music to "+StringField(rawreceive$,3,"#"),*usagePointer\perm,*usagePointer\IP) + CompilerIf #EASYLOG + AddGadgetItem(#Listview_2,-1,Characters(*usagePointer\CID)\name+" changed music to "+StringField(rawreceive$,3,"#")) + SetGadgetItemData(#Listview_2,CountGadgetItems(#Listview_2)-1,ClientID) + CompilerEndIf + Else + *usagePointer\hack=1 + WriteLog("[HACKER] tried changing music to "+StringField(rawreceive$,3,"#"),*usagePointer\perm,*usagePointer\IP) + EndIf + ;------- ooc commands + Case "CT" + send=0 + *usagePointer\last.s="" + ctparam$=StringField(rawreceive$,4,"#") + If *usagePointer\CID>=0 + WriteLog("[OOC]["+Characters(*usagePointer\CID)\name+"]["+StringField(rawreceive$,3,"#")+"]["+ctparam$+"]",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[OOC][HACKER]["+StringField(rawreceive$,3,"#")+"]["+ctparam$+"]",*usagePointer\perm,*usagePointer\IP) + *usagePointer\hack=1 + EndIf + + Debug ctparam$ + If Left(ctparam$,1)="/" + Select StringField(ctparam$,1," ") + Case "/login" + If oppass$=Mid(ctparam$,8,Len(ctparam$)-2) + If oppass$<>"" + SendNetworkString(ClientID,LoginReply$) + *usagePointer\perm=1 + EndIf + ElseIf adminpass$=Mid(ctparam$,8,Len(ctparam$)-2) + If adminpass$<>"" + SendNetworkString(ClientID,LoginReply$) + *usagePointer\perm=2 + EndIf + EndIf + send=0 + + Case "/bg" + If *usagePointer\perm + bgcomm$=Mid(ctparam$,5,Len(ctparam$)-2) + Rooms(*usagePointer\room)\bg=bgcomm$ + Sendtarget("*",*usagePointer\room,"BN#"+bgcomm$+"#%") + EndIf + + Case "/ooc" + If *usagePointer\perm + CompilerIf #CONSOLE=0 + ooccather$=Mid(ctparam$,6,Len(ctparam$)-2) + sendo$="IL#" + SendNetworkString(ClientID,"FI#clients using the name "+ooccather$+"#%") + items=CountGadgetItems(#ListIcon_2) + LockMutex(ListMutex) + For o=0 To 100 + If GetGadgetItemText(#ListIcon_2,items-o,0)=ooccather$ + clid$=Str(GetGadgetItemData(#ListIcon_2,items-o)) + If FindMapElement(Clients(),clid$) + If Clients(clid$)\CID<=100 And Clients(clid$)\CID>=0 + If Clients(clid$)\perm + charname$=Characters(Clients(clid$)\CID)\name+"(mod)" + Else + charname$=Characters(Clients(clid$)\CID)\name + EndIf + Else + charname$="nobody" + EndIf + sendo$=sendo$+Clients(clid$)\IP+"|"+charname$+"|"+GetGadgetItemText(#ListIcon_2,items-o,1)+"|*" + EndIf + EndIf + Next + UnlockMutex(ListMutex) + sendo$=sendo$+"#%" + SendNetworkString(ClientID,sendo$) + CompilerElse + SendNetworkString(ClientID,"FI#needs gui, sorry#%") + CompilerEndIf + EndIf + + Case "/judge" + If *usagePointer\perm + CompilerIf #CONSOLE=0 + sendo$="IL#" + SendNetworkString(ClientID,"FI#clients that used WTCE#%") + items=CountGadgetItems(#Listview_2) + LockMutex(ListMutex) + For o=0 To 100 + If FindString(GetGadgetItemText(#ListView_2,items-o,0)," pressed WT%CE button") + clid$=Str(GetGadgetItemData(#ListView_2,items-o)) + If FindMapElement(Clients(),clid$) + If Clients(clid$)\CID<=100 And Clients(clid$)\CID>=0 + If Clients(clid$)\perm + charname$=Characters(Clients(clid$)\CID)\name+"(mod)" + Else + charname$=Characters(Clients(clid$)\CID)\name + EndIf + Else + charname$="nobody" + EndIf + sendo$=sendo$+Clients(clid$)\IP+"|"+charname$+"|"+Str(Clients(clid$)\CID)+"|*" + EndIf + EndIf + Next + UnlockMutex(ListMutex) + sendo$=sendo$+"#%" + SendNetworkString(ClientID,sendo$) + CompilerElse + SendNetworkString(ClientID,"FI#needs gui, sorry#%") + CompilerEndIf + EndIf + + Case "/room" + nroom=Val(StringField(ctparam$,2," ")) + If nroom<=roomc And nroom>=0 + If Not Rooms(nroom)\lock Or *usagePointer\perm>Rooms(nroom)\mlock + If Rooms(*usagePointer\room)\lock=ClientID + Rooms(*usagePointer\room)\lock=0 + Rooms(*usagePointer\room)\mlock=0 + EndIf + *usagePointer\room=nroom + SendNetworkString(ClientID,"BN#"+Rooms(*usagePointer\room)\bg+"#%") + SendNetworkString(ClientID,"FI#room "+Str(*usagePointer\room)+" selected%") + Else + SendNetworkString(ClientID,"FI#room locked%") + EndIf + ElseIf StringField(ctparam$,2," ")="" + SendNetworkString(ClientID,"FI#you are in room "+*usagePointer\room+"%") + Else + SendNetworkString(ClientID,"FI#not a valid room%") + EndIf + + Case "/lock" + If *usagePointer\room + locks$=StringField(ctparam$,2," ") + Select locks$ + Case "0" + Rooms(*usagePointer\room)\lock=0 + Rooms(*usagePointer\room)\mlock=0 + SendNetworkString(ClientID,"FI#room unlocked%") + Case "1" + Rooms(*usagePointer\room)\lock=*usagePointer\ClientID + Rooms(*usagePointer\room)\mlock=0 + SendNetworkString(ClientID,"FI#room locked%") + Case "2" + If *usagePointer\perm + Rooms(*usagePointer\room)\lock=*usagePointer\ClientID + Rooms(*usagePointer\room)\mlock=1 + SendNetworkString(ClientID,"FI#room superlocked%") + EndIf + Default + pr$="FI#room is " + If Rooms(*usagePointer\room)\lock=0 + pr$+"not " + EndIf + SendNetworkString(ClientID,pr$+"locked%") + EndSelect + Else + SendNetworkString(ClientID,"FI#you can't lock the default room%") + EndIf + + Case "/toggle" + If *usagePointer\perm + Select StringField(ctparam$,2," ") + Case "WTCE" + rt= ~ rt + pr$="FI#WTCE is " + If rt=1 + pr$+"enabled%" + Else + pr$+"disabled%" + EndIf + SendNetworkString(ClientID,pr$) + Case "LogHD" + loghd = ~ loghd + EndSelect + EndIf + + Case "/switch" + Characters(*usagePointer\cid)\taken=0 + *usagePointer\cid=-1 + SendNetworkString(ClientID,"DONE#%") + + Case "/smokeweed" + reply$="CT#sD#daaamn i'm high#%" + WriteLog("smoke weed everyday",*usagePointer\perm,*usagePointer\IP) + + Case "/public" + Debug ctparam$ + If StringField(ctparam$,2," ")="" + pr$="FI#server is " + If public=0 + pr$+"not " + EndIf + SendNetworkString(ClientID,pr$+"public%") + Else + If *usagePointer\perm>1 + public=Val(StringField(ctparam$,2," ")) + If public + msthread=CreateThread(@Masteradvert(),port) + EndIf + CompilerIf #CONSOLE=0 + SetGadgetState(#CheckBox_MS,public) + CompilerEndIf + EndIf + EndIf + + Case "/evi" + ; Mid(ctparam$,7,Len(ctparam$)-2) + SendNetworkString(ClientID,"MS#chat#dolannormal#Dolan#dolannormal#"+StringField(ctparam$,2," ")+"#jud#1#0#"+Str(characternumber-1)+"#0#0#"+StringField(ctparam$,2," ")+"#"+Str(characternumber-1)+"#0#"+Str(modcol)+"#%") + + Case "/roll" + smes$="" + smes$=ctparam$ + Debug smes$ + If smes$<>"/roll" + dicemax=Val(StringField(smes$,2," ")) + Else + dicemax=6 + EndIf + If dicemax<0 Or dicemax>9999 + dicemax=6 + EndIf + If OpenCryptRandom() + random$=Str(CryptRandom(dicemax)) + CloseCryptRandom() + Else + random$=Str(Random(dicemax)) + EndIf + + Sendtarget("*",*usagePointer\room,"FI#dice rolled "+random$+"%") + + Case "/pm" + sname$=StringField(rawreceive$,3,"#") + Debug sname$ + smes$=ctparam$ + Debug smes$ + SendTarget(StringField(smes$,2," "),-1,"CT#PM "+sname$+" to You#"+Mid(smes$,6+Len(StringField(smes$,2," ")))+"#%") + SendNetworkString(ClientID,"CT#PM You to "+StringField(smes$,2," ")+"#"+Mid(smes$,6+Len(StringField(smes$,2," ")))+"#%") + + Case "/send" + If *usagePointer\perm + sname$=StringField(ctparam$,2," ") + Debug sname$ + smes$=Mid(ctparam$,8+Len(sname$),Len(ctparam$)-6) + smes$=Escape(smes$) + SendTarget(sname$,-1,smes$) + EndIf + + Case "/sendall" + If *usagePointer\perm + reply$=Mid(ctparam$,10,Len(ctparam$)-2) + reply$=Escape(reply$) + EndIf + + Case "/reload" + If *usagePointer\perm>1 + LoadSettings(1) + SendNetworkString(ClientID,"FI#serverD reloaded%") + EndIf + + Case "/play" + If *usagePointer\perm + + If IsNumeric(Trim(Right(ctparam$,2))) + mcid$=Trim(Right(ctparam$,2)) + song$=Mid(ctparam$,7,Len(ctparam$)-8) + Else + mcid$=Str(*usagePointer\CID) + song$=Right(ctparam$,Len(ctparam$)-6) + EndIf + + reply$="MC#"+song$+"#"+mcid$+"#%" + + EndIf + + Case "/hd" + If *usagePointer\perm And *usagePointer\CID>=0 + kick$=Mid(ctparam$,5,Len(ctparam$)-2) + If kick$="" Or kick$="*" + everybody=1 + Else + everybody=0 + EndIf + hdlist$="IL#" + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If kick$=Str(Clients()\CID) Or kick$=Clients()\HD Or kick$=Clients()\IP Or everybody + hdlist$=hdlist$+Clients()\IP+"|"+Str(Clients()\CID)+"|"+Clients()\HD+"|*" + EndIf + Wend + UnlockMutex(ListMutex) + SendNetworkString(ClientID,hdlist$+"#%") + WriteLog("["+Characters(*usagePointer\CID)\name+"] used /hd",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used /hd",*usagePointer\perm,*usagePointer\IP) + EndIf + + Case "/ip" + If *usagePointer\perm And *usagePointer\CID>=0 + CreateThread(@ListIP(),ClientID) + WriteLog("["+Characters(*usagePointer\CID)\name+"] used /ip",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used /ip",*usagePointer\perm,*usagePointer\IP) + EndIf + + Case "/kick" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,7,Len(ctparam$)-2),#KICK,*usagePointer\perm) + SendNetworkString(ClientID,"FI#kicked "+Str(akck)+" clients%") + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + EndIf + Case "/ban" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,6,Len(ctparam$)-2),#BAN,*usagePointer\perm) + SendNetworkString(ClientID,"FI#banned "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/mute" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,7,Len(ctparam$)-2),#MUTE,*usagePointer\perm) + SendNetworkString(ClientID,"FI#muted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/unmute" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,9,Len(ctparam$)-2),#UNMUTE,*usagePointer\perm) + SendNetworkString(ClientID,"FI#unmuted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/ignore" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,9,Len(ctparam$)-2),#CIGNORE,*usagePointer\perm) + SendNetworkString(ClientID,"FI#muted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/unignore" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,11,Len(ctparam$)-2),#UNIGNORE,*usagePointer\perm) + SendNetworkString(ClientID,"FI#unmuted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/undj" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,7,Len(ctparam$)-2),#UNDJ,*usagePointer\perm) + SendNetworkString(ClientID,"FI#muted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/dj" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,5,Len(ctparam$)-2),#DJ,*usagePointer\perm) + SendNetworkString(ClientID,"FI#unmuted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/gimp" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,7,Len(ctparam$)-2),#GIMP,*usagePointer\perm) + SendNetworkString(ClientID,"FI#gimped "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + Case "/ungimp" + If *usagePointer\perm + akck=KickBan(Mid(ctparam$,9,Len(ctparam$)-2),#UNGIMP,*usagePointer\perm) + SendNetworkString(ClientID,"FI#ungimped "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+ctparam$,*usagePointer\perm,*usagePointer\IP) + EndIf + EndSelect + Else + CompilerIf #CONSOLE=0 + AddGadgetItem(#ListIcon_2,-1,StringField(rawreceive$,3,"#")+Chr(10)+ctparam$) + SetGadgetItemData(#ListIcon_2,CountGadgetItems(#ListIcon_2)-1,ClientID) + CompilerEndIf + *usagePointer\last.s=rawreceive$ + reply$="CT#"+Right(rawreceive$,length-6) + EndIf + + Case "CA" + If *usagePointer\CID>=0 And *usagePointer\perm + CreateThread(@ListIP(),ClientID) + WriteLog("["+Characters(*usagePointer\CID)\name+"] used /ip",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used /ip",*usagePointer\perm,*usagePointer\IP) + *usagePointer\hack=1 + EndIf + + Case "opKICK" + If *usagePointer\perm + akck=KickBan(StringField(rawreceive$,3,"#"),#KICK,*usagePointer\perm) + SendNetworkString(ClientID,"FI#kicked "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used opKICK",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+StringField(rawreceive$,4,"#"),*usagePointer\perm,*usagePointer\IP) + EndIf + Case "opBAN" + If *usagePointer\perm + akck=KickBan(StringField(rawreceive$,3,"#"),#BAN,*usagePointer\perm) + SendNetworkString(ClientID,"FI#banned "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used opBAN",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+StringField(rawreceive$,4,"#"),*usagePointer\perm,*usagePointer\IP) + EndIf + Case "opMUTE" + If *usagePointer\perm + akck=KickBan(StringField(rawreceive$,3,"#"),#MUTE,*usagePointer\perm) + SendNetworkString(ClientID,"FI#muted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used opMUTE",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+StringField(rawreceive$,4,"#"),*usagePointer\perm,*usagePointer\IP) + EndIf + Case "opunMUTE" + If *usagePointer\perm + akck=KickBan(StringField(rawreceive$,3,"#"),#UNMUTE,*usagePointer\perm) + SendNetworkString(ClientID,"FI#unmuted "+Str(akck)+" clients%") + EndIf + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] used opunMUTE",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[HACKER] used "+StringField(rawreceive$,4,"#"),*usagePointer\perm,*usagePointer\IP) + EndIf + Case "VERSION" + SendNetworkString(ClientID,"FI#sD v"+Str(#PB_Editor_CompileCount)+"."+Str(#PB_Editor_BuildCount)+"%") + + Case "ZZ" + If *usagePointer\CID>=0 + WriteLog("["+Characters(*usagePointer\CID)\name+"] called mod",*usagePointer\perm,*usagePointer\IP) + Else + WriteLog("[someone] called mod",*usagePointer\perm,*usagePointer\IP) + EndIf + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\perm + SendNetworkString(Clients()\ClientID,"ZZ#"+*usagePointer\IP+"#%") + SendNetworkString(Clients()\ClientID,"FI#"+*usagePointer\IP+" called%") + Else + SendNetworkString(Clients()\ClientID,"ZZ#someone#%") + EndIf + Wend + UnlockMutex(ListMutex) + EndSelect + + If reply$<>"" + areply$=reply$ + CreateThread(@SendToAll(),@areply$) + reply$="" + EndIf + EndIf + EndIf + EndIf + send=1 + + Case #PB_NetworkEvent_Disconnect + FindMapElement(Clients(),Str(ClientID)) + If Clients()\CID>=0 + Characters(Clients()\CID)\taken=0 + EndIf + If Rooms(Clients()\room)\lock=ClientID + Rooms(Clients()\room)\lock=0 + Rooms(Clients()\room)\mlock=0 + EndIf + ip$=Clients()\IP + dcperm=Clients()\perm + DeleteMapElement(Clients(),Str(ClientID)) + rf=1 + WriteLog("CLIENT DISCONNECTED",dcperm,ip$) + + Default + Delay(1) + + EndSelect + CompilerIf #CONSOLE=0 + If rf + CreateThread(@RefreshList(),0) + rf=0 + EndIf + CompilerEndIf + Until Quit = 1 + + + + + CompilerIf #CONSOLE=0 + EndProcedure + + + Procedure Splash(ponly) + If OpenWindow(2,#PB_Ignore,#PB_Ignore,420,263,"serverD",#PB_Window_BorderLess|#PB_Window_ScreenCentered) + + UsePNGImageDecoder() + CatchImage(3,?dend) + ImageGadget(0,0,0,420,263,ImageID(3)) + CatchImage(0,?green) + Icons(0)=ImageID(0) + CatchImage(1,?mod) + Icons(1)=ImageID(1) + CatchImage(2,?hacker) + Icons(2)=ImageID(2) + + If ReceiveHTTPFile("http://weedlan.de/serverd/serverd.txt","serverd.txt") + OpenPreferences("serverd.txt") + PreferenceGroup("Version") + newbuild=ReadPreferenceInteger("Build",#PB_Editor_BuildCount) + If newbuild>#PB_Editor_BuildCount + update=1 + EndIf + ClosePreferences() + EndIf + Delay(500) + CloseWindow(2) + EndIf + EndProcedure + ;------------------------------------------------ PROGRAM START + + + + start: + CompilerIf #PB_Compiler_Debugger + If 1 + CompilerElse + + If ErrorLine() + + + Quit=1 + lpublic=public + public=0 + OpenFile(5,"crash.txt") + WriteStringN(5,"it crashed at source line offset "+Str(ErrorAddress())) + CloseFile(5) + LoadSettings(0) + Delay(500) + public=lpublic + Quit=0 + If nthread + nthread=CreateThread(@Network(),0) + EndIf + Else + CompilerEndIf + Splash(0) + + Open_Window_0() + + + LoadSettings(0) + oldCLient.Client + *clickedClient.Client + + decryptor$="33" + key=2 + + parameter$=ProgramParameter() + If parameter$="-auto" + If CreateNetworkServer(0, port,#PB_Network_TCP) + CompilerIf #CONSOLE=0 + SetWindowColor(0, RGB(255,255,0)) + SetGadgetText(#Button_2,"RELOAD") + CompilerEndIf + nthread=CreateThread(@Network(),0) + If public And msthread=0 + msthread=CreateThread(@Masteradvert(),port) + EndIf + Else + MessageRequester("serverD","SERVER CREATION FAILED - PORT IN USE?") + EndIf + EndIf + + + + EndIf + ;;;;;;;;;;;;;;;;;;;; EVENT LOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Repeat ; Start of the event loop + Event = WaitWindowEvent() ; This line waits until an event is received from Windows + WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures + GadgetID = EventGadget() ; Is it a gadget event? + EventType = EventType() ; The event type + If Event = #PB_Event_Gadget + + + llv=lvstate + lvstate=GetGadgetState(#Listview_0) + If lvstate <> -1 And lvstate<>llv + cldata = GetGadgetItemData(#Listview_0,lvstate) + If cldata + ;Debug "someones selected, let's find out who" + LockMutex(ListMutex) + + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID = cldata + *clickedClient.Client = @Clients() + EndIf + Wend + UnlockMutex(ListMutex) + EndIf + + ;If GadgetID = #Button_0 + ; SendNetworkString(*clickedClient\ServerID,GetGadgetText(#String_2)) + ;ElseIf GadgetID = #Button_11 + ; SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),GetGadgetText(#String_2)) + + If GadgetID = #Button_kk ;KICK + SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),"KK#"+Str(*clickedClient\CID)+"#%") + Delay(10) + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID=*clickedClient\ClientID + If Clients()\CID>=0 + Characters(Clients()\CID)\taken=0 + EndIf + CloseNetworkConnection(Clients()\ClientID) + DeleteMapElement(Clients()) + EndIf + Wend + UnlockMutex(ListMutex) + rf=1 + + CompilerIf #EASYLOG=0 + ElseIf GadgetID = #Listview_0 + SetGadgetText(#Listview_2,*clickedClient\Log) + CompilerEndIf + + ElseIf GadgetID = #Button_sw ;SWITCH + SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),"DONE#%") + + ElseIf GadgetID = #Button_mu ;MUTE + SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),"MU#"+Str(*clickedClient\CID)+"#%") + + ElseIf GadgetID = #Button_um ;UNMUTE + SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),"UM#"+Str(*clickedClient\CID)+"#%") + + ElseIf GadgetID = #Button_kb ;BAN + AddElement(IPbans()) + IPbans()=*clickedClient\IP + OpenFile(2,"base/banlist.txt") + FileSeek(2,Lof(2)) + WriteStringN(2,*clickedClient\IP) + CloseFile(2) + SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),"KB#"+Str(*clickedClient\CID)+"#%") + Delay(10) + If *clickedClient\CID>=0 + Characters(*clickedClient\CID)\taken=0 + EndIf + CloseNetworkConnection(*clickedClient\ClientID) + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID=*clickedClient\ClientID + DeleteMapElement(Clients()) + EndIf + Wend + UnlockMutex(ListMutex) + rf=1 + + ElseIf GadgetID = #Button_hd ;HDBAN + AddElement(HDbans()) + HDbans()=*clickedClient\HD + OpenFile(2,"base/HDbanlist.txt") + FileSeek(2,Lof(2)) + WriteStringN(2,*clickedClient\HD) + CloseFile(2) + SendNetworkString(GetGadgetItemData(#Listview_0,GetGadgetState(#Listview_0)),"KB#"+Str(*clickedClient\CID)+"#%") + Delay(10) + If *clickedClient\CID>=0 + Characters(*clickedClient\CID)\taken=0 + EndIf + CloseNetworkConnection(*clickedClient\ClientID) + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID=*clickedClient\ClientID + DeleteMapElement(Clients()) + EndIf + Wend + UnlockMutex(ListMutex) + rf=1 + + ElseIf GadgetID = #Button_dc ;DISCONNECT + If *clickedClient\CID>=0 + Characters(*clickedClient\CID)\taken=0 + EndIf + CloseNetworkConnection(*clickedClient\ClientID) + LockMutex(ListMutex) + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID=*clickedClient\ClientID + DeleteMapElement(Clients()) + EndIf + Wend + UnlockMutex(ListMutex) + rf=1 + + ElseIf GadgetID = #Button_ig ;IGNORE + *clickedClient\ignore.b=1 + + ElseIf GadgetID = #Button_si ; STOP IGNORING ME + *clickedClient\ignore.b=0 + + ElseIf GadgetID = #Button_ndj ;IGNORE + *clickedClient\ignoremc.b=1 + + ElseIf GadgetID = #Button_dj ; STOP IGNORING ME + *clickedClient\ignoremc.b=0 + + EndIf + + EndIf + + If GadgetID = #ListIcon_2 + ooclient=GetGadgetItemData(#ListIcon_2,GetGadgetState(#ListIcon_2)) + If ooclient + rf=1 + LockMutex(ListMutex) + + o=0 + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID = ooclient + SetGadgetState(#Listview_0,o) + Break + EndIf + o+1 + Wend + UnlockMutex(ListMutex) + EndIf + + ElseIf GadgetID = #Listview_2 + CompilerIf #EASYLOG + msclient=GetGadgetItemData(#Listview_2,GetGadgetState(#Listview_2)) + If msclient + rf=1 + LockMutex(ListMutex) + + b=0 + ResetMap(Clients()) + While NextMapElement(Clients()) + If Clients()\ClientID = msclient + SetGadgetState(#Listview_0,b) + EndIf + b+1 + Wend + UnlockMutex(ListMutex) + EndIf + CompilerEndIf + ElseIf GadgetID = #CheckBox_MS + public=GetGadgetState(#CheckBox_MS) + Debug public + If public + msthread=CreateThread(@Masteradvert(),port) + EndIf + + ElseIf GadgetID = #Button_2 ;START + If nthread + LoadSettings(1) + Else + If CreateNetworkServer(0, port,#PB_Network_TCP) + SetWindowColor(0, RGB(0,128,0)) + SetGadgetText(#Button_2,"RELOAD") + nthread=CreateThread(@Network(),0) + If public And msthread=0 + msthread=CreateThread(@Masteradvert(),port) + EndIf + Else + MessageRequester("serverD","SERVER CREATION FAILED - PORT IN USE?") + EndIf + EndIf + + ElseIf GadgetID = #Button_4 ;CONFIG + CreateThread(@ConfigWindow(),0) + + ElseIf GadgetID = #String_5 ;CONFIG + port=Val(GetGadgetText(#String_5)) + + ElseIf GadgetID = 1337 + MessageRequester("serverD","This is serverD version "+Str(#PB_Editor_CompileCount)+"."+Str(#PB_Editor_BuildCount)+Chr(10)+"(c) stonedDiscord 2014") + + EndIf + ElseIf Event = #PB_Event_SizeWindow + + ResizeGadget(#Frame3D_0,0,0,WindowWidth(0)/2.517,WindowHeight(0)) + ResizeGadget(#ListView_0,70,40,WindowWidth(0)/2.517-70,WindowHeight(0)-40) + ResizeGadget(#Button_2,WindowWidth(0)/6.08,15,WindowWidth(0)/8.111,22) + ResizeGadget(#String_5,WindowWidth(0)/3.476,15,WindowWidth(0)/10.42,22) + ResizeGadget(#Frame3D_4,WindowWidth(0)/2.517,0,WindowWidth(0)/3.173,WindowHeight(0)) + ResizeGadget(#Listview_2, WindowWidth(0)/1.7, 30, WindowWidth(0)-WindowWidth(0)/1.7, WindowHeight(0)-90) + ResizeGadget(#Listview_2,WindowWidth(0)/2.517,20,WindowWidth(0)/3.173,WindowHeight(0)-20) + ResizeGadget(#Frame3D_5,WindowWidth(0)/1.4,0,WindowWidth(0)/3.476,WindowHeight(0)) + ResizeGadget(#ListIcon_2,WindowWidth(0)/1.4,20,WindowWidth(0)/3.476,WindowHeight(0)-20) + + EndIf + + Until Event = #PB_Event_CloseWindow ; End of the event loop + + Quit=1 + + OpenPreferences("base/settings.ini") + PreferenceGroup("net") + WritePreferenceInteger("port",port) + WritePreferenceInteger("public",public) + ClosePreferences() + + End + + DataSection + green: + IncludeBinary "green.png" + mod: + IncludeBinary "mod.png" + hacker: + IncludeBinary "hacker.png" + dend: + IncludeBinary "serverd.png" + bannerend: + EndDataSection + + CompilerEndIf +; IDE Options = PureBasic 5.11 (Windows - x86) +; CursorPosition = 2053 +; FirstLine = 1996 +; Folding = ---- +; EnableXP +; EnableCompileCount = 0 +; EnableBuildCount = 0 \ No newline at end of file diff --git a/mod.png b/mod.png new file mode 100644 index 0000000..446405b Binary files /dev/null and b/mod.png differ diff --git a/poker.ini b/poker.ini new file mode 100644 index 0000000..6dda00a --- /dev/null +++ b/poker.ini @@ -0,0 +1,10 @@ +[cfg] +LogFile = base\serverlog.log +Logging = 1 +oppass = penis +ModCol = 1 +LoginReply = CT#sD#dicks#% +motdevi = 1 +BlockIni = 0 +; IDE Options = PureBasic 5.11 (Windows - x86) +; EnableXP \ No newline at end of file diff --git a/poker.pb b/poker.pb new file mode 100644 index 0000000..e69de29 diff --git a/serverd.png b/serverd.png new file mode 100644 index 0000000..0f87d1a Binary files /dev/null and b/serverd.png differ diff --git a/serverd.txt b/serverd.txt new file mode 100644 index 0000000..4b862d2 --- /dev/null +++ b/serverd.txt @@ -0,0 +1,5 @@ +[Version] +Compile=293 +Build=84 + WD-WCC2EAKD8991 +67.8.214.168