diff --git a/Common.pb b/Common.pb index 078001a..93044c6 100644 --- a/Common.pb +++ b/Common.pb @@ -124,13 +124,13 @@ Procedure Open_Window_0() BalloonTip(GadgetID(#Button_si), #Button_si, "Stop ignoring this client", "", #TOOLTIP_INFO_ICON) ButtonGadget(#Button_About, -30, 310, 100, 30, "ABOUT", #PB_Button_Right) ButtonGadget(#Button_Load, -30, 340, 100, 30, "LOAD", #PB_Button_Right) - ListIconGadget(#Listview_0, 70, 40, 220, 330, "IP", 100, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection) + ListIconGadget(#Listview_0, 70, 40, 220, 330, "IP", 90, #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", 80) - AddGadgetColumn(#Listview_0, 2, "Area", 50) - AddGadgetColumn(#Listview_0, 3, "HDID", 80) + AddGadgetColumn(#Listview_0, 1, "Character", 70) + AddGadgetColumn(#Listview_0, 2, "Area", 70) + AddGadgetColumn(#Listview_0, 3, "HDID", 70) 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) @@ -244,8 +244,8 @@ Procedure ConfigWindow(var) ClosePreferences() EndProcedure ; IDE Options = PureBasic 5.31 (Windows - x86) -; CursorPosition = 147 -; FirstLine = 125 +; CursorPosition = 132 +; FirstLine = 119 ; Folding = - ; EnableXP ; EnableCompileCount = 0 diff --git a/gui.pb b/gui.pb index 71a2d4a..2305454 100644 --- a/gui.pb +++ b/gui.pb @@ -220,6 +220,7 @@ Repeat ; Start of the event loop EndIf EndIf chill-1 + Delay(1) EndIf Until Event = #PB_Event_CloseWindow ; End of the event loop Quit=1 @@ -244,7 +245,7 @@ DataSection bannerend: EndDataSection ; IDE Options = PureBasic 5.31 (Windows - x86) -; CursorPosition = 242 +; CursorPosition = 222 ; FirstLine = 196 ; Folding = - ; EnableXP \ No newline at end of file diff --git a/main.pb b/main.pb index cb40a08..93f653f 100644 --- a/main.pb +++ b/main.pb @@ -291,7 +291,7 @@ Procedure LoadSettings(reload) ClosePreferences() If Logging - If OpenFile(1,LogFile$,#PB_File_SharedRead | #PB_File_NoBuffering) + If OpenFile(1,LogFile$,#PB_File_Append) FileSeek(1,Lof(1)) WriteLog("LOGGING STARTED",Server) Else @@ -467,7 +467,7 @@ Procedure LoadSettings(reload) areas(loadareas)\bg=area$ PreferenceGroup("hidden") areas(loadareas)\hidden=ReadPreferenceInteger(Str(loadareas+1),0) - PreferenceGroup("password") + PreferenceGroup("pass") areas(loadareas)\pw=Encode(ReadPreferenceString(Str(loadareas+1),"")) Next ClosePreferences() @@ -571,20 +571,6 @@ Procedure LoadSettings(reload) EndProcedure -Procedure MSWait(*usagePointer.Client) - Define wttime,wtarea - wtarea=*usagePointer\area - wttime=Len(Trim(StringField(*usagePointer\last,7,"#")))*60 - wttime-20 - If wttime<10 - wttime=10 - ElseIf wttime>5000 - wttime=5000 - EndIf - Delay(wttime) - areas(wtarea)\wait=0 -EndProcedure - Procedure TrackWait(a) Define stoploop,k,cw cw=1000 @@ -739,11 +725,11 @@ Procedure SendDone(*usagePointer.Client) SendTarget(Str(*usagePointer\ClientID),"DONE#%",Server) EndProcedure -Procedure SwitchAreas(*usagePointer.Client,narea$) +Procedure SwitchAreas(*usagePointer.Client,narea$,apass$) Define sendd=0 Define ir Debug narea$ - For ir=0 To AreaNumber-1 + For ir=0 To AreaNumber areas(ir)\players=0 Debug areas(ir)\name If areas(ir)\name = narea$ @@ -789,23 +775,27 @@ Procedure SwitchAreas(*usagePointer.Client,narea$) Else If Val(narea$)<=AreaNumber-1 And Val(narea$)>=0 If Not areas(Val(narea$))\lock Or *usagePointer\perm>areas(Val(narea$))\mlock - If areas(*usagePointer\area)\lock=*usagePointer\ClientID - areas(*usagePointer\area)\lock=0 - areas(*usagePointer\area)\mlock=0 - EndIf - areas(*usagePointer\area)\players-1 - *usagePointer\area=Val(narea$) - areas(*usagePointer\area)\players+1 - If sendd=1 - *usagePointer\CID=-1 - SendDone(*usagePointer) - SendTarget(Str(*usagePointer\ClientID),"CT#$HOST#area "+Str(*usagePointer\area)+" selected#%",Server) + If areas(Val(narea$))\pw="" Or areas(Val(narea$))\pw=apass$ Or *usagePointer\perm + If areas(*usagePointer\area)\lock=*usagePointer\ClientID + areas(*usagePointer\area)\lock=0 + areas(*usagePointer\area)\mlock=0 + EndIf + areas(*usagePointer\area)\players-1 + *usagePointer\area=Val(narea$) + areas(*usagePointer\area)\players+1 + If sendd=1 + *usagePointer\CID=-1 + SendDone(*usagePointer) + SendTarget(Str(*usagePointer\ClientID),"CT#$HOST#area "+Str(*usagePointer\area)+" selected#%",Server) + Else + SendTarget(Str(*usagePointer\ClientID),"BN#"+areas(*usagePointer\area)\bg+"#%",Server) + SendTarget(Str(*usagePointer\ClientID),"CT#$HOST#area "+Str(*usagePointer\area)+" selected#%",Server) + EndIf + SendTarget(Str(*usagePointer\ClientID),"HP#1#"+Str(Areas(*usagePointer\area)\good)+"#%",Server) + SendTarget(Str(*usagePointer\ClientID),"HP#2#"+Str(Areas(*usagePointer\area)\evil)+"#%",Server) Else - SendTarget(Str(*usagePointer\ClientID),"BN#"+areas(*usagePointer\area)\bg+"#%",Server) - SendTarget(Str(*usagePointer\ClientID),"CT#$HOST#area "+Str(*usagePointer\area)+" selected#%",Server) + SendTarget(Str(*usagePointer\ClientID),"CT#$HOST#wrong password#%",Server) EndIf - SendTarget(Str(*usagePointer\ClientID),"HP#1#"+Str(Areas(*usagePointer\area)\good)+"#%",Server) - SendTarget(Str(*usagePointer\ClientID),"HP#2#"+Str(Areas(*usagePointer\area)\evil)+"#%",Server) Else SendTarget(Str(*usagePointer\ClientID),"CT#$HOST#area locked#%",Server) EndIf @@ -978,7 +968,7 @@ Procedure KickBan(kick$,param$,action,*usagePointer.Client) SendTarget(Str(Clients()\ClientID),"DONE#%",Server) EndIf Case #MOVE - SwitchAreas(Clients(),param$) + SwitchAreas(Clients(),param$,"") EndSelect UnlockMutex(ActionMutex) @@ -1185,7 +1175,7 @@ Procedure HandleAOCommand(ClientID) If Not (music=0 Or *usagePointer\CID <> Val(StringField(rawreceive$,4,"#"))) If Left(StringField(rawreceive$,3,"#"),1)=">" - SwitchAreas(*usagePointer,Mid(StringField(rawreceive$,3,"#"),2)) + SwitchAreas(*usagePointer,Mid(StringField(rawreceive$,3,"#"),2),"") Else If *usagePointer\ignoremc=0 @@ -1241,6 +1231,14 @@ Procedure HandleAOCommand(ClientID) EndSelect send=0 + Case "/cmds" + SendTarget(Str(ClientID),"CT#$HOST#help,cmds,login,pos,change,switch,online,area,evi,roll,pm,version,smokeweed#%",Server) + If *usagePointer\perm + SendTarget(Str(ClientID),"CT#$HOST#ip,bg,move,lock,(no)skip,play,hd,(un)ban,kick,disconnect,(un)mute,(un)ignore,(un)dj,(ung)gimp#%",Server) + EndIf + If *usagePointer\perm>1 + SendTarget(Str(ClientID),"CT#$HOST#public,send,sendall,reload,toggle,decryptor,snapshot,stop,loadreplay#%",Server) + EndIf Case "/ip" If *usagePointer\perm If CommandThreading @@ -1269,7 +1267,7 @@ Procedure HandleAOCommand(ClientID) Case "/change" nchar$=Mid(ctparam$,9) For nch=0 To CharacterNumber - If Characters(nch)\name=nchar$ + If Characters(nch)\name=nchar$ And Characters(nch)\pw="" If BlockTaken=1 LockMutex(ListMutex) PushMapPosition(Clients()) @@ -1345,7 +1343,8 @@ Procedure HandleAOCommand(ClientID) UnlockMutex(ListMutex) EndIf - narea$=StringField(ctparam$,2," ") + narea$=StringField(ctparam$,2," ") + apass$=StringField(ctparam$,3," ") If narea$="" arep$="CT#$HOST#Areas:" For ir=0 To AreaNumber-1 @@ -1366,7 +1365,7 @@ Procedure HandleAOCommand(ClientID) arep$+"#%" SendTarget(Str(ClientID),arep$,Server) Else - SwitchAreas(*usagePointer,narea$) + SwitchAreas(*usagePointer,narea$,apass$) EndIf Case "/loadreplay" @@ -2339,9 +2338,9 @@ CompilerElse CompilerEndIf End -; IDE Options = PureBasic 5.31 (Windows - x86) -; CursorPosition = 1148 -; FirstLine = 1145 +; IDE Options = PureBasic 5.11 (Linux - x64) +; CursorPosition = 1269 +; FirstLine = 1264 ; Folding = --- ; EnableXP ; EnableCompileCount = 0 diff --git a/server_shared.pb b/server_shared.pb index a0af48b..0c3d3ef 100644 --- a/server_shared.pb +++ b/server_shared.pb @@ -5,7 +5,7 @@ CompilerElse Global libext$=".dll" CompilerEndIf -XIncludeFile "shared_headers.pb" +XIncludeFile "../serverD/shared_headers.pb" Global NewList Plugins.Plugin() @@ -136,12 +136,28 @@ Procedure WriteLog(string$,*lclient.Client) PrintN(logstr$) CompilerElse If Quit=0 - AddGadgetItem(#listbox_event,-1,"["+GetCharacterName(*lclient)+"]["+GetAreaName(*lclient)+"]"+string$) + CompilerIf #NICE + AddGadgetItem(#listbox_event,-1,string$) + CompilerElse + AddGadgetItem(#listbox_event,-1,"["+GetCharacterName(*lclient)+"]["+GetAreaName(*lclient)+"]"+string$) + CompilerEndIf SetGadgetItemData(#listbox_event,CountGadgetItems(#listbox_event)-1,*lclient\ClientID) EndIf CompilerEndIf EndProcedure +Procedure MSWait(*usagePointer.Client,message$) + Define wttime + Debug areas(*usagePointer\area)\wait + Debug *usagePointer\area + wttime=Len(Trim(message$))*60 + If wttime>5000 + wttime=5000 + EndIf + Delay(wttime) + areas(*usagePointer\area)\wait=0 +EndProcedure + ;- Signal handling on linux CompilerIf #PB_Compiler_OS = #PB_OS_Linux #SIGINT = 2 @@ -310,7 +326,7 @@ CompilerIf #WEB ProcedureReturn Result EndProcedure - ;Used procedures + ;Used procedures Procedure.s DayInText(dd) Protected d$ Select DayOfWeek(dd) @@ -369,8 +385,8 @@ CompilerIf #WEB EndProcedure CompilerEndIf - - Procedure RemoveDisconnect(ClientID) + +Procedure RemoveDisconnect(ClientID) LockMutex(ListMutex) If FindMapElement(Clients(),Str(ClientID)) WriteLog("DISCONNECTING",Clients()) @@ -381,10 +397,18 @@ CompilerEndIf If Clients()\area>=0 areas(Clients()\area)\players-1 EndIf + CompilerIf #NICE + If OpenFile(7,"base/scene/"+scene$+"/PlayerData/"+Clients()\username+".txt") + For ir=0 To itemamount + WriteStringN(7,Str(Clients()\Inventory[ir])) + Next + CloseFile(7) + EndIf + CompilerEndIf If ListSize(Plugins()) ResetList(Plugins()) While NextElement(Plugins()) - pStat=#NONE + pStat=#NODATA CallFunctionFast(Plugins()\gcallback,#DISC) CallFunctionFast(Plugins()\rawfunction,Clients()) Wend @@ -449,8 +473,8 @@ Procedure SendTarget(user$,message$,*sender.Client) EndIf UnlockMutex(ListMutex) EndProcedure -; IDE Options = PureBasic 5.31 (Windows - x86) -; CursorPosition = 375 -; FirstLine = 353 +; IDE Options = PureBasic 5.11 (Linux - x64) +; CursorPosition = 410 +; FirstLine = 395 ; Folding = --- ; EnableXP \ No newline at end of file diff --git a/shared_headers.pb b/shared_headers.pb index 075cc3f..412c071 100644 --- a/shared_headers.pb +++ b/shared_headers.pb @@ -17,8 +17,16 @@ Structure Plugin active.b EndStructure +Enumeration ;ranks + #USER + #ANIM + #MOD + #ADMIN + #SERVER +EndEnumeration + Enumeration ;plugin status - #NONE + #NODATA #DATA #CONN #DISC @@ -26,7 +34,7 @@ Enumeration ;plugin status EndEnumeration Enumeration ;client type - #NONE + #NOTYPE #VANILLA #MASTER #VNO @@ -34,6 +42,16 @@ Enumeration ;client type #AOTWO EndEnumeration +Enumeration ;area status + #IDLE + #BUILDINGOPEN + #BUILDINGFULL + #CASINGOPEN + #CASINGFULL + #RECESS + #REPLAY +EndEnumeration + Structure area name.s bg.s @@ -45,9 +63,12 @@ Structure area players.w good.w evil.w + maxhp.w + replaymode.w track.s trackstart.l trackwait.i + status.w EndStructure Structure ACharacter @@ -88,7 +109,7 @@ Structure Client judget.b username.s skip.b - Inventory.i[20] + Inventory.i[50] EndStructure Structure TempBan @@ -114,6 +135,7 @@ Enumeration #SWITCH #MOVE EndEnumeration -; IDE Options = PureBasic 5.31 (Windows - x86) -; CursorPosition = 33 +; IDE Options = PureBasic 5.11 (Linux - x64) +; CursorPosition = 24 +; FirstLine = 4 ; EnableXP \ No newline at end of file