[S] PHP Server Files (Nexon Client, Outbox, much more)
Hello my friends.
I'm working on my PHP Server in WarRock and i wanted to sell it (or parts of it) to everybody who wants to learn off it. I wanted to get some more private money so here we go..
I'll add one or two source codes in this post to let you see what i did until now (everythings object orientated)
server.php (main file, only tcp)
Code:
<?php
echo "\n _______________________________";
echo "\n / \ ";
echo "\n | Rexiles WarRock Server |";
echo "\n | - - - |";
echo "\n | (c) 2012 Felix F. (Supreme) |";
echo "\n | |";
echo "\n \_______________________________/";
echo "\n\n";
// Master includes
include("functions.php");
include("data.php");
WriteLine("Server", "L.U.C.S. (Version): ".$arrPatch[0].";".$arrPatch[1].";".$arrPatch[2].";".$arrPatch[3]);
// Launcher.Updater.Client.Sub
// Needed Classes
// ~ Network
include("network/tcpserver.php");
include("network/clienthandler.php");
include("network/packet.php");
include("network/crypter.php");
include("network/packets.php");
// ~ Data
include("data/mysql.php");
include("data/user.php");
include("data/login_user_nexon.php");
include("data/inventory.php");
include("data/outboxitem.php");
include("data/room.php");
include("data/luckyshot.php");
include("data/itemmanager/itemmanager.php");
include("data/weaponmanager/weaponmanager.php");
// Other Servers
include("servers/login_nexon.php");
include("servers/game.php");
include("servers/udp.php");
$objMysql = new MysqlClass($arrMysqlData['host'], $arrMysqlData['user'], $arrMysqlData['password'], $arrMysqlData['database']);
WriteLine("MySQL", "Successfully connected to ".$objMysql->getHost()." as '".$objMysql->getUser()."'");
$objMysql->query("UPDATE `account` SET `online`='false' WHERE `online`='true';");
$objItemManager = new ItemManagerClass("data/itemmanager/items.list");
$objWeaponManager = new WeaponManager();
$arrLuckyshotItems = LuckyshotItem::loadItems(); //load items from database
include("data/equipment_default.php");
$arrServers = array();
$arrServers['login'] = new LoginServer('0.0.0.0', 5330);
$arrServers['game'] = new GameServer('0.0.0.0', $serverData['port']);
//$arrServers['udp'] = new UdpServer('127.0.0.1', 5350);
//$arrServers['http'] = new HTTPServer('127.0.0.1', 80);
while(true)
{
foreach($arrServers as $strKey => $objServer)
{
$objServer->onServerRun();
if($strKey == 'game')
{
$objServer->masterTick();
}
}
usleep(1); //let cpu do its work...
}
?>
servers/game.php (Packet handling, ...)
Code:
<?php
class GameHandler extends ClientHandler
{
protected $objUser = NULL;
public function getUser()
{
return $this->objUser;
}
public function setUser($objUser)
{
if(!isset($this->objUser) || $this->objUser == NULL)
{
$this->objUser = $objUser;
}
}
public function OnConnect()
{
parent::OnConnect();
}
public function OnDisconnect()
{
parent::OnDisconnect();
$this->leaveServer();
}
public function leaveServer()
{
WriteLine("GameServer", $this->objUser->getNickname()." [#".$this->objUser->getUserId()."] left the Server");
$this->objUser->leaveRoom();
foreach($this->objUser->getFriendedOnline() as $objFriend)
{
$objFriendHandler = $objFriend->getHandler($this->objServer);
$objFriendUser = $objFriendHandler->getUser();
$objFriendUser->chatPlayer("'".$this->objUser->getNickname()."' left the Server", "Messenger");
}
$this->objUser->goOffline();
}
public function kickClient()
{
$this->objServer->killClient($this->objClient); //just terminate connection and remove us from handlers / connections list
}
public function OnDataReceive($strData)
{
try
{
global $GameOperationcodes;
global $objMysql;
parent::OnDataReceive($strData);
$objPacket = Crypter::uncryptPacket($strData, Crypter::PACKETTYPE_Game());
$arrOperationcodeNames = array_flip($GameOperationcodes);
if(array_search($objPacket->getOperationcode(), $arrOperationcodeNames) == -1)
{
WriteLine("GameServer", "(Unknown) Packet: ".$objPacket->getPacket());
}
else
{
$strPacketName = strtolower(substr($arrOperationcodeNames[$objPacket->getOperationcode()], 2, strlen($arrOperationcodeNames[$objPacket->getOperationcode()]) - 2));
$strFunctionName = "gameHandler_".$strPacketName."::handle";
if(is_callable($strFunctionName))
{
call_user_func($strFunctionName, $objPacket, $this, $this->objServer, $this->objUser);
}
else
{
WriteLine("GameServer", "No Handler for Packet (".$strPacketName.")");
}
}
}
catch(Exception $ex)
{
$this->kickClient(); //cya bastard =D
}
}
public function tryHandleCommand($strMessage)
{
$strTrueMessage = substr($strMessage, strlen($this->objUser->getNickname()) + 4);
$strPrefix = substr($strTrueMessage, 0, 1);
$arrSplit = explode(chr(0x1D), $strTrueMessage);
if($strPrefix == "/")
{
$this->handleCommand($arrSplit);
return true;
}
}
protected function handleCommand($arrBlocks)
{
$intCount = count($arrBlocks);
$arrBlocks[0] = substr($arrBlocks[0], 1);
$thisUser = $this->getUser();
switch($arrBlocks[0])
{
case 'msn':
{
if($intCount < 2)
{
$this->objUser->chatPlayerGreen("Please enter an Action ( add/remmove/list )", "Messenger");
return;
}
$strAction = $arrBlocks[1];
if($strAction == 'add')
{
if($intCount < 3)
{
$this->objUser->chatPlayerGreen("Please enter a Nickname", "Messenger");
return;
}
$strNickname = $arrBlocks[2];
$arrFriends = $thisUser->getFriends();
$boolAlreadyFriends = false;
foreach($arrFriends as $objFriend)
{
if($objFriend->getNickname() == $strNickname)
{
$boolAlreadyFriends = true;
break;
}
}
if($boolAlreadyFriends == true)
{
$this->objUser->chatPlayerGreen("'".$strNickname."' is already your Friend!", "Messenger");
}
else
{
global $objMysql;
$objQuery = $objMysql->query("SELECT `id` FROM `account` WHERE `nickname`='".mysql_real_escape_string($strNickname)."' LIMIT 0,1;");
if(mysql_num_rows($objQuery) > 0)
{
$objRow = mysql_fetch_array($objQuery);
$objMysql->query("INSERT INTO `friends` (`userid`, `friendid`) VALUES ('".$this->objUser->getUserId()."', '".$objRow['id']."');");
foreach($this->objServer->getPlayers() as $objHandler)
{
$objUser = $objHandler->getUser();
if($objUser->getNickname() == $strNickname)
{
$objUser->chatPlayerGreen("'".$this->objUser->getNickname()."' added you as Friend!", "Messenger");
break;
}
}
$this->objUser->chatPlayerGreen("'".$strNickname."' added to Friends! :)", "Messenger");
}
else
{
$this->objUser->chatPlayerGreen("'".$strNickname."' not Found! :(", "Messenger");
}
}
}
elseif($strAction == 'remove')
{
if($intCount < 3)
{
$this->objUser->chatPlayerGreen("Please enter a Nickname", "Messenger");
return;
}
$strNickname = $arrBlocks[2];
$arrFriends = $thisUser->getFriends();
foreach($arrFriends as $objFriend)
{
if($objFriend->getNickname() == $strNickname)
{
if($objFriend->getIsOnline($this->objServer) == true)
{
$objFriendHandler = $objFriend->getHandler($this->objServer);
$objFriendUser = $objFriendHandler->getUser();
$objFriendUser->chatPlayerGreen("'".$this->objUser->getNickname()."' removed you from his Friendlist!", "Messenger");
}
global $objMysql;
$objMysql->query("DELETE FROM `friends` WHERE `userid`='".$this->objUser->getUserId()."' AND `friendid`='".$objFriend->getUserId()."'");
$this->objUser->chatPlayerGreen("'".$objFriend->getNickname()."' removed from Friendlist!", "Messenger");
break;
}
}
}
elseif($strAction == 'list')
{
$this->objUser->chatPlayerGreen("-- Friends --", "Messenger");
foreach($thisUser->getFriends() as $objFriend)
{
$strStatus = " is offline";
if($objFriend->getIsOnline($this->objServer) == true)
{
$strStatus = " is online";
$objFriendHandler = $objFriend->getHandler($this->objServer);
$objFriendUser = $objFriendHandler->getUser();
if($objFriendUser->getRoom() != NULL)
{
$objRoom = $objFriendUser->getRoom();
$strStatus .= " (Room ".$objRoom->getId().")";
}
}
$this->objUser->chatPlayerGreen($objFriend->getNickname().$strStatus, "Messenger");
}
}
else
{
}
break;
}
case 'userinfo':
{
if($thisUser->getAuthority() == 0) { $thisUser->chatPlayer("No access to this command!"); break; }
global $objMysql;
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter a Nickname");
return;
}
$strNickname = $arrBlocks[1];
$objQuery = $objMysql->query("SELECT * FROM `account` WHERE `nickname`='".mysql_real_escape_string($strNickname)."' LIMIT 0,1;");
if(mysql_num_rows($objQuery) > 0)
{
$objRow = mysql_fetch_array($objQuery);
$strAppend = "";
if($objRow['banned'] == 'true') { $strAppend = "(banned) "; }
$this->objUser->chatPlayer("-- Userinfo ".$strAppend."--");
$this->objUser->chatPlayer("Username: ".$objRow['username']);
$this->objUser->chatPlayer("Nickname: ".$objRow['nickname']);
$objQuery = $objMysql->query("SELECT * FROM `account_detail` WHERE `id`='".$objRow['id']."' LIMIT 0,1;");
$objRow = mysql_fetch_array($objQuery);
$this->objUser->chatPlayer("Premium: ".Functions::PremiumToString($objRow['premium']));
$this->objUser->chatPlayer("Experience: ".$objRow['exp']." (".$objRow['level'].")");
$this->objUser->chatPlayer("Dinar: ".$objRow['dinar']);
$this->objUser->chatPlayer("Credits: ".$objRow['credits']);
$dblKd = round(($objRow['kills'] + 1) / ($objRow['deaths'] + 1), 3);
$this->objUser->chatPlayer("K/D: ".$objRow['kills']."/".$objRow['deaths']." (".$dblKd.")");
$this->objUser->chatPlayer("Authority: ".$objRow['authority']);
break;
}
else
{
$this->objUser->chatPlayer("Nickname '".$strNickname."' not found!");
}
break;
}
case 'createuser':
{
if($thisUser->getAuthority() != 2) { $thisUser->chatPlayer("No access to this command!"); break; }
global $objMysql;
if($intCount < 4)
{
$this->objUser->chatPlayer("Please keep to structure");
return;
}
$strUsername = $arrBlocks[1];
$strNickname = $arrBlocks[2];
$strPassword = $arrBlocks[3];
$objQuery = $objMysql->query("SELECT * FROM `account` WHERE `nickname`='".mysql_real_escape_string($strNickname)."' OR `username`='".mysql_real_escape_string($strUsername)."' LIMIT 0,1;");
if(mysql_num_rows($objQuery) > 0)
{
$this->objUser->chatPlayer("Username or nickname already in use!");
break;
}
else
{
$objMysql->query("INSERT INTO `account` (`username`, `password`, `nickname`) VALUES ('".mysql_real_escape_string($strUsername)."', PASSWORD('".mysql_real_escape_string($strPassword)."'), '".mysql_real_escape_string($strNickname)."');");
$objMysql->query("INSERT INTO `account_detail` (`premium`, `level`, `exp`, `dinar`, `credits`, `kills`, `deaths`, `authority`, `showlevel`) VALUES ('1', '1', '0', '250000', '5000', '0', '0', 'player', 'true');");
$objMysql->query("INSERT INTO `peer` (`userid` ,`remoteip` ,`remoteport` ,`localip` ,`localport` ,`c_remoteip` ,`c_localip`)VALUES (NULL , '127.0.0.1', '0', '127.0.0.1', '0', '0', '0');");
$objQuery = $objMysql->query("SELECT `id` FROM `account` WHERE `username`='".mysql_real_escape_string($strUsername)."' LIMIT 0,1;");
$objRow = mysql_fetch_array($objQuery);
$objMysql->query("INSERT INTO `equipment` (`userid`, `class`) VALUES ('".$objRow['id']."', 'engineer');");
$objMysql->query("INSERT INTO `equipment` (`userid`, `class`) VALUES ('".$objRow['id']."', 'medic');");
$objMysql->query("INSERT INTO `equipment` (`userid`, `class`) VALUES ('".$objRow['id']."', 'sniper');");
$objMysql->query("INSERT INTO `equipment` (`userid`, `class`) VALUES ('".$objRow['id']."', 'assault');");
$objMysql->query("INSERT INTO `equipment` (`userid`, `class`) VALUES ('".$objRow['id']."', 'heavy');");
$this->objUser->chatPlayer("User '".$strUsername."' created (#".$objRow['id'].")");
}
break;
}
case 'help':
{
$this->objUser->chatPlayer("-- Commands --");
$this->objUser->chatPlayer("Messenger: /msn <add/remove/list>");
if($thisUser->getAuthority() >= 1)
{
$this->objUser->chatPlayer("Kick player: /kick <nickname>");
$this->objUser->chatPlayer("Kill room: /killrm <id>");
$this->objUser->chatPlayer("Userinfo: /userinfo <nickname>");
}
if($thisUser->getAuthority() >= 2)
{
$this->objUser->chatPlayer("Server notify: /notify <message>");
$this->objUser->chatPlayer("Ban / unban: /ban <username> <1/0>");
$this->objUser->chatPlayer("Add User: /createuser <username> <password> <nickname>");
}
break;
}
case 'kick':
{
if($thisUser->getAuthority() == 0) { $thisUser->chatPlayer("No access to this command!"); break; }
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter a Nickname!");
break;
}
$strNickname = $arrBlocks[1];
$objFound = NULL;
foreach($this->objServer->getPlayers() as $objPlayer)
{
$objUser = $objPlayer->getUser();
if($objUser->getNickname() == $strNickname)
{
$objFound = $objPlayer;
break;
}
}
if($objFound != NULL)
{
$objUser = $objFound->getUser();
if($objUser->getUserId() == 1)
{
$this->objUser->leaveRoom();
$this->kickClient();
$objUser->chatPlayer("'".$this->objUser->getNickname()."' wanted to kick you from Server!");
break;
}
if($objUser->getAuthority() > $this->objUser->getAuthority())
{
$this->objUser->chatPlayer("You can't kick ".$objUser->getNickname());
$objUser->chatPlayer("'".$this->objUser->getNickname()."' wanted to kick you from Server!");
break;
}
if($objUser->getNickname() == $this->objUser->getNickname())
{
$objUser->chatPlayer("You can't kick yourself!");
break;
}
$objUser->leaveRoom();
$objFound->kickClient();
$this->objUser->chatPlayer("'".$objUser->getNickname()."' kicked!");
}
else
{
$this->objUser->chatPlayer("Player '".$strNickname."' is not online!");
}
break;
}
case 'killrm':
{
if($thisUser->getAuthority() == 0) { $thisUser->chatPlayer("No access to this command!"); break; }
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter a Room ID!");
break;
}
$intRoomId = $arrBlocks[1];
$intChannelId = $this->objUser->getChannel();
if($intCount > 2)
{
if(is_numeric($arrBlocks[2]))
{
$intChannelId = $arrBlocks[2];
}
}
if(!is_numeric($intRoomId))
{
$this->objUser->chatPlayer("Please enter a (valid) Room ID!");
break;
}
$objRoom = $this->objServer->getRoom($intChannelId, $intRoomId);
if(!isset($objRoom) || $objRoom == NULL)
{
$this->objUser->chatPlayer("Room does not exist!");
break;
}
if(count($objRoom->getPlayers()) <= 0)
{
$this->objServer->removeRoom($intChannelId, $objRoom);
}
else
{
foreach($objRoom->getPlayers() as $objPlayer)
{
$objUser = $objPlayer->getUser();
$objUser->leaveRoom();
}
}
$this->objUser->chatPlayer("Woosh! Room has been deleted!");
break;
}
case 'notify':
{
if($thisUser->getAuthority() != 2) { $thisUser->chatPlayer("No access to this command!"); break; }
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter Notify Text!");
break;
}
$strMessage = implode(" ", $arrBlocks);
$strMessage = substr($strMessage, strlen($arrBlocks[0]) + 1);
foreach($this->objServer->getPlayers() as $objHandler)
{
$objHandler->send(new gSvNotify($strMessage));
}
$this->objUser->chatPlayer("You notified '".$strMessage."'");
break;
}
case 'spectate':
{
if($thisUser->getAuthority() == 0) { $thisUser->chatPlayer("No access to this command!"); break; }
$this->objUser->chatPlayer("This function is not available at the moment!");
return;
$objRoom = $this->objUser->getRoom();
if(isset($objRoom) && $objRoom != NULL)
{
$this->objUser->chatPlayer("You're already in a Room!");
break;
}
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter a Room ID!");
break;
}
$intRoomId = $arrBlocks[1];
if(!is_numeric($intRoomId))
{
$this->objUser->chatPlayer("Please enter a (valid) Room ID!");
break;
}
$objRoom = $this->objServer->getRoom($this->objUser->getChannel(), $intRoomId);
if(isset($objRoom) && $objRoom != NULL)
{
$this->send(new gSvJoinRoom(1, NULL, $objRoom)); //join =D
$arrPlayers = $objRoom->getPlayers();
$this->send(new gSvPlayerlist($arrPlayers, $objRoom, $this)); //send the player, who joins, who is in the room (including his self for his seat)
$this->objUser->setRoom($objRoom);
$this->objUser->setSpectating(true);
$objRoom->addSpectator($this);
}
else
{
$this->objUser->chatPlayer("Room does not exist");
}
break;
}
case 'ban':
{
if($thisUser->getAuthority() != 2) { $thisUser->chatPlayer("No access to this command!"); break; }
global $objMysql;
if($intCount < 3)
{
$this->objUser->chatPlayer("Please keep to Structure (<username> <1/0>)!");
break;
}
$strUsername = $arrBlocks[1];
$intBan = $arrBlocks[2];
if(!is_numeric($intBan) || $intBan < 0 || $intBan > 1)
{
$this->objUser->chatPlayer("Ban value must be 1 or 0!");
break;
}
$objQuery = $objMysql->query("SELECT * FROM `account` WHERE `username`='".mysql_real_escape_string($strUsername)."' LIMIT 0,1;");
if(mysql_num_rows($objQuery) < 1)
{
$this->objUser->chatPlayer("User '".$strUsername."' not found!");
break;
}
$objRow = mysql_fetch_array($objQuery);
$objQuery = $objMysql->query("SELECT * FROM `account_detail` WHERE `id`='".$objRow['id']."' LIMIT 0,1;");
$objRow = mysql_fetch_array($objQuery);
if(($objRow['authority'] == 'admin' || $objRow['authority'] == 'moderator') && $this->objUser->getUserId() == 1)
{
$this->objUser->chatPlayer("You can't ban/unban this User!");
break;
}
$strBanned = ($intBan == 1 ? 'true' : 'false');
$objQuery = $objMysql->query("UPDATE `account` SET `banned`='".$strBanned."' WHERE `username`='".mysql_real_escape_string($strUsername)."'");
$strBanned = ($intBan == 1 ? 'banned' : 'unbanned');
if($intBan == 1)
{
foreach($this->objServer->getPlayers() as $objHandler)
{
$objUser = $objHandler->getUser();
if($objUser->getUsername() == $strUsername)
{
$objUser->leaveRoom();
$objHandler->kickClient();
$strBanned .= " and kicked";
break;
}
}
}
$this->objUser->chatPlayer("User '".$strUsername."' has been ".$strBanned);
break;
}
case 'resetnickname':
{
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter an username!");
break;
}
global $objMysql;
$strUsername = mysql_real_escape_string($arrBlocks[1]);
$objQuery = $objMysql->query("SELECT `id` FROM `account` WHERE `username`='".$strUsername."' LIMIT 0,1;");
if(mysql_num_rows($objQuery) < 1)
{
$this->objUser->chatPlayer("User '".$strUsername."' does not exist!");
break;
}
else
{
$objRow = mysql_fetch_array($objQuery);
if($objRow['id'] == $this->objUser->getUserId())
{
$objQuery = $objMysql->query("UPDATE `account` SET `nickname`=NULL WHERE `id`='".$this->objUser->getUserId()."'");
}
else
{
$objQuery = $objMysql->query("SELECT * FROM `account_detail` WHERE `id`='".$objRow['id']."' LIMIT 0,1;");
}
}
}
case 'rename':
{
if($intCount < 3)
{
$this->objUser->chatPlayer("Please enter an username and a new nickname!");
break;
}
$strUsername = $arrBlocks[1];
$strNickname = $arrBlocks[2];
$strAdditional = "!";
foreach($this->objServer->getPlayers() as $objHandler)
{
$objUser = $objHandler->getUser();
if($objUser->getUsername() == $strUsername)
{
$objUser->setNickname($strNickname);
$objUser->send(new gSvChangeNickname($objUser->getNickname()));
$strAdditional = " and notified!";
}
}
$this->objUser->chatPlayer("User '".$strUsername."' successfully renamed".$strAdditional);
}
case 'testcode':
{
if($intCount < 2)
{
$this->objUser->chatPlayer("Please enter an Errocode!");
break;
}
$intErrorcode = $arrBlocks[1];
if(!is_numeric($intErrorcode))
{
$this->objUser->chatPlayer("Please enter an (valid) Errocode!");
break;
}
$this->send(new gSvJoinRoom($intErrorcode));
$this->objUser->chatPlayer("Errorcode: ".$intErrorcode, "Test Errocode");
break;
}
default:
{
$this->objUser->chatPlayer("No such command '".$arrBlocks[0]."'");
}
}
return true;
}
}
class GameServer extends TcpServer
{
protected $boolResetToday;
public function onClientConnected($objClient)
{
$this->arrHandlers[array_search($objClient, $this->arrClients)] = new GameHandler($this, $objClient);
}
public function onClientReceived($objClient, $strData)
{
parent::onClientReceived($objClient, $strData);
}
public function onClientDisconnected($objClient)
{
parent::onClientDisconnected($objClient);
}
public function __construct($strIp, $intPort)
{
parent::__construct($strIp, $intPort);
$this->arrRooms = array();
$this->arrRooms[] = array(); //1 cqc
$this->arrRooms[] = array(); //2 uo
$this->arrRooms[] = array(); //3 bg
$this->arrRooms[] = array(); //4 ai
$this->boolResetToday = false;
global $objMysql;
$objMysql->query("UPDATE `account_detail` SET `couponstoday`='0';");
}
public function getPlayers($intChannelId = NULL)
{
$arrPlayers = array();
foreach($this->arrHandlers as $objHandler)
{
if($intChannelId == NULL)
{
$arrPlayers[] = $objHandler;
}
else
{
$objUser = $objHandler->getUser();
if($objUser->getChannel() == $intChannelId)
{
$arrPlayers[] = $objHandler;
}
}
}
return $arrPlayers;
}
public function getPlayerCount()
{
return count($this->getPlayers());
}
public function getFreeSessionId()
{
$arrEmptyPlayers = array();
foreach($this->getPlayers() as $intKey => $objHandler)
{
if(!isset($objHandler) || $objHandler == NULL)
{
$arrEmptyPlayers[] = $intKey;
}
}
if(count($arrEmptyPlayers) > 0)
{
return min($arrEmptyPlayers);
}
else
{
return 0;
}
}
public function updateRoomList($intChannelId, $intRoomId)
{
$arrPlayers = $this->getPlayers($intChannelId);
$intRoompage = floor($intRoomId / 15);
foreach($arrPlayers as $objPlayer)
{
$objUser = $objPlayer->getUser();
$objRoom = $objUser->getRoom();
if(isset($objRoom) || $objRoom != NULL) { continue; }
if($objUser->getRoompage() == $intRoompage)
{
$objPlayer->send(new gSvRoomlist($objUser, $this->getRooms($intChannelId), $this->getRoomsCount($intChannelId)));
}
}
}
public function masterTick()
{
for($intChannel = 0; $intChannel < 4; $intChannel ++)
{
foreach($this->getRooms($intChannel) as $objRoom)
{
$objRoom->roomTick();
}
}
if(date('His') === '000000' && $this->boolResetToday == false) //reset coupons today
{
global $objMysql;
$objMysql->query("UPDATE `account_detail` SET `couponstoday`='0';");
$this->boolResetToday = true;
}
elseif(date('His') !== '000000' && $this->boolResetToday == true)
{
$this->boolResetToday = false;
}
}
protected $arrRooms;
public function getRoom($intChannelId, $intRoomId)
{
return @$this->arrRooms[$intChannelId][$intRoomId];
}
public function getRooms($intChannelId)
{
return @$this->arrRooms[$intChannelId];
}
public function getRoomsCount($intChannelId)
{
$intCount = 0;
foreach($this->arrRooms as $objRoom)
{
if(isset($objRoom) && $objRoom != NULL)
{
$intCount ++;
}
}
return $intCount;
}
public function getFreeRoomId($intChannelId)
{
$arrEmptyRooms = array();
foreach($this->getRooms($intChannelId - 1) as $intKey => $objRoom)
{
if(!isset($objRoom) || $objRoom == NULL)
{
$arrEmptyRooms[] = $intKey;
}
}
if(count($arrEmptyRooms) > 0)
{
return min($arrEmptyRooms);
}
else
{
return 0;
}
}
public function addRoom($intChannelId, $objRoom)
{
$this->arrRooms[$intChannelId][$objRoom->getId()] = $objRoom;
$this->updateRoomList($intChannelId, $objRoom->getId());
}
public function removeRoom($intChannelId, $objRoom)
{
unset($this->arrRooms[$intChannelId][array_search($objRoom, $this->arrRooms)]);
$this->updateRoomList($intChannelId, $objRoom->getId());
}
}
?>
and because im so nice, i add another file...
network/game/handlers/gameHandler_kickplayer.php (when youre room master you can kick players, well this is yet at work)
Code:
<?php
class gameHandler_kickplayer
{
public static function handle($objPacket, $objHandler, $objServer, $objUser)
{
$objUser->chatPlayer("This function is yet at work!");
return;
$intPlayerSlot = $objPacket->getNextBlock();
$objRoom = $objUser->getRoom();
if(isset($objRoom) && $objRoom != NULL)
{
$intMySlot = $objRoom->getPlayerSlot($objHandler);
if($intMySlot == $objRoom->getMasterId())
{
$objTargetPlayer = $objRoom->getPlayer($intPlayerSlot);
if(isset($objTargetPlayer) && $objTargetPlayer != NULL)
{
$objTargetPlayer->leaveRoom();
$objTargetPlayerUser = $objTargetPlayer->getUser();
$objTargetPlayerUser->chatPlayer("You have been forced out of the Game by Master or Admin!");
return;
$objRoom->removePlayer($objTargetPlayer);
$objTargetUser = $objTargetPlayer->getUser();
$objTargetUser->setRoom(NULL);
$objHandlersend(new gSvKickPlayerNotify($intPlayerSlot));
$objTargetPlayer->send(new gSvKickPlayerNotify($intMySlot));
$objTargetUser->leaveRoom();
}
}
else
{
$objHandler->kickClient();
}
}
else
{
$objHandler->kickClient();
}
}
}
?>
I have counted my files and directorys: 81 files in 10 directories.
Tell me a good price and maybe ill sell the source (or parts of it).
Only payable with PaySafeCard.
I will probably give you a tiny extra gift.
Just PM me here on epvp | add me on skype: powachill.
Greeez homies...
Supreme
#EDIT
I have some Screens:
And there i censored some packets you shouldnt see...
#EDIT2
I can login with every Nexon Account. Password will be validated with Nickname change (comes with login).. Thats temporairly until i figured out how to check the nexon auth servers generated password..
Server files and client 06/16/2012 - Metin2 Private Server - 2 Replies Hello every one
Im looking for fresh unbugged English server files and a nice English client with new items and weapons etc....
The problem is all the clients I have are German ..:D
And I speak English lol
And if any one knows how to add my hamachi ip on the client so people can join my server please tell me :handsdown:
2011er Client/Files Server mit 2010er Client zocken. 09/10/2011 - Metin2 - 3 Replies Ich zocke auf Imba-2010. Und zwar hat der Server glaube ich 2011er Client oder Files. Mein Problem ist dort kann ich nicht den Client modden. Im spiel sind die meisten dann unsichtbar und manche Characktäre von mir auch und kann auch nicht laufen.
Meine Frage ist, kann ich irgendwie mit einem 2010er Client auf den Server spielen. Wenn jah könnt ihr mir sagen wie ?
Sorry wenn das hier unpassend ist. Ich kenne mich hier nicht so wirklich aus.
Fange grad mit allem an.
Thxz im vorraus...
Need .REZ files? Let Nexon Repair Your Game For You! 09/09/2011 - Combat Arms Hacks, Bots, Cheats & Exploits - 3 Replies Take the 4 attached files, and put them in your Combat Arms folder.
Start the game.
It will then think the game needs patched and will start the Nexon patcher.
It will check all the files and then replace only the ones that need updating/replaced.
If you see anyone asking for rez files, SEND THEM HERE.
[HELP] Server+Client Files 02/19/2010 - EO PServer Hosting - 5 Replies Hy @all,
There are a hundred thousand different server files and client files, with each part in extreme bugs.
My question is since we do have professionals here in this forum.
And I've already lost the general idea which I have since been tested
What for Server Files + Client Of course the current status (Paladin, mannequin, without checksum Problem and if possible, no clients where only parts of updates is in there, so as to completely botched.) you can use here?
From the...
Original files for the nexon game 04/29/2009 - Mabinogi - 4 Replies Hello all, I've recently screwed up on my modding of the files in the nexon folder, and now i cant fix it due to not having the original files.
Does anyone have the original data file from the nexon folder. It would be much appreciated. :)