Frox' Tech Blog

Aller au contenu | Aller au menu | Aller à la recherche

samedi, 15 août 2009

Installer MumbleViewer

En root :
apt-get install libzeroc-ice32 php-zeroc-ice icecpp
su murmur
cd ~/murmur
vi murmur.ini => commenter dbus=..., décommenter ice=...
exit

vi /etc/php5/apache2/php.ini
dans la section :
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
on rajoute :
;PHP-ICE
extension=icephp.so
ice.slice=/home/murmur/murmur/Murmur.ice

/etc/init.d/apache2 restart

cd /var/www/
wget http://mumbleviewer.mine.nu/publish/mumbleviewer-1.0-php.tar.gz
tar -xzf mumbleviewer-1.0-php.tar.gz

Puis redémarrage de murmur : su murmur
ps -eaf|grep murmur => kill du processus
cd ~/murmur
./murmur.x86

Et enfin aller voir ici : http://ip/mumbleviewer/viewer.php
MumbleViewer

vendredi, 31 juillet 2009

GHost++ : installation sur Ubuntu

(en cours de rédaction)

Système : Ubuntu Server 8.04 LTS 32 bits
(installation toute fraîche)

Version de GHost ++ : 13.3


Compilation du programme


. Connexion en root

. Installation de quelques paquets :

root:$ apt-get install build-essential m4 libgmp3-dev zlib1g-dev libbz2-dev libmysql++-dev make gcc g++ zip unzip sqlite3 screen
root:$


. Téléchargement de Boost version 1.38 dans le home de root :

root:$ cd
root:$ wget http://freefr.dl.sourceforge.net/project/boost/boost/1.38.0/boost_1_38_0.tar.gz


. On décompresse l'archive et on retire les droits d'écriture pour le groupe et les autres :

root:$ tar -xvzf boost_1_38_0.tar.gz
root:$ chmod -R go-w boost_1_38_0


. On crée le Makefile :

root:$ cd boost_1_38_0/
root:$ ./configure --prefix=/usr --with-libraries=date_time,thread,system,filesystem,regex


. On modifie le Makefile pour remplacer la ligne BJAM_CONFIG= par BJAM_CONFIG= --layout=system :
root:$ vi Makefile

. On compile :
root:$ make install

. Vérifier qu'il y a bien de nouvelles bibliothèques dans /usr/lib :
root:$ ls -rtlF /usr/lib
=> fichiers libboost_*

. On rajoute le user wc3bot, on se connecte avec, et on va dans son home :

root:$ adduser wc3bot
...
...
root:$ su wc3bot
wc3bot:$ cd


. Téléchargement des sources de GHost++ et décompression :

wc3bot:$ wget http://ghostplusplus.googlecode.com/files/ghostplusplus_13.3.zip
wc3bot:$ unzip ghostplusplus_13.3.zip


. Compilation de bncsutil et stormlib :

wc3bot:$ cd ~/ghost/bncsutil/src/bncsutil
wc3bot:$ make
wc3bot:$ cd ~/ghost/StormLib/stormlib
wc3bot:$ make


. Compilation de GHost++ (peut être un peu long) :

wc3bot:$ cd ~/ghost/ghost/
wc3bot:$ make


. Copie de l'exécutable généré dans le répertoire parent :

wc3bot:$ cp ghost++ ..


. On se remet en root pour copier les 2 bibliothèques précédemment compilées dans /usr/lib (nécessaires au lancement du programme) :

wc3bot:$ exit
root:$ cp /home/wc3bot/ghost/bncsutil/src/bncsutil/libbncsutil.so /usr/lib
root:$ cp /home/wc3bot/ghost/StormLib/stormlib/libStorm.so /usr/lib



Paramétrage



  • Créer le fichier ~/ghost/motd.txt qui contiendra le texte qui s'affiche lorsque quelqu'un se connecte à la salle d'attente (lobby). Exemple de contenu :


##############################################################
This game is hosted by GHost++ version 13.3
on a Linux Ubuntu 8.04 LTS dedicated server
    . Do not ask for slot reservation
    . Map download allowed if not too slow
    . Auto-kick if ping > 90 ms
    . Stay till the end when the game starts, OR GET BANNED
##############################################################



  • Dans ~/ghost/mapcfgs se trouvent les fichiers de configuration des maps.

En 13.3 il y a entre autres fichiers dota6.59d.cfg, si on veut utiliser une version plus récente, 6.61b par exemple, il faut donc créer le fichier dota6.61b.cfg qui contiendra :

#####################################
# map file for DotA Allstars v6.61b #
#####################################
 
# the map path tells Warcraft III clients where to find the map on their system
# it is NOT the path to the map on the GHost++ system, in fact GHost++ doesn't need the map at all
 
map_path = Maps\Download\DotA Allstars v6.61b.w3x
#map_size = 157 189 52 0
#map_info = 34 117 108 107
#map_crc = 79 37 133 166
 
# map speed
#  1 = slow
#  2 = normal
#  3 = fast
 
map_speed = 3
 
# map visibility
#  1 = hide terrain
#  2 = explored
#  3 = always visible
#  4 = default
 
map_visibility = 4
 
# map observers
#  1 = none
#  2 = on defeat
#  3 = allowed
#  4 = referees
 
map_observers = 1
 
# map flags
#  - you can combine these flags by adding together all the options you want to use
#  - for example to have teams together and fixed teams you would use "3"
#  1 = teams together
#  2 = fixed teams
#  4 = unit share
#  8 = random hero
#  16 = random races
 
map_flags = 3
 
# map game type
#  1 = custom
 
map_gametype = 1
 
# map dimensions
 
#map_width = 52 0
#map_height = 52 0
 
# map players and teams
 
map_numplayers = 10
map_numteams = 2
 
#
# slot structure
#  [PID] [Download Status] [Slot Status] [Computer] [Team] [Colour] [Race] [Skill] [Handicap]
#  - PID is always 0
#  - Download Status is always 255
#  - Slot Status is 0 for open, 1 for closed, 2 for occupied
#  - Computer is 0 for no, 1 for yes
#  - Team
#  - Colour
#  - Race is 1 for human, 2 for orc, 4 for night elf, 8 for undead, 32 for random (add 64 to any of these for fixed)
#  - Skill is 0 for easy computer, 1 for normal computer or human, 2 for hard computer
#  - Handicap is 50/60/70/80/90/100
#
 
map_slot1 = 0 255 0 0 0 1 4 1 100
map_slot2 = 0 255 0 0 0 2 4 1 100
map_slot3 = 0 255 0 0 0 3 4 1 100
map_slot4 = 0 255 0 0 0 4 4 1 100
map_slot5 = 0 255 0 0 0 5 4 1 100
map_slot6 = 0 255 0 0 1 7 8 1 100
map_slot7 = 0 255 0 0 1 8 8 1 100
map_slot8 = 0 255 0 0 1 9 8 1 100
map_slot9 = 0 255 0 0 1 10 8 1 100
map_slot10 = 0 255 0 0 1 11 8 1 100
 
# map type (for map specific stats)
 
map_type = dota
 
# map categories
# the match making category is used to select score data from the database when matchmaking is enabled
# the stats w3mmd category is used to insert data to the database when using map_type = w3mmd
# these are used to allow stats and scores to persist across multiple version of the same map
 
map_matchmakingcategory = dota_elo
map_statsw3mmdcategory =
 
 
# map local path (for map downloads)
#  GHost++ doesn't require map files but if it has access to them it can send them to players
#  GHost++ will search bot_mappath + map_localpath for the map file (bot_mappath is set in the main config file)
 
map_localpath = DotA Allstars v6.61b.w3x



  • Dans ~/ghost/maps il faut uploader la map ("DotA Allstars v6.61b.w3x" dans notre exemple).



  • Créer le répertoire ~/wc3files et y uploader les 4 fichiers suivants qui se trouvent dans le répertoire du jeu (C:\Program Files\WarCraft3) :

game.dll
storm.dll
war3.exe
War3Patch.mpq


  • Il faut ensuite éditer le fichier ~/ghost/ghost.cfg où sont importants les paramètres suivants :

- remplacer tous les \ (faits pour Windows) par des /
- bot_war3path (mettre le chemin où se trouvent les fichiers game.dll, etc.)
- bot_spoofchecks = 0 (ça évite des problèmes)
- bot_allowdownloads = 1 (téléchargments autorisés puisqu'on est sur un serveur dédié)
- bot_maxdownloadspeed = 5000 (gros débit puisqu'on est sur un serveur dédié)
- bot_autokickping = 90 (ping bas puisqu'on est sur un serveur dédié)
- bot_defaultmap = dota6.61b (dans notre exemple)
- bnet_server = europe.battle.net
- bnet_cdkeyroc = XXXXXXXXXXXXXXXXXXXXXXXXXX (clé Reign of Chaos sans -)
- bnet_cdkeytft = XXXXXXXXXXXXXXXXXXXXXXXXXX (clé Frozen Throne sans -)
- bnet_username = nom_du_compte_bnet_du_bot
- bnet_password = password_du_compte
- bnet_firstchannel = chan_ou_le_bot_doit_se_connecter
- bnet_rootadmin = nom_du_compte_bnet_qui_sera_admin_du_bot
- bnet_bnlsserver = hehoe.de (ip ou adresse d'un serveur BNLS public)
- bnet_bnlsport = 9367 (port du serveur BNLS public)
- bnet_bnlswardencookie = 1 (en général)

NB : pour plus de renseignements sur les serveurs BNLS et avoir des adresses de serveurs publics, voir le forum codelain.


Au final voici un exemple de fichier de ghost.cfg :

#####################
# BOT CONFIGURATION #
#####################
 
### the log file
 
bot_log = ghost.log
 
### the language file
 
bot_language = language.cfg
 
### the path to your local Warcraft III directory
###  this path must contain war3.exe, storm.dll, and game.dll
###  this path must end in your system's path seperator (i.e. "\" on Windows or "/" on Linux)
###  if this path contains War3Patch.mpq the bot will attempt to extract "Scripts\common.j" and "Scripts\blizzard.j" on startup and write them to bot_mapcfgpath (which is defined later in this file)
###  common.j and blizzard.j are only required for automatically calculating map_crc, you do not need them if your map config files already contain map_crc
 
bot_war3path = /home/wc3bot/wc3files/
 
### the address GHost++ will bind to when hosting games (leave it blank to bind to all available addresses)
###  if you don't know what this is just leave it blank
 
bot_bindaddress =
 
### the port GHost++ will host battle.net games on (this must be different from your admingame_port)
 
bot_hostport = 6112
 
### maximum number of games to host at once
 
bot_maxgames = 5
 
### command trigger for ingame only (battle.net command triggers are defined later)
 
bot_commandtrigger = !
 
### the path to the directory where you keep your map config files (must end in your system's path seperator)
###  this directory can also contain common.j and blizzard.j (extracted from War3Patch.mpq)
###  common.j and blizzard.j are only required for automatically calculating map_crc, you do not need them if your map config files already contain map_crc
 
bot_mapcfgpath = mapcfgs/
 
### the path to the directory where you keep your savegame files (must end in your system's path seperator)
 
bot_savegamepath = savegames/
 
### the path to the directory where you keep your map files (must end in your system's path seperator)
###  GHost++ doesn't require map files but if it has access to them it can send them to players and automatically calculate most map config values
###  GHost++ will search [bot_mappath + map_localpath] for the map file (map_localpath is set in each map's config file)
 
bot_mappath = maps/
 
### whether to save replays or not
 
bot_savereplays = 1
 
### the path to the directory where you want GHost++ to save replays (must end in your system's path seperator)
 
bot_replaypath = replays/
 
### the bot's virtual host name as it appears in the game lobby
###  colour codes are defined by the sequence "|cFF" followed by a six character hexadecimal colour in RRGGBB format (e.g. 0000FF for pure blue)
###  the virtual host name cannot be longer than 15 characters including the colour code, if you try to go over this limit GHost++ will use the default virtual host name
 
bot_virtualhostname = |cFF4080C0GHost
 
### whether to hide each player's IP address from other players or not
 
bot_hideipaddresses = 0
 
### whether to check for multiple IP address usage or not
 
bot_checkmultipleipusage = 1
 
### whether to require spoof checks or not
###  disabling spoof checks just turns off automatic spoof checks and requiring players to be spoof checked before starting the game
###  spoof checks need to be enabled if you want GHost++ to detect which realm each player came from (use the !check command to see the realm)
###  you can always manually spoof check by whispering the bot (and in fact is required before running admin commands)
 
bot_spoofchecks = 0
 
### whether to display game refresh messages by default
###  this can always be changed for a particular game with the !refresh command
 
bot_refreshmessages = 0
 
### whether to automatically lock games when the owner joins
 
bot_autolock = 0
 
### whether to automatically save games when a player disconnects
###  this can always be changed for a particular game with the !autosave command
 
bot_autosave = 0
 
### whether to allow map downloads or not
###  set to 0 to disable map downloads
###  set to 1 to enable map downloads
###  set to 2 to enable conditional map downloads (an admin must start each map download with the !download or !dl command)
 
bot_allowdownloads = 1
 
### whether to ping players during map downloads or not
###  GHost++ will always stop pinging any players who are downloading the map
###  this config value determines whether GHost++ should stop pinging *all* players when at least one player is downloading the map
 
bot_pingduringdownloads = 0
 
### the maximum number of players allowed to download the map at the same time
 
bot_maxdownloaders = 5
 
### the maximum combined download speed of all players downloading the map (in KB/sec)
 
bot_maxdownloadspeed = 5000
 
### use LC style pings (divide actual pings by two)
 
bot_lcpings = 1
 
### auto kick players with ping higher than this
 
bot_autokickping = 90
 
### the ban method
###  if bot_banmethod = 1, GHost++ will automatically reject players using a banned name
###  if bot_banmethod = 2, GHost++ will automatically reject players using a banned IP address
###  if bot_banmethod = 3, GHost++ will automatically reject players using a banned name or IP address
###  if bot_banmethod is anything else GHost++ will print a message when a banned player joins but will not automatically reject them
 
bot_banmethod = 1
 
### the IP blacklist file
 
bot_ipblacklistfile = ipblacklist.txt
 
### automatically close the game lobby if a reserved player (or admin) doesn't join it for this many minutes
###  games which are set to automatically start when enough players join are exempt from this limit (e.g. autohosted games)
 
bot_lobbytimelimit = 10
 
### the game latency
###  this can always be changed for a particular game with the !latency command (which enforces a minimum of 50 and a maximum of 500)
 
bot_latency = 100
 
### the maximum number of packets a player is allowed to get out of sync by before starting the lag screen
###  before version 8.0 GHost++ did not have a lag screen which is the same as setting this to a very high number
###  this can always be changed for a particular game with the !synclimit command (which enforces a minimum of 10 and a maximum of 10000)
 
bot_synclimit = 50
 
### whether votekicks are allowed or not
 
bot_votekickallowed = 1
 
### the percentage of players required to vote yes for a votekick to pass
###  the player starting the votekick is assumed to have voted yes and the player the votekick is started against is assumed to have voted no
###  the formula for calculating the number of votes needed is votes_needed = ceil( ( num_players - 1 ) * bot_votekickpercentage / 100 )
###  this means it will round UP the number of votes required
###  if you set it to 100 it will require 2/3, 3/4, 4/5, 5/6, 6/7, 7/8, 8/9, 9/10, 10/11, and 11/12 votes to pass
###  if you set it to 90 it will require 2/3, 3/4, 4/5, 5/6, 6/7, 7/8, 8/9, 9/10, 9/11, and 10/12 votes to pass
###  if you set it to 80 it will require 2/3, 3/4, 4/5, 4/6, 5/7, 6/8, 7/9, 8/10, 8/11, and 9/12 votes to pass
###  if you set it to 70 it will require 2/3, 3/4, 3/5, 4/6, 5/7, 5/8, 6/9, 7/10, 7/11, and 8/12 votes to pass
###  if you set it to 60 it will require 2/3, 2/4, 3/5, 3/6, 4/7, 5/8, 5/9, 6/10, 6/11, and 7/12 votes to pass
 
bot_votekickpercentage = 80
 
### the default map (the .cfg is added automatically)
 
bot_defaultmap = dota6.61b
 
### the MOTD file
###  the first 8 lines of this file will be displayed when a player joins the game
###  if this file doesn't exist a default MOTD will be used
 
bot_motdfile = motd.txt
 
### the gameloaded file
###  the first 8 lines of this file will be displayed when the game finished loading (after the player loading times are displayed)
 
bot_gameloadedfile = gameloaded.txt
 
### the gameover file
###  the first 8 lines of this file will be displayed when the game is over
###  this only works when using a stats class - note: at the time of this writing the only stats class is for DotA maps
 
bot_gameoverfile = gameover.txt
 
### whether to use regular expressions when loading map configs and maps or not
 
bot_useregexes = 0
 
############################
# ADMIN GAME CONFIGURATION #
############################
 
### whether to create the admin game or not (see readme.txt for more information)
 
admingame_create = 0
 
### the port GHost++ will host the admin game on (this must be different from your bot_hostport)
 
admingame_port = 6113
 
### the admin game password
 
admingame_password =
 
##########################
# DATABASE CONFIGURATION #
##########################
 
### database type
###  use "sqlite3" for a local SQLite database
###  use "mysql" for any MySQL database
 
db_type = sqlite3
 
### sqlite3 database configuration
###  this is only used if your database type is SQLite
 
db_sqlite3_file = ghost.dbs
 
### mysql database configuration
###  this is only used if your database type is MySQL
 
db_mysql_server = localhost
db_mysql_database = ghost
db_mysql_user = YOUR_USERNAME
db_mysql_password = YOUR_PASSWORD
db_mysql_port = 0
 
############################
# BATTLE.NET CONFIGURATION #
############################
 
### which battle.net server to connect to
###  1.) useast.battle.net
###  2.) uswest.battle.net
###  3.) asia.battle.net
###  4.) europe.battle.net
### note that each banned player is tied to the realm it was created on and the realm is case sensitive
### so if you change your realm from useast.battle.net to USEAST.BATTLE.NET it'll still connect but anyone previously banned will not be counted as banned until you change it back
 
bnet_server = europe.battle.net
 
### your Warcraft III: Reign of Chaos CD key
 
bnet_cdkeyroc = FFFFFFFFFFFFFFFFFFFFFFFFFF
 
### your Warcraft III: The Frozen Throne CD key
 
bnet_cdkeytft = FFFFFFFFFFFFFFFFFFFFFFFFFF
 
### your battle.net username
 
bnet_username = thebot
 
### your battle.net password
 
bnet_password = thebotpass
 
### the first channel to join upon entering battle.net
 
bnet_firstchannel = thechan
 
### the root admin on this battle.net server only
 
bnet_rootadmin = theadmin
 
### command trigger for this battle.net server only
 
bnet_commandtrigger = !
 
### whether to automatically add your friends list to each game's reserved list
 
bnet_holdfriends = 1
 
### whether to automatically add your clan members list to each game's reserved list
 
bnet_holdclan = 1
 
### BNLS server information for Warden handling (see readme.txt for more information)
###  you will need to use a valid BNLS server here if you are connecting to an official battle.net realm or you will be disconnected every two minutes
 
#bnet_bnlsserver = bnls.hikato.com
#bnet_bnlsport = 19283
#bnet_bnlsserver = bnls.pingblazer.com
#bnet_bnlsport = 9367
#bnet_bnlsserver = ragetrain.com
#bnet_bnlsport = 9367
bnet_bnlsserver = hehoe.de
bnet_bnlsport = 9367
bnet_bnlswardencookie = 1
 
### you will need to edit this section of the config file if you're connecting to a PVPGN server
###  your PVPGN server operator will tell you what to put here
 
bnet_custom_war3version = 23
bnet_custom_exeversion =
bnet_custom_exeversionhash =
bnet_custom_passwordhashtype =
 
###
### example configuration for connecting to a second official battle.net server
###
 
# bnet2_server = uswest.battle.net
# bnet2_cdkeyroc = FFFFFFFFFFFFFFFFFFFFFFFFFF
# bnet2_cdkeytft = FFFFFFFFFFFFFFFFFFFFFFFFFF
# bnet2_username =
# bnet2_password =
# bnet2_firstchannel = The Void
# bnet2_rootadmin =
# bnet2_commandtrigger = !
# bnet2_holdfriends = 1
# bnet2_holdclan = 1
# bnet2_bnlsserver = localhost
# bnet2_bnlsport = 9367
# bnet2_bnlswardencookie = 2
 
###
### example configuration for connecting to a third PVPGN battle.net server
###
 
# bnet3_server = server.eurobattle.net
# bnet3_cdkeyroc = FFFFFFFFFFFFFFFFFFFFFFFFFF
# bnet3_cdkeytft = FFFFFFFFFFFFFFFFFFFFFFFFFF
# bnet3_username =
# bnet3_password =
# bnet3_firstchannel = The Void
# bnet3_rootadmin =
# bnet3_commandtrigger = !
# bnet3_holdfriends = 1
# bnet3_holdclan = 1
# bnet3_custom_war3version = 23
# bnet3_custom_exeversion = 184 0 22 1
# bnet3_custom_exeversionhash = 219 152 153 144
# bnet3_custom_passwordhashtype = pvpgn



Lancement


  • Voici un script tout simple pour lancer le bot, créer le fichier ~/startbot.sh contenant ceci :


cd ~/ghost
screen -dmS ghostpp /home/wc3bot/ghost/ghost++


  • Aller voir dans la log (fichier ~/ghost/ghost.log) pour voir si le bot est bien connecté.

Il faut notamment être attentif à la connexion au serveur BNLS.
Si l'authentification BNLS échoue alors le bot sera déconnecté de Battle.Net au bout de 2-3 minutes et essaiera de se reconnecter 90 secondes plus tard.
Si c'est le cas rien ne sert de le laisser tourner en boucle, il faut changer de serveur BNLS, sinon votre IP risque d'être bannie de Battle.Net pour deux semaines.
Si la log n'a pas bougé pendant 5 minutes c'est gagné !

  • Pour arrêter GHost++ :

- rentrer la commande screen -r et faire CTRL+C
- ou, si ça ne fonctionne pas, repérer le processus et le tuer (ps -eaf|grep ghostpp puis kill xxxxx)


Personnalisations


L'avantage de compiler un programme à partir des sources, c'est qu'on peut modifier l'application à notre sauce. Voici une liste des modifications que j'ai mises en place : lien

mercredi, 20 mai 2009

GHost++ : ajout de quelques fonctions intéressantes

Démarrer le compte à rebours de 10 au lieu de 5

Fichier : game_base.cpp
Fonction : void CBaseGame :: StartCountDown( bool force )
Modification :
2 fois dans la fonction, au début et à la fin, on remplace :

m_CountDownCounter = 5;

par :

m_CountDownCounter = 10;



Empêcher le compte à rebours si tous les slots ne sont pas remplis

Fichier : game_base.cpp
Fonction : void CBaseGame :: StartCountDown( bool force )
Modification :
Le début de la fonction est modifié de :

{
	if( !m_CountDownStarted )
	{
		if( force )
		{
			m_CountDownStarted = true;
			m_CountDownCounter = 5;
		}
		else
		{
			// check if everyone has the map
			string StillDownloading;

en :

{
	if( !m_CountDownStarted )
	{
		if( force )
		{
			m_CountDownStarted = true;
			m_CountDownCounter = 10;
		}
		else
		{
                        // ajout pir
	        	// verifie qu'il n'y a pas de slot ouvert
		        if( GetSlotsOpen( ) > 0 )
		        {
		                SendAllChat( "Slot(s) open, fill them" );
		                return;
		        }
			// check if everyone has the map
			string StillDownloading;



Avoir une liste des pays bannis

Fichier : ghost.cfg
Modification : par exemple pour bannir l'Espagne, l'Italie et l'Allemagne on rajoute la ligne :

bannedcountries = ESITDE


Fichier : ghost.h
Modification : après la ligne suivante :

string m_AdminGamePassword;	// config value: the admin game password

On rajoute ceci :

string m_BannedCountries;	// custom value: banned countries


Fichier : ghost.cpp
Modification : après la ligne suivante :

m_AdminGamePassword = CFG->GetString( "admingame_password", string( ) );

On rajoute ceci :

m_BannedCountries = CFG->GetString( "bannedcountries", string( ));


Fichier : game_base.cpp
Modification : après le bloc suivant :

// check if the new player's name is banned
 
	for( vector<CBNET *> :: iterator i = m_GHost->m_BNETs.begin( ); i != m_GHost->m_BNETs.end( ); i++ )
	{
		CDBBan *Ban = (*i)->IsBanned( joinPlayer->GetName( ) );
 
		if( Ban )
		{
			CONSOLE_Print( "[GAME: " + m_GameName + "] player [" + joinPlayer->GetName( ) + "] is trying to join the game but is banned" );
			SendAllChat( m_GHost->m_Language->TryingToJoinTheGameButBanned( joinPlayer->GetName( ) ) );
			potential->SetDeleteMe( true );
			return;
		}
	}

Mais avant celui-ci :

// try to find an empty slot
 
	unsigned char SID = GetEmptySlot( false );
 
	// check if the player is an admin or root admin on any connected realm for determining reserved status
	// we can't just use the spoof checked realm like in EventPlayerBotCommand because the player hasn't spoof checked yet
 
	bool AnyAdminCheck = false;

On rajoute ceci :

// [FROMENFORCER]
	//Make sure from checking is enabled and config values are clean
	if(!m_GHost->m_BannedCountries.empty( ) || m_GHost->m_BannedCountries.length() % 2 != 0)
	{
		int num;
		vector<string> BannedLocations;
		string PlayerLocation;
		bool playerIsApproved;
 
		if(m_GHost->m_BannedCountries.length() == 2)
			num = 1;
		else
			num = m_GHost->m_BannedCountries.length() / 2;
 
		//Loop through banned countries and construct an array
		for(int i = 0; i < m_GHost->m_BannedCountries.length(); i += 2)
			BannedLocations.push_back(m_GHost->m_BannedCountries.substr(i,2));
 
		//Get their location
		PlayerLocation = m_GHost->m_DBLocal->FromCheck( UTIL_ByteArrayToUInt32( potential->GetExternalIP( ), true ));
 
		//Kick if not from an allowed location, ignore if their location is approved or cannot be found "??"
		playerIsApproved = true;
 
		//Try to make a match
		for(int x = 0; x < num; x++)
		{
			//Ban the player if their country is banned
			if(PlayerLocation == BannedLocations[x])
				playerIsApproved = false;
		}
 
		if(!playerIsApproved && PlayerLocation != "??")
		{
			//Player location has been found and is invalid, deny them entry
			CONSOLE_Print("[FROMENFORCER] Player [" + joinPlayer->GetName() + "] tried to join the game but is not from an approved location (" + PlayerLocation + ")");
			SendAllChat("[" + joinPlayer->GetName() + "] tried to join the game but is not from an approved location (" + PlayerLocation + ")");
			potential->SetDeleteMe(true);
			return;
		}
	}


dimanche, 14 septembre 2008

Installation d'un serveur murmur

Tout est déjà expliqué sur le site du projet, mais voici quand même l'ensemble des commandes passées.

En root, on crée le user murmur et on se connecte avec :
root:$ adduser murmur
root:$ su murmur

Téléchargement et décompression de murmur-static_x86-1.1.6.tar.bz2 dans le home :
murmur:$ cd ~
murmur:$ wget http://freefr.dl.sourceforge.net/project/mumble/Mumble/1.1.8/murmur-static_x86-1.1.8.tar.lzma
murmur:$ lzma -d murmur-static_x86-1.1.8.tar.lzma
murmur:$ tar -xf murmur-static_x86-1.1.8.tar
murmur:$ mv murmur-static_x86-1.1.8/ murmur

Lancement du serveur :
murmur:$ cd murmur
murmur:$ ./murmur.x86

Création du password pour le user SuperUser :
murmur:$ ./murmur.x86 -supw <password>

Installation du client sous Windows

Connexion avec SuperUser

Création des canaux : CSS, Dota, ...

kill du processus murmur (vu avec ps -eaf|grep murmur)

Dans murmur.ini, changer 2 lignes :
# Murmur defaults to not using D-Bus. If you wish to use dbus, which is one of the
# RPC methods available in murmur, please specify so here.
#
dbus=system
La 2ième ligne :
# Password to join server
serverpassword=lemotdepasse


Installation de dbus :
murmur:$ exit
root:$ apt-get install dbus

Création du fichier /etc/dbus-1/system.d/murmurd.conf :
root:$ vi /etc/dbus-1/system.d/murmurd.conf

Ce fichier contient :

<!DOCTYPE busconfig PUBLIC
  "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="murmur">
     <allow own="net.sourceforge.mumble.murmur"/>
   </policy>
   <policy user="root">
     <allow own="net.sourceforge.mumble.murmur"/>
   </policy>
   <policy context="default">
     <allow send_destination="net.sourceforge.mumble.murmur"/>
     <allow receive_sender="net.sourceforge.mumble.murmur"/>
   </policy>
 </busconfig>


On relance dbus :
root:$ /etc/init.d/dbus restart

On relance le serveur murmur :
root:$ su murmur
murmur:$ cd ~/murmur
murmur:$ ./murmur.x86

Vérification que ça fonctionne :

murmur:$ dbus-send --system --dest=net.sourceforge.mumble.murmur --type=method_call --print-reply / org.freedesktop.DBus.Introspectable.Introspect
murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call / net.sourceforge.mumble.Meta.getDefaultConf



Exemple d'utilisation de dbus pour ajouter un user :

murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call /<serverid> net.sourceforge.mumble.Murmur.registerPlayer string:"<username>"
murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call /<serverid> net.sourceforge.mumble.Murmur.getRegisteredPlayers string:"<username>"
murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call /<serverid> net.sourceforge.mumble.Murmur.setRegistration int32:<userid> string:"<username>" string:"<email>" string:"<password>"


Exemple concret :

murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call /1 net.sourceforge.mumble.Murmur.registerPlayer string:"kevin"
murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call /1 net.sourceforge.mumble.Murmur.getRegisteredPlayers string:"kevin"
murmur:$ dbus-send --system --print-reply --dest=net.sourceforge.mumble.murmur --type=method_call /1 net.sourceforge.mumble.Murmur.setRegistration int32:1 string:"kevin" string:"" string:"passkevin"


Ensuite pour le second user, le <userid> sera 2, ainsi de suite...

Ainsi une fois les users enregistrés, le SuperUser peut se connecter à Mumble et mettre ces utilisateurs priviligiés dans des groupes (admin, etc.).

dimanche, 13 mai 2007

Redémarrer le serveur TeamSpeak

Se connecter avec le user teamspeak
Aller dans :
/home/teamspeak/tss2_rc2/
Taper :
./teamspeak2-server_startscript restart