* Initial commit.

This commit is contained in:
Robert MacGregor 2026-02-27 21:56:30 -05:00
commit 66f9b4d8a9
23 changed files with 7105 additions and 0 deletions

168
base/scripts/TR2BonusHud.cs Executable file
View file

@ -0,0 +1,168 @@
new GuiControlProfile ("TR2BonusBigText")
{
fontType = "Verdana";
fontSize = 10;
fontColor = "255 255 51";
};
new GuiControlProfile ("TR2BonusHUGEText")
{
fontType = "Verdana Bold";
fontSize = 36;
fontColor = "255 255 51";
};
new GuiControlProfile ("TR2BonusPopupProfile")
{
bitmapbase = "gui/hud_new_window";
};
function createBonusHud()
{
if( isObject(TR2BonusHud) )
TR2BonusHud.delete();
new ShellFieldCtrl(TR2BonusHud) {
profile = "TR2BonusPopupProfile";
horizSizing = "center";
vertSizing = "bottom";
position = "0 0";
extent = "77 52";
minExtent = "70 48";
visible = "0";
helpTag = "0";
};
%profile[1] = "TR2BonusBigText";
%profile[2] = "TR2BonusHUGEText";
%sizing[1] = "bottom";
%sizing[2] = "top";
%pos[1] = 3;
%pos[2] = 17;
%size[1] = "77 22";
%size[2] = "77 50";
for( %i = 1; %i <= 2; %i++ )
{
$TR2BonusText[%i] = new GuiMLTextCtrl()
{
profile = %profile[%i];
horizSizing = "center";
vertSizing = %sizing[%i];
position = "0 " @ %pos[%i];
extent = %size[%i];
minExtent = "8 8";
visible = "1";
helpTag = "0";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "256";
};
TR2BonusHud.add($TR2BonusText[%i]);
}
$TR2BonusText[1].setText("<just:center><color:4682B4>JACKPOT");
}
function TR2BonusHud::dockToChat(%this)
{
%x = getWord(outerChatHud.extent, 2);
%y = getWord(outerChatHud.position, 1);
%this.setPosition(%x, %y);
}
function TR2BonusObject::flashText(%this, %count, %delay)
{
for( %i = 0; %i < %count; %i++ )
{
%isNewBonus = %i % 2;
%text = %isNewBonus ? $TR2Bonus::NewBonus : $TR2Bonus::OldBonus;
%extraDelay = %isNewBonus ? 0 : 250;
$TR2BonusText[2].schedule(%delay * %i + %extraDelay, "setText", %text);
}
$TR2BonusText[2].schedule(%delay * %count, "setText", $TR2Bonus::NewBonus);
}
function TR2BonusObject::doBonus(%this, %text, %color)
{
if( %color $= "" )
%color = "ffffff";
TR2BonusHud.setVisible(1);
$TR2Bonus::OldBonus = "<just:center><color:229922>" @ %this.currentBonus;
$TR2Bonus::NewBonus = "<just:center><color:" @ %color @ ">" @ %text;
// No flash if old score == new score
if( %text !$= %this.currentBonus || (%text $= %this.currentBonus && %color !$= %this.currentColor) )
%this.flashText(5, 500);
%this.currentBonus = %text;
%this.currentColor = %color;
}
function handleNewBonus(%msgType, %msgString, %text, %color)
{
if( $TR2Bonus::Gametype $= "TR2Game")
TR2BonusObject.doBonus(%text, %color);
}
function updateBonusTitle(%msgType, %msgString, %newTitle)
{
$TR2BonusText[1].setText(%newTitle);
}
function captureGameType(%msgType, %msgString, %game)
{
$TR2Bonus::Gametype = detag(%game);
if( detag(%game) $= "TR2Game" )
TR2BonusHud.setVisible(1);
else
TR2BonusHud.setVisible(0);
}
function setBonusHudState(%msgType, %msgString, %a, %b, %c)
{
if( $TR2Bonus::Gametype $= "TR2Game" )
TR2BonusHud.setVisible(1);
else
TR2BonusHud.setVisible(0);
}
createBonusHud();
PlayGui.add(TR2BonusHud);
$TR2BonusText[2].setText("<just:center><color:fffff0>0");
if( !isObject(TR2BonusObject) )
{
new ScriptObject(TR2BonusObject)
{
class = TR2BonusObject;
currentBonus = 0;
};
}
//package TR2BonusHud
//{
//function PlayGui::onWake(%this)
//{
// if( $TRBonus::Gametype $= "TR2Game" )
// TR2BonusHud.setVisible(1);
// else
// TR2BonusHud.setVisible(0);
//
// parent::onWake(%this);
//}
//
//function PlayGui::onSleep(%this)
//{
// TR2BonusHud.setVisible(0);
// parent::onSleep(%this);
//}
//};
//activatePackage(TR2BonusHud);
addMessageCallback('MsgTR2Bonus', handleNewBonus);
addMessageCallback('MsgTR2BonusTitle', updateBonusTitle);
addMessageCallback('MsgClientReady', captureGameType);
addMessageCallback('MsgMissionStart', setBonusHudState);
addMessageCallback('MsgMissionEnd', setBonusHudState);

97
base/scripts/autoexec/Strcmp.cs Executable file
View file

@ -0,0 +1,97 @@
// For T2 Linux: Patch for "broken" strcmp function.
// In Windows, that function delivers a direction and magnitude. In Linux, that function delivers a direction only.
// Patch by Electricutioner
package strCmpPatch
{
function strcmp(%a, %b)
{
%posA = 0;
if (%a !$= "")
%posA = strPos($Patch::Strcmp::ASCIIStream, %a) + 1;
%posB = 0;
if (%b !$= "")
%posB = strPos($Patch::Strcmp::ASCIIStream, %b) + 1;
return (%posA - %posB);
}
function generateASCIIStream()
{
for (%i = 1; %i < 255; %i++)
{
$Patch::Strcmp::ASCIIStream = $Patch::Strcmp::ASCIIStream @ collapseEscape("\\x" @ DecToHex(%i));
}
}
};
// Bone functions
function DecToBin(%dec)
{
%length = mCeil(mLog(%dec) / mLog(2));
%bin = "";
for (%i = 0; %i <= %length; %i++)
{
%test = mPow(2, %length - %i);
if (%dec >= %test)
{
%bin = %bin @ "1";
%dec -= %test;
}
else if (%i > 0)
%bin = %bin @ "0";
}
return %bin;
}
function BinToDec(%bin)
{
%dec = 0;
for (%i = 0; %i < strLen(%bin); %i++)
%dec += getSubStr(%bin, %i, 1) * mPow(2, strLen(%bin) - %i - 1);
return %dec;
}
function DecToHex(%dec)
{
%bin = DecToBin(%dec);
while (strLen(%bin) % 4 != 0)
%bin = "0" @ %bin;
for (%i = 0; %i < strLen(%bin); %i += 4)
{
%block = getSubStr(%bin, strLen(%bin) - %i - 4, 4);
%part = BinToDec(%block);
if (%part > 9)
{
switch (%part)
{
case 10:
%hex = "a" @ %hex;
case 11:
%hex = "b" @ %hex;
case 12:
%hex = "c" @ %hex;
case 13:
%hex = "d" @ %hex;
case 14:
%hex = "e" @ %hex;
case 15:
%hex = "f" @ %hex;
}
}
else
%hex = %part @ %hex;
}
//special purpose modification:
//pad out the hex output to lengh that is divisible by 2 and is not zero
while (strLen(%hex) == 0 || strLen(%hex) % 2 != 0)
%hex = "0" @ %hex;
return %hex;
}
if ($platform $= "Linux")
{
activatePackage(strCmpPatch);
generateASCIIStream();
}

View file

@ -0,0 +1,190 @@
$IRCClient::NickName = getField(wonGetAuthInfo(),0);
$IRCClient::NickName = strReplace($IRCClient::NickName," ","_");
$IRCClient::NickName = stripChars($IRCClient::NickName,"~@#$!+%/|^{&*()<>");
package t2csri_ircfix {
function GetIRCServerList(%arg1) {
return "IP:irc.arloria.net:6667";
}
function IRCClient::notify(%event)
{
if (isObject(ServerConnection) && getSubStr(%event,0,9) $= "IDIRC_ERR") return;
Parent::notify(%event);
}
function IRCClient::away(%params)
{
%me = $IRCClient::people.getObject(0);
%me.flags = %me.flags & ~$PERSON_AWAY;
if (strlen(%params))
{
if ($IRCClient::awaytimeout)
{
cancel($IRCClient::awaytimeout);
$IRCClient::awaytimeout = 0;
}
IRCClient::send("AWAY :" @ %params);
} else IRCClient::send("AWAY");
}
function IRCTCP::onDisconnect(%this)
{
$IRCClient::state = IDIRC_DISCONNECTED;
IRCClient::reset();
//IRCClient::notify(IDIRC_ERR_DROPPED);
parent::onDisconnect(%this);
}
function IRCClient::onVersion(%prefix,%params)
{
nextToken(%prefix,prefix,"!");
parent::onVersion(%prefix,%params);
}
function IRCTCP::onConnected(%this)
{
IRCClient::newMessage("","IRCClient: Established TCP/IP connection");
%me = $IRCClient::people.getObject(0);
%me.displayName = $IRCClient::NickName;
%me.setName(%me.displayName);
$IRCClient::tcp.schedule(500, "send", "NICK " @ $IRCClient::NickName @ "\r\n");
$IRCClient::tcp.schedule(500, "send", "USER " @ $IRCClient::NickName @ " x x :" @ $IRCClient::NickName @ "\r\n");
$IRCClient::tcp.schedule(2000, "send", "WHOIS " @ $IRCClient::NickName @ "\r\n");
$IRCClient::state = IDIRC_CONNECTING_WAITING;
}
function IRCClient::relogin()
{
if($IRCClient::state !$= IDIRC_CONNECTED)
IRCClient::connect();
%me = $IRCClient::people.getObject(0);
%me.displayName = $IRCClient::NickName;
%me.setName(%me.displayName);
%me.tagged = %me.displayName;
IRCClient::correctNick(%me);
IRCClient::newMessage("","IRCClient: Reauthentication starting");
$IRCClient::tcp.schedule(500, "send", "NICK " @ $IRCClient::NickName @ "\r\n");
$IRCClient::tcp.schedule(500, "send", "USER " @ $IRCClient::NickName @ " x x :" @ $IRCClient::NickName @ "\r\n");
$IRCClient::tcp.schedule(2000, "send", "WHOIS " @ $IRCClient::NickName @ "\r\n");
$IRCClient::state = IDIRC_CONNECTING_WAITING;
}
function IRCClient::dispatch(%prefix,%command,%params)
{
if (%command == 378) {IRCClient::onConFrom(%prefix,%params); return true;}
else parent::dispatch(%prefix,%command,%params);
}
function chatMemberPopup::add(%this,%name,%index) {
if (%index == 10 || %index == 11) return;
parent::add(%this,%name,%index);
}
function JoinChatDlg::onWake(%this)
{
if ($IRCClient::state $= IDIRC_CONNECTING_WAITING)
MessageBoxOK("CONNECTING...","Waiting for IRC server to respond, please wait.");
else
parent::onWake(%this);
}
function ChatTabView::onSelect(%this,%obj,%name)
{
parent::onSelect(%this,%obj,%name);
if (%name $= "welcome" && $IRCClient::channels.getObject(0) != %obj)
{
ChatPanel.setVisible(true);
WelcomePanel.setVisible(false);
ChatEditOptionsBtn.setVisible(false);
}
}
function IRCClient::onConFrom(%prefix,%params)
{
//IP acquisition test... may remove
//Krash-T2 Krash-T2 :is connecting from *@24.108.153.184 24.108.153.184
if ($IPv4::InetAddress $= "" && getWord(%params,0) $= $IRCClient::people.getObject(0).displayName) $IPv4::InetAddress = getWord(%params,getWordCount(%params)-1);
}
function IRCClient::onBadNick(%prefix,%params)
{
$IRCClient::NickName = getField(wonGetAuthInfo(),0) @ "-"@getRandom(0,99);
$IRCClient::NickName = strReplace($IRCClient::NickName," ","_");
IRCClient::relogin();
}
function IRCClient::onNick(%prefix,%params)
{
%person = IRCClient::findPerson2(%prefix,false);
if (%person) {
%person.displayName = %params;
%person.tagged = %params;
IRCClient::correctNick(%person);
ChatRoomMemberList_rebuild();
}
parent::onNick(%prefix,%params);
}
function IRCClient::newMessage(%channel,%message)
{
//quick UE fix, rewrite later
for (%i = 0;%i < getWordCount(%message);%i++) {
%word = getWord(%message,%i);
%first = strstr(%word,"<");
if (%first != -1) {
%word1 = getSubstr(%word,%first,strlen(%word));
%second = strstr(%word1,">");
if (%second == -1)
%message = stripChars(%message,"<>");
}
}
parent::newMessage(%channel,%message);
}
function IRCClient::setIdentity(%p,%ident)
{
parent::setIdentity(%p,%ident);
if(%p.getName() !$= %p.displayName) %p.setName(%p.displayName);
if(%p.untagged $= "")%p.untagged = %p.displayName;
}
function IRCClient::onMode(%prefix,%params)
{
parent::onMode(%prefix,%params);
ChatRoomMemberList_rebuild();
}
function IRCClient::onJoinServer(%mission,%server,%address,%mayprequire,%prequire)
{
if(strstr(strlwr($IRCClient::currentChannel.getName(),"tribes")) == -1) return;
parent::onJoinServer(%mission,%server,%address,%mayprequire,%prequire);
}
function IRCClient::onNameReply(%prefix,%params)
{
%params = strreplace(%params,"~","@");
%params = strreplace(%params,"&","@");
%params = strreplace(%params,"*","@");
%params = strreplace(%params,"%","@");
%params = strreplace(%params,"^","@");
parent::onNameReply(%prefix,%params);
}
function IRCClient::onPing(%prefix,%params)
{
//echo(%prefix SPC %params);
if (!$PingStarted) {
$IRCClient::tcp.schedule(1000, "send", "PONG " @ %params @ "\r\n");
$PingStarted = true;
} else $IRCClient::tcp.send("PONG " @ %params @ "\r\n");
}
function IRCClient::onPart(%prefix,%params)
{
%params = firstWord(%params);
parent::onPart(%prefix,%params);
ChatRoomMemberList_rebuild();
}
function IRCClient::notify(%event)
{
if (%event $= IDIRC_CHANNEL_LIST) {
JoinChatList.clear();
for (%i = 0; %i < $IRCClient::numChannels; %i++)
{
switch$ ( $IRCClient::channelNames[%i] ) {
case "#the_construct" or "#help" or "#welcome": %temp = 1;
default: %temp = 0;
}
if (strStr(strlwr($IRCClient::channelNames[%i]),"tribes") != -1) %temp = 1;
JoinChatList.addRow(%i, IRCClient::displayChannel( $IRCClient::channelNames[%i]) TAB $IRCClient::channelUsers[%i] TAB %temp );
JoinChatList.setRowStyle( %i, %temp > 0 );
}
JoinChatList.sort();
JoinChatName.onCharInput();
} else parent::notify(%event);
}
}; activatePackage(t2csri_ircfix);

View file

@ -0,0 +1,456 @@
// Tribes 2 Unofficial Authentication System
// http://www.tribesnext.com/
// Written by Krash
// Copyright 2008 by Krash and the Tribes 2 Community System Reengineering Intitiative
// Master listing / Queries.
if ($Host::TN::beat $= "") $Host::TN::beat = 3; //Time between beats in minutes.
if ($Host::TN::echo $= "") $Host::TN::echo = 1; //Enable the MS echoes.
function NewsGui::onWake( %this )
{
Canvas.pushDialog( LaunchToolbarDlg );
%this.pane = "News";
NM_TabView.setSelected( 1 );
}
function NM_TabView::onAdd( %this )
{
%this.addSet( 1, "gui/shll_horztabbuttonB", "5 5 5", "50 50 0", "5 5 5" );
%this.addTab(1,"NEWS",1);
%this.addTab(2,"FORUMS");
%this.setTabActive(2,0);
%this.addTab(3,"DOWNLOADS");
%this.setTabActive(3,0);
}
function NM_TabView::onSelect( %this, %id, %text )
{
NM_NewsPane.setVisible( %id == 1 );
//NM_ForumPane.setVisible( %id == 2 );
//NM_FilePane.setVisible( %id == 3 );
NM_TabFrame.setAltColor( %id == 1 );
%ctrl = "NM_" @ NewsGui.pane @ "Pane";
if ( isObject( %ctrl ) )
%ctrl.onDeactivate();
switch ( %id )
{
case 1: // News
NM_NewsPane.onActivate();
}
}
function NM_NewsPane::onActivate(%this) {
NewsGui.pane = "News";
}
function NM_NewsPane::onDeactivate(%this) {}
function NewsGui::setKey(%this) {}
function LaunchNews() {
if (!isObject(NewsGui)){
new GuiChunkedBitmapCtrl(NewsGui) {
profile = "GuiContentProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
variable = "$ShellBackground";
helpTag = "0";
useVariable = "1";
new ShellPaneCtrl() {
profile = "ShellPaneProfile";
horizSizing = "width";
vertSizing = "height";
position = "12 13";
extent = "620 423";
minExtent = "48 92";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
text = "TRIBESNEXT";
maxLength = "255";
noTitleBar = "0";
new ShellTabFrame(NM_TabFrame) {
profile = "ShellHorzTabFrameProfile";
horizSizing = "width";
vertSizing = "height";
position = "22 54";
extent = "576 351";
minExtent = "26 254";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
isVertical = "0";
useCloseButton = "0";
edgeInset = "0";
};
new ShellTabGroupCtrl(NM_TabView) {
profile = "TabGroupProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "30 25";
extent = "560 29";
minExtent = "38 29";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
glowOffset = "7";
tabSpacing = "2";
maxTabWidth = "150";
stretchToFit = "0";
};
new GuiControl(NM_NewsPane) {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "586 423";
minExtent = "8 8";
visible = "0";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
new ShellFieldCtrl(NewsPanel) {
profile = "ShellFieldProfile";
horizSizing = "width";
vertSizing = "height";
position = "31 92";
extent = "559 315";
minExtent = "16 18";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
new ShellScrollCtrl() {
profile = "NewScrollCtrlProfile";
horizSizing = "width";
vertSizing = "height";
position = "195 5";
extent = "360 303";
minExtent = "24 52";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
defaultLineHeight = "15";
childMargin = "0 2";
fieldBase = "gui/shll_field";
new GuiScrollContentCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "4 6";
extent = "336 291";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
new GuiMLTextCtrl(NewsText) {
profile = "NewTextEditProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "0 0";
extent = "362 2376";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
deniedSound = "InputDeniedSound";
};
};
};
new ShellScrollCtrl() {
profile = "NewScrollCtrlProfile";
horizSizing = "right";
vertSizing = "height";
position = "2 21";
extent = "195 287";
minExtent = "24 52";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
willFirstRespond = "1";
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
constantThumbHeight = "0";
defaultLineHeight = "15";
childMargin = "0 3";
fieldBase = "gui/shll_field";
new GuiScrollContentCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 7";
extent = "187 273";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
new ShellTextList(NewsHeadlines) {
profile = "ShellTextArrayProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "187 180";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
};
};
new GuiTextCtrl() {
profile = "ShellAltTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "12 6";
extent = "72 20";
minExtent = "8 8";
visible = "1";
hideCursor = "0";
bypassHideCursor = "0";
helpTag = "0";
text = "HEADLINES:";
longTextBuffer = "0";
maxLength = "255";
};
};
};
};
};
} else LaunchTabView.viewTab( "TRIBESNEXT", NewsGui, 0 );
}
//================================================================
function queryTNServers(%filter,%mod,%maptype,%minplayers,%maxplayers,%maxBots,%flags) {
%server = "master.tribesnext.com:80";
if (!isObject(TNbite))
%bite = new TCPObject(TNbite){};
else %bite = TNbite;
%bite.mode = 0;
%filename = "/list";
if (%filter)
%filename = "/list/"@%mod@"/"@%maptype@"/"@%minplayers@"/"@%maxplayers@"/"@%maxBots@"/"@%flags;
if (%filter $= "types") {
%filename = "/listtypes";
%bite.mode = 2;
} else queryFavoriteServers(); // Filtering fix, since the old master query isn't used.
%bite.get(%server, %filename);
}
function queryMasterGameTypes(){
clearGameTypes();
clearMissionTypes();
queryTNServers("types");
}
function queryMasterServer(%port, %flags, %rulesSet, %missionType, %minPlayers, %maxPlayers, %maxBots, %regionMask, %maxPing, %minCpu, %filtFlags, %buddy )
{
if (%flags !$= "") queryTNServers(1,%rulesSet,%missionType,%minplayers,%maxplayers,%maxBots,%filtFlags SPC %buddy);
else queryTNServers();
}
function TNbite::onLine(%this, %line) {
if (trim(%line) $= "") {
if (!%this.primed) %this.primed = true;
if (%this.mode != 5) return;
}
if (!%this.primed) return;
if (%this.mode == 1)
switch (%line) { // heartbeats
case 0: if ($Host::TN::echo) echo(" - Server added to list.");
case 1: if ($Host::TN::echo) { echo(" - Your server could not be contacted.");
echo(" - Check your IP / port configuration."); }
case 2: if ($Host::TN::echo) echo(" - Heartbeat confirmed.");
}
else if (%this.mode == 2) //filter retrieval
switch (firstWord(%line)) {
case 0: addGameType( restWords(%line) );
case 1: addMissionType( restWords(%line) );
}
else if (%this.mode == 5) // news retrieval
NewsGui.addLine(%line);
else // and finally, the server list...
if ( strpos(%line,":") != -1 && strstr(%line,".") != -1) {
querySingleServer( %line );
if (!%this.fnd) %this.fnd = true;
}
}
function TNbite::onConnectFailed(%this) {
if ($Host::TN::echo) echo("-- Could not connect to master server.");
}
function TNbite::onDNSFailed(%this) {
if ($Host::TN::echo) echo("-- Could not connect to DNS server.");
}
function TNbite::onDisconnect(%this) {
if (!%this.fnd && %this.mode == 0)
if (!GMJ_Browser.rowCount())
updateServerBrowserStatus( "No servers found.", 0 );
%this.delete();
}
function TNbite::get(%this, %server, %query)
{
%this.server = %server;
%this.query = %query;
%this.connect(%server);
}
function TNbite::onConnected(%this)
{
if (%this.query !$= "") {
%query = "GET " @ %this.query @ " HTTP/1.1\r\nHost: " @ %this.server @ "\r\nUser-Agent: Tribes 2\r\nConnection: close\r\n\r\n";
%this.send(%query);
}
}
function NewsGui::addLine( %this, %line ) {
%this = NewsText;
if (firstWord(%line) $= "<tag>") {
%line = setWord(%line,0,"<tag:"@%this.index++@">");
NewsHeadlines.addRow(%this.index,stripMLControlChars(%line));
}
if (%line $= "#EOF") {NewsText.upToDate = true; NewsHeadlines.setSelectedRow(0); return;}
%text = %this.getText();
%line = detag( %line );
%text = (%text $= "") ? %line : %text NL %line;
%this.setText( %text );
}
function NewsText::update( %this, %online ) {
%this.setText("");
NewsHeadlines.clear();
%this.index = -1;
if (%online) {
%server = "www.tribesnext.com:80";
if (!isObject(TNbite))
%bite = new TCPObject(TNbite){};
else %bite = TNbite;
%bite.mode = 5;
%filename = "/news";
%bite.get(%server, %filename);
}
}
function NewsHeadlines::onSelect( %this, %id, %text )
{
NewsText.scrollToTag( %id );
}
//================================================================
package t2csri_webs {
function CheckEmail( %bool ) {
if ($LaunchMode $= "Normal") return; // Do nothing for now
parent::CheckEmail( %bool );
}
function LaunchTabView::addLaunchTab( %this, %text, %gui, %makeInactive ) {
// disable currently unused tabs
if (%text $= "EMAIL" || %text $= "BROWSER") parent::addLaunchTab( %this, %text, %gui, 1 );
else parent::addLaunchTab( %this, %text, %gui, %makeInactive );
}
function LaunchToolbarMenu::add(%this,%id,%text) {
parent::add(%this,%id,%text);
if ($PlayingOnline && %text $= "BROWSER") {
LaunchToolbarMenu.add( 1, "TRAINING" );
LaunchToolbarMenu.add( 2, "TRIBESNEXT" );
}
}
function OpenLaunchTabs( %gotoWarriorSetup ) {
parent::OpenLaunchTabs( %gotoWarriorSetup );
if ($PlayingOnline && !TrainingGui.added) {
LaunchTabView.addLaunchTab( "TRAINING", TrainingGui );
LaunchTabView.addLaunchTab( "TRIBESNEXT", NewsGui );
LaunchNews();
NewsText.update(1);
TrainingGui.added = true;
}
}
function JoinSelectedGame() {
if (($IPv4::InetAddress $= "" || strstr($IPv4::InetAddress,".") == -1) && $PlayingOnline) {
messageBoxOK("IP ERROR","Your external address has not been set or is set incorrectly. \n\nAttempting to reset...");
ipv4_getInetAddress();
return;
} else parent::JoinSelectedGame();
}
function ClientReceivedDataBlock(%index, %total)
{
DB_LoadingProgress.setValue( %index / %total );
parent::ClientReceivedDataBlock(%index, %total);
}
function CreateServer(%mission, %missionType) {
parent::CreateServer(%mission, %missionType);
if (!isActivePackage(t2csri_server)) exec("t2csri/serverGlue.cs");
}
function StartHeartbeat() {
if ($playingOnline) {
if(isEventPending($TNBeat)) cancel($TNBeat);
%server = "master.tribesnext.com:80";
if ($Host::BindAddress !$= "")
%path = "/add/" @ $Host::Port @"/"@ $Host::BindAddress;
else %path = "/add/" @ $Host::Port;
if (!isObject(TNbite))
%bite = new TCPObject(TNbite){};
else %bite = TNbite;
%bite.mode = 1;
%bite.get(%server, %path);
if ($Host::TN::echo)
echo("-- Sent heartbeat to TN Master. ("@%server@")");
$TNBeat = schedule($Host::TN::beat*60000,0,"StartHeartBeat");
} else parent::StartHeartbeat();
}
function StopHeartbeat() {
if ($playingOnline) {
if(isEventPending($TNBeat)) cancel($TNBeat);
} else parent::StartHeartbeat();
}
//================================================================
};
if (!isActivePackage(t2csri_webs)) activatepackage (t2csri_webs);

View file

@ -0,0 +1,8 @@
// Tribes 2 Unofficial Authentication System
// http://www.tribesnext.com/
// Written by Electricutioner/Thyth
// Copyright 2008 by Electricutioner/Thyth and the Tribes 2 Community System Reengineering Intitiative
// Version 1.0 initialization and glue file (server side)
schedule(0, 0, exec, "t2csri/serverglue.cs");