After Mogura\'s Guide to Client Customisation. Here\'s my guide to Client Modding.
!! You have to compile PlaneShift from source !!
!! Don\'t blame me if you screw up. You do it at your own risk !!
\" !>\" means that a line of code is inserted.
\"
If you like my mods and one of the developer finds a little free time, he might compile it and put it to the updater ;)
I think we should start now.
# Mod 1
If you\'d like the have a logfile of the ingame chat, do the following. This is very hand to dump the buddy list :)
File: planeshift\\src\\client\\aws\\pscommwindow.cpp
-----------------------------------------------
019 #include
!> #include
020
021 // CS INCLUDES
--
//Log of the SystemWindow
129 if (psContain(noCaseMsg,systemTriggers)){
130 colour = psengine->GetG2D()->FindRGB(255,255,0);
131 }
132
!> ofstream fp_out(\"chat.log\",ios::app);
!>
!> if (fp_out.is_open())
!> {
!> fp_out << buff;
!> fp_out.close();
!> }
133
134 systemTextBox->AddLine(buff, colour);
---
//Log of the ChatWindow
285 if ( buff[0] )
!> {
286 chatTextBox->AddLine(buff, colour);
287
!> ofstream fp_out(\"chat.log\",ios::app);
!>
!> if (fp_out.is_open())
!> {
!> fp_out << buff;
!> fp_out.close();
!> }
!> }
287 }
-----------------------------------------------
# Mod 2
With this little trick you can spice up the colors of your chat window.
File: planeshift\\src\\client\\aws\\pscommwindow.h
-----------------------------------------------
122 int triggerColour;
123
!> int sayColour;
!>
!> int meColour;
!>
!> int guildColour;
123 }
-----------------------------------------------
File: planeshift\\src\\client\\aws\\pscommwindow.cpp
-----------------------------------------------
206 if ( !havePlayerName )
207 {
208 csRef psengine = CS_QUERY_REGISTRY(objreg, iPSEngine);
209 noCasePlayerName.Replace(psengine->GetCelClient()->GetMainActor()->GetName());
210 noCasePlayerName.strlwr(); // Create lowercase string
211 chatTriggers.Push(noCasePlayerName);
212 havePlayerName = true;
213 playerColour = psengine->GetG2D()->FindRGB(255,35,35);
214 triggerColour = psengine->GetG2D()->FindRGB(204,255,0);
215
!> sayColour = psengine->GetG2D()->FindRGB(90,205,255);
!> meColour = psengine->GetG2D()->FindRGB(45,103,255);
!> guildColour = psengine->GetG2D()->FindRGB(60,200,0);
215 }
216
217 switch( msg.iChatType )
218 {
219 case CHAT_GROUP:
220 case CHAT_SHOUT:
221 {
222 cs_snprintf(buff,1024,\"%s shouts: %s\\n\",
223 (const char *)msg.sPerson,(const char *)msg.sText);
224 break;
225 }
226 case CHAT_GUILD:
227 case CHAT_AUCTION:
228 {
229 cs_snprintf(buff,1024,\"%s from %s: %s\\n\",pType,
230 (const char *)msg.sPerson,(const char *)msg.sText);
!> colour = guildColour;
221 break;
232 }
233
234 case CHAT_SAY:
235 {
236 cs_snprintf(buff,1024,\"%s says: %s\\n\",
237 (const char *)msg.sPerson,(const char *)msg.sText);
!> colour = sayColour;
238 break;
239 }
240
241 case CHAT_ME:
242 {
243 cs_snprintf(buff,1024,\"%s %s\\n\",
244 (const char *)msg.sPerson,(const char *)msg.sText);
!> colour = meColour;
245 break;
246 }
-----------------------------------------------
# Mod 3
Did you ever wonder what time it is? Let\'s add a ingame clock.
File: planeshift\\src\\client\\psengine.cpp
-----------------------------------------------
505 psUserCmdMessage cmdmsg(\"/online\");
506 netmanager->GetMsgHandler()->SendMessage(cmdmsg.msg);
507
!> modehandler->IsReady = true;
!>
508 return true;
-----------------------------------------------
hmm, I know it\'s not nice to mess with variables that arn\'t yours, but call my lazy :)
File: planeshift\\src\\client\\modehandler.h
-----------------------------------------------
112 void CheckNewSectorRain(iSector *newsector);
113
!> bool IsReady;
!>
113 };
-----------------------------------------------
File: planeshift\\src\\client\\modehandler.cpp
-----------------------------------------------
080 LoadLightingLevels();
081
!> IsReady = false;
081 }
---
373 printf(\"The time is now %d o\'clock.\\n\",msg.value);
373
!> if (IsReady)
!> {
!> char tmp[256];
!> sprintf(tmp, \"The time is now %d o\'clock.\",msg.value);
!> psSystemMessage sys(0,MSG_INFO,tmp);
!> msghandler->AddToLocalQueue(sys.msg);
!> }
!>
375 if (msg.value > lights.Length() )
-----------------------------------------------
# Mod 4
Aren\'t you tired of typing \"/tell personwithincrediblelongname hello\" ?
Just set /talkto and everything you type will be told to that person ;)
File: planeshift\\src\\client\\aws\\pscommwindow.h
-----------------------------------------------
122 int triggerColour;
123
!> char* pTalkPerson;
!>
!> bool useTalkto;
123 };
-----------------------------------------------
File: planeshift\\src\\client\\aws\\pscommwindow.cpp
-----------------------------------------------
065 systemTriggers.Push(\"server admin\");
066
!> pTalkPerson = \"\";
!> useTalkto = false;
!>
066 }
---
076 cmdsource->Subscribe(\"/say\",
077 \"Talk to the people in your immediate vicinity.\",
078 true,this);
!> cmdsource->Subscribe(\"/tlk\", \"Ignore that. You shouldn\'t see it anyway ;)\", false,this);
!> cmdsource->Subscribe(\"/talkto\",\"Set who to talk to. ;)\",CmdHandler::VISIBLE_TO_USER,this);
079 cmdsource->Subscribe(\"/shout\",\"Talk to people in your sector.\",CmdHandler::VISIBLE_TO_USER,this);
---
297 if ( buff[0] != \'/\' )
298 {
299 pPerson = \"\";
300 pText = buff;
300 *(pText-1) = 0;
300 chattype = CHAT_SAY;
300 }
!> else if ( !strncmp(buff+1, \"tlk \", 4 ))
!> {
!> if (useTalkto)
!> {
!> pPerson = pTalkPerson;
!> pText = buff + 5;
!> chattype = CHAT_TELL;
!> }
!> else
!> {
!> pPerson = \"\";
!> pText = buff + 5;
!> chattype = CHAT_SAY;
!> }
!> }
!> else if ( !strncmp(buff+1, \"talkto \", 7))
!> {
!> pTalkPerson = csStrNew(buff + 8);
!> useTalkto = true;
!>
!> delete[] buff;
!> return NULL;
!> }
!> else if ( !strncmp(buff+1, \"talkto\", 6))
!> {
!> useTalkto = false;
!> }
304 else if ( !strncmp(buff+1, \"say \", 4))
---
403 char* tmp = new char[strlen(Str)+7];
404 tmp[0] = \'/\';
!> tmp[1] = \'t\';
!> tmp[2] = \'l\';
!> tmp[3] = \'k\';
408 tmp[4] = \' \';
-----------------------------------------------
# Mod 5
Wanna disable the sound forever? Maybe because you\'re running winamp in the background? or WinTV?
File: planeshift\\src\\client\\sound\\pssoundmngr.cpp
-----------------------------------------------
076 SCF_CONSTRUCT_IBASE (iParent);
077
!> soundEnabled = false;
!> musicEnabled = false;
080
081 eventHandler = NULL;
-----------------------------------------------
# Mod 6
Are you tired of holding down the shift-key to run? Then let\'s make it stick. press L (or what ever you set in the keys.xml)
File: planeshift\\src\\common\\psbehave\\psbehave.cpp
-----------------------------------------------
243 autorun = false,
244 running = false,
!> lockrun = false,
245 hyperrun = false;
---
291 else if (!strcmp (msg_id+11, \"autorun1\")) // toggle switch not only while keydown
292 {
293 if (autorun == running)
294 {
295 autorun = (autorun)?false:true;
296 running = autorun;
297 }
298 }
!> else if (!strcmp (msg_id+11, \"lockrun1\")) // toggle switch not only while keydown
!> {
!> if (lockrun == running)
!> {
!> lockrun = (lockrun)?false:true;
!> running = lockrun;
!> }
!> }
299 else if (!strcmp (msg_id+11, \"run1\") && !autorun)
300 {
301 // If run is turned on by holding down a key
!> if (!running && !autorun && !lockrun)
303 running = true;
304 }
305 else if (!strcmp (msg_id+11, \"run0\") && !autorun)
306 {
!> if (!running && !autorun && !lockrun)
308 running = false;
309 }
-----------------------------------------------
File: planeshift\\keys.xml
-----------------------------------------------
016
!>
017
-----------------------------------------------
# Mod 7
Take a screenshot by simply pressing P (or what ever you set in the keys.xml)
File: planeshift\\src\\common\\psbehave\\psbehave.cpp
-----------------------------------------------
031 #include
032
!> #include
!> #include
!> #include
!> #include
!> #include \"psengine.h\"
033
034 #include
---
263 if (!pccam)
264 return false;
265
!> if (!strcmp (msg_id+11, \"screenshot1\"))
!> {
!> CaptureScreen();
!> return false;
!> }
266
267 if (!strcmp (msg_id+11, \"forward1\"))
---
598 mouselook_first_time = false;
599 }
600 }
601
!> void psBehaviourActor::CaptureScreen()
!> {
!>
!> char name[255];
!> sprintf(name, \"/this/screenshot/%d.jpg\", time(NULL));
!>
!> csRef G2D = CS_QUERY_REGISTRY(object_reg, iGraphics2D);
!> if (!G2D) return;
!>
!> csRef VFS = CS_QUERY_REGISTRY (object_reg, iVFS);
!> if (!VFS) return;
!>
!> csRef img (csPtr (G2D->ScreenShot ()));
!> if (!img) return;
!>
!> csRef imageio (CS_QUERY_REGISTRY (object_reg, iImageIO));
!> if (!imageio) return;
!>
!> csRef db (imageio->Save (img, \"image/jpg\", \"progressive\"));
!> if (!db) return;
!>
!> if (VFS->WriteFile(name, (const char*)db->GetData(), db->GetSize()))
!> {
!> csRef psengine = CS_QUERY_REGISTRY(object_reg, iPSEngine);
!> if (!psengine) return;
!> char tmp[255];
!> sprintf(tmp, \"Screenshot taken.\\n\");
!> psSystemMessage sys(0,MSG_INFO,tmp);
!> psengine->GetMsgHandler()->AddToLocalQueue(sys.msg);
!> }
!> }
602
603 psBehaveTest::psBehaveTest()
-----------------------------------------------
File: planeshift\\src\\common\\psbehave\\psbehave.cpp
-----------------------------------------------
127 csVector3 defFollowPos, defLookatPos, defFirstPos;
128
!> void CaptureScreen ();
129 };
-----------------------------------------------
File: planeshift\\keys.xml
-----------------------------------------------
016
!>
017
-----------------------------------------------