Skip to content

Commit

Permalink
fixed ooc from server
Browse files Browse the repository at this point in the history
  • Loading branch information
stonedDiscord committed Jul 19, 2016
1 parent afff764 commit 6898d1c
Show file tree
Hide file tree
Showing 12 changed files with 745 additions and 536 deletions.
24 changes: 12 additions & 12 deletions AOprivateServer.pbp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<section name="data">
<explorer view="" pattern="8"/>
<log show="1"/>
<lastopen date="2016-07-04 12:18" user="Sven" host="SPC"/>
<lastopen date="2016-07-19 20:46" user="Sven" host="SPC"/>
</section>
<section name="files">
<file name="Common.pb">
Expand All @@ -16,15 +16,15 @@
</file>
<file name="gui.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="73be5d372ae83eed9d3ae4eb41b55ec1"/>
<fingerprint md5="7fc8c69b6900b38909c0d2bb2c8a90d1"/>
</file>
<file name="main.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="57d45c349cd0e31b3d9d0ed338e29b03"/>
<fingerprint md5="64332cf2ecc9b02980736266b7cec10f"/>
</file>
<file name="server_shared.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
<fingerprint md5="536f6a33aae444f829d7ea1d9c6de490"/>
<fingerprint md5="257d91b5d8ebd89e2ee7795533ae0dea"/>
</file>
<file name="shared_headers.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" panelstate="+"/>
Expand All @@ -34,15 +34,15 @@
<section name="targets">
<target name="serverD" enabled="1" default="1">
<inputfile value="main.pb"/>
<outputfile value="build\serverD.exe"/>
<executable value="build\serverD.exe"/>
<outputfile value="serverD.exe"/>
<executable value="serverD.exe"/>
<options thread="1" xpskin="1" debug="1"/>
<purifier enable="1" granularity="1,1,1,1"/>
<icon enable="1">sD.ico</icon>
<format exe="default" cpu="2"/>
<debugger custom="1" type="ide"/>
<compilecount enable="1" value="1196"/>
<buildcount enable="1" value="134"/>
<compilecount enable="1" value="1201"/>
<buildcount enable="1" value="135"/>
<versioninfo enable="1">
<field0 value="2,%COMPILECOUNT,%BUILDCOUNT,0"/>
<field1 value="2.%COMPILECOUNT.%BUILDCOUNT,0"/>
Expand All @@ -69,14 +69,14 @@
</target>
<target name="serverDco" enabled="1" default="0">
<inputfile value="main.pb"/>
<outputfile value="build\serverDco.exe"/>
<executable value="build\serverDco.exe"/>
<outputfile value="serverDco.exe"/>
<executable value="serverDco.exe"/>
<options thread="1" debug="1"/>
<icon enable="0">owner.ico</icon>
<format exe="console" cpu="0"/>
<debugger custom="1" type="ide"/>
<compilecount enable="1" value="1196"/>
<buildcount enable="1" value="134"/>
<compilecount enable="1" value="1201"/>
<buildcount enable="1" value="135"/>
<versioninfo enable="1">
<field0 value="2,%COMPILECOUNT,%BUILDCOUNT,0"/>
<field1 value="2,%COMPILECOUNT,%BUILDCOUNT,0"/>
Expand Down
1,046 changes: 633 additions & 413 deletions LICENSE.md

Large diffs are not rendered by default.

Binary file removed build/serverDco.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions gui.pb
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ DataSection
hacker:
IncludeBinary "hacker.png"
dend:
IncludeBinary "serverd.png"
IncludeBinary "splash.png"
bannerend:
EndDataSection
; IDE Options = PureBasic 5.31 (Windows - x86)
; CursorPosition = 27
; FirstLine = 26
; CursorPosition = 242
; FirstLine = 196
; Folding = -
; EnableXP
File renamed without changes.
110 changes: 10 additions & 100 deletions main.pb
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ Procedure LoadSettings(reload)
EndIf
ReDim Characters.ACharacter(characternumber)
ReDim ReadyChar(characternumber/10)
Debug "rcharpages"
Debug characternumber/10
For loadchars=0 To characternumber
Characters(loadchars)\name=Encode(ReadPreferenceString(Str(loadchars),"zettaslow"))
Next
Expand All @@ -352,7 +354,7 @@ Procedure LoadSettings(reload)
ready$="CI#"
charpage=0
Debug CharacterNumber
For loadcharsettings=0 To characternumber
For loadcharsettings=0 To CharacterNumber
OpenPreferences("base/scene/"+scene$+"/char"+Str(loadcharsettings)+".ini")
PreferenceGroup("desc")
Characters(loadcharsettings)\desc=Encode(ReadPreferenceString("text","No description"))
Expand All @@ -368,21 +370,17 @@ Procedure LoadSettings(reload)
ClosePreferences()
ready$ = ready$ + Str(loadcharsettings)+"#"+Characters(loadcharsettings)\name+"&"+Characters(loadcharsettings)\desc+"&"+Str(Characters(loadcharsettings)\evinumber)+"&"+Characters(loadcharsettings)\evidence+"&"+Characters(loadcharsettings)\pw+"&0&#"

If loadcharsettings%10 = 9
If loadcharsettings%10 = 9 Or loadcharsettings=CharacterNumber
ready$=ready$+"#%"
ReadyChar(charpage)=ready$
Debug ready$
Debug charpage
Debug loadcharsettings
charpage+1
ready$="CI#"
EndIf
Next

If Right(ready$,2)<>"#%"
ready$=ready$+"#%"
ReadyChar(charpage)=ready$
EndIf

If ReadFile(2, "base/musiclist.txt")
tracks=0
ltracks=0
Expand Down Expand Up @@ -573,71 +571,6 @@ Procedure LoadSettings(reload)

EndProcedure

Procedure SendTarget(user$,message$,*sender.Client)
Define everybody,i,omessage$,sresult
omessage$=message$

If user$="*" Or user$="everybody"
everybody=1
Else
everybody=0
EndIf

For i=0 To characternumber
If Characters(i)\name=user$
user$=Str(i)
Break
EndIf
Next

LockMutex(ListMutex)

If FindMapElement(Clients(),user$)

If Clients()\type=#WEBSOCKET
CompilerIf #WEB
Websocket_SendTextFrame(Clients()\ClientID,message$)
CompilerEndIf
Else
Debug message$
sresult=SendNetworkString(Clients()\ClientID,message$)
If sresult=-1
WriteLog("CLIENT DIED DIRECTLY",Clients())
If areas(Clients()\area)\lock=Clients()\ClientID
areas(Clients()\area)\lock=0
areas(Clients()\area)\mlock=0
EndIf
DeleteMapElement(Clients(),Str(Clients()\ClientID))
rf=1
EndIf
EndIf
Else
ResetMap(Clients())
While NextMapElement(Clients())
If user$=Str(Clients()\CID) Or user$=Clients()\HD Or user$=Clients()\IP Or user$=Clients()\username Or user$="Area"+Str(Clients()\area) Or (everybody And (*sender\area=Clients()\area Or *sender\area=-1)) And Clients()\type=*sender\type
If Clients()\type=#WEBSOCKET
CompilerIf #WEB
Websocket_SendTextFrame(Clients()\ClientID,message$)
CompilerEndIf
Else
Debug message$
sresult=SendNetworkString(Clients()\ClientID,message$)
If sresult=-1
WriteLog("CLIENT DIED",Clients())
If areas(Clients()\area)\lock=Clients()\ClientID
areas(Clients()\area)\lock=0
areas(Clients()\area)\mlock=0
EndIf
DeleteMapElement(Clients(),Str(Clients()\ClientID))
rf=1
EndIf
EndIf
EndIf
Wend
EndIf
UnlockMutex(ListMutex)
EndProcedure

Procedure MSWait(*usagePointer.Client)
Define wttime,wtarea
wtarea=*usagePointer\area
Expand Down Expand Up @@ -772,31 +705,6 @@ ProcedureDLL MasterAdvert(Port)
msthread=0
EndProcedure

Procedure RemoveDisconnect(ClientID)
LockMutex(ListMutex)
If FindMapElement(Clients(),Str(ClientID))
WriteLog("DISCONNECTING",Clients())
If areas(Clients()\area)\lock=ClientID
areas(Clients()\area)\lock=0
areas(Clients()\area)\mlock=0
EndIf
If Clients()\area>=0
areas(Clients()\area)\players-1
EndIf
If ListSize(Plugins())
ResetList(Plugins())
While NextElement(Plugins())
pStat=#NONE
CallFunctionFast(Plugins()\gcallback,#DISC)
CallFunctionFast(Plugins()\rawfunction,Clients())
Wend
EndIf
DeleteMapElement(Clients(),Str(ClientID))
rf=1
EndIf
UnlockMutex(ListMutex)
EndProcedure

Procedure SendDone(*usagePointer.Client)
Define send$
Define sentchar
Expand Down Expand Up @@ -1164,7 +1072,7 @@ Procedure HandleAOCommand(ClientID)
Case "MS"
msreplayfix:
If *usagePointer\perm=3
Sendtarget("*","MS#"+Mid(rawreceive$,coff),*usagePointer)
Sendtarget("Area"+Str(*usagePointer\area),"MS#"+Mid(rawreceive$,coff),*usagePointer)
ElseIf ReplayMode=0
WriteLog("[CHAT]"+StringField(rawreceive$,7,"#"),*usagePointer)
If *usagePointer\CID>=0 And *usagePointer\CID<=CharacterNumber
Expand Down Expand Up @@ -1209,6 +1117,8 @@ Procedure HandleAOCommand(ClientID)
msreply$=msreply$+"2#"
Case 5
msreply$=msreply$+"5#"
Case 6
msreply$=msreply$+"6#"
Default
*usagePointer\hack=1
EndSelect
Expand Down Expand Up @@ -2430,8 +2340,8 @@ CompilerEndIf

End
; IDE Options = PureBasic 5.31 (Windows - x86)
; CursorPosition = 2430
; FirstLine = 2382
; CursorPosition = 1148
; FirstLine = 1145
; Folding = ---
; EnableXP
; EnableCompileCount = 0
Expand Down
Binary file renamed build/serverD.exe → serverD.exe
Binary file not shown.
Binary file added serverDco.exe
Binary file not shown.
87 changes: 83 additions & 4 deletions server_shared.pb
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ CompilerIf #WEB
ProcedureReturn Result

EndProcedure

;Used procedures
;Used procedures
Procedure.s DayInText(dd)
Protected d$
Select DayOfWeek(dd)
Expand Down Expand Up @@ -370,8 +369,88 @@ CompilerIf #WEB
EndProcedure

CompilerEndIf

Procedure RemoveDisconnect(ClientID)
LockMutex(ListMutex)
If FindMapElement(Clients(),Str(ClientID))
WriteLog("DISCONNECTING",Clients())
If areas(Clients()\area)\lock=ClientID
areas(Clients()\area)\lock=0
areas(Clients()\area)\mlock=0
EndIf
If Clients()\area>=0
areas(Clients()\area)\players-1
EndIf
If ListSize(Plugins())
ResetList(Plugins())
While NextElement(Plugins())
pStat=#NONE
CallFunctionFast(Plugins()\gcallback,#DISC)
CallFunctionFast(Plugins()\rawfunction,Clients())
Wend
EndIf
DeleteMapElement(Clients(),Str(ClientID))
rf=1
EndIf
UnlockMutex(ListMutex)
EndProcedure

Procedure SendTarget(user$,message$,*sender.Client)
Define everybody,i,omessage$,sresult
omessage$=message$

If user$="*" Or user$="everybody"
everybody=1
Else
everybody=0
EndIf

For i=0 To characternumber
If Characters(i)\name=user$
user$=Str(i)
Break
EndIf
Next

LockMutex(ListMutex)

If FindMapElement(Clients(),user$)

If Clients()\type=#WEBSOCKET
CompilerIf #WEB
Websocket_SendTextFrame(Clients()\ClientID,message$)
CompilerEndIf
Else
Debug message$
sresult=SendNetworkString(Clients()\ClientID,message$)
If sresult=-1
WriteLog("CLIENT DIED DIRECTLY",Clients())
RemoveDisconnect(Clients()\ClientID)
EndIf
EndIf
Else
ResetMap(Clients())
While NextMapElement(Clients())
If user$=Str(Clients()\CID) Or user$=Clients()\HD Or user$=Clients()\IP Or user$=Clients()\username Or user$="Area"+Str(Clients()\area) Or everybody
If Clients()\type=#WEBSOCKET
CompilerIf #WEB
Websocket_SendTextFrame(Clients()\ClientID,message$)
CompilerEndIf
Else
Debug message$
sresult=SendNetworkString(Clients()\ClientID,message$)
If sresult=-1
WriteLog("CLIENT DIED",Clients())
RemoveDisconnect(Clients()\ClientID)
EndIf
EndIf
EndIf
Wend
EndIf
UnlockMutex(ListMutex)
EndProcedure
; IDE Options = PureBasic 5.31 (Windows - x86)
; CursorPosition = 138
; FirstLine = 114
; CursorPosition = 375
; FirstLine = 353
; Folding = ---
; EnableXP
4 changes: 0 additions & 4 deletions serverd.txt

This file was deleted.

File renamed without changes
4 changes: 4 additions & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Version]
Compile=1200
Build=134
0.0.0.0

13 comments on commit 6898d1c

@Catalylia
Copy link

@Catalylia Catalylia commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peers at code in dismay I need to relearn this shiiiii....I need to be able to understand disssss

Just to ask, this ooc rehaul does NOT make the entire OOC chat unified for all areas of a server right? People can still speak in OOC from different areas and have it only show up in that area? Cause that is one thing I was afraid about when I posted the issue about announcements. I was hoping for a special command, not unified for everyone since some servers have a unified OOC for everyone and it's kinda hectic. >..<

@stonedDiscord
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no i made the ooc server-wide across all areas
it's not related to the IC chat so why would i seperate it by area

@Catalylia
Copy link

@Catalylia Catalylia commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well for one thing, sometimes you want to post a link or roll a dice in one area and not see it In all areas. Also, sometimes mods will change areas and login or do commands in that empty area so if they derp their derp, like the server mod pass for example, does not get seen by everyone. Then there are times when there is a case in one area and people are typing spoilers in the OOC and you don't want the entire server to be spoiled on said case.

Generally speaking it's very messy to have everybody see the OOC from every area, especially with more than one area's OOC being used at one time. Case docs get spoiled, convos get mixed up even if you try to make an identifier for the area, general spam in OOC gets worse and it could be a security thing with logins.

@Catalylia
Copy link

@Catalylia Catalylia commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore if someone derps private messaging the entire server will see it instead of a single area. Unifying the OOC adds a WHOLE lot of issues.

@oldmud0
Copy link

@oldmud0 oldmud0 commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, does serverD.exe now have CLI support now? Or is the GUI now mandatory?

@Catalylia
Copy link

@Catalylia Catalylia commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seriously afraid of unified OOC, It's a blooming mess. >..< XD It scares me more than removal of regular members locking rooms, which I can live with in the end even though I hear grumbling about it. But this is kinda scary. o.o

@oldmud0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buy PureBasic and hack it yourself, then.

@Catalylia
Copy link

@Catalylia Catalylia commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if I had anything but a leaky cauldron of a brain, maybe I would. As it is, last time I seriously coded was shoots self for repetitive story about x years ago But I seriously do not see how unifying the OOC is a good idea for anyone. Allowing a host or a mod to do it with a command, sure, but unifying the whole thing? >..<

I'm sorry if I seem whiny or opinionated or annoying.

@oldmud0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never used rooms anyway.

@Catalylia
Copy link

@Catalylia Catalylia commented on 6898d1c Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp. I've got like....21 areas. >...> Sooooo. Yeah. >..< Areas are like an invaluable thing in my serv. >.<

@stonedDiscord
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serverDco.exe has always been CLI and will continue to be

@oldmud0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I thought you removed serverDco.exe. Must have misread the commit summary.

@Catalylia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

His commit said it did not build so I guessed it was still behind...but ehh.

Please sign in to comment.