diff --git a/hwe/battle_simulator.php b/hwe/battle_simulator.php
index cb279f56..a4ad377d 100644
--- a/hwe/battle_simulator.php
+++ b/hwe/battle_simulator.php
@@ -40,22 +40,34 @@ $startYear = $gameStor->getValue('startyear');
diff --git a/hwe/css/battle_simulator.css b/hwe/css/battle_simulator.css
index 91fdcdb8..a7539a41 100644
--- a/hwe/css/battle_simulator.css
+++ b/hwe/css/battle_simulator.css
@@ -10,4 +10,8 @@
.form_sample{
display:none;
+}
+
+input[type=number]{
+ text-align:right;
}
\ No newline at end of file
diff --git a/hwe/func_converter.php b/hwe/func_converter.php
index ef7503ed..3c9b3c98 100644
--- a/hwe/func_converter.php
+++ b/hwe/func_converter.php
@@ -15,7 +15,7 @@ function NationCharCall($call) {
$invTable[$name] = $typeID;
}
}
- return $invTable[$name]??0;
+ return $invTable[$call]??0;
}
function getCharacterList(){
diff --git a/hwe/js/battle_simulator.js b/hwe/js/battle_simulator.js
index 4d1b2ae1..a087ebdc 100644
--- a/hwe/js/battle_simulator.js
+++ b/hwe/js/battle_simulator.js
@@ -257,10 +257,12 @@ jQuery(function($){
return true;
}
- var exportGeneralInfoForDB = function($general, idx){
+ var exportGeneralInfoForDB = function($general){
var retVal = exportGeneralInfo($general);
var dbVal = {
+ nation: (retVal.no)<=1 ? 1 : 2,
+ city: (retVal.no)<=1 ? 1 : 2,
turntime:'2018-08-26 12:00',
leader2:0,
power2:0,
@@ -279,16 +281,7 @@ jQuery(function($){
experience:Math.pow(retVal.explevel, 2),
};
- if(idx <= 0){
- dbVal['name'] = '출병자';
- dbVal['nation'] = 1;
- }
- else{
- dbVal['name'] = '수비자{0}'.format(idx);
- dbVal['nation'] = 2;
- }
-
- return $.merge(retVal, defaultVal);
+ return $.merge(retVal, dbVal);
}
var getGeneralFrame = function($btn){
@@ -369,8 +362,49 @@ jQuery(function($){
importGeneralInfo(getGeneralDetail($newObj), generalData);
}
+ var exportAll = function(forDB){
+ if(forDB === undefined){
+ forDB = false;
+ }
+
+ var attackerGeneral = (forDB?exportGeneralInfoForDB:exportGeneralInfo)($('.attacker_form'));
+
+ var defenderGenerals = $('.defender_form').map(function(){
+ return (forDB?exportGeneralInfoForDB:exportGeneralInfo)($(this));
+ }).toArray();
+
+ var defaultCity = {
+ nation:0,
+ def:1000,
+ wall:1000,
+ };
+
+ var defenderCity = {
+ def: parseInt($('#city_def').val()),
+ wall: parseInt($('#city_wall').val()),
+ };
+
+ var year = parseInt($('#year').val());
+ var month = parseInt($('#month').val());
+ var repeatCnt = parseInt($('#repeat_cnt').val());
+
+ }
+
+ var beginBattle = function(){
+ var attackerGeneral = exportGeneralInfoForDB($('.attacker_form'));
+
+ var defenderGenerals = $('.defender_form').map(function(){
+ return exportGeneralInfoForDB($(this));
+ }).toArray();
+ console.log(attackerGeneral);
+ console.log(defenderGenerals);
+ }
+
initBasicEvent();
$attackerCard.append($generalForm.clone(true,true));
addDefender();
+ $('.btn-begin_battle').click(function(){
+ beginBattle();
+ });
});
\ No newline at end of file