2002-09-23 05:26:26 +00:00
|
|
|
// HTML Template
|
2002-04-07 20:53:41 +00:00
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
// Code added to update when shutting down -avtotar (16/09/02)
|
|
|
|
|
// Slight modification on avotars fix (19/09/02)
|
2002-04-07 20:53:41 +00:00
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
#include "cHTMLSystem.h"
|
2002-10-25 04:57:23 +00:00
|
|
|
#include "cVersionClass.h"
|
|
|
|
|
|
|
|
|
|
extern cVersionClass CVC;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
cHTMLTemplate::cHTMLTemplate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cHTMLTemplate::~cHTMLTemplate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplate::Process
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Parses a template
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
2003-01-20 16:24:24 +00:00
|
|
|
//o--------------------------------------------------------------------------o
|
|
|
|
|
//| Function - void cHTMLTemplate::Process( void )
|
|
|
|
|
//| Date - 1/18/2003 4:43:17 AM
|
|
|
|
|
//| Developers - DarkStorm / EviLDeD
|
|
|
|
|
//| Organization -UOX3 DevTeam
|
|
|
|
|
//| Status - Currently under development
|
|
|
|
|
//o--------------------------------------------------------------------------o
|
|
|
|
|
//| Description -
|
|
|
|
|
//o--------------------------------------------------------------------------o
|
|
|
|
|
//| Modifications -
|
|
|
|
|
//o--------------------------------------------------------------------------o
|
2002-04-07 20:53:41 +00:00
|
|
|
void cHTMLTemplate::Process( void )
|
|
|
|
|
{
|
|
|
|
|
// Only read the Status Page if it's not already loaded
|
|
|
|
|
if( !Loaded )
|
|
|
|
|
LoadTemplate();
|
|
|
|
|
|
|
|
|
|
// Parse the Content...
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string ParsedContent = Content;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
//***************************************/
|
|
|
|
|
// Replacing Placeholders
|
|
|
|
|
//***************************************/
|
|
|
|
|
|
|
|
|
|
int Pos;
|
|
|
|
|
|
|
|
|
|
// Account-Count
|
|
|
|
|
char AccountCount[32];
|
2003-01-20 16:24:24 +00:00
|
|
|
sprintf(AccountCount, "%d", Accounts->size());
|
2002-04-07 20:53:41 +00:00
|
|
|
for( Pos = ParsedContent.find("%accounts"); Pos >= 0; Pos = ParsedContent.find( "%accounts" ) )
|
|
|
|
|
{
|
|
|
|
|
ParsedContent.replace( Pos, 9, AccountCount );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Version
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string Version = CVC.GetVersion();
|
2002-09-23 05:26:26 +00:00
|
|
|
Version += "(";
|
2002-10-25 04:57:23 +00:00
|
|
|
Version += CVC.GetBuild();
|
2002-09-23 05:26:26 +00:00
|
|
|
Version += ")";
|
Changed:
-Fixed a potentially very serious bugs with how containers were being set upon
loading the world
-Fixed possible re-adding of weight to containers and characters at load
-Fixed a bug causing equipped items that were not weapons to take damage in
combat
-Minor cleanups / warning fixes / Linux compatability issues (punt)
-Changed CItem::Get/SetLayer() to a UI08
-Fixed a bug in speech causing you to see your own text twice
-Fixed a nasty crash bug caused by changing an items layer
-Fixed a bug causing NPC's to always be the first attacker
-Armor DEF system overhauled to match OSI system
-Updated Hash Table Remove() calls to remove unrefrenced parameter "index"
-Changed cSocket::Get/SetDWord() to a UI32 to fix problems checking it against
INVALIDSERIAL and storing large serial numbers
-Changed cSocket::AddID() to a UI32 for the same reason as above
-Changed cSocket:::Get/SetWord() to a UI16 to fix possible problems storing ID's
-Fixed up calcStealDiff() to match new weight system
-Minor updates to CPStatsWindow to match the new Armor DEF system and Weight
system
-Fixed calls to getTileName() so the names container was set with MAX_NAME
-Fixed up getFieldDir() using direction typedefs
-Changed Get/SetMagic() to Get/SetMovable()
-Cleaned up some unrefrenced params
-Changed some int's to UI16's in books.cpp
-WorldSave Changes:
-XYZ and worldnum to Location=x,y,z,worldnum
-HiDamage and LoDamage into Damage=hidamage,lodamage
-Strength,st2,Dexterity,dx2,Intelligence,in2 changed to Strength=str,st2,
Intelligence=int,in2, Dexterity=dex,dx2
-DWord0-3 changed to DWords=0,1,2,3
-FX1,FY1,FX2,FY2,FZ1 changed to WanderArea=FX1,FY1,FX2,FY2,FZ1
-MoreX,MoreY,MoreZ changed to MoreXYZ=morex,morey,morez
-More,More2 changed to More=more,more2
-Type,Type2 changed to Type=type,type2
-Light,Rain,Heat,Cold,Snow,Lightning changed to
RaceDamage=Light,Rain,Heat,Cold,Snow,Lightning
-Fame,Karma,Kills changed to Reputation=fame,karma,kills
-Complete rewrite to the Weight system
-Weight is more permanent, removed need to recalc it constantly
-Packs now show the weight of themselves and all their contents
-Packs now have a weight limit (currently hardcapped to 400, should make it
based on type of container and possibly scriptable)
-All items use the weight value given to them in the scripts unless the entry
is 0 in which case they pull weight from the MUL's
-Better handling of overloaded for teleport / recall / walking
-Weight will max out at 65535 stones and can not go lower than 0 stones
-Items container is now set as a cBaseObject
-Fixed up itemsfx() and renamed it to itemSound(), now better handles Gold
sfx and where an item was dropped (ie in a pack or on the ground)
-Cleaned up goldsfx() and renamed it to goldSound()
-Many fixes to get/drop/wear/packItem functions
-Minor fixes/cleanups in movement.cpp
-Fixed a worldsave crash with tamed creatures
-Pressing 0 in console reloads items as well as everything else
-Made dagger usable for carve again
-Fixed a horse mounting distance check
-Noted (and in some cases fixed) unrefrenced variables throughout the code
-Converted inscribe.gmp to inscribe.dfn and used NewMakeMenu() in favor of the
old make menu system
-Updated GetMagic() == 3 calls to IsLockedDown() calls (as that is all it
should be used for)
-Fixed up all IsLockedDown() calls, resources that are LockedDown can NOT be
used, even by GM, until released
-Also note, items that should be usable if locked: Skill items (looms, training
dummies, etc, Recall runes)
-Moved the two functions from newbie.cpp to pcmanage.cpp and removed newbie.cpp
from the project
-Moved action() and impaction() to effects.cpp
-Moved isHuman() to npcs.cpp
-Where possible made functions that were part of classes private
-Made use of cCombat::getWeaponTyp
2003-03-13 09:05:58 +00:00
|
|
|
Version += " [";
|
|
|
|
|
Version += OS_STR;
|
|
|
|
|
Version += "]";
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
for( Pos = ParsedContent.find( "%version" ); Pos >= 0; Pos = ParsedContent.find( "%version" ) )
|
|
|
|
|
{
|
|
|
|
|
ParsedContent.replace( Pos, 8, Version );
|
|
|
|
|
}
|
|
|
|
|
// Character Count
|
|
|
|
|
char CharacterCount[32];
|
|
|
|
|
sprintf( CharacterCount, "%d", chars.Count() );
|
|
|
|
|
for( Pos = ParsedContent.find( "%charcount" ); Pos >= 0; Pos = ParsedContent.find( "%charcount" ) )
|
|
|
|
|
{
|
|
|
|
|
ParsedContent.replace( Pos, 10, CharacterCount );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Item Count
|
|
|
|
|
char ItemCount[32];
|
|
|
|
|
sprintf( ItemCount, "%d", items.Count() );
|
|
|
|
|
for( Pos = ParsedContent.find("%itemcount"); Pos >= 0; Pos = ParsedContent.find( "%itemcount" ) )
|
|
|
|
|
{
|
|
|
|
|
ParsedContent.replace( Pos, 10, ItemCount );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Connection Count (GMs, Counselors, Player)
|
|
|
|
|
UI32 gm = 0, cns = 0, ccount = 0;
|
|
|
|
|
|
|
|
|
|
// Get all Network Connections
|
|
|
|
|
Network->PushConn();
|
|
|
|
|
cSocket *tSock = NULL;
|
2002-09-29 04:49:07 +00:00
|
|
|
CChar *tChar = NULL;
|
2002-04-07 20:53:41 +00:00
|
|
|
for( tSock = Network->FirstSocket(); !Network->FinishedSockets(); tSock = Network->NextSocket() )
|
|
|
|
|
{
|
2002-09-29 04:49:07 +00:00
|
|
|
tChar = tSock->CurrcharObj();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if( tChar == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if( tChar->IsGM() )
|
|
|
|
|
gm++;
|
|
|
|
|
else if( tChar->IsCounselor() )
|
|
|
|
|
cns++;
|
|
|
|
|
else
|
|
|
|
|
ccount++;
|
|
|
|
|
}
|
|
|
|
|
catch(...)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
Network->PopConn();
|
|
|
|
|
|
|
|
|
|
// GMs
|
|
|
|
|
char GMCount[32];
|
|
|
|
|
sprintf( GMCount, "%d", gm );
|
|
|
|
|
for( Pos = ParsedContent.find( "%online_gms" ); Pos >= 0; Pos = ParsedContent.find( "%online_gms" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 11, GMCount ):ParsedContent.replace( Pos, 11, "0" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Counselor
|
|
|
|
|
char CounsiCount[32];
|
|
|
|
|
sprintf( CounsiCount, "%d", cns );
|
|
|
|
|
for( Pos = ParsedContent.find( "%online_couns" ); Pos >= 0; Pos = ParsedContent.find( "%online_couns" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 13, CounsiCount ):ParsedContent.replace( Pos, 13, "0");
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Player
|
|
|
|
|
char PlayerCount[32];
|
|
|
|
|
sprintf( PlayerCount, "%d", ccount );
|
|
|
|
|
for( Pos = ParsedContent.find( "%online_player" ); Pos >= 0; Pos = ParsedContent.find( "%online_player" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 14, PlayerCount ):ParsedContent.replace( Pos, 14, "0" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Total
|
|
|
|
|
char AllCount[32];
|
|
|
|
|
sprintf( AllCount, "%d", (ccount + gm + cns) );
|
|
|
|
|
for( Pos = ParsedContent.find( "%online_all" ); Pos >= 0; Pos = ParsedContent.find( "%online_all" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 11, AllCount ):ParsedContent.replace( Pos, 11, "0" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//RealTime( time_str )
|
|
|
|
|
char time_str[80];
|
|
|
|
|
RealTime( time_str );
|
|
|
|
|
for( Pos = ParsedContent.find( "%time" ); Pos >= 0; Pos = ParsedContent.find( "%time" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 5, time_str ):ParsedContent.replace( Pos, 5, "Down" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IP(s) + PORT(s)
|
|
|
|
|
UI16 ServerCount = (UI16)cwmWorldState->ServerData()->GetServerCount();
|
|
|
|
|
if( ServerCount > 0 )
|
|
|
|
|
{
|
|
|
|
|
for( UI16 i = 0; i < ServerCount; i++ )
|
|
|
|
|
{
|
|
|
|
|
physicalServer *mServ = cwmWorldState->ServerData()->GetServerEntry( i );
|
|
|
|
|
char ipToken[8]; // i think we'll never get higher than 2 digits, anyway...
|
|
|
|
|
sprintf( ipToken, "%%ip%i", i+1 );
|
|
|
|
|
|
|
|
|
|
if( mServ != NULL )
|
|
|
|
|
{
|
|
|
|
|
for( Pos = ParsedContent.find( ipToken ); Pos >= 0; Pos = ParsedContent.find( ipToken ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, strlen(ipToken), mServ->getIP().c_str()):ParsedContent.replace( Pos, strlen(ipToken), "Down" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char portToken[10]; // i think we'll never get higher than 2 digits, anyway...
|
|
|
|
|
sprintf( portToken, "%%port%i", i+1 );
|
|
|
|
|
|
|
|
|
|
if( mServ != NULL )
|
|
|
|
|
{
|
|
|
|
|
for( Pos = ParsedContent.find( portToken ); Pos >= 0; Pos = ParsedContent.find( portToken ) )
|
|
|
|
|
{
|
|
|
|
|
char myPort[5];
|
2002-09-23 05:26:26 +00:00
|
|
|
sprintf( myPort, "%i", mServ->getPort() );
|
|
|
|
|
(keeprun)?ParsedContent.replace( Pos, strlen( portToken ), myPort ):ParsedContent.replace( Pos, strlen( portToken ), "NA" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char serverToken[10]; // i think we'll never get higher than 2 digits, anyway...
|
|
|
|
|
sprintf( serverToken, "%%server%i", i+1 );
|
|
|
|
|
|
|
|
|
|
if( mServ != NULL )
|
|
|
|
|
{
|
|
|
|
|
for( Pos = ParsedContent.find( serverToken ); Pos >= 0; Pos = ParsedContent.find( serverToken ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, strlen( serverToken ), mServ->getName().c_str() ):ParsedContent.replace( Pos, strlen( serverToken ), "Down" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// PLAYERLIST
|
|
|
|
|
for( Pos = ParsedContent.find( "%playerlist%" ); Pos >= 0; Pos = ParsedContent.find( "%playerlist%" ) )
|
|
|
|
|
{
|
|
|
|
|
UI32 SecondPos = ParsedContent.find( "%playerlist%", Pos+1 );
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string myInline = ParsedContent.substr( Pos, SecondPos - Pos + 12 );
|
|
|
|
|
std::string PlayerList;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
Network->PushConn();
|
|
|
|
|
for( tSock = Network->FirstSocket(); !Network->FinishedSockets(); tSock = Network->NextSocket() )
|
|
|
|
|
{
|
2002-10-01 00:57:59 +00:00
|
|
|
try
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
2002-10-01 00:57:59 +00:00
|
|
|
if( tSock != NULL )
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
2002-10-01 00:57:59 +00:00
|
|
|
CChar *tChar = tSock->CurrcharObj();
|
|
|
|
|
if( tChar != NULL )
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string parsedInline = myInline;
|
2002-10-01 00:57:59 +00:00
|
|
|
parsedInline.replace( 0, 12, "" );
|
|
|
|
|
parsedInline.replace( parsedInline.length()-12, 12, "" );
|
|
|
|
|
|
|
|
|
|
// Tokens for the PlayerList
|
|
|
|
|
// %playername
|
|
|
|
|
// %playertitle
|
|
|
|
|
// %playerip
|
|
|
|
|
// %playeraccount
|
|
|
|
|
// %playerx
|
|
|
|
|
// %playery
|
|
|
|
|
// %playerz
|
|
|
|
|
// %playerrace
|
|
|
|
|
// %playerregion
|
|
|
|
|
|
|
|
|
|
// PlayerName
|
|
|
|
|
SI32 sPos;
|
|
|
|
|
for( sPos = parsedInline.find( "%playername" ); sPos >= 0; sPos = parsedInline.find( "%playername" ) )
|
|
|
|
|
{
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 11, tChar->GetName() ):parsedInline.replace( sPos, 11, "" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerTitle
|
|
|
|
|
for( sPos = parsedInline.find( "%playertitle" ); sPos >= 0; sPos = parsedInline.find( "%playertitle" ) )
|
|
|
|
|
{
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 12, tChar->GetTitle() ):parsedInline.replace( sPos, 12, "" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerIP
|
|
|
|
|
for( sPos = parsedInline.find( "%playerip" ); sPos >= 0; sPos = parsedInline.find( "%playerip" ) )
|
|
|
|
|
{
|
|
|
|
|
cSocket *mySock = calcSocketObjFromChar( tChar );
|
|
|
|
|
char ClientIP[32];
|
|
|
|
|
sprintf( ClientIP, "%i.%i.%i.%i", mySock->ClientIP4(), mySock->ClientIP3(), mySock->ClientIP3(), mySock->ClientIP1() );
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 9, ClientIP ):parsedInline.replace( sPos, 9, "" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerAccount
|
|
|
|
|
for( sPos = parsedInline.find( "%playeraccount" ); sPos >= 0; sPos = parsedInline.find( "%playeraccount" ) )
|
|
|
|
|
{
|
2003-01-20 16:24:24 +00:00
|
|
|
ACCOUNTSBLOCK toScan;
|
|
|
|
|
toScan=tChar->GetAccount();
|
|
|
|
|
if( toScan.wAccountIndex!=AB_INVALID_ID)
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 14, toScan.sUsername):parsedInline.replace( sPos, 14, "" );
|
2002-10-01 00:57:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerX
|
|
|
|
|
for( sPos = parsedInline.find( "%playerx" ); sPos >= 0; sPos = parsedInline.find( "%playerx" ) )
|
|
|
|
|
{
|
|
|
|
|
char myX[5];
|
|
|
|
|
sprintf( myX, "%i", tChar->GetX() );
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 8, myX ):parsedInline.replace( sPos, 8, "" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerY
|
|
|
|
|
for( sPos = parsedInline.find( "%playery" ); sPos >= 0; sPos = parsedInline.find( "%playery" ) )
|
|
|
|
|
{
|
|
|
|
|
char myY[5];
|
|
|
|
|
sprintf( myY, "%i", tChar->GetY() );
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 8, myY ):parsedInline.replace( sPos, 8, myY );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerZ
|
|
|
|
|
for( sPos = parsedInline.find( "%playerz" ); sPos >= 0; sPos = parsedInline.find( "%playerz" ) )
|
|
|
|
|
{
|
|
|
|
|
char myZ[3];
|
|
|
|
|
sprintf( myZ, "%i", tChar->GetZ() );
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 8, myZ ):parsedInline.replace( sPos, 8, "" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerRace -- needs testing
|
|
|
|
|
for( sPos = parsedInline.find( "%playerrace" ); sPos >= 0; sPos = parsedInline.find( "%playerrace" ) )
|
|
|
|
|
{
|
|
|
|
|
RACEID myRace = tChar->GetRace();
|
|
|
|
|
const char *rName = Races->Name( myRace );
|
|
|
|
|
UI32 raceLenName = strlen( rName );
|
|
|
|
|
char *myRaceName = new char[ raceLenName + 1 ];
|
|
|
|
|
strcpy( myRaceName, rName );
|
|
|
|
|
|
|
|
|
|
if( myRaceName != NULL )
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 11, myRaceName ):parsedInline.replace( sPos, 11, "");
|
|
|
|
|
delete [] myRaceName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PlayerRegion
|
|
|
|
|
for( sPos = parsedInline.find( "%playerregion" ); sPos >= 0; sPos = parsedInline.find( "%playerregion" ) )
|
|
|
|
|
{
|
|
|
|
|
(keeprun)?parsedInline.replace( sPos, 13, region[tChar->GetRegion()]->GetName() ):parsedInline.replace( sPos, 13, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PlayerList += parsedInline;
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-01 00:57:59 +00:00
|
|
|
catch(...)
|
|
|
|
|
{
|
|
|
|
|
Console << "| EXCEPTION: Invalid character/socket pointer found. Ignored." << myendl;
|
|
|
|
|
}
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
Network->PopConn();
|
|
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, myInline.length(), PlayerList ):ParsedContent.replace( Pos, myInline.length(), "");
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GuildCount
|
|
|
|
|
char GuildCount[32];
|
|
|
|
|
sprintf( GuildCount, "%d", GuildSys->NumGuilds() );
|
|
|
|
|
for( Pos = ParsedContent.find( "%guildcount" ); Pos >= 0; Pos = ParsedContent.find( "%guildcount" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 11, PlayerCount ):ParsedContent.replace( Pos, 11, "" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GUILDLIST
|
|
|
|
|
for( Pos = ParsedContent.find( "%guildlist%" ); Pos >= 0; Pos = ParsedContent.find( "%guildlist%" ) )
|
|
|
|
|
{
|
|
|
|
|
UI32 SecondPos = ParsedContent.find( "%guildlist%", Pos+1 );
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string myInline = ParsedContent.substr( Pos, SecondPos - Pos + 11 );
|
|
|
|
|
std::string GuildList;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
for( SI16 i = 0; i < (SI16)GuildSys->NumGuilds(); i++ )
|
|
|
|
|
{
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string parsedInline = myInline;
|
2002-04-07 20:53:41 +00:00
|
|
|
parsedInline.replace( 0, 11, "" );
|
|
|
|
|
parsedInline.replace( parsedInline.length()-11, 11, "" );
|
|
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
//parsedInline += "Yeah it worked";
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
// Tokens for the GuildList
|
|
|
|
|
// %guildid
|
|
|
|
|
// %guildname
|
|
|
|
|
|
|
|
|
|
// GuildID
|
|
|
|
|
SI32 sPos;
|
|
|
|
|
CGuild *myGuild = GuildSys->Guild( i );
|
|
|
|
|
|
|
|
|
|
char GuildID[6];
|
|
|
|
|
sprintf( GuildID, "%d", i );
|
|
|
|
|
for( sPos = parsedInline.find( "%guildid" ); sPos >= 0; sPos = parsedInline.find( "%guildid" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?parsedInline.replace( sPos, 8, GuildID ):parsedInline.replace( sPos, 8, "" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GuildName
|
|
|
|
|
for( sPos = parsedInline.find( "%guildname" ); sPos >= 0; sPos = parsedInline.find( "%guildname" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?parsedInline.replace( sPos, 10, myGuild->Name() ):parsedInline.replace( sPos, 10, "" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GuildList += parsedInline;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, myInline.length(), GuildList ):ParsedContent.replace( Pos, myInline.length(), "" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//NPCCount
|
|
|
|
|
char npcs[6];
|
|
|
|
|
UI32 npccount = 0;
|
|
|
|
|
|
|
|
|
|
if( npccount == 0 )
|
|
|
|
|
{
|
|
|
|
|
for( UI32 a = 0; a < chars.Count(); a++ )
|
|
|
|
|
{
|
|
|
|
|
if( chars[a].isFree() )
|
|
|
|
|
continue;
|
|
|
|
|
if( chars[a].IsNpc() )
|
|
|
|
|
npccount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(npcs, "%i", npccount);
|
|
|
|
|
|
|
|
|
|
for( Pos = ParsedContent.find( "%npcs" ); Pos >= 0; Pos = ParsedContent.find( "%npcs" ) )
|
|
|
|
|
{
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 5, npcs ):ParsedContent.replace( Pos, 5, "0" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Performance Dump
|
|
|
|
|
R64 eps = 0.00000000001;
|
|
|
|
|
for( Pos = ParsedContent.find( "%performance" ); Pos >= 0; Pos = ParsedContent.find( "%performance" ) )
|
|
|
|
|
{
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string performance;
|
|
|
|
|
std::ostringstream myStream( performance );
|
2002-09-23 05:26:26 +00:00
|
|
|
if(keeprun)
|
|
|
|
|
{
|
|
|
|
|
myStream << "Network code: " << (R32)((R32)networkTime/(R32)networkTimeCount) << "msec [" << networkTimeCount << " samples] <BR>";
|
|
|
|
|
myStream << "Timer code: " << (R32)((R32)timerTime/(R32)timerTimeCount) << "msec [" << timerTimeCount << " samples] <BR>";
|
|
|
|
|
myStream << "Auto code: " << (R32)((R32)autoTime/(R32)autoTimeCount) << "msec [" << autoTimeCount << " samples] <BR>";
|
|
|
|
|
myStream << "Loop Time: " << (R32)((R32)loopTime/(R32)loopTimeCount) << "msec [" << loopTimeCount << " samples] <BR>";
|
|
|
|
|
if( !( loopTime < eps || loopTimeCount < eps ) )
|
|
|
|
|
myStream << "Simulation Cycles: " << (1000.0*(1.0/(R32)((R32)loopTime/(R32)loopTimeCount))) << " per sec <BR>";
|
|
|
|
|
else
|
|
|
|
|
myStream << "Simulation Cycles: Greater than 10000 <BR> ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
myStream << "Network code: 0" << "<BR>";
|
|
|
|
|
myStream << "Timer code: 0" << "<BR>";
|
|
|
|
|
myStream << "Auto code: 0" << "<BR>";
|
|
|
|
|
myStream << "Loop Time: 0" << "<BR>";
|
|
|
|
|
myStream << "Simulation Cycles: 0<BR>";
|
|
|
|
|
}
|
2002-04-07 20:53:41 +00:00
|
|
|
ParsedContent.replace(Pos, 12, myStream.str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Uptime
|
|
|
|
|
for( Pos = ParsedContent.find( "%uptime" ); Pos >= 0; Pos = ParsedContent.find( "%uptime" ) )
|
|
|
|
|
{
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string uptime;
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
char sh[3], sm[3], ss[3];
|
2003-01-13 15:58:29 +00:00
|
|
|
std::ostringstream myStream( uptime );
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
UI32 total, hr, min, sec;
|
|
|
|
|
|
|
|
|
|
total = (uiCurrentTime - starttime ) / CLOCKS_PER_SEC;
|
|
|
|
|
hr = total / 3600;
|
|
|
|
|
if( hr < 10 && hr <= 60 )
|
|
|
|
|
sprintf( sh,"0%i",hr );
|
|
|
|
|
else
|
|
|
|
|
sprintf( sh, "%i", hr);
|
|
|
|
|
total -= hr * 3600;
|
|
|
|
|
min = total / 60;
|
|
|
|
|
if( min < 10 && min <= 60 )
|
|
|
|
|
sprintf( sm, "0%i", min );
|
|
|
|
|
else
|
|
|
|
|
sprintf( sm, "%i", min );
|
|
|
|
|
total -= min*60;
|
|
|
|
|
sec = total;
|
|
|
|
|
if( sec < 10 && sec <= 60 )
|
|
|
|
|
sprintf( ss, "0%i", sec );
|
|
|
|
|
else
|
|
|
|
|
sprintf( ss, "%i", sec );
|
|
|
|
|
myStream << sh << ":" << sm << ":" << ss;
|
|
|
|
|
|
|
|
|
|
ParsedContent.replace(Pos, 7, myStream.str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Simulation Cycles (whatever that may be...)
|
|
|
|
|
for( Pos = ParsedContent.find( "%simcycles" ); Pos >= 0; Pos = ParsedContent.find( "%simcycles" ) )
|
|
|
|
|
{
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string simcycles;
|
|
|
|
|
std::ostringstream myStream( simcycles );
|
2002-04-07 20:53:41 +00:00
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
if(keeprun)
|
|
|
|
|
{
|
|
|
|
|
if( !( loopTime < eps || loopTimeCount < eps ) )
|
|
|
|
|
myStream << "Simulation Cycles: " << (1000.0*(1.0/(R32)((R32)loopTime/(R32)loopTimeCount))) << " per sec <BR>";
|
|
|
|
|
else
|
|
|
|
|
myStream << "Simulation Cycles: Greater than 10000 <BR> ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
myStream << "Simulation Cycles: 0<BR> ";
|
|
|
|
|
}
|
2002-04-07 20:53:41 +00:00
|
|
|
ParsedContent.replace(Pos, 10, myStream.str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update Time in SECONDS
|
|
|
|
|
for( Pos = ParsedContent.find( "%updatetime" ); Pos >= 0; Pos = ParsedContent.find( "%updatetime" ) )
|
|
|
|
|
{
|
|
|
|
|
char strUpdateTimer[32]; // Could be a big value...
|
|
|
|
|
sprintf( strUpdateTimer, "%i", UpdateTimer );
|
|
|
|
|
|
2002-09-23 05:26:26 +00:00
|
|
|
(keeprun)?ParsedContent.replace( Pos, 11, strUpdateTimer ):ParsedContent.replace( Pos, 11, "0" );
|
2002-04-07 20:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//***************************************/
|
|
|
|
|
// End Replacing Placeholders
|
|
|
|
|
//***************************************/
|
|
|
|
|
|
|
|
|
|
// Print the Content out to the new file...
|
2003-01-13 15:58:29 +00:00
|
|
|
std::ofstream Output( OutputFile );
|
2002-04-07 20:53:41 +00:00
|
|
|
if( !Output.is_open() )
|
|
|
|
|
{
|
2003-03-04 13:53:59 +00:00
|
|
|
Console.Error( 1, " Couldn't open the template file %s for writing", OutputFile );
|
2002-04-07 20:53:41 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Output << ParsedContent;
|
|
|
|
|
|
|
|
|
|
Output.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplate::Poll
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Updates the page if needed
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplate::Poll( bool Force )
|
|
|
|
|
{
|
|
|
|
|
if( ( Force ) || ( ScheduledUpdate < uiCurrentTime ) )
|
|
|
|
|
{
|
|
|
|
|
Process();
|
|
|
|
|
ScheduledUpdate = BuildTimeValue( (R32)UpdateTimer );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplate::LoadTemplate
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Loads the Template into memory
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplate::LoadTemplate( void )
|
|
|
|
|
{
|
|
|
|
|
Content = "";
|
|
|
|
|
|
2003-01-13 15:58:29 +00:00
|
|
|
std::ifstream InputFile1( InputFile );
|
2002-04-07 20:53:41 +00:00
|
|
|
|
|
|
|
|
if( !InputFile1.is_open() )
|
|
|
|
|
{
|
|
|
|
|
Console.Error( 1, "Couldn't open HTML Template File %s", InputFile );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while( !InputFile1.eof() )
|
|
|
|
|
{
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string Line;
|
|
|
|
|
std::getline( InputFile1, Line );
|
2002-04-07 20:53:41 +00:00
|
|
|
Content += Line;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputFile1.close();
|
|
|
|
|
|
|
|
|
|
Loaded = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplate::UnloadTemplate
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Unloads the Template (i.e. for reloading)
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplate::UnloadTemplate( void )
|
|
|
|
|
{
|
|
|
|
|
Loaded = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplate::Load
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Loads the HTML Template from a ScriptSection
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplate::Load( ScriptSection *found )
|
|
|
|
|
{
|
|
|
|
|
Type = ETT_PERIODIC;
|
|
|
|
|
|
|
|
|
|
const char *tag = NULL;
|
|
|
|
|
const char *data = NULL;
|
|
|
|
|
|
|
|
|
|
for( tag = found->First(); !found->AtEnd(); tag = found->Next() )
|
|
|
|
|
{
|
|
|
|
|
data = found->GrabData();
|
|
|
|
|
|
|
|
|
|
if( !strcmp( tag, "UPDATE" ) )
|
|
|
|
|
{
|
|
|
|
|
UpdateTimer = makeNum( data );
|
|
|
|
|
}
|
|
|
|
|
else if( !strcmp( tag, "TYPE" ) )
|
|
|
|
|
{
|
|
|
|
|
if( !strcmp( data, "PERIODIC" ) )
|
|
|
|
|
Type = ETT_PERIODIC;
|
|
|
|
|
else if( !strcmp( data, "OFFLINE" ) )
|
|
|
|
|
Type = ETT_OFFLINE;
|
|
|
|
|
else if( !strcmp( data, "PLAYER" ) )
|
|
|
|
|
Type = ETT_PLAYER;
|
|
|
|
|
else if( !strcmp( data, "GUILD" ) )
|
|
|
|
|
Type = ETT_GUILD;
|
|
|
|
|
}
|
|
|
|
|
else if( !strcmp( tag, "INPUT" ) )
|
|
|
|
|
{
|
|
|
|
|
sprintf( InputFile, "%s", data );
|
|
|
|
|
}
|
|
|
|
|
else if( !strcmp( tag, "OUTPUT" ) )
|
|
|
|
|
{
|
|
|
|
|
sprintf( OutputFile, "%s", data );
|
|
|
|
|
}
|
|
|
|
|
else if( !strcmp( tag, "NAME" ) )
|
|
|
|
|
{
|
|
|
|
|
Name = data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScheduledUpdate = 0;
|
|
|
|
|
Loaded = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cHTMLTemplates::cHTMLTemplates()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cHTMLTemplates::~cHTMLTemplates()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::Load
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Loads the HTML Templates from the scripts
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplates::Load( void )
|
|
|
|
|
{
|
|
|
|
|
|
2003-03-04 13:53:59 +00:00
|
|
|
VECSCRIPTLIST *toWalk = FileLookup->GetFiles( html_def );
|
2002-04-07 20:53:41 +00:00
|
|
|
if( toWalk == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for( UI32 i = 0; i < toWalk->size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( (*toWalk)[i] != NULL )
|
|
|
|
|
{
|
|
|
|
|
Script *toCheck = (*toWalk)[i];
|
|
|
|
|
if( toWalk == NULL )
|
|
|
|
|
continue;
|
|
|
|
|
|
2003-03-04 13:53:59 +00:00
|
|
|
SI32 NumEntries = toCheck->NumEntries();
|
2002-04-07 20:53:41 +00:00
|
|
|
if( NumEntries == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for( ScriptSection *found = toCheck->FirstEntry(); found != NULL; found = toCheck->NextEntry() )
|
|
|
|
|
{
|
|
|
|
|
cHTMLTemplate *Template = new cHTMLTemplate();
|
|
|
|
|
Template->Load( found );
|
|
|
|
|
Templates.push_back( Template );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::Unload
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Unloads all Templates
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplates::Unload( void )
|
|
|
|
|
{
|
|
|
|
|
if( Templates.size() < 1 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for( UI32 i = 0; i < Templates.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
delete( Templates[ i ] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Templates.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::Poll
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Polls the templates for updates
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplates::Poll( UI08 TemplateType )
|
|
|
|
|
{
|
|
|
|
|
if( Templates.size() < 1 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for( UI32 i = 0; i < Templates.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( Templates[ i ]->GetTemplateType() != TemplateType )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if( Templates[ i ] != NULL )
|
|
|
|
|
Templates[ i ]->Poll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::TemplateInfoGump
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Shows an information gump about current templates
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
void cHTMLTemplates::TemplateInfoGump( cSocket *mySocket )
|
|
|
|
|
{
|
|
|
|
|
CGump InfoGump = CGump( false, false );
|
|
|
|
|
|
|
|
|
|
InfoGump.SetSerial( 1 ); // Serial for the HTML Status Callback
|
|
|
|
|
|
|
|
|
|
InfoGump.StartPage();
|
|
|
|
|
// Add an exit button
|
|
|
|
|
InfoGump.AddButton( 40, 300, (UI16)cwmWorldState->ServerData()->GetButtonCancel(), (UI16)( cwmWorldState->ServerData()->GetButtonCancel() + 1 ), 1, 0, 0 );
|
|
|
|
|
|
|
|
|
|
InfoGump.AddBackground( 0, 0, cwmWorldState->ServerData()->GetBackgroundPic(), 350, 350 );
|
|
|
|
|
|
|
|
|
|
// 10 Max Templates per page
|
|
|
|
|
UI32 Entries = 0; // Entries per page
|
|
|
|
|
UI32 CurrentPage = 0; // Page
|
|
|
|
|
|
|
|
|
|
for( UI32 i = 0; i < Templates.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( Entries == 0 )
|
|
|
|
|
{
|
|
|
|
|
// We should add a next button if we're not starting the first page
|
|
|
|
|
if( CurrentPage != 0 )
|
|
|
|
|
InfoGump.AddButton( 300, 250, (UI16)cwmWorldState->ServerData()->GetButtonRight(), (UI16)( cwmWorldState->ServerData()->GetButtonRight() + 1 ), 0, (UI16)( CurrentPage + 1 ), 0 );
|
|
|
|
|
|
|
|
|
|
CurrentPage = InfoGump.StartPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we're not on the first page add the "back" button
|
|
|
|
|
if( CurrentPage > 1 )
|
|
|
|
|
InfoGump.AddButton( 30, 250, (UI16)cwmWorldState->ServerData()->GetButtonLeft(), (UI16)( cwmWorldState->ServerData()->GetButtonLeft() + 1 ), 0, (UI16)( CurrentPage - 1 ), 0 );
|
|
|
|
|
|
|
|
|
|
Entries++;
|
|
|
|
|
|
|
|
|
|
// ~25 pixel per entry
|
|
|
|
|
char tmpName[256];
|
|
|
|
|
sprintf( tmpName, "%s (%i)", Templates[ i ]->GetName().c_str(), i );
|
|
|
|
|
|
|
|
|
|
InfoGump.AddText( 40, (UI16)( 40 + (Entries-1)*25 ), cwmWorldState->ServerData()->GetLeftTextColour(), tmpName );
|
|
|
|
|
|
|
|
|
|
if( Entries == 5 )
|
|
|
|
|
Entries = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfoGump.Send( mySocket );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::GetName
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Returns the name of the Template
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string cHTMLTemplate::GetName( void )
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
|
|
|
|
return Name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::GetOutput
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Gets the Output Filename
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string cHTMLTemplate::GetOutput( void )
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
|
|
|
|
return OutputFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::GetInput
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Gets the Input Filename
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
2003-01-13 15:58:29 +00:00
|
|
|
std::string cHTMLTemplate::GetInput( void )
|
2002-04-07 20:53:41 +00:00
|
|
|
{
|
|
|
|
|
return InputFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::TemplateInfoGump
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Gets the next scheduled Update time
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
UI32 cHTMLTemplate::GetScheduledUpdate( void )
|
|
|
|
|
{
|
|
|
|
|
return ScheduledUpdate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::GetUpdateTimer
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Gets the Update timer
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
UI32 cHTMLTemplate::GetUpdateTimer( void )
|
|
|
|
|
{
|
|
|
|
|
return UpdateTimer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplate::GetTemplateType
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Gets the Template Type
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
UI08 cHTMLTemplate::GetTemplateType( void )
|
|
|
|
|
{
|
|
|
|
|
return Type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Function - cHTMLTemplates::Refresh
|
|
|
|
|
//| Programmer - Dark-Storm
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
//| Purpose - Refreshs a single template
|
|
|
|
|
//o---------------------------------------------------------------------------o
|
|
|
|
|
bool cHTMLTemplates::Refresh( UI32 TemplateID )
|
|
|
|
|
{
|
|
|
|
|
if( Templates.size() < 1 )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if( TemplateID >= Templates.size() )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if( Templates[ TemplateID ] == NULL )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
Templates[ TemplateID ]->Poll( true );
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|