mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Updated ServerTrader & added Categories
This commit is contained in:
@@ -1,17 +0,0 @@
|
|||||||
#include "TraderCategory.hpp"
|
|
||||||
|
|
||||||
class CfgServerTrader {
|
|
||||||
|
|
||||||
//Hero Trader for Example
|
|
||||||
class RU_Functionary1 { //Classname of the person
|
|
||||||
humanity = "hero"; //If Hero, normal or bandit
|
|
||||||
category[] = { //{"DisplayName","LinkedCategory"}
|
|
||||||
{"Ammunition","ammunition_1"},
|
|
||||||
{"Clothes","clothes_1"},
|
|
||||||
{"Helicopter Armed","heliarmed_1"},
|
|
||||||
{"Military Armed","militaryarmed_1"},
|
|
||||||
{"Trucks Armed","truckarmed_1"},
|
|
||||||
{"Weapons","weapons_1"}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
#include "CfgServerTrader\TraderCategory.hpp"
|
|
||||||
|
|
||||||
class CfgServerTrader {
|
class CfgServerTrader {
|
||||||
#include "CfgServerTrader\TraderHero.hpp"
|
#include "CfgServerTrader\TraderHero.hpp"
|
||||||
#include "CfgServerTrader\TraderFriendly.hpp"
|
#include "CfgServerTrader\TraderFriendly.hpp"
|
||||||
#include "CfgServerTrader\TraderNeutral.hpp"
|
#include "CfgServerTrader\TraderNeutral.hpp"
|
||||||
#include "CfgServerTrader\TraderBandit.hpp"
|
#include "CfgServerTrader\TraderBandit.hpp"
|
||||||
|
};
|
||||||
|
|
||||||
|
class CfgTraderCategory {
|
||||||
|
#include "CfgTraderCategory\HeroAmmunition.hpp"
|
||||||
};
|
};
|
||||||
@@ -7,12 +7,14 @@ use Data::Dumper;
|
|||||||
|
|
||||||
my $pathServerTradersSQF = '..\..\Server Files\MPMissions\DayZ_Epoch_11.Chernarus\server_traders.sqf';
|
my $pathServerTradersSQF = '..\..\Server Files\MPMissions\DayZ_Epoch_11.Chernarus\server_traders.sqf';
|
||||||
my $pathServerTradersCfg = '..\..\SQF\dayz_code\Configs\CfgServerTrader\\';
|
my $pathServerTradersCfg = '..\..\SQF\dayz_code\Configs\CfgServerTrader\\';
|
||||||
|
my $pathServerTraderCategoriesCfg = '..\..\SQF\dayz_code\Configs\CfgServerTraderCategories\\';
|
||||||
my $MySQL = DBI->connect('DBI:mysql:host=localhost;database=test2', 'root', 'root');
|
my $MySQL = DBI->connect('DBI:mysql:host=localhost;database=test2', 'root', 'root');
|
||||||
|
|
||||||
open(TRADERSQF, '<', $pathServerTradersSQF) or die $!;
|
open(TRADERSQF, '<', $pathServerTradersSQF) or die $!;
|
||||||
my $trader = '';
|
my $trader = '';
|
||||||
my $isTrader = 0;
|
my $isTrader = 0;
|
||||||
my @traders;
|
my @traders;
|
||||||
|
my $traderCategories = {};
|
||||||
while (<TRADERSQF>) {
|
while (<TRADERSQF>) {
|
||||||
if (/^menu_(\w+)\s*=\s*\[/) {
|
if (/^menu_(\w+)\s*=\s*\[/) {
|
||||||
$trader = '{"'.$1.'":[';
|
$trader = '{"'.$1.'":[';
|
||||||
@@ -84,6 +86,7 @@ foreach my $traderhuman (keys $traderHumanity) {
|
|||||||
$catName =~ s~ |-|/~~g;
|
$catName =~ s~ |-|/~~g;
|
||||||
|
|
||||||
$cfg .= "\t\t{\"".$cat->[0]."\",\"".$catName."\"}\n";
|
$cfg .= "\t\t{\"".$cat->[0]."\",\"".$catName."\"}\n";
|
||||||
|
$traderCategories->{$catName} = $cat->[1];
|
||||||
}
|
}
|
||||||
$cfg .= "\t};\n";
|
$cfg .= "\t};\n";
|
||||||
$cfg .= "};\n"
|
$cfg .= "};\n"
|
||||||
@@ -94,4 +97,16 @@ foreach my $traderhuman (keys $traderHumanity) {
|
|||||||
close(CFG);
|
close(CFG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach my $traderCategory (keys $traderCategories) {
|
||||||
|
my $cfg = '';
|
||||||
|
|
||||||
|
$cfg .= "class ".$traderCategory." {\n";
|
||||||
|
$cfg .= "\ttid = ".$traderCategories->{$traderCategory}.";\n";
|
||||||
|
$cfg .= "};\n";
|
||||||
|
|
||||||
|
open(CFG, '>', $pathServerTraderCategoriesCfg.$traderCategory.'.hpp') or die $!;
|
||||||
|
print CFG $cfg;
|
||||||
|
close(CFG);
|
||||||
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
Reference in New Issue
Block a user