v5.1 代码策略
This commit is contained in:
+92
-76
@@ -234,10 +234,11 @@ void __fastcall TAIForm::WebProcessMessageReceived(TObject* Sender, const _di_IC
|
|||||||
TJSONObject* opts = new TJSONObject();
|
TJSONObject* opts = new TJSONObject();
|
||||||
TJSONArray* rows = new TJSONArray();
|
TJSONArray* rows = new TJSONArray();
|
||||||
|
|
||||||
if( IsCodePolicy(p->kind) ){ //代码策略:data只有code(打注一体另有miniChip)
|
if( IsCodePolicy(p->kind) ){ //代码策略:data只有code与roadType(打注一体另有miniChip)
|
||||||
data->AddPair( "code", new TJSONString( p->code ) );
|
data->AddPair( "code", new TJSONString( p->code ) );
|
||||||
if( p->kind==KIND_BET_WCH )
|
if( p->kind!=KIND_BET_SPE )
|
||||||
data->AddPair( "miniChip", new TJSONNumber( ((TBetChipPolicy*)p)->miniChip ) );
|
data->AddPair( "miniChip", new TJSONNumber( ((TBetChipPolicy*)p)->miniChip ) );
|
||||||
|
data->AddPair( "roadType", new TJSONNumber( p->road ) );
|
||||||
}
|
}
|
||||||
else if( p->kind == KIND_BET_ASK ){ //庄闲问路(小强路特例,rows留空)
|
else if( p->kind == KIND_BET_ASK ){ //庄闲问路(小强路特例,rows留空)
|
||||||
opts->AddPair( "适用路单", new TJSONString( "小强路" ) );
|
opts->AddPair( "适用路单", new TJSONString( "小强路" ) );
|
||||||
@@ -556,6 +557,18 @@ TAIForm::ApplyResult TAIForm::SaveAIPolicy(const String& json)
|
|||||||
r.message = "解析失败: 缺少 code 字段"; delete obj; return r; }
|
r.message = "解析失败: 缺少 code 字段"; delete obj; return r; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//代码打法(特殊打法/打注一体)的data里还需要roadType(本策略适用的路单):
|
||||||
|
//0=珠盘路 1=大路 2=大眼路 3=小路 4=小强路
|
||||||
|
int codeRoad = 0;
|
||||||
|
if( ptype==TYPE_P_BET && IsCodePolicy(pkind) ){
|
||||||
|
TJSONValue* vRoad = dataObj->GetValue("roadType");
|
||||||
|
if( !vRoad || !vRoad->InheritsFrom(__classid(TJSONNumber)) ){
|
||||||
|
r.message = "解析失败: 缺少 roadType 字段或类型错误"; delete obj; return r; }
|
||||||
|
codeRoad = (int)((TJSONNumber*)vRoad)->AsInt;
|
||||||
|
if( codeRoad<0 || codeRoad>4 ){
|
||||||
|
r.message = "校验失败: roadType 必须为 0-4 的整数"; delete obj; return r; }
|
||||||
|
}
|
||||||
|
|
||||||
//代码策略的data中还需要miniChip(最小非0注码):仅打注一体与特殊注码两类需要,
|
//代码策略的data中还需要miniChip(最小非0注码):仅打注一体与特殊注码两类需要,
|
||||||
//特殊打法只管下注方向、不输出注码,无miniChip
|
//特殊打法只管下注方向、不输出注码,无miniChip
|
||||||
//注意KIND_BET_SPE与KIND_CHIP_SPE同为101,必须配ptype才能区分
|
//注意KIND_BET_SPE与KIND_CHIP_SPE同为101,必须配ptype才能区分
|
||||||
@@ -576,23 +589,32 @@ TAIForm::ApplyResult TAIForm::SaveAIPolicy(const String& json)
|
|||||||
//构造策略对象与行文本
|
//构造策略对象与行文本
|
||||||
String line;
|
String line;
|
||||||
TBasePolicy* pPolicy = NULL;
|
TBasePolicy* pPolicy = NULL;
|
||||||
if( pkind==KIND_BET_WCH ){
|
if(IsCodePolicy(pkind)){
|
||||||
//打注一体:bet+chip代码策略,带miniChip
|
if(pkind==KIND_BET_WCH){
|
||||||
TBetChipPolicy* pBC = new TBetChipPolicy;
|
//打注一体:bet+chip代码策略,带roadType/miniChip
|
||||||
pBC->type = 2; pBC->kind = pkind; pBC->desc = desc;
|
pPolicy = new TBetChipPolicy;
|
||||||
pBC->code = dataObj->GetValue("code")->Value();
|
((TBetChipPolicy*)pPolicy)->road = codeRoad;
|
||||||
pBC->miniChip = codeMiniChip;
|
((TBetChipPolicy*)pPolicy)->miniChip = codeMiniChip;
|
||||||
pPolicy = pBC;
|
}
|
||||||
}
|
else if( pkind==KIND_BET_SPE ){
|
||||||
else if( pkind==KIND_BET_SPE ){
|
//特殊打法:bet代码策略,带roadType
|
||||||
//特殊打法:代码策略,无miniChip
|
pPolicy = new TBetPolicy;
|
||||||
TBetPolicy* pBP = new TBetPolicy;
|
((TBetPolicy*)pPolicy)->road = codeRoad;
|
||||||
pBP->type = 2; pBP->kind = pkind; pBP->desc = desc;
|
}
|
||||||
pBP->code = dataObj->GetValue("code")->Value();
|
else if( pkind==KIND_CHIP_SPE ){
|
||||||
pPolicy = pBP;
|
//特殊注码:chip代码策略,带miniChip
|
||||||
|
pPolicy = new TChipPolicy;
|
||||||
|
((TChipPolicy*)pPolicy)->miniChip = codeMiniChip;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPolicy->type = 2;
|
||||||
|
pPolicy->kind = pkind;
|
||||||
|
pPolicy->desc = desc;
|
||||||
|
pPolicy->code = StringReplace(dataObj->GetValue("code")->Value(), "\n", "", TReplaceFlags() << rfReplaceAll);
|
||||||
}
|
}
|
||||||
else if( ptype == TYPE_P_BET ){
|
else if( ptype == TYPE_P_BET ){
|
||||||
TBetPolicy* pBP = new TBetPolicy;
|
TBetPolicy* pBP = new TBetPolicy;
|
||||||
|
|
||||||
pBP->type = 2; pBP->kind = pkind; pBP->desc = desc;
|
pBP->type = 2; pBP->kind = pkind; pBP->desc = desc;
|
||||||
String road = opts ? ((TJSONString*)opts->GetValue("适用路单"))->Value() : String("");
|
String road = opts ? ((TJSONString*)opts->GetValue("适用路单"))->Value() : String("");
|
||||||
if( road == "大路" ) pBP->road = 1;
|
if( road == "大路" ) pBP->road = 1;
|
||||||
@@ -615,66 +637,58 @@ TAIForm::ApplyResult TAIForm::SaveAIPolicy(const String& json)
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
TChipPolicy* pCP = NULL;
|
TChipPolicy* pCP = NULL;
|
||||||
if( IsCodePolicy(pkind) ){
|
|
||||||
pCP = new TChipPolicy;
|
if( pkind == KIND_CHIP_HAN ) pCP = new TTierPolicy;
|
||||||
pCP->type = 2; pCP->kind = pkind; pCP->desc = desc;
|
else if( pkind == KIND_CHIP_LEV || pkind == KIND_CHIP_COM ) pCP = new TLevelPolicy;
|
||||||
pCP->code = dataObj->GetValue("code")->Value();
|
else if( pkind == KIND_CHIP_WLD ) pCP = new TWLDiffPolicy;
|
||||||
pCP->miniChip = codeMiniChip;
|
else pCP = new TChipPolicy;
|
||||||
pPolicy = pCP;
|
pCP->type = 2; pCP->kind = pkind; pCP->desc = desc;
|
||||||
|
if( pkind != KIND_CHIP_RAN && opts ){
|
||||||
|
pCP->dead = (int)((TJSONNumber*)opts->GetValue("爆缆方式"))->AsInt;
|
||||||
|
pCP->deadPause = (int)((TJSONNumber*)opts->GetValue("暂停分钟"))->AsInt;
|
||||||
|
if( pkind == KIND_CHIP_HAN ){
|
||||||
|
TTierPolicy* tp = (TTierPolicy*)pCP;
|
||||||
|
tp->bTierWinRet = ((TJSONBool*)opts->GetValue("高层赢多回基"))->AsBoolean;
|
||||||
|
tp->bTierAccChip = ((TJSONBool*)opts->GetValue("净输值累加"))->AsBoolean;
|
||||||
|
tp->bTierLos0 = ((TJSONBool*)opts->GetValue("输多打0"))->AsBoolean;
|
||||||
|
}
|
||||||
|
else if( pkind >= KIND_CHIP_LEV ){
|
||||||
|
TLevelPolicy* lp = (TLevelPolicy*)pCP;
|
||||||
|
lp->bTotalDiff = ((TJSONBool*)opts->GetValue("总体计算"))->AsBoolean;
|
||||||
|
lp->bInstant = ((TJSONBool*)opts->GetValue("即时升降"))->AsBoolean;
|
||||||
|
if( pkind == KIND_CHIP_WLD ) ((TWLDiffPolicy*)pCP)->bIndie = ((TJSONBool*)opts->GetValue("升降清零"))->AsBoolean;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
for(int i=0; i<rows->Count; i++){
|
||||||
if( pkind == KIND_CHIP_HAN ) pCP = new TTierPolicy;
|
TJSONObject* rObj = (TJSONObject*)rows->Items[i];
|
||||||
else if( pkind == KIND_CHIP_LEV || pkind == KIND_CHIP_COM ) pCP = new TLevelPolicy;
|
if( i>0 ) line += ";";
|
||||||
else if( pkind == KIND_CHIP_WLD ) pCP = new TWLDiffPolicy;
|
if( pkind == KIND_CHIP_COM )
|
||||||
else pCP = new TChipPolicy;
|
line += ((TJSONString*)rObj->GetValue("常规方案"))->Value() + "," + ((TJSONString*)rObj->GetValue("倍数"))->Value() + ","
|
||||||
pCP->type = 2; pCP->kind = pkind; pCP->desc = desc;
|
+ ((TJSONString*)rObj->GetValue("赢利"))->Value() + "," + ((TJSONString*)rObj->GetValue("赢走向"))->Value() + ","
|
||||||
if( pkind != KIND_CHIP_RAN && opts ){
|
+ ((TJSONString*)rObj->GetValue("亏损"))->Value() + "," + ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
||||||
pCP->dead = (int)((TJSONNumber*)opts->GetValue("爆缆方式"))->AsInt;
|
else if( pkind == KIND_CHIP_HAN )
|
||||||
pCP->deadPause = (int)((TJSONNumber*)opts->GetValue("暂停分钟"))->AsInt;
|
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("手数"))->Value() + ","
|
||||||
if( pkind == KIND_CHIP_HAN ){
|
+ ((TJSONString*)rObj->GetValue("赢走向"))->Value() + "," + ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
||||||
TTierPolicy* tp = (TTierPolicy*)pCP;
|
else if( pkind == KIND_CHIP_LEV )
|
||||||
tp->bTierWinRet = ((TJSONBool*)opts->GetValue("高层赢多回基"))->AsBoolean;
|
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("赢利"))->Value() + ","
|
||||||
tp->bTierAccChip = ((TJSONBool*)opts->GetValue("净输值累加"))->AsBoolean;
|
+ ((TJSONString*)rObj->GetValue("赢走向"))->Value() + "," + ((TJSONString*)rObj->GetValue("亏损"))->Value() + ","
|
||||||
tp->bTierLos0 = ((TJSONBool*)opts->GetValue("输多打0"))->AsBoolean;
|
+ ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
||||||
}
|
else if( pkind == KIND_CHIP_WLD )
|
||||||
else if( pkind >= KIND_CHIP_LEV ){
|
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("大于等于"))->Value() + ","
|
||||||
TLevelPolicy* lp = (TLevelPolicy*)pCP;
|
+ ((TJSONString*)rObj->GetValue("赢走向"))->Value() + "," + ((TJSONString*)rObj->GetValue("小于"))->Value() + ","
|
||||||
lp->bTotalDiff = ((TJSONBool*)opts->GetValue("总体计算"))->AsBoolean;
|
+ ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
||||||
lp->bInstant = ((TJSONBool*)opts->GetValue("即时升降"))->AsBoolean;
|
else
|
||||||
if( pkind == KIND_CHIP_WLD ) ((TWLDiffPolicy*)pCP)->bIndie = ((TJSONBool*)opts->GetValue("升降清零"))->AsBoolean;
|
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("赢走向"))->Value() + ","
|
||||||
}
|
+ ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
||||||
}
|
|
||||||
for(int i=0; i<rows->Count; i++){
|
|
||||||
TJSONObject* rObj = (TJSONObject*)rows->Items[i];
|
|
||||||
if( i>0 ) line += ";";
|
|
||||||
if( pkind == KIND_CHIP_COM )
|
|
||||||
line += ((TJSONString*)rObj->GetValue("常规方案"))->Value() + "," + ((TJSONString*)rObj->GetValue("倍数"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("赢利"))->Value() + "," + ((TJSONString*)rObj->GetValue("赢走向"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("亏损"))->Value() + "," + ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
|
||||||
else if( pkind == KIND_CHIP_HAN )
|
|
||||||
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("手数"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("赢走向"))->Value() + "," + ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
|
||||||
else if( pkind == KIND_CHIP_LEV )
|
|
||||||
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("赢利"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("赢走向"))->Value() + "," + ((TJSONString*)rObj->GetValue("亏损"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
|
||||||
else if( pkind == KIND_CHIP_WLD )
|
|
||||||
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("大于等于"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("赢走向"))->Value() + "," + ((TJSONString*)rObj->GetValue("小于"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
|
||||||
else
|
|
||||||
line += ((TJSONString*)rObj->GetValue("注码"))->Value() + "," + ((TJSONString*)rObj->GetValue("赢走向"))->Value() + ","
|
|
||||||
+ ((TJSONString*)rObj->GetValue("输走向"))->Value();
|
|
||||||
}
|
|
||||||
int err = pCP->ParsePolicy(((AnsiString)line).c_str(), TYPE_P_CHIP);
|
|
||||||
if( err ){
|
|
||||||
int row = err >> 16;
|
|
||||||
int col = err & 0xF;
|
|
||||||
r.code = 3; r.message = "校验失败: 第 " + IntToStr(row) + " 行第 " + IntToStr(col) + " 列格式有误";
|
|
||||||
delete pCP; delete obj; return r;
|
|
||||||
}
|
|
||||||
pPolicy = pCP;
|
|
||||||
}
|
}
|
||||||
|
int err = pCP->ParsePolicy(((AnsiString)line).c_str(), TYPE_P_CHIP);
|
||||||
|
if( err ){
|
||||||
|
int row = err >> 16;
|
||||||
|
int col = err & 0xF;
|
||||||
|
r.code = 3; r.message = "校验失败: 第 " + IntToStr(row) + " 行第 " + IntToStr(col) + " 列格式有误";
|
||||||
|
delete pCP; delete obj; return r;
|
||||||
|
}
|
||||||
|
pPolicy = pCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
//阶段三:命名
|
//阶段三:命名
|
||||||
@@ -689,7 +703,7 @@ TAIForm::ApplyResult TAIForm::SaveAIPolicy(const String& json)
|
|||||||
preName = index>=0 ? ap[index]->name : AutoNewPolicyName(ptype);
|
preName = index>=0 ? ap[index]->name : AutoNewPolicyName(ptype);
|
||||||
}
|
}
|
||||||
|
|
||||||
//主窗口置前
|
//主窗口置前
|
||||||
// if (Application->MainForm->WindowState == wsMinimized)
|
// if (Application->MainForm->WindowState == wsMinimized)
|
||||||
// Application->MainForm->WindowState = wsNormal;
|
// Application->MainForm->WindowState = wsNormal;
|
||||||
// Application->MainForm->BringToFront();
|
// Application->MainForm->BringToFront();
|
||||||
@@ -709,7 +723,9 @@ TAIForm::ApplyResult TAIForm::SaveAIPolicy(const String& json)
|
|||||||
int ret = SavePolicy(ptype, pPolicy, tgtIndex);
|
int ret = SavePolicy(ptype, pPolicy, tgtIndex);
|
||||||
if( ret >= 0 ){
|
if( ret >= 0 ){
|
||||||
r.ok = true; r.code = 0; r.id = pPolicy->id; r.name = finalName;
|
r.ok = true; r.code = 0; r.id = pPolicy->id; r.name = finalName;
|
||||||
PostMessage(Application->MainFormHandle, UM_POLICYCHANGED, 0x10000 | ptype, 0);
|
|
||||||
|
if(tgtIndex<0) //新增:通告主窗追加
|
||||||
|
PostMessage(Application->MainFormHandle, UM_POLICYCHANGED, 0x10000 | ptype, 0);
|
||||||
|
|
||||||
pPolicy = NULL; // 所有权已移交给 g_aBetPolicies,禁止释放
|
pPolicy = NULL; // 所有权已移交给 g_aBetPolicies,禁止释放
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -23,9 +23,9 @@ void __fastcall TChip02Frame::EditChipExit(TObject *Sender)
|
|||||||
TEdit* pE = (TEdit*)Sender;
|
TEdit* pE = (TEdit*)Sender;
|
||||||
|
|
||||||
int num;
|
int num;
|
||||||
if(!TryStrToInt(pE->Text, num) || num<g_MinOnBet || num>g_MaxOnBet ){
|
if(!TryStrToInt(pE->Text, num) || num<1 || num>g_MaxOnBet ){
|
||||||
ShowMessage("注码金额不能超过限红");
|
ShowMessage("注码不能小于 1 或大于限红");
|
||||||
pE->Text = pE==m_leMinChip ? "20" : "100";
|
pE->Text = pE==m_leMinChip ? "1" : "5";
|
||||||
pE->SetFocus();
|
pE->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -25,11 +25,18 @@ object CodesFrame: TCodesFrame
|
|||||||
object m_lblDesc: TLabel
|
object m_lblDesc: TLabel
|
||||||
Left = 40
|
Left = 40
|
||||||
Top = 63
|
Top = 63
|
||||||
Width = 169
|
Width = 65
|
||||||
Height = 15
|
Height = 15
|
||||||
AutoSize = False
|
|
||||||
Caption = #31574#30053#25551#36848#65306
|
Caption = #31574#30053#25551#36848#65306
|
||||||
end
|
end
|
||||||
|
object m_lblOption: TLabel
|
||||||
|
Left = 156
|
||||||
|
Top = 63
|
||||||
|
Width = 187
|
||||||
|
Height = 15
|
||||||
|
Alignment = taRightJustify
|
||||||
|
AutoSize = False
|
||||||
|
end
|
||||||
object m_memDesc: TMemo
|
object m_memDesc: TMemo
|
||||||
Left = 40
|
Left = 40
|
||||||
Top = 87
|
Top = 87
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ __published: // IDE-managed Components
|
|||||||
TMemo *m_memDesc;
|
TMemo *m_memDesc;
|
||||||
TLabel *m_lblTip;
|
TLabel *m_lblTip;
|
||||||
TLabel *m_lblDesc;
|
TLabel *m_lblDesc;
|
||||||
|
TLabel *m_lblOption;
|
||||||
private: // User declarations
|
private: // User declarations
|
||||||
public: // User declarations
|
public: // User declarations
|
||||||
__fastcall TCodesFrame(TComponent* Owner);
|
__fastcall TCodesFrame(TComponent* Owner);
|
||||||
|
|||||||
+224
-73
@@ -3,6 +3,7 @@
|
|||||||
#include "GameUnit.h"
|
#include "GameUnit.h"
|
||||||
#include "GlobalUnit.h"
|
#include "GlobalUnit.h"
|
||||||
#include "UtilityUnit.h"
|
#include "UtilityUnit.h"
|
||||||
|
#include "RBmasterMain.h"
|
||||||
|
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
|
|
||||||
@@ -493,6 +494,7 @@ void __fastcall TGame::Reset()
|
|||||||
|
|
||||||
bRun = bRev = bReset = bBreak = bPause
|
bRun = bRev = bReset = bBreak = bPause
|
||||||
= bReal = bIndPolicy = false;
|
= bReal = bIndPolicy = false;
|
||||||
|
bPreSPC = bPreBWC = false;
|
||||||
nChipMul = iRoad = iBetPolicy = iChipPolicy = -1;
|
nChipMul = iRoad = iBetPolicy = iChipPolicy = -1;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -504,6 +506,8 @@ void __fastcall TGame::ResetBet()
|
|||||||
iState = iBet = nChip = iBetSeq = iChipSeq = 0;
|
iState = iBet = nChip = iBetSeq = iChipSeq = 0;
|
||||||
bReal = bReset = false;
|
bReal = bReset = false;
|
||||||
aBets.clear();
|
aBets.clear();
|
||||||
|
sCtxSPB = sCtxSPC = sCtxBWC = ""; //新局重置时代码策略context清零
|
||||||
|
bPreSPC = bPreBWC = false;
|
||||||
|
|
||||||
if(pRankChip)
|
if(pRankChip)
|
||||||
pRankChip->Reset();
|
pRankChip->Reset();
|
||||||
@@ -526,10 +530,56 @@ int __fastcall TGame::Color2Bet(TBetPolicy* pBP, char clr)
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//统一 eval 入口:按 kind 组装 prelude 与 ctx,直接调用 MainForm::EvalJSCode
|
||||||
|
//kind→对应 ctx 字段:KIND_BET_SPE→sCtxSPB KIND_CHIP_SPE→sCtxSPC KIND_BET_WCH→sCtxBWC
|
||||||
|
//失败(通道未就绪/超时/校验失败)⇒ 停台,不得降级;成功时 ctx 回写
|
||||||
|
bool __fastcall TGame::EvalCodeJS(int kind, const String& sCode, TJSCodeRet& bs, int iCodeIn)
|
||||||
|
{
|
||||||
|
String* pCtx = kind==KIND_BET_SPE ? &sCtxSPB
|
||||||
|
: kind==KIND_CHIP_SPE ? &sCtxSPC : &sCtxBWC;
|
||||||
|
|
||||||
|
int iM = nChipMul<0 ? g_nChipMul : nChipMul;
|
||||||
|
bool bOk;
|
||||||
|
if(kind==KIND_CHIP_SPE){ //calcChip(result,chipMult,context)
|
||||||
|
String sPr = "var result=" + IntToStr(iCodeIn)
|
||||||
|
+ "; var chipMult=" + IntToStr(iM) + ";";
|
||||||
|
bOk = MainForm && MainForm->EvalJSCode(kind, sCode, sPr, *pCtx, bs);
|
||||||
|
}
|
||||||
|
else{ //road 拼装(读 road 历史)
|
||||||
|
String sRoad = "";
|
||||||
|
for(int i=0; i<aRes.size(); i++){
|
||||||
|
if(i) sRoad += ",";
|
||||||
|
sRoad += IntToStr(aRes[i]);
|
||||||
|
}
|
||||||
|
String sPr = "var road=[" + sRoad + "]";
|
||||||
|
if(kind==KIND_BET_WCH) //calcBetWithChip(road,chipMult,context)
|
||||||
|
sPr += "; var chipMult=" + IntToStr(iM);
|
||||||
|
sPr += ";";
|
||||||
|
|
||||||
|
bOk = MainForm && MainForm->EvalJSCode(kind, sCode, sPr, *pCtx, bs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bOk){ //执行失败:本台停下,不得降级
|
||||||
|
bRun = iBet = nChip = 0;
|
||||||
|
|
||||||
|
String sKind = kind==KIND_BET_SPE ? "SPB" : kind==KIND_CHIP_SPE ? "SPC" : "BWC";
|
||||||
|
// TLog::WriteLog("失败,代码策略执行失败," + vid + "," + IntToStr(iGame) + "," + sKind);
|
||||||
|
DebugPrint("%s 代码策略执行失败 kind=%d", ((AnsiString)vid).c_str(), kind);
|
||||||
|
if(hTable)
|
||||||
|
PostMessage(hTable, UM_LOG_UPDATE, ST_FAILED, 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*pCtx = bs.sCtx; //ctx 透传(空对象即重建)
|
||||||
|
|
||||||
|
DebugPrint("JS ret: bet=%d, chip=%d, blast=%d, minutes=%d", bs.iBet, bs.iChip, bs.iBlast, bs.iBlastMinutes);
|
||||||
|
|
||||||
|
return bOk;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void __fastcall TGame::CalcBet()
|
void __fastcall TGame::CalcBet()
|
||||||
{
|
{
|
||||||
iBet = nChip = 0; //默认不下注
|
|
||||||
|
|
||||||
int iBP = iBetPolicy>=0 ? iBetPolicy : g_iBetPolicy;
|
int iBP = iBetPolicy>=0 ? iBetPolicy : g_iBetPolicy;
|
||||||
TBetPolicy* pBP = (TBetPolicy*)g_aBetPolicies[iBP];
|
TBetPolicy* pBP = (TBetPolicy*)g_aBetPolicies[iBP];
|
||||||
|
|
||||||
@@ -538,8 +588,35 @@ void __fastcall TGame::CalcBet()
|
|||||||
if(uBP!=pBP->id){ //改用ID判断避免方案删除带来问题
|
if(uBP!=pBP->id){ //改用ID判断避免方案删除带来问题
|
||||||
uBP = pBP->id;
|
uBP = pBP->id;
|
||||||
aBets.clear();
|
aBets.clear();
|
||||||
|
sCtxSPB = sCtxBWC = ""; //打法策略切换时context清零
|
||||||
|
bPreBWC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//代码策略分支:SPB 每手评估;BWC 由 CalcResult 暂存,仅初发评估一次
|
||||||
|
if(pBP->kind==KIND_BET_SPE){
|
||||||
|
TJSCodeRet bs;
|
||||||
|
if(EvalCodeJS(KIND_BET_SPE, pBP->code, bs))
|
||||||
|
iBet = bs.iBet; //失败已由 EvalCodeJS 停台
|
||||||
|
|
||||||
|
iBetSeq = (uBP<<16) + aRes.size()+1; //保证打法方案切换检测有效
|
||||||
|
return; //不走既有匹配
|
||||||
|
}
|
||||||
|
if(pBP->kind==KIND_BET_WCH){
|
||||||
|
if(!bPreBWC){ //CalcResult已暂存本手注码及方向则原样使用
|
||||||
|
iBet = nChip = 0;
|
||||||
|
TJSCodeRet bs;
|
||||||
|
if(EvalCodeJS(KIND_BET_WCH, pBP->code, bs)){
|
||||||
|
iBet = bs.iBet;
|
||||||
|
nChip = bs.iChip * (nChipMul<0 ? g_nChipMul : nChipMul);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iBetSeq = (uBP<<16) + aRes.size()+1; //保证打法方案切换检测有效
|
||||||
|
return; //打注一体由 CalcResult 暂存
|
||||||
|
}
|
||||||
|
|
||||||
|
iBet = 0; //默认不下注,nChip 由 CalcChip 各分支赋值
|
||||||
|
|
||||||
if(!aBets.empty()){ //连续下注项
|
if(!aBets.empty()){ //连续下注项
|
||||||
if(aBets[0]==0 || aBets[0]==4){
|
if(aBets[0]==0 || aBets[0]==4){
|
||||||
iBet = aBets[0];
|
iBet = aBets[0];
|
||||||
@@ -695,18 +772,26 @@ void __fastcall TGame::CalcBet()
|
|||||||
void __fastcall TGame::CalcChip()
|
void __fastcall TGame::CalcChip()
|
||||||
{
|
{
|
||||||
int iCP = iChipPolicy>=0 ? iChipPolicy : g_iChipPolicy;
|
int iCP = iChipPolicy>=0 ? iChipPolicy : g_iChipPolicy;
|
||||||
|
if(iCP<0)
|
||||||
|
return;
|
||||||
|
|
||||||
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[iCP];
|
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[iCP];
|
||||||
|
TBetPolicy* pBP = (TBetPolicy*)g_aBetPolicies[iBetPolicy>=0 ? iBetPolicy : g_iBetPolicy];
|
||||||
|
|
||||||
bool bGlobalChip = !bIndPolicy && (g_aGames.bFloat || pCP->kind>=KIND_CHIP_LEV
|
bool bGlobalChip = !bIndPolicy && (g_aGames.bFloat || pCP->kind>=KIND_CHIP_LEV
|
||||||
&& pCP->kind<=KIND_CHIP_WLD
|
&& pCP->kind<=KIND_CHIP_WLD
|
||||||
&& ((TLevelPolicy*)pCP)->bTotalDiff);
|
&& ((TLevelPolicy*)pCP)->bTotalDiff);
|
||||||
int& iCS = !bIndPolicy && g_aGames.bFloat ? g_aGames.iChipSeq : iChipSeq;
|
int& iCS = !bIndPolicy && g_aGames.bFloat ? g_aGames.iChipSeq : iChipSeq;
|
||||||
|
|
||||||
|
//方案切换检测(代码策略同样需要,否则切换策略时进度不重置)
|
||||||
int uCP = iCS >> 20,
|
int uCP = iCS >> 20,
|
||||||
uCRnk = (iCS & 0xFF000) >> 12,
|
uCRnk = (iCS & 0xFF000) >> 12,
|
||||||
uCSeq = iCS & 0xFFF;
|
uCSeq = iCS & 0xFFF;
|
||||||
if(uCP!=pCP->id){ //改用ID判断避免方案删除带来问题
|
if(uCP!=pCP->id){ //改用ID判断避免方案删除带来问题
|
||||||
uCRnk = uCSeq = 0;
|
uCRnk = uCSeq = 0;
|
||||||
iCS = (pCP->id<<20);
|
iCS = (pCP->id<<20);
|
||||||
|
sCtxSPC = ""; //注码策略切换时context清零
|
||||||
|
bPreSPC = false;
|
||||||
|
|
||||||
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
||||||
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind)
|
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind)
|
||||||
@@ -721,6 +806,19 @@ void __fastcall TGame::CalcChip()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//代码策略:SPC 在 CalcResult 暂存(初发在此评估一次),BWC 直接穿过
|
||||||
|
if(pCP->kind==KIND_CHIP_SPE){
|
||||||
|
if(!bPreSPC){ //CalcResult未暂存时评估:初发/新注码策略传0,无结算手(iBet=0/tie/op>=2后)传3
|
||||||
|
nChip = 0;
|
||||||
|
TJSCodeRet bs;
|
||||||
|
if(EvalCodeJS(KIND_CHIP_SPE, pCP->code, bs, sCtxSPC.IsEmpty() ? 0 : 3))
|
||||||
|
nChip = bs.iChip * (bIndPolicy ? nChipMul : g_nChipMul);
|
||||||
|
}
|
||||||
|
return; //暂存的 nChip 原样使用
|
||||||
|
}
|
||||||
|
|
||||||
|
nChip = 0; //非代码策略:由下方各分支赋值
|
||||||
|
|
||||||
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
||||||
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind)
|
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind)
|
||||||
: GetRankChip(pCP->kind);
|
: GetRankChip(pCP->kind);
|
||||||
@@ -752,7 +850,7 @@ int __fastcall TGame::CalcResult(int op)
|
|||||||
int uBP = iBetSeq >> 16,
|
int uBP = iBetSeq >> 16,
|
||||||
uBSeq = iBetSeq & 0xFFFF;
|
uBSeq = iBetSeq & 0xFFFF;
|
||||||
|
|
||||||
if(!iBet || !uBSeq)// || uBSeq>aRes.size() && op!=2)// || !nChip) 允许注码为0
|
if(!iBet || !uBSeq)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int dType = 0; //是否爆缆
|
int dType = 0; //是否爆缆
|
||||||
@@ -814,71 +912,74 @@ int __fastcall TGame::CalcResult(int op)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//处理注码步骤
|
//处理注码步骤(打注一体无全局注码,iCP 为 -1,跳过本段)
|
||||||
int iCP = iChipPolicy>=0 ? iChipPolicy : g_iChipPolicy;
|
int iCP = iChipPolicy>=0 ? iChipPolicy : g_iChipPolicy;
|
||||||
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[iCP];
|
TChipPolicy* pCP = iCP>=0 && iCP<(int)g_aChipPolicies.size() ? (TChipPolicy*)g_aChipPolicies[iCP] : NULL;
|
||||||
bool bGlobalChip = !bIndPolicy && (g_aGames.bFloat || pCP->kind>=KIND_CHIP_LEV
|
|
||||||
&& pCP->kind<=KIND_CHIP_WLD
|
|
||||||
&& ((TLevelPolicy*)pCP)->bTotalDiff);
|
|
||||||
int& iCS = !bIndPolicy && g_aGames.bFloat ? g_aGames.iChipSeq : iChipSeq;
|
|
||||||
int uCP = iCS >> 20,
|
|
||||||
uCRnk = (iCS & 0xFF000) >> 12,
|
|
||||||
uCSeq = iCS & 0xFFF;
|
|
||||||
if(uCP!=pCP->id){
|
|
||||||
uCRnk = uCSeq = 0;
|
|
||||||
|
|
||||||
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
if(pCP){
|
||||||
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind)
|
bool bGlobalChip = !bIndPolicy && (g_aGames.bFloat || pCP->kind>=KIND_CHIP_LEV
|
||||||
: GetRankChip(pCP->kind);
|
&& pCP->kind<=KIND_CHIP_WLD
|
||||||
pRC->SetPolicy(pCP);
|
&& ((TLevelPolicy*)pCP)->bTotalDiff);
|
||||||
|
int& iCS = !bIndPolicy && g_aGames.bFloat ? g_aGames.iChipSeq : iChipSeq;
|
||||||
|
int uCP = iCS >> 20,
|
||||||
|
uCRnk = (iCS & 0xFF000) >> 12,
|
||||||
|
uCSeq = iCS & 0xFFF;
|
||||||
|
if(uCP!=pCP->id){
|
||||||
|
uCRnk = uCSeq = 0;
|
||||||
|
|
||||||
|
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
||||||
|
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind)
|
||||||
|
: GetRankChip(pCP->kind);
|
||||||
|
pRC->SetPolicy(pCP);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(bGlobalChip && g_aGames.pRankChip)
|
||||||
|
g_aGames.ClearRankChip();
|
||||||
|
else
|
||||||
|
ClearRankChip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
||||||
if(bGlobalChip && g_aGames.pRankChip)
|
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind) : GetRankChip(pCP->kind);
|
||||||
g_aGames.ClearRankChip();
|
|
||||||
else
|
if(pCP->kind==KIND_CHIP_COM && bGlobalChip && !g_aGames.bFloat && op<2)
|
||||||
ClearRankChip();
|
uCSeq = ((TComboChip*)pRC)->GetRankSeq(ret, uCRnk, uCSeq);
|
||||||
|
|
||||||
|
int rnk = (g_aGames.bFloat && g_aGames.iFloatGame!=iGame) ? uCRnk
|
||||||
|
: pRC->HandleResult(ret, wl);
|
||||||
|
if(rnk!=uCRnk){
|
||||||
|
uCRnk = rnk;
|
||||||
|
uCSeq = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if(pCP->kind==KIND_CHIP_NOR && (!g_aGames.bFloat || g_aGames.iFloatGame==iGame)){
|
||||||
else if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
TChipRow* pRow = (TChipRow*)pCP->aRows[uCSeq];
|
||||||
TRankChip* pRC = bGlobalChip ? g_aGames.GetRankChip(pCP->kind) : GetRankChip(pCP->kind);
|
if(ret==1)
|
||||||
|
uCSeq = pRow->iWin - 1;
|
||||||
if(pCP->kind==KIND_CHIP_COM && bGlobalChip && !g_aGames.bFloat && op<2)
|
else if(ret==2)
|
||||||
uCSeq = ((TComboChip*)pRC)->GetRankSeq(ret, uCRnk, uCSeq);
|
uCSeq = pRow->iLos - 1;
|
||||||
|
|
||||||
int rnk = (g_aGames.bFloat && g_aGames.iFloatGame!=iGame) ? uCRnk
|
|
||||||
: pRC->HandleResult(ret, wl);
|
|
||||||
if(rnk!=uCRnk){
|
|
||||||
uCRnk = rnk;
|
|
||||||
uCSeq = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(pCP->kind==KIND_CHIP_NOR && (!g_aGames.bFloat || g_aGames.iFloatGame==iGame)){
|
|
||||||
TChipRow* pRow = (TChipRow*)pCP->aRows[uCSeq];
|
|
||||||
if(ret==1)
|
|
||||||
uCSeq = pRow->iWin - 1;
|
|
||||||
else if(ret==2)
|
|
||||||
uCSeq = pRow->iLos - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(uCSeq<0 || uCRnk<0){
|
|
||||||
dType = pCP->dead + 1;
|
|
||||||
uCRnk = uCSeq = 0;
|
|
||||||
|
|
||||||
g_aGames.betData.dead++;
|
|
||||||
|
|
||||||
if(!bGlobalChip){
|
|
||||||
TBetLog* pLog = NewBetLog();
|
|
||||||
pLog->ev = LOGEVT_DEAD;
|
|
||||||
pLog->op = pCP->dead;
|
|
||||||
pLog->num = pCP->deadPause;
|
|
||||||
SendMessage(Application->MainFormHandle, UM_LOG_UPDATE, 0, (long)pLog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_MISC, 0);
|
if(uCSeq<0 || uCRnk<0){
|
||||||
}
|
dType = pCP->dead + 1;
|
||||||
|
uCRnk = uCSeq = 0;
|
||||||
|
|
||||||
if(op<=2) //撤销不更新iCS
|
g_aGames.betData.dead++;
|
||||||
iCS = (pCP->id<<20) + (uCRnk<<12) + uCSeq;
|
|
||||||
|
if(!bGlobalChip){
|
||||||
|
TBetLog* pLog = NewBetLog();
|
||||||
|
pLog->ev = LOGEVT_DEAD;
|
||||||
|
pLog->op = pCP->dead;
|
||||||
|
pLog->num = pCP->deadPause;
|
||||||
|
SendMessage(Application->MainFormHandle, UM_LOG_UPDATE, 0, (long)pLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_MISC, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(op<=2) //撤销不更新iCS
|
||||||
|
iCS = (pCP->id<<20) + (uCRnk<<12) + uCSeq;
|
||||||
|
}
|
||||||
|
|
||||||
if(wl!=0){
|
if(wl!=0){
|
||||||
profit += wl;
|
profit += wl;
|
||||||
@@ -956,6 +1057,37 @@ int __fastcall TGame::CalcResult(int op)
|
|||||||
if(wl!=0)
|
if(wl!=0)
|
||||||
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_BET_R, ret);
|
PostMessage(Application->MainFormHandle, UM_STATE_UPDATE, STATE_BET_R, ret);
|
||||||
|
|
||||||
|
//代码策略爆纤判定(结算侧):注码策略为特殊注码或打法策略为打注一体,每结算评估一次
|
||||||
|
TBetPolicy* pBC = (TBetPolicy*)g_aBetPolicies[iBetPolicy>=0 ? iBetPolicy : g_iBetPolicy];
|
||||||
|
bool bSPC = pCP && pCP->kind==KIND_CHIP_SPE; //打注一体时 pCP 无效
|
||||||
|
|
||||||
|
if(op<2 && (bSPC || pBC->kind==KIND_BET_WCH)){
|
||||||
|
TJSCodeRet bs;
|
||||||
|
bool bOk = bSPC
|
||||||
|
? EvalCodeJS(KIND_CHIP_SPE, pCP->code, bs, ret) //result 直接取本手结算
|
||||||
|
: EvalCodeJS(KIND_BET_WCH, pBC->code, bs); //road 为最新路单
|
||||||
|
|
||||||
|
if(bOk){
|
||||||
|
int iM = nChipMul<0 ? g_nChipMul : nChipMul;
|
||||||
|
|
||||||
|
if(bSPC){ //SPC:暂存本手注码
|
||||||
|
nChip = bs.iChip * iM;
|
||||||
|
bPreSPC = true;
|
||||||
|
}
|
||||||
|
else{ //BWC:暂存本手注码及下注方向
|
||||||
|
iBet = bs.iBet;
|
||||||
|
nChip = bs.iChip * iM;
|
||||||
|
bPreBWC = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bs.iBlast){ //爆缆直接生效(优先于既有层级注码爆缆)
|
||||||
|
dType = bs.iBlast;
|
||||||
|
if(bs.iBlast==3)
|
||||||
|
ret = (ret & ~0xFF00) | (bs.iBlastMinutes << 8); //暂停分钟进 0xFF00
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(dType) ret += dType<<16;
|
if(dType) ret += dType<<16;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -964,6 +1096,7 @@ int __fastcall TGame::CalcResult(int op)
|
|||||||
void __fastcall TGame::HandleResult(int op)
|
void __fastcall TGame::HandleResult(int op)
|
||||||
{
|
{
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
|
bPreSPC = bPreBWC = false; //上一手已按结算消费完毕
|
||||||
|
|
||||||
if(!aManBets.empty()){ //处理手工下注
|
if(!aManBets.empty()){ //处理手工下注
|
||||||
if(op==0){ //正常结算
|
if(op==0){ //正常结算
|
||||||
@@ -1066,7 +1199,9 @@ void __fastcall TGame::HandleResult(int op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(dead && g_bGameOn){
|
if(dead && g_bGameOn){
|
||||||
int pause = dead==3 ? ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->deadPause : 0;
|
int min8 = (ret >> 8) & 0xFF;
|
||||||
|
int pause = dead==3 && min8 ? min8
|
||||||
|
: (g_iChipPolicy>=0 ? ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->deadPause : 0);
|
||||||
SendMessage(Application->MainFormHandle, UM_FLOAT_DEAD, dead-1, pause);
|
SendMessage(Application->MainFormHandle, UM_FLOAT_DEAD, dead-1, pause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1075,7 +1210,9 @@ void __fastcall TGame::HandleResult(int op)
|
|||||||
if(dead && (bIndPolicy || !g_aGames.bFloat)){
|
if(dead && (bIndPolicy || !g_aGames.bFloat)){
|
||||||
if(!bIndPolicy && g_aGames.pRankChip){
|
if(!bIndPolicy && g_aGames.pRankChip){
|
||||||
// DebugPrint("总体阶梯爆缆");
|
// DebugPrint("总体阶梯爆缆");
|
||||||
int pause = dead==3 ? ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->deadPause : 0;
|
int min8 = (ret >> 8) & 0xFF;
|
||||||
|
int pause = dead==3 && min8 ? min8
|
||||||
|
: (g_iChipPolicy>=0 ? ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->deadPause : 0);
|
||||||
SendMessage(Application->MainFormHandle, UM_GLOBAL_DEAD, dead-1, pause);
|
SendMessage(Application->MainFormHandle, UM_GLOBAL_DEAD, dead-1, pause);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -1208,10 +1345,14 @@ void __fastcall TGame::AutoBetOn(bool bR)
|
|||||||
if(g_settings.bInitBetByGame){ //新局重置打法
|
if(g_settings.bInitBetByGame){ //新局重置打法
|
||||||
iBet = iBetSeq = 0;
|
iBet = iBetSeq = 0;
|
||||||
aBets.clear();
|
aBets.clear();
|
||||||
|
sCtxSPB = sCtxBWC = ""; //打法类策略context清零
|
||||||
}
|
}
|
||||||
|
bPreBWC = false; //洗牌后首局丢弃上一手暂存,强制 BWC 用新靴路单重评估
|
||||||
|
|
||||||
if(g_settings.bInitChipByGame){ //新局重置注码
|
if(g_settings.bInitChipByGame){ //新局重置注码
|
||||||
nChip = iChipSeq = 0;
|
nChip = iChipSeq = 0;
|
||||||
|
sCtxSPC = ""; //特殊注码context清零
|
||||||
|
bPreSPC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_settings.bInitProfitByGame && profit!=0 //新局重置赢利
|
if(g_settings.bInitProfitByGame && profit!=0 //新局重置赢利
|
||||||
@@ -1222,8 +1363,8 @@ void __fastcall TGame::AutoBetOn(bool bR)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(aBets.empty()) //连续下注可从新局开始
|
// if(aBets.empty()) //连续下注可从新局开始
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bBreak || gmstatus!=1 || !CanBet() || !g_bSimulate && timeout<3){ //非下注状态/暂停中/实打时间太短,放弃
|
if(bBreak || gmstatus!=1 || !CanBet() || !g_bSimulate && timeout<3){ //非下注状态/暂停中/实打时间太短,放弃
|
||||||
@@ -1258,8 +1399,9 @@ void __fastcall TGame::AutoBetOn(bool bR)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(iBet==0 || iBet==4){
|
if(iBet==0 || iBet==4){
|
||||||
if(!aBets.empty()){//连续下注 不打/局停不可取消
|
if(!aBets.empty()){
|
||||||
aBets.erase(aBets.begin()); //删除本项
|
if(!aBets.empty())
|
||||||
|
aBets.erase(aBets.begin()); //删除本项
|
||||||
|
|
||||||
iState = ST_NOBET;
|
iState = ST_NOBET;
|
||||||
if(hTable) PostMessage(hTable, UM_LOG_UPDATE, iState, 0);
|
if(hTable) PostMessage(hTable, UM_LOG_UPDATE, iState, 0);
|
||||||
@@ -1303,7 +1445,10 @@ void __fastcall TGame::AutoBetOff(bool bB)
|
|||||||
|
|
||||||
if(iState==ST_BETSET || iState==ST_BETTING){ //下注超时或取消
|
if(iState==ST_BETSET || iState==ST_BETTING){ //下注超时或取消
|
||||||
iState = ST_CANCELED;
|
iState = ST_CANCELED;
|
||||||
iBet = nChip = 0;
|
|
||||||
|
//CalcResult暂存的值需保留
|
||||||
|
if(!bPreBWC) iBet = 0;
|
||||||
|
if(!bPreSPC && !bPreBWC) nChip = 0;
|
||||||
// iBetSeq &= 0xFFFF0000;
|
// iBetSeq &= 0xFFFF0000;
|
||||||
|
|
||||||
// aBets.clear();
|
// aBets.clear();
|
||||||
@@ -1437,9 +1582,13 @@ void __fastcall TGame::Shuffle()
|
|||||||
if(g_settings.bInitBetByGame){ //新局重置打法
|
if(g_settings.bInitBetByGame){ //新局重置打法
|
||||||
iBet = iBetSeq = 0;
|
iBet = iBetSeq = 0;
|
||||||
aBets.clear();
|
aBets.clear();
|
||||||
|
sCtxSPB = sCtxBWC = ""; //打法类策略context清零
|
||||||
}
|
}
|
||||||
|
bPreBWC = false;
|
||||||
if(g_settings.bInitChipByGame){ //新局重置注码
|
if(g_settings.bInitChipByGame){ //新局重置注码
|
||||||
nChip = iChipSeq = 0;
|
nChip = iChipSeq = 0;
|
||||||
|
sCtxSPC = ""; //特殊注码context清零
|
||||||
|
bPreSPC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
iState = ST_INIT;
|
iState = ST_INIT;
|
||||||
@@ -1720,12 +1869,14 @@ void __fastcall TGameArray::GameOn()
|
|||||||
iChipSeq = iFloatGame = 0;
|
iChipSeq = iFloatGame = 0;
|
||||||
memset(seqCount, 0, sizeof(seqCount));
|
memset(seqCount, 0, sizeof(seqCount));
|
||||||
|
|
||||||
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[g_iChipPolicy];
|
if(g_iChipPolicy>=0){ //打注一体时无全局注码
|
||||||
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[g_iChipPolicy];
|
||||||
GetRankChip(pCP->kind)->SetPolicy(pCP);
|
if(pCP->kind>=KIND_CHIP_HAN && pCP->kind<=KIND_CHIP_WLD){
|
||||||
|
GetRankChip(pCP->kind)->SetPolicy(pCP);
|
||||||
|
|
||||||
if(g_settings.bInitBetChipByStart)
|
if(g_settings.bInitBetChipByStart)
|
||||||
pRankChip->Reset();
|
pRankChip->Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(g_settings.bInitBetChipByStart){
|
else if(g_settings.bInitBetChipByStart){
|
||||||
|
|||||||
+9
-2
@@ -228,13 +228,15 @@ public:
|
|||||||
class TTableFrame;
|
class TTableFrame;
|
||||||
|
|
||||||
//代码策略(特殊打法/打注一体/特殊注码)求值结果:生产方TMainForm解析JSON,TGame直接按字段使用
|
//代码策略(特殊打法/打注一体/特殊注码)求值结果:生产方TMainForm解析JSON,TGame直接按字段使用
|
||||||
struct TJSCodeRet{
|
typedef struct tagJSCodeRet{
|
||||||
int iBet; //下注项:0=不打 1=庄 2=闲 3=和 4=局停,未输出=-1
|
int iBet; //下注项:0=不打 1=庄 2=闲 3=和 4=局停,未输出=-1
|
||||||
int iChip; //基码个数:未输出=-1
|
int iChip; //基码个数:未输出=-1
|
||||||
int iBlast; //爆缆动作:0=无 1=停止 2=新局重开 3=暂停重开
|
int iBlast; //爆缆动作:0=无 1=停止 2=新局重开 3=暂停重开
|
||||||
int iBlastMinutes;
|
int iBlastMinutes;
|
||||||
String sCtx; //下一轮透传的 context 对象串(JS原样序列化,空串=未初始化)
|
String sCtx; //下一轮透传的 context 对象串(JS原样序列化,空串=未初始化)
|
||||||
};
|
|
||||||
|
tagJSCodeRet(){iBet=iChip=iBlast=iBlastMinutes=0;};
|
||||||
|
} TJSCodeRet;
|
||||||
|
|
||||||
class TGame
|
class TGame
|
||||||
{
|
{
|
||||||
@@ -274,6 +276,8 @@ public:
|
|||||||
String sCtxSPB, //calcBet(road,context)
|
String sCtxSPB, //calcBet(road,context)
|
||||||
sCtxSPC, //calcChip(result,chipMult,context)
|
sCtxSPC, //calcChip(result,chipMult,context)
|
||||||
sCtxBWC; //calcBetWithChip(road,chipMult,context)
|
sCtxBWC; //calcBetWithChip(road,chipMult,context)
|
||||||
|
bool bPreSPC, //CalcResult已为下一手预存 nChip(SPC)
|
||||||
|
bPreBWC; //CalcResult已为下一手预存 iBet/nChip(BWC)
|
||||||
|
|
||||||
vector<TManBet> aManBets; //手工下注
|
vector<TManBet> aManBets; //手工下注
|
||||||
|
|
||||||
@@ -321,6 +325,9 @@ public:
|
|||||||
void __fastcall ClearRankChip();
|
void __fastcall ClearRankChip();
|
||||||
TRankChip* __fastcall GetRankChip(int type);
|
TRankChip* __fastcall GetRankChip(int type);
|
||||||
void __fastcall ResetIP();
|
void __fastcall ResetIP();
|
||||||
|
|
||||||
|
//代码策略执行辅助(内部统一入口,失败已停台+三写日志;ctx由kind映射读写)
|
||||||
|
bool __fastcall EvalCodeJS(int kind, const String& sCode, TJSCodeRet& bs, int iCodeIn=0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TGameArray : public vector<TGame*>
|
class TGameArray : public vector<TGame*>
|
||||||
|
|||||||
+1182
File diff suppressed because it is too large
Load Diff
+334
@@ -0,0 +1,334 @@
|
|||||||
|
#include <vcl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "PolicyUnit.h"
|
||||||
|
|
||||||
|
// 读整个文件到 String (UTF-8 字节 → UTF-16)
|
||||||
|
String ReadFileUTF8(const String& path)
|
||||||
|
{
|
||||||
|
char szPath[1024];
|
||||||
|
sprintf(szPath, "%s", ((UTF8String)path).c_str());
|
||||||
|
FILE* fp = fopen(szPath, "rb");
|
||||||
|
if(!fp)
|
||||||
|
return String();
|
||||||
|
|
||||||
|
fseek(fp, 0, SEEK_END);
|
||||||
|
long size = ftell(fp);
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
|
if(size <= 0){
|
||||||
|
fclose(fp);
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
|
char* buf = new char[size + 1];
|
||||||
|
size_t n = fread(buf, 1, size, fp);
|
||||||
|
buf[n] = 0;
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
// UTF-8 字节 → UTF-16 String
|
||||||
|
String result = String((UTF8String)buf);
|
||||||
|
delete[] buf;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按换行分行,解析 key=value
|
||||||
|
bool ParseConfig(const String& text, int& iType, int& iKind, int& iRoad,
|
||||||
|
String& sName, String& sDesc, String& sCode, int& iMiniChip)
|
||||||
|
{
|
||||||
|
iType = -1; iKind = -1; iRoad = 0; iMiniChip = 0;
|
||||||
|
sName = sDesc = sCode = String();
|
||||||
|
|
||||||
|
// 去掉 \r,按 \n 分行
|
||||||
|
std::vector<String> lines;
|
||||||
|
{
|
||||||
|
String cur;
|
||||||
|
for(int i = 1; i <= text.Length(); i++){
|
||||||
|
wchar_t c = text[i];
|
||||||
|
if(c == L'\r') continue;
|
||||||
|
if(c == L'\n'){
|
||||||
|
lines.push_back(cur);
|
||||||
|
cur = String();
|
||||||
|
} else {
|
||||||
|
cur += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(cur.Length() > 0)
|
||||||
|
lines.push_back(cur);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i = 0; i < lines.size(); i++){
|
||||||
|
String line = TrimRight(lines[i]);
|
||||||
|
if(line.Length() == 0) continue;
|
||||||
|
if(line[1] == L'#') continue;
|
||||||
|
|
||||||
|
// Pos 是 1-based,返回 = 在 line 中的位置(从 1 开始)
|
||||||
|
int eqPos = 0;
|
||||||
|
for(int j = 1; j <= line.Length(); j++){
|
||||||
|
if(line[j] == L'='){
|
||||||
|
eqPos = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(eqPos <= 1) continue;
|
||||||
|
|
||||||
|
String key = TrimRight(line.SubString(1, eqPos - 1));
|
||||||
|
String val = line.SubString(eqPos + 1, line.Length() - eqPos);
|
||||||
|
|
||||||
|
// trim 两侧空格
|
||||||
|
while(val.Length() > 0 && val[1] == L' ')
|
||||||
|
val = val.SubString(2, val.Length() - 1);
|
||||||
|
while(val.Length() > 1 && val[val.Length()] == L' ')
|
||||||
|
val = val.SubString(1, val.Length() - 1);
|
||||||
|
|
||||||
|
if(key == "type") iType = StrToInt(val);
|
||||||
|
else if(key == "kind") iKind = StrToInt(val);
|
||||||
|
else if(key == "road") iRoad = StrToInt(val);
|
||||||
|
else if(key == "name") sName = val;
|
||||||
|
else if(key == "desc") sDesc = val;
|
||||||
|
else if(key == "code") sCode = val;
|
||||||
|
else if(key == "miniChip") iMiniChip = StrToInt(val);
|
||||||
|
else {
|
||||||
|
wprintf(L" 警告: 未知 key '%ls'\n", key.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return iType >= 0 && iKind > 0 && sName.Length() > 0 && sCode.Length() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取路径的目录部分(含末尾分隔符);无分隔符则返回空串
|
||||||
|
String GetDirPart(const String& path)
|
||||||
|
{
|
||||||
|
int lastSep = 0;
|
||||||
|
for(int i = 1; i <= path.Length(); i++){
|
||||||
|
if(path[i] == L'\\' || path[i] == L'/')
|
||||||
|
lastSep = i;
|
||||||
|
}
|
||||||
|
if(lastSep > 0)
|
||||||
|
return path.SubString(1, lastSep);
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查扩展名(小写比较),返回 .bpf=0, .cpf=1, 其他=-1
|
||||||
|
int CheckExt(const String s)
|
||||||
|
{
|
||||||
|
int l = s.Length();
|
||||||
|
if(l < 4) return -1;
|
||||||
|
String ext = s.SubString(l - 2, 3).LowerCase();
|
||||||
|
if(ext == L"bpf") return 0;
|
||||||
|
if(ext == L"cpf") return 1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取文件名(不含目录、不含扩展名)
|
||||||
|
String GetFileNameNoExt(const String& path)
|
||||||
|
{
|
||||||
|
int lastSep = 0;
|
||||||
|
for(int i = path.Length(); i >= 1; i--){
|
||||||
|
if(path[i] == L'\\' || path[i] == L'/'){
|
||||||
|
lastSep = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String file = lastSep > 0 ? path.SubString(lastSep + 1, path.Length() - lastSep) : path;
|
||||||
|
// 去掉扩展名
|
||||||
|
for(int i = file.Length(); i >= 1; i--){
|
||||||
|
if(file[i] == L'.'){
|
||||||
|
return file.SubString(1, i - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从 .bpf/.cpf 提取策略字段,写入 UTF-8 key=value 的 .txt;成功 0,失败负数
|
||||||
|
int PolicyToText(const String& szInput, const String& szOutFile)
|
||||||
|
{
|
||||||
|
int type = CheckExt(szInput);
|
||||||
|
if(type < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
TBasePolicy* p = NULL;
|
||||||
|
int ret = ImportPolicy(type, szInput, p);
|
||||||
|
if(ret != 0){
|
||||||
|
wprintf(L"ImportPolicy 失败 (ret=%d)\n", ret);
|
||||||
|
delete p;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char szOut[1024];
|
||||||
|
sprintf(szOut, "%s", ((UTF8String)szOutFile).c_str());
|
||||||
|
FILE* fw = fopen(szOut, "w");
|
||||||
|
if(!fw){
|
||||||
|
delete p;
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fw, "type=%d\n", type);
|
||||||
|
fprintf(fw, "kind=%d\n", p->kind);
|
||||||
|
fprintf(fw, "name=%s\n", ((UTF8String)p->name).c_str());
|
||||||
|
|
||||||
|
if(p->desc.Length() > 0)
|
||||||
|
fprintf(fw, "desc=%s\n", ((UTF8String)p->desc).c_str());
|
||||||
|
|
||||||
|
if(IsCodePolicy(p->kind)){
|
||||||
|
if(p->code.Length() > 0)
|
||||||
|
fprintf(fw, "code=%s\n", ((UTF8String)p->code).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type == TYPE_P_BET){
|
||||||
|
fprintf(fw, "road=%d\n", ((TBetPolicy*)p)->road);
|
||||||
|
}
|
||||||
|
|
||||||
|
int iMiniChip = 0;
|
||||||
|
if(type == TYPE_P_BET && p->kind == KIND_BET_WCH){
|
||||||
|
iMiniChip = ((TBetChipPolicy*)p)->miniChip;
|
||||||
|
}
|
||||||
|
else if(type == TYPE_P_CHIP && IsCodePolicy(p->kind)){
|
||||||
|
iMiniChip = ((TChipPolicy*)p)->miniChip;
|
||||||
|
}
|
||||||
|
if(iMiniChip > 0)
|
||||||
|
fprintf(fw, "miniChip=%d\n", iMiniChip);
|
||||||
|
|
||||||
|
fclose(fw);
|
||||||
|
delete p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析 .txt 配置,校验并导出为 .bpf/.cpf;成功 0,失败负数
|
||||||
|
int TextToPolicy(const String& szInput, const String& szOutFile)
|
||||||
|
{
|
||||||
|
String text = ReadFileUTF8(szInput);
|
||||||
|
if(text.Length() == 0){
|
||||||
|
wprintf(L"无法读取文件: %s\n", szInput.c_str());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int iType, iKind, iRoad, iMiniChip;
|
||||||
|
String sName, sDesc, sCode;
|
||||||
|
if(!ParseConfig(text, iType, iKind, iRoad, sName, sDesc, sCode, iMiniChip)){
|
||||||
|
wprintf(L"配置不完整: 需要 type, kind, name, code\n");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 缺省输出文件名
|
||||||
|
String szOut = szOutFile;
|
||||||
|
if(szOut.Length() == 0){
|
||||||
|
szOut = GetDirPart(szInput) + sName + (iType == TYPE_P_BET ? L".bpf" : L".cpf");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!IsCodePolicy(iKind)){
|
||||||
|
wprintf(L"kind=%d 不是代码策略 (需要 101/102/121)\n", iKind);
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
if(iType == TYPE_P_BET){
|
||||||
|
if(iRoad < 0 || iRoad > 4){
|
||||||
|
wprintf(L"road=%d 超出范围 (0-4)\n", iRoad);
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
if(iKind != KIND_BET_SPE && iKind != KIND_BET_WCH){
|
||||||
|
wprintf(L"type=0 时 kind 必须是 101 或 102\n");
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
|
} else if(iType == TYPE_P_CHIP){
|
||||||
|
if(iKind != KIND_CHIP_SPE){
|
||||||
|
wprintf(L"type=1 时 kind 必须是 121\n");
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wprintf(L"type=%d 无效 (0=打法 1=注码)\n", iType);
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
if(iMiniChip <= 0 && (iKind == KIND_BET_WCH || iKind == KIND_CHIP_SPE)){
|
||||||
|
wprintf(L"kind=%d 需要 miniChip>0\n", iKind);
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
|
||||||
|
TBasePolicy* pPolicy = nullptr;
|
||||||
|
if(iType == TYPE_P_BET){
|
||||||
|
if(iKind == KIND_BET_WCH){
|
||||||
|
TBetChipPolicy* p = new TBetChipPolicy();
|
||||||
|
p->road = iRoad;
|
||||||
|
p->code = sCode;
|
||||||
|
p->miniChip = iMiniChip;
|
||||||
|
pPolicy = p;
|
||||||
|
} else {
|
||||||
|
TBetPolicy* p = new TBetPolicy();
|
||||||
|
p->road = iRoad;
|
||||||
|
p->code = sCode;
|
||||||
|
pPolicy = p;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TChipPolicy* p = new TChipPolicy();
|
||||||
|
p->code = sCode;
|
||||||
|
p->miniChip = iMiniChip;
|
||||||
|
pPolicy = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPolicy->name = sName;
|
||||||
|
pPolicy->desc = sDesc;
|
||||||
|
pPolicy->type = 2;
|
||||||
|
pPolicy->id = 0;
|
||||||
|
pPolicy->kind = iKind;
|
||||||
|
pPolicy->actived = true;
|
||||||
|
|
||||||
|
int ret = ExportPolicy(iType, pPolicy, szOut);
|
||||||
|
delete pPolicy;
|
||||||
|
|
||||||
|
if(ret != 0)
|
||||||
|
wprintf(L"导出失败 (ret=%d)\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _tmain(int argc, _TCHAR* argv[])
|
||||||
|
{
|
||||||
|
if(argc < 2){
|
||||||
|
wprintf(L"用法: PolicyCoder.exe <input.txt> [output.bpf|output.cpf]\n");
|
||||||
|
wprintf(L" input.txt: UTF-8 配置文件,key=value 格式\n");
|
||||||
|
wprintf(L" 支持的 key: type(0/1) kind(101/102/121) road(0-4) name desc code miniChip\n");
|
||||||
|
wprintf(L" 输出: 缺省用 <name>.bpf 或 <name>.cpf,与 input.txt 同目录\n");
|
||||||
|
wprintf(L"\n");
|
||||||
|
wprintf(L"用法: PolicyCoder.exe <input.bpf|input.cpf> [output.txt]\n");
|
||||||
|
wprintf(L" 从策略文件提取 type/kind/name/desc/code/road/miniChip 写入 .txt\n");
|
||||||
|
wprintf(L" 输出: 缺省用 <同名>.txt,与 input.bpf/cpf 同目录\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String szInput = argv[1];
|
||||||
|
|
||||||
|
// 如果是 .bpf/.cpf → 提取模式
|
||||||
|
int extType = CheckExt(szInput);
|
||||||
|
if(extType >= 0){
|
||||||
|
String outFile;
|
||||||
|
if(argc >= 3){
|
||||||
|
outFile = argv[2];
|
||||||
|
} else {
|
||||||
|
String dir = GetDirPart(szInput);
|
||||||
|
outFile = dir + GetFileNameNoExt(szInput) + L".txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = PolicyToText(szInput, outFile);
|
||||||
|
if(ret == 0)
|
||||||
|
wprintf(L"成功: %s\n", outFile.c_str());
|
||||||
|
else
|
||||||
|
wprintf(L"提取失败 (ret=%d)\n", ret);
|
||||||
|
return ret == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .txt 导入模式
|
||||||
|
String outFile;
|
||||||
|
if(argc >= 3){
|
||||||
|
outFile = argv[2];
|
||||||
|
} else {
|
||||||
|
outFile = String(); // 由 TextToPolicy 内部分配
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = TextToPolicy(szInput, outFile);
|
||||||
|
if(ret == 0)
|
||||||
|
wprintf(L"成功: %s\n", outFile.c_str());
|
||||||
|
else
|
||||||
|
wprintf(L"导出失败 (ret=%d)\n", ret);
|
||||||
|
return ret == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
+161
-7
@@ -83,6 +83,13 @@ void __fastcall TPolicyEditForm::TopDrawTab(TObject *Sender, TCanvas *TabCanvas,
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicyEditForm::TopChange(TObject *Sender, int NewTab, bool &AllowChange)
|
void __fastcall TPolicyEditForm::TopChange(TObject *Sender, int NewTab, bool &AllowChange)
|
||||||
{
|
{
|
||||||
|
//打注一体由打法策略自带注码,禁止切到注码页签
|
||||||
|
if(m_iType==TYPE_P_BET && NewTab==TYPE_P_CHIP && g_iBetPolicy>=0
|
||||||
|
&& g_aBetPolicies[g_iBetPolicy]->kind==KIND_BET_WCH){
|
||||||
|
AllowChange = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetView(NewTab);
|
SetView(NewTab);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -93,8 +100,8 @@ void __fastcall TPolicyEditForm::SetView(int type)
|
|||||||
|
|
||||||
m_lblPolicy->Caption = "编辑" + m_sType + ":";
|
m_lblPolicy->Caption = "编辑" + m_sType + ":";
|
||||||
m_cbPolicy->Text = "请选择" + m_sType;
|
m_cbPolicy->Text = "请选择" + m_sType;
|
||||||
m_btnSave->Caption = "保存" + m_sType;
|
// m_btnSave->Caption = "保存" + m_sType;
|
||||||
m_btnSelect->Caption = "选择该" + m_sType;
|
// m_btnSelect->Caption = "选择该" + m_sType;
|
||||||
m_panChip->Visible = type==TYPE_P_CHIP;
|
m_panChip->Visible = type==TYPE_P_CHIP;
|
||||||
m_rgRoad->Visible = type==TYPE_P_BET;
|
m_rgRoad->Visible = type==TYPE_P_BET;
|
||||||
|
|
||||||
@@ -141,6 +148,7 @@ void __fastcall TPolicyEditForm::SetView(int type)
|
|||||||
m_cbPolicy->Text = AutoNewName();
|
m_cbPolicy->Text = AutoNewName();
|
||||||
|
|
||||||
UpdateGrid();
|
UpdateGrid();
|
||||||
|
UpdateExportBtn();
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicyEditForm::ClearSPFrame()
|
void __fastcall TPolicyEditForm::ClearSPFrame()
|
||||||
@@ -178,9 +186,9 @@ void __fastcall TPolicyEditForm::UpdateGrid()
|
|||||||
{
|
{
|
||||||
m_btnDelRow->Enabled = false;
|
m_btnDelRow->Enabled = false;
|
||||||
m_btnInsRow->Enabled = false;
|
m_btnInsRow->Enabled = false;
|
||||||
m_btnSave->Enabled = m_bRowChanged = m_bColChanged = !m_editPolicy;
|
m_btnSave->Enabled = m_bRowChanged = m_bColChanged = !m_editPolicy;
|
||||||
m_bRoadChanged = false;
|
m_bRoadChanged = false;
|
||||||
m_btnSelect->Enabled = m_editPolicy;
|
m_btnSelect->Enabled = m_editPolicy;
|
||||||
m_btnDel->Enabled = m_editPolicy && m_editPolicy->type>1;
|
m_btnDel->Enabled = m_editPolicy && m_editPolicy->type>1;
|
||||||
|
|
||||||
ClearSPFrame();
|
ClearSPFrame();
|
||||||
@@ -197,6 +205,12 @@ void __fastcall TPolicyEditForm::UpdateGrid()
|
|||||||
frmSP->m_lblTitle->Caption = (pBP->kind==KIND_BET_WCH ? "打注一体:" : "特殊打法:") + pBP->name;
|
frmSP->m_lblTitle->Caption = (pBP->kind==KIND_BET_WCH ? "打注一体:" : "特殊打法:") + pBP->name;
|
||||||
frmSP->SetDesc( pBP->desc );
|
frmSP->SetDesc( pBP->desc );
|
||||||
|
|
||||||
|
String sOption = pBP->road==1 ? "大路" : pBP->road==2 ? "大眼路" : pBP->road==3 ? "小路"
|
||||||
|
: pBP->road==4 ? "小强路" : "珠盘路";
|
||||||
|
if(pBP->kind==KIND_BET_WCH)
|
||||||
|
sOption += " 最小注码:" + IntToStr(((TBetChipPolicy*)pBP)->miniChip);
|
||||||
|
frmSP->m_lblOption->Caption = sOption;
|
||||||
|
|
||||||
m_frmSP->Parent = m_panEdit;
|
m_frmSP->Parent = m_panEdit;
|
||||||
m_frmSP->Width = m_panEdit->Width;
|
m_frmSP->Width = m_panEdit->Width;
|
||||||
m_frmSP->Show();
|
m_frmSP->Show();
|
||||||
@@ -243,6 +257,8 @@ void __fastcall TPolicyEditForm::UpdateGrid()
|
|||||||
frmSP->m_lblTitle->Caption = "特殊注码:" + pCP->name;
|
frmSP->m_lblTitle->Caption = "特殊注码:" + pCP->name;
|
||||||
frmSP->SetDesc( pCP->desc );
|
frmSP->SetDesc( pCP->desc );
|
||||||
|
|
||||||
|
frmSP->m_lblOption->Caption = "最小注码:" + IntToStr(pCP->miniChip);
|
||||||
|
|
||||||
m_frmSP->Parent = m_panEdit;
|
m_frmSP->Parent = m_panEdit;
|
||||||
m_frmSP->Width = m_panEdit->Width;
|
m_frmSP->Width = m_panEdit->Width;
|
||||||
m_frmSP->Show();
|
m_frmSP->Show();
|
||||||
@@ -857,6 +873,7 @@ void __fastcall TPolicyEditForm::OnPolicyChange(TObject *Sender)
|
|||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
UpdateGrid();
|
UpdateGrid();
|
||||||
|
UpdateExportBtn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -872,6 +889,7 @@ void __fastcall TPolicyEditForm::OnAddClick(TObject *Sender)
|
|||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
UpdateGrid();
|
UpdateGrid();
|
||||||
|
UpdateExportBtn();
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicyEditForm::OnSaveClick(TObject *Sender)
|
void __fastcall TPolicyEditForm::OnSaveClick(TObject *Sender)
|
||||||
@@ -885,6 +903,8 @@ void __fastcall TPolicyEditForm::OnSaveClick(TObject *Sender)
|
|||||||
g_RandomChip.minChip = Min(c1, c2);
|
g_RandomChip.minChip = Min(c1, c2);
|
||||||
g_RandomChip.maxChip = Max(c1, c2);
|
g_RandomChip.maxChip = Max(c1, c2);
|
||||||
|
|
||||||
|
((TChipPolicy*)m_editPolicy)->miniChip = g_RandomChip.minChip;
|
||||||
|
|
||||||
m_btnSave->Enabled = false;
|
m_btnSave->Enabled = false;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1103,6 +1123,7 @@ void __fastcall TPolicyEditForm::OnSaveClick(TObject *Sender)
|
|||||||
m_editPolicy = pTmpPolicy;
|
m_editPolicy = pTmpPolicy;
|
||||||
|
|
||||||
m_btnSave->Enabled = m_bRowChanged = m_bColChanged = false;
|
m_btnSave->Enabled = m_bRowChanged = m_bColChanged = false;
|
||||||
|
UpdateExportBtn();
|
||||||
m_btnSelect->Enabled = true;
|
m_btnSelect->Enabled = true;
|
||||||
m_btnDel->Enabled = true;
|
m_btnDel->Enabled = true;
|
||||||
|
|
||||||
@@ -1322,6 +1343,8 @@ void __fastcall TPolicyEditForm::InitChipGrid(int kind)
|
|||||||
Hint = "常规注码按每次投注的输赢结果决定走向('和'不变)";
|
Hint = "常规注码按每次投注的输赢结果决定走向('和'不变)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateExportBtn();
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicyEditForm::OnChipOptionClick(TObject *Sender)
|
void __fastcall TPolicyEditForm::OnChipOptionClick(TObject *Sender)
|
||||||
@@ -1351,7 +1374,7 @@ void __fastcall TPolicyEditForm::OnTipClick(TObject *Sender)
|
|||||||
PostMessage(Application->MainFormHandle, UM_OPENMAUAL, 1, 0);
|
PostMessage(Application->MainFormHandle, UM_OPENMAUAL, 1, 0);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicyEditForm::OnExport(TObject *Sender)
|
void __fastcall TPolicyEditForm::OnGridExport(TObject *Sender)
|
||||||
{
|
{
|
||||||
TStringGrid* pSG = m_sg;
|
TStringGrid* pSG = m_sg;
|
||||||
|
|
||||||
@@ -1434,7 +1457,7 @@ void __fastcall TPolicyEditForm::OnExport(TObject *Sender)
|
|||||||
delete pDlg;
|
delete pDlg;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicyEditForm::OnImport(TObject *Sender)
|
void __fastcall TPolicyEditForm::OnGridImport(TObject *Sender)
|
||||||
{
|
{
|
||||||
TStringGrid* pSG = m_sg;
|
TStringGrid* pSG = m_sg;
|
||||||
|
|
||||||
@@ -1546,4 +1569,135 @@ void __fastcall TPolicyEditForm::OnImport(TObject *Sender)
|
|||||||
delete pDlg;
|
delete pDlg;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TPolicyEditForm::UpdateExportBtn()
|
||||||
|
{ //禁出:庄闲问路/庄闲差(外挂参在全局设置)、组合(引用跨机失效)、随机注码(面值在全局设置)
|
||||||
|
m_btnExport->Enabled = m_editPolicy
|
||||||
|
&& !m_btnSave->Enabled
|
||||||
|
&& !(m_editPolicy->kind==KIND_BET_ASK || m_editPolicy->kind==KIND_BET_DIF
|
||||||
|
|| m_editPolicy->kind==KIND_CHIP_COM || m_editPolicy->kind==KIND_CHIP_RAN);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TPolicyEditForm::OnImportClick(TObject *Sender)
|
||||||
|
{
|
||||||
|
TOpenDialog * pDlg = new TOpenDialog(NULL);
|
||||||
|
pDlg->Options << ofFileMustExist;
|
||||||
|
pDlg->Title = "导入";
|
||||||
|
pDlg->Filter = m_iType==TYPE_P_BET ? "打法策略文件(*.bpf)|*.bpf" : "注码策略文件(*.cpf)|*.cpf";
|
||||||
|
|
||||||
|
if(pDlg->Execute(Application->MainFormHandle)){
|
||||||
|
TBasePolicy* p = NULL;
|
||||||
|
int err = ImportPolicy(m_iType, pDlg->FileName, p);
|
||||||
|
TPolicySaveForm* pForm = NULL;
|
||||||
|
|
||||||
|
if(err){
|
||||||
|
String msg;
|
||||||
|
switch(err){
|
||||||
|
case 1: msg = "无法打开文件"; break;
|
||||||
|
case 2: msg = "格式错误"; break;
|
||||||
|
case 3: msg = "策略文件版本过低,请用新版本软件导入"; break;
|
||||||
|
case 4: msg = "文件损坏或不完整"; break;
|
||||||
|
case 5: msg = "文件内容不合法"; break;
|
||||||
|
default: msg = "无法识别的文件"; break;
|
||||||
|
}
|
||||||
|
MessageBox(Handle, msg.c_str(), L"导入", MB_ICONERROR | MB_OK);
|
||||||
|
goto END_IMPORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_iType==TYPE_P_CHIP && p->kind==KIND_CHIP_COM){ //组合策略不支持导入
|
||||||
|
MessageBox(Handle, L"组合注码策略不支持导入", L"导入", MB_ICONERROR | MB_OK);
|
||||||
|
delete p;
|
||||||
|
goto END_IMPORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
pForm = new TPolicySaveForm(this, m_iType, p->name);
|
||||||
|
if(pForm->ShowModal()==mrOk){
|
||||||
|
p->name = pForm->m_name;
|
||||||
|
int index = pForm->m_iPolicy;
|
||||||
|
if(index>0){
|
||||||
|
TBasePolicy* pP = m_iType==TYPE_P_BET ? g_aBetPolicies[index] : g_aChipPolicies[index];
|
||||||
|
p->id = pP->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = "导入" + m_sType;
|
||||||
|
int ret = SavePolicy(m_iType, p, index);
|
||||||
|
if(ret>=0){
|
||||||
|
if(index<0){
|
||||||
|
m_cbPolicy->AddItem(p->name, NULL);
|
||||||
|
m_cbPolicy->ItemIndex = m_cbPolicy->Items->Count-1;
|
||||||
|
|
||||||
|
if(m_iType==TYPE_P_CHIP && p->kind==KIND_CHIP_NOR){
|
||||||
|
m_pCombo->AddItem(p->name, (TObject*)p->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
CalcNewName();
|
||||||
|
|
||||||
|
PostMessage(Application->MainFormHandle, UM_POLICYCHANGED, 0x10000 | m_iType, 0);
|
||||||
|
m_iSelPolicy = m_cbPolicy->ItemIndex;
|
||||||
|
}
|
||||||
|
else if(m_iSelPolicy!=index){
|
||||||
|
m_cbPolicy->ItemIndex = index;
|
||||||
|
m_iSelPolicy = index;
|
||||||
|
|
||||||
|
if(m_iType==TYPE_P_CHIP && p->kind==KIND_CHIP_NOR
|
||||||
|
&& m_pCombo->Items->IndexOfObject((TObject*)p->id)<0 ){
|
||||||
|
m_pCombo->AddItem(p->name, (TObject*)p->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_editPolicy = p;
|
||||||
|
|
||||||
|
//强制重画:覆盖同名路径下 ItemIndex 不变,靠不上 OnChange 级联
|
||||||
|
m_cbPolicy->ItemIndex = m_iSelPolicy;
|
||||||
|
Clear();
|
||||||
|
UpdateGrid();
|
||||||
|
|
||||||
|
m_btnSave->Enabled = m_bRowChanged = m_bColChanged = false;
|
||||||
|
m_btnSelect->Enabled = true;
|
||||||
|
m_btnDel->Enabled = true;
|
||||||
|
|
||||||
|
msg += "成功";
|
||||||
|
MessageBox(Handle, msg.c_str(), L"导入", MB_ICONINFORMATION | MB_OK);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
msg += "失败";
|
||||||
|
MessageBox(Handle, msg.c_str(), L"导入", MB_ICONERROR | MB_OK);
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
delete p;
|
||||||
|
|
||||||
|
delete pForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
END_IMPORT:
|
||||||
|
delete pDlg;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TPolicyEditForm::OnExportClick(TObject *Sender)
|
||||||
|
{
|
||||||
|
if(!m_editPolicy){
|
||||||
|
MessageBox(Handle, L"请先选择一个策略", L"导出", MB_ICONINFORMATION | MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TSaveDialog *pDlg = new TSaveDialog(this);
|
||||||
|
pDlg->Title = "导出";
|
||||||
|
pDlg->FileName = m_editPolicy->name + (m_iType==TYPE_P_BET ? ".bpf" : ".cpf");
|
||||||
|
pDlg->Filter = m_iType==TYPE_P_BET ? "打法策略文件(*.bpf)|*.bpf" : "注码策略文件(*.cpf)|*.cpf";
|
||||||
|
|
||||||
|
if(pDlg->Execute(Application->MainFormHandle)){
|
||||||
|
int ret = ExportPolicy(m_iType, m_editPolicy, pDlg->FileName);
|
||||||
|
if(ret!=0){
|
||||||
|
MessageBox(Handle, L"无法写入文件,请检查路径权限", L"导出", MB_ICONERROR | MB_OK);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
String msg = m_sType + "已导出";
|
||||||
|
MessageBox(Handle, msg.c_str(), L"导出", MB_ICONINFORMATION | MB_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete pDlg;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
+61
-40
@@ -28,7 +28,7 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
object m_cbPolicy: TComboBox
|
object m_cbPolicy: TComboBox
|
||||||
Left = 87
|
Left = 87
|
||||||
Top = 41
|
Top = 41
|
||||||
Width = 165
|
Width = 160
|
||||||
Height = 23
|
Height = 23
|
||||||
AutoDropDown = True
|
AutoDropDown = True
|
||||||
AutoCloseUp = True
|
AutoCloseUp = True
|
||||||
@@ -39,9 +39,9 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
OnChange = OnPolicyChange
|
OnChange = OnPolicyChange
|
||||||
end
|
end
|
||||||
object m_btnAdd: TButton
|
object m_btnAdd: TButton
|
||||||
Left = 271
|
Left = 258
|
||||||
Top = 41
|
Top = 41
|
||||||
Width = 75
|
Width = 56
|
||||||
Height = 23
|
Height = 23
|
||||||
Caption = #26032#24314
|
Caption = #26032#24314
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@@ -66,33 +66,23 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
Shape = bsFrame
|
Shape = bsFrame
|
||||||
ShowHint = False
|
ShowHint = False
|
||||||
end
|
end
|
||||||
object m_btnDelRow: TButton
|
object m_btnSave: TButton
|
||||||
Left = 4
|
Left = 198
|
||||||
Top = 313
|
Top = 313
|
||||||
Width = 80
|
Width = 54
|
||||||
Height = 25
|
Height = 25
|
||||||
Caption = #21024#38500#34892
|
Caption = #20445#23384
|
||||||
Enabled = False
|
Enabled = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
OnClick = OnDelRowClick
|
|
||||||
end
|
|
||||||
object m_btnSave: TButton
|
|
||||||
Left = 201
|
|
||||||
Top = 313
|
|
||||||
Width = 88
|
|
||||||
Height = 25
|
|
||||||
Caption = #20445#23384#25171#27861
|
|
||||||
Enabled = False
|
|
||||||
TabOrder = 2
|
|
||||||
OnClick = OnSaveClick
|
OnClick = OnSaveClick
|
||||||
end
|
end
|
||||||
object m_btnSelect: TButton
|
object m_btnSelect: TButton
|
||||||
Left = 297
|
Left = 322
|
||||||
Top = 313
|
Top = 313
|
||||||
Width = 103
|
Width = 76
|
||||||
Height = 25
|
Height = 25
|
||||||
Caption = #36873#25321#35813#25171#27861
|
Caption = #20840#23616#20351#29992
|
||||||
TabOrder = 3
|
TabOrder = 2
|
||||||
OnClick = OnSelectClick
|
OnClick = OnSelectClick
|
||||||
end
|
end
|
||||||
object m_sg: TStringGrid
|
object m_sg: TStringGrid
|
||||||
@@ -116,7 +106,7 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
PopupMenu = m_pmSG
|
PopupMenu = m_pmSG
|
||||||
ScrollBars = ssVertical
|
ScrollBars = ssVertical
|
||||||
ShowHint = False
|
ShowHint = False
|
||||||
TabOrder = 5
|
TabOrder = 4
|
||||||
OnDrawCell = SGDrawCell
|
OnDrawCell = SGDrawCell
|
||||||
OnKeyDown = SGKeyDown
|
OnKeyDown = SGKeyDown
|
||||||
OnMouseDown = SGMouseDown
|
OnMouseDown = SGMouseDown
|
||||||
@@ -140,7 +130,7 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
ParentCtl3D = False
|
ParentCtl3D = False
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = False
|
ShowHint = False
|
||||||
TabOrder = 4
|
TabOrder = 3
|
||||||
Visible = False
|
Visible = False
|
||||||
OnExit = EditorExit
|
OnExit = EditorExit
|
||||||
OnKeyDown = EditorKeyDown
|
OnKeyDown = EditorKeyDown
|
||||||
@@ -166,7 +156,7 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
ParentCtl3D = False
|
ParentCtl3D = False
|
||||||
ShowFrame = False
|
ShowFrame = False
|
||||||
TabOrder = 7
|
TabOrder = 6
|
||||||
OnClick = OnRoadClick
|
OnClick = OnRoadClick
|
||||||
end
|
end
|
||||||
object m_panChip: TPanel
|
object m_panChip: TPanel
|
||||||
@@ -178,9 +168,11 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Ctl3D = True
|
Ctl3D = True
|
||||||
ParentCtl3D = False
|
ParentCtl3D = False
|
||||||
TabOrder = 6
|
TabOrder = 5
|
||||||
OnClick = OnDeadClick
|
OnClick = OnDeadClick
|
||||||
OnMouseMove = FormMouseMove
|
OnMouseMove = FormMouseMove
|
||||||
|
ExplicitLeft = -2
|
||||||
|
ExplicitTop = 23
|
||||||
object m_lblDead: TLabel
|
object m_lblDead: TLabel
|
||||||
Left = 17
|
Left = 17
|
||||||
Top = 32
|
Top = 32
|
||||||
@@ -364,16 +356,6 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
OnClick = OnChipOptionClick
|
OnClick = OnChipOptionClick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object m_btnInsRow: TButton
|
|
||||||
Left = 92
|
|
||||||
Top = 313
|
|
||||||
Width = 80
|
|
||||||
Height = 25
|
|
||||||
Caption = #25554#20837#34892
|
|
||||||
Enabled = False
|
|
||||||
TabOrder = 8
|
|
||||||
OnClick = OnInsRowClick
|
|
||||||
end
|
|
||||||
object m_pCombo: TComboBox
|
object m_pCombo: TComboBox
|
||||||
Left = 72
|
Left = 72
|
||||||
Top = 146
|
Top = 146
|
||||||
@@ -389,11 +371,41 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
Visible = False
|
Visible = False
|
||||||
OnKeyDown = ComboKeyDown
|
OnKeyDown = ComboKeyDown
|
||||||
end
|
end
|
||||||
|
object m_btnExport: TButton
|
||||||
|
Left = 260
|
||||||
|
Top = 313
|
||||||
|
Width = 54
|
||||||
|
Height = 25
|
||||||
|
Caption = #23548#20986
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 7
|
||||||
|
OnClick = OnExportClick
|
||||||
|
end
|
||||||
|
object m_btnDelRow: TButton
|
||||||
|
Left = 4
|
||||||
|
Top = 313
|
||||||
|
Width = 80
|
||||||
|
Height = 25
|
||||||
|
Caption = #21024#38500#34892
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 8
|
||||||
|
OnClick = OnDelRowClick
|
||||||
|
end
|
||||||
|
object m_btnInsRow: TButton
|
||||||
|
Left = 92
|
||||||
|
Top = 313
|
||||||
|
Width = 80
|
||||||
|
Height = 25
|
||||||
|
Caption = #25554#20837#34892
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 9
|
||||||
|
OnClick = OnInsRowClick
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object m_btnDel: TButton
|
object m_btnDel: TButton
|
||||||
Left = 352
|
Left = 315
|
||||||
Top = 40
|
Top = 41
|
||||||
Width = 75
|
Width = 56
|
||||||
Height = 23
|
Height = 23
|
||||||
Caption = #21024#38500
|
Caption = #21024#38500
|
||||||
Enabled = False
|
Enabled = False
|
||||||
@@ -440,17 +452,26 @@ object PolicyEditForm: TPolicyEditForm
|
|||||||
OnDrawTab = TopDrawTab
|
OnDrawTab = TopDrawTab
|
||||||
OnMeasureTab = TopMeasureTab
|
OnMeasureTab = TopMeasureTab
|
||||||
end
|
end
|
||||||
|
object m_btnImport: TButton
|
||||||
|
Left = 372
|
||||||
|
Top = 41
|
||||||
|
Width = 56
|
||||||
|
Height = 23
|
||||||
|
Caption = #23548#20837
|
||||||
|
TabOrder = 6
|
||||||
|
OnClick = OnImportClick
|
||||||
|
end
|
||||||
object m_pmSG: TPopupMenu
|
object m_pmSG: TPopupMenu
|
||||||
AutoHotkeys = maManual
|
AutoHotkeys = maManual
|
||||||
Left = 301
|
Left = 301
|
||||||
Top = 307
|
Top = 307
|
||||||
object miExport: TMenuItem
|
object miExport: TMenuItem
|
||||||
Caption = #23548#20986#34920#26684'...'
|
Caption = #23548#20986#34920#26684'...'
|
||||||
OnClick = OnExport
|
OnClick = OnGridExport
|
||||||
end
|
end
|
||||||
object miImport: TMenuItem
|
object miImport: TMenuItem
|
||||||
Caption = #23548#20837#34920#26684'...'
|
Caption = #23548#20837#34920#26684'...'
|
||||||
OnClick = OnImport
|
OnClick = OnGridImport
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ __published: // IDE-managed Components
|
|||||||
TMenuItem *miImport;
|
TMenuItem *miImport;
|
||||||
TCheckBox *m_cbTierLos0;
|
TCheckBox *m_cbTierLos0;
|
||||||
TTabSet *m_tsTop;
|
TTabSet *m_tsTop;
|
||||||
|
TButton *m_btnExport;
|
||||||
|
TButton *m_btnImport;
|
||||||
void __fastcall FormCreate(TObject *Sender);
|
void __fastcall FormCreate(TObject *Sender);
|
||||||
void __fastcall OnDelRowClick(TObject *Sender);
|
void __fastcall OnDelRowClick(TObject *Sender);
|
||||||
void __fastcall OnPolicyChange(TObject *Sender);
|
void __fastcall OnPolicyChange(TObject *Sender);
|
||||||
@@ -81,12 +83,14 @@ __published: // IDE-managed Components
|
|||||||
void __fastcall OnTipClick(TObject *Sender);
|
void __fastcall OnTipClick(TObject *Sender);
|
||||||
void __fastcall ComboKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
void __fastcall ComboKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||||
void __fastcall OnInsRowClick(TObject *Sender);
|
void __fastcall OnInsRowClick(TObject *Sender);
|
||||||
void __fastcall OnExport(TObject *Sender);
|
void __fastcall OnGridExport(TObject *Sender);
|
||||||
void __fastcall OnImport(TObject *Sender);
|
void __fastcall OnGridImport(TObject *Sender);
|
||||||
void __fastcall TopMeasureTab(TObject *Sender, int Index, int &TabWidth);
|
void __fastcall TopMeasureTab(TObject *Sender, int Index, int &TabWidth);
|
||||||
void __fastcall TopDrawTab(TObject *Sender, TCanvas *TabCanvas, TRect &R, int Index, bool Selected);
|
void __fastcall TopDrawTab(TObject *Sender, TCanvas *TabCanvas, TRect &R, int Index, bool Selected);
|
||||||
void __fastcall TopChange(TObject *Sender, int NewTab, bool &AllowChange);
|
void __fastcall TopChange(TObject *Sender, int NewTab, bool &AllowChange);
|
||||||
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
|
void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
|
||||||
|
void __fastcall OnImportClick(TObject *Sender);
|
||||||
|
void __fastcall OnExportClick(TObject *Sender);
|
||||||
private: // User declarations
|
private: // User declarations
|
||||||
int m_iType;
|
int m_iType;
|
||||||
int m_iSelPolicy;
|
int m_iSelPolicy;
|
||||||
@@ -112,6 +116,7 @@ private: // User declarations
|
|||||||
void __fastcall InitChipGrid(int kind); //0=普通注码 1=层级注码
|
void __fastcall InitChipGrid(int kind); //0=普通注码 1=层级注码
|
||||||
void __fastcall ClearSPFrame();
|
void __fastcall ClearSPFrame();
|
||||||
void __fastcall SetView(int type);
|
void __fastcall SetView(int type);
|
||||||
|
void __fastcall UpdateExportBtn();
|
||||||
|
|
||||||
public: // User declarations
|
public: // User declarations
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -28,8 +28,12 @@ void __fastcall TPolicySaveForm::FormCreate(TObject *Sender)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TPolicySaveForm::OnOkClick(TObject *Sender)
|
void __fastcall TPolicySaveForm::OnOkClick(TObject *Sender)
|
||||||
{
|
{
|
||||||
|
if(m_leName->Text.Trim().IsEmpty()){ //名称不能为空
|
||||||
|
MessageBox(Handle, L"名称不能为空", L"保存", MB_ICONERROR | MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vector<TBasePolicy*>& aPolicies = m_iType==TYPE_P_BET ? g_aBetPolicies : g_aChipPolicies;
|
vector<TBasePolicy*>& aPolicies = m_iType==TYPE_P_BET ? g_aBetPolicies : g_aChipPolicies;
|
||||||
// bool bRepeat = false;
|
|
||||||
int type = -1;
|
int type = -1;
|
||||||
m_iPolicy = -1;
|
m_iPolicy = -1;
|
||||||
for(int i=0; i<aPolicies.size(); i++){
|
for(int i=0; i<aPolicies.size(); i++){
|
||||||
|
|||||||
+487
-280
@@ -51,7 +51,7 @@ char *sysChip[SYSCPNUM] = {//kk|pppp pause|dead
|
|||||||
,"05-任意赢两手回基\n0012\n2,2,3;2,1,4;2,4,5;3,1,6;3,6,7;4,1,8;4,8,9;5,1,10;5,10,11;8,1,12;8,12,13;10,1,14;10,14,0;20,1,0"
|
,"05-任意赢两手回基\n0012\n2,2,3;2,1,4;2,4,5;3,1,6;3,6,7;4,1,8;4,8,9;5,1,10;5,10,11;8,1,12;8,12,13;10,1,14;10,14,0;20,1,0"
|
||||||
,"06-随机注码\n08"
|
,"06-随机注码\n08"
|
||||||
,"07-阶梯-4级\n02000\n1,500,1,500,2;2,500,1,500,3;3,1000,1,500,4;4,1500,1,500,0"
|
,"07-阶梯-4级\n02000\n1,500,1,500,2;2,500,1,500,3;3,1000,1,500,4;4,1500,1,500,0"
|
||||||
,"08-组合阶梯-3级\n03200\n1,20,500,1,500,2;2,20,500,1,500,3;3,20,1000,1,500,0"
|
,"08-组合阶梯-3级\n03200\n1,1,500,1,500,2;2,1,500,1,500,3;3,1,1000,1,500,0"
|
||||||
,"09-赢输次差-单3\n04020\n1,10,2,-10,3;0,20,0,10,1;2,-10,1,-30,0"
|
,"09-赢输次差-单3\n04020\n1,10,2,-10,3;0,20,0,10,1;2,-10,1,-30,0"
|
||||||
,"10-赢输次差-总4\n04021\n1,20,2,-20,3;0,40,0,20,1;2,-20,1,-40,4;4,-40,3,-60,0"
|
,"10-赢输次差-总4\n04021\n1,20,2,-20,3;0,40,0,20,1;2,-20,1,-40,4;4,-40,3,-60,0"
|
||||||
};
|
};
|
||||||
@@ -487,6 +487,7 @@ TBetPolicy& TBetPolicy::operator = (const TBetPolicy& b)
|
|||||||
|
|
||||||
if(IsCodePolicy(kind)){
|
if(IsCodePolicy(kind)){
|
||||||
code = b.code;
|
code = b.code;
|
||||||
|
road = b.road;
|
||||||
}
|
}
|
||||||
else if(kind==KIND_BET_NOR){
|
else if(kind==KIND_BET_NOR){
|
||||||
road = b.road;
|
road = b.road;
|
||||||
@@ -546,9 +547,13 @@ vector<int> u_aUserCPLen;
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//文件定义
|
//文件定义
|
||||||
#define USER_BPF_VERSION 0x04 //0x03起记录desc
|
#define USER_BPF_VERSION 0x06 //0x03起记录desc
|
||||||
|
//0x05起代码策略记录road
|
||||||
|
//0x06起name/desc/code加密
|
||||||
#define USER_BPF_FILE "betpolicy.dat"
|
#define USER_BPF_FILE "betpolicy.dat"
|
||||||
#define USER_CPF_VERSION 0x09 //0x07起记录desc;0x09起记录miniChip(代码策略在code后,非代码在rows后)
|
#define USER_CPF_VERSION 0x0A //0x07起记录desc
|
||||||
|
//0x09起记录miniChip(代码策略在code后,非代码在rows后)
|
||||||
|
//0x0A起name/desc/code加密
|
||||||
#define USER_CPF_FILE "chipolicy.dat"
|
#define USER_CPF_FILE "chipolicy.dat"
|
||||||
|
|
||||||
//BetPolicy文件头
|
//BetPolicy文件头
|
||||||
@@ -574,9 +579,42 @@ typedef struct tCPFHeader{
|
|||||||
}
|
}
|
||||||
} TCPFHEADER;
|
} TCPFHEADER;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 加密定义
|
||||||
|
#include "SHA2.h"
|
||||||
|
|
||||||
|
unsigned char u_encKey[32];
|
||||||
|
bool u_encKeyInited = false;
|
||||||
|
|
||||||
|
void __fastcall InitEncKey()
|
||||||
|
{
|
||||||
|
// 硬编码种子字符串,所有编译产物一致
|
||||||
|
const char seed[] = "RBmasterPolicyEncSeed_v1";
|
||||||
|
sha2_context ctx;
|
||||||
|
unsigned char digest[32];
|
||||||
|
sha2_starts(&ctx, 0);
|
||||||
|
sha2_update(&ctx, (unsigned char*)seed, sizeof(seed)-1);
|
||||||
|
sha2_finish(&ctx, digest);
|
||||||
|
memcpy(u_encKey, digest, 32);
|
||||||
|
u_encKeyInited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加密:XOR 每字节 ^ g_encKey[i%32]
|
||||||
|
void __fastcall EncryptBytes(char* data, int len)
|
||||||
|
{
|
||||||
|
if (!u_encKeyInited)
|
||||||
|
InitEncKey();
|
||||||
|
|
||||||
|
for (int i=0; i<len; i++)
|
||||||
|
data[i] ^= u_encKey[i % 32];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解密 = 加密(XOR 对合)
|
||||||
|
#define DecryptBytes EncryptBytes
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//例程函数
|
//例程函数
|
||||||
//代码策略判断:这三类的数据体只有 code(KIND_BET_SPE/KIND_BET_WCH/KIND_CHIP_SPE 均为 101/102)
|
//代码策略判断:这三类的数据体只有 code(KIND_BET_SPE/KIND_BET_WCH/KIND_CHIP_SPE 为 101/102/121)
|
||||||
bool IsCodePolicy(int kind)
|
bool IsCodePolicy(int kind)
|
||||||
{
|
{
|
||||||
return kind>100;
|
return kind>100;
|
||||||
@@ -640,6 +678,7 @@ vector<int> __fastcall PolicyInCombo(int id)
|
|||||||
return coms;
|
return coms;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
//写入字符串时,长度包含终止符
|
||||||
int __fastcall SaveBetPolicy(TBetPolicy* pPolicy, FILE* fp)
|
int __fastcall SaveBetPolicy(TBetPolicy* pPolicy, FILE* fp)
|
||||||
{
|
{
|
||||||
int posStart = ftell(fp);
|
int posStart = ftell(fp);
|
||||||
@@ -647,24 +686,31 @@ int __fastcall SaveBetPolicy(TBetPolicy* pPolicy, FILE* fp)
|
|||||||
char buff[1024];
|
char buff[1024];
|
||||||
//UTF8String显式锁死UTF-8,与系统ACP开关解耦(UTF-8开关机写出字节一致)
|
//UTF8String显式锁死UTF-8,与系统ACP开关解耦(UTF-8开关机写出字节一致)
|
||||||
sprintf( buff, "%s", ((UTF8String)pPolicy->name).c_str() );
|
sprintf( buff, "%s", ((UTF8String)pPolicy->name).c_str() );
|
||||||
int len = strlen(buff)+1;
|
int len = strlen(buff)+1;
|
||||||
|
EncryptBytes(buff, len); // 加密(含 null 终止符)
|
||||||
fwrite( &len, sizeof(int), 1, fp );
|
fwrite( &len, sizeof(int), 1, fp );
|
||||||
fwrite( buff, sizeof(char), len, fp );
|
fwrite( buff, sizeof(char), len, fp );
|
||||||
|
|
||||||
sprintf( buff, "%s", ((UTF8String)pPolicy->desc).c_str() );
|
sprintf( buff, "%s", ((UTF8String)pPolicy->desc).c_str() );
|
||||||
len = strlen(buff)+1;
|
len = strlen(buff)+1;
|
||||||
|
EncryptBytes(buff, len); // 加密(含 null 终止符)
|
||||||
fwrite( &len, sizeof(int), 1, fp );
|
fwrite( &len, sizeof(int), 1, fp );
|
||||||
fwrite( buff, sizeof(char), len, fp );
|
fwrite( buff, sizeof(char), len, fp );
|
||||||
|
|
||||||
fwrite( &pPolicy->type, sizeof(int), 1, fp );
|
fwrite( &pPolicy->type, sizeof(int), 1, fp );
|
||||||
fwrite( &pPolicy->id, sizeof(int), 1, fp );
|
fwrite( &pPolicy->id, sizeof(int), 1, fp );
|
||||||
fwrite( &pPolicy->kind, sizeof(int), 1, fp );
|
fwrite( &pPolicy->kind, sizeof(int), 1, fp );
|
||||||
|
fwrite( &pPolicy->road, sizeof(int), 1, fp );
|
||||||
|
|
||||||
if(IsCodePolicy(pPolicy->kind)){
|
if(IsCodePolicy(pPolicy->kind)){
|
||||||
//代码策略:kind之后存代码,无road、无行记录
|
//代码策略:kind之后存代码与road,无行记录
|
||||||
int clen = ((UTF8String)pPolicy->code).Length() + 1;
|
int clen = ((UTF8String)pPolicy->code).Length() + 1;
|
||||||
|
char* cbuf = new char[clen];
|
||||||
|
memcpy(cbuf, ((UTF8String)pPolicy->code).c_str(), clen);
|
||||||
|
EncryptBytes(cbuf, clen);
|
||||||
fwrite( &clen, sizeof(int), 1, fp );
|
fwrite( &clen, sizeof(int), 1, fp );
|
||||||
fwrite( ((UTF8String)pPolicy->code).c_str(), sizeof(char), clen, fp );
|
fwrite( cbuf, sizeof(char), clen, fp );
|
||||||
|
delete[] cbuf;
|
||||||
|
|
||||||
//打注一体还需记录最小非0注码(JSON提供)
|
//打注一体还需记录最小非0注码(JSON提供)
|
||||||
if(pPolicy->kind==KIND_BET_WCH){
|
if(pPolicy->kind==KIND_BET_WCH){
|
||||||
@@ -673,8 +719,6 @@ int __fastcall SaveBetPolicy(TBetPolicy* pPolicy, FILE* fp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fwrite( &pPolicy->road, sizeof(int), 1, fp );
|
|
||||||
|
|
||||||
int num = pPolicy->aRows.size();
|
int num = pPolicy->aRows.size();
|
||||||
fwrite( &num, sizeof(int), 1, fp );
|
fwrite( &num, sizeof(int), 1, fp );
|
||||||
|
|
||||||
@@ -708,11 +752,13 @@ int __fastcall SaveChipPolicy(TChipPolicy* pPolicy, FILE* fp)
|
|||||||
//UTF8String显式锁死UTF-8,与系统ACP开关解耦(UTF-8开关机写出字节一致)
|
//UTF8String显式锁死UTF-8,与系统ACP开关解耦(UTF-8开关机写出字节一致)
|
||||||
sprintf( buff, "%s", ((UTF8String)pPolicy->name).c_str() );
|
sprintf( buff, "%s", ((UTF8String)pPolicy->name).c_str() );
|
||||||
int len = strlen(buff)+1;
|
int len = strlen(buff)+1;
|
||||||
|
EncryptBytes(buff, len); // 加密(含 null 终止符)
|
||||||
fwrite( &len, sizeof(int), 1, fp );
|
fwrite( &len, sizeof(int), 1, fp );
|
||||||
fwrite( buff, sizeof(char), len, fp );
|
fwrite( buff, sizeof(char), len, fp );
|
||||||
|
|
||||||
sprintf( buff, "%s", ((UTF8String)pPolicy->desc).c_str() );
|
sprintf( buff, "%s", ((UTF8String)pPolicy->desc).c_str() );
|
||||||
len = strlen(buff)+1;
|
len = strlen(buff)+1;
|
||||||
|
EncryptBytes(buff, len); // 加密(含 null 终止符)
|
||||||
fwrite( &len, sizeof(int), 1, fp );
|
fwrite( &len, sizeof(int), 1, fp );
|
||||||
fwrite( buff, sizeof(char), len, fp );
|
fwrite( buff, sizeof(char), len, fp );
|
||||||
|
|
||||||
@@ -723,10 +769,12 @@ int __fastcall SaveChipPolicy(TChipPolicy* pPolicy, FILE* fp)
|
|||||||
//代码策略:kind之后存代码,无爆缆开关、无行记录
|
//代码策略:kind之后存代码,无爆缆开关、无行记录
|
||||||
if(IsCodePolicy(pPolicy->kind)){
|
if(IsCodePolicy(pPolicy->kind)){
|
||||||
int clen = ((UTF8String)pPolicy->code).Length() + 1;
|
int clen = ((UTF8String)pPolicy->code).Length() + 1;
|
||||||
|
char* cbuf = new char[clen];
|
||||||
|
memcpy(cbuf, ((UTF8String)pPolicy->code).c_str(), clen);
|
||||||
|
EncryptBytes(cbuf, clen);
|
||||||
fwrite( &clen, sizeof(int), 1, fp );
|
fwrite( &clen, sizeof(int), 1, fp );
|
||||||
fwrite( ((UTF8String)pPolicy->code).c_str(), sizeof(char), clen, fp );
|
fwrite( cbuf, sizeof(char), clen, fp );
|
||||||
|
delete[] cbuf;
|
||||||
//代码策略的最小注码由JSON提供
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int op = (pPolicy->deadPause<<16) | pPolicy->dead;
|
int op = (pPolicy->deadPause<<16) | pPolicy->dead;
|
||||||
@@ -1039,6 +1087,306 @@ void __fastcall LoadSystemBetPolicies()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
//解析一条用户打法记录(加载器与单条导入共用):成功返回0,失败返回4
|
||||||
|
static int __fastcall ParseBetPolicyRecord(FILE* fp, int ver, TBetPolicy*& pOut, int& iLen, bool bBookkeep = true)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
int num = 0, count = 0, clen = 0, id = 0, bet = 0, cond = 0;
|
||||||
|
int posStart = ftell(fp), posEnd = 0;
|
||||||
|
TBetPolicy* pPolicy = new TBetPolicy;
|
||||||
|
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(num>1024) goto __fail; //长度前缀超过buf容量,直接判失败
|
||||||
|
if(fread(buf, sizeof(char), num, fp)!=(size_t)num) goto __fail;
|
||||||
|
|
||||||
|
if (ver >= 0x06) EncryptBytes(buf, num); // 读入后解密
|
||||||
|
pPolicy->name = ver<=3 ? GBKToUTF8(buf) : String((UTF8String)buf); //旧版本GBK;新版本UTF-8(bytes为0x04起统一)
|
||||||
|
|
||||||
|
if(ver>=4){ //新版本才记录desc,紧跟name之后,恒为UTF-8
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(num>1024) goto __fail;
|
||||||
|
if(fread(buf, sizeof(char), num, fp)!=(size_t)num) goto __fail;
|
||||||
|
|
||||||
|
if (ver >= 0x06) EncryptBytes(buf, num); // 读入后解密
|
||||||
|
pPolicy->desc = String((UTF8String)buf);
|
||||||
|
}
|
||||||
|
pPolicy->actived = true;
|
||||||
|
|
||||||
|
if(fread(&pPolicy->type, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
|
||||||
|
if(ver>=3){
|
||||||
|
if(fread(&id, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
pPolicy->id = id;
|
||||||
|
|
||||||
|
if(bBookkeep){
|
||||||
|
if(id>u_iUserBetId)
|
||||||
|
u_iUserBetId = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pPolicy->id = ++u_iUserBetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fread(&pPolicy->kind, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(ver>=0x06){
|
||||||
|
if(fread(&pPolicy->road, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
//打注一体用TBetChipPolicy(带miniChip),其余仍为TBetPolicy
|
||||||
|
if(pPolicy->kind==KIND_BET_WCH){
|
||||||
|
TBetChipPolicy* pChip = new TBetChipPolicy;
|
||||||
|
pChip->name = pPolicy->name;
|
||||||
|
pChip->desc = pPolicy->desc;
|
||||||
|
pChip->type = pPolicy->type;
|
||||||
|
pChip->id = pPolicy->id;
|
||||||
|
pChip->kind = pPolicy->kind;
|
||||||
|
pChip->actived = pPolicy->actived;
|
||||||
|
delete pPolicy;
|
||||||
|
pPolicy = pChip;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(IsCodePolicy(pPolicy->kind)){
|
||||||
|
//代码策略:kind之后是代码与road,无行记录
|
||||||
|
if(fread(&clen, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(clen>262144) goto __fail; //代码长度上限,防止超大分配
|
||||||
|
if(clen>0){
|
||||||
|
char* cbuf = new char[clen];
|
||||||
|
if(fread(cbuf, sizeof(char), clen, fp)!=(size_t)clen) goto __fail;
|
||||||
|
if (ver >= 0x06) EncryptBytes(cbuf, clen); // 读入后解密
|
||||||
|
pPolicy->code = String((UTF8String)cbuf);
|
||||||
|
delete[] cbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ver<0x06){
|
||||||
|
if(fread(&pPolicy->road, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
}
|
||||||
|
//打注一体在代码之后记录最小非0注码
|
||||||
|
if(pPolicy->kind==KIND_BET_WCH){
|
||||||
|
if(fread(&((TBetChipPolicy*)pPolicy)->miniChip, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(ver<0x06){
|
||||||
|
if(fread(&pPolicy->road, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
for(int k=0; k<num; k++){
|
||||||
|
TBetRow* row = new TBetRow;
|
||||||
|
|
||||||
|
if(ver<2){
|
||||||
|
if(fread(&bet, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
row->bets.push_back((char)bet);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(fread(&count, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
for(int j=0; j<count; j++){
|
||||||
|
if(fread(&bet, sizeof(char), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
row->bets.push_back((char)bet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fread(&count, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
for(int j=0; j<count; j++){
|
||||||
|
if(fread(&cond, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
row->cond.push_back(cond);
|
||||||
|
}
|
||||||
|
pPolicy->aRows.push_back(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
posEnd = ftell(fp);
|
||||||
|
if(bBookkeep){
|
||||||
|
g_aBetPolicies.push_back(pPolicy);
|
||||||
|
u_aUserBPLen.push_back(posEnd-posStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
iLen = posEnd - posStart;
|
||||||
|
pOut = pPolicy;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
__fail:
|
||||||
|
delete pPolicy;
|
||||||
|
pOut = NULL;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//解析一条用户注码记录(含历史版本分支,加载器与单条导入共用):成功返回0,失败返回4
|
||||||
|
static int __fastcall ParseChipPolicyRecord(FILE* fp, int ver, TChipPolicy*& pOut, int& iLen, bool bBookkeep = true)
|
||||||
|
{
|
||||||
|
char name[1024];
|
||||||
|
char desc[1024] = {0};
|
||||||
|
int num = 0, type = 0, id = 0, kind = 0, clen = 0, op = 0;
|
||||||
|
int posStart = ftell(fp), posEnd = 0;
|
||||||
|
TChipPolicy* pPolicy = NULL;
|
||||||
|
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(num>1024) goto __fail; //长度前缀超限,直接判失败
|
||||||
|
if(fread(name, sizeof(char), num, fp)!=(size_t)num) goto __fail;
|
||||||
|
if (ver >= 0x0A) EncryptBytes(name, num); // 读入后解密
|
||||||
|
|
||||||
|
//新版本才记录desc,紧跟name之后;char[1024]清零保证旧版本时为空串
|
||||||
|
if(ver>=8){
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(num>1024) goto __fail;
|
||||||
|
if(fread(desc, sizeof(char), num, fp)!=(size_t)num) goto __fail;
|
||||||
|
if (ver >= 0x0A) EncryptBytes(desc, num); // 读入后解密
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fread(&type, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
|
||||||
|
if(ver>=5){
|
||||||
|
if(fread(&id, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(bBookkeep){
|
||||||
|
if(id>u_iUserChipId)
|
||||||
|
u_iUserChipId = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
id = ++u_iUserChipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
kind = 0;
|
||||||
|
if(ver>=4){
|
||||||
|
if(fread(&kind, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
|
||||||
|
if(IsCodePolicy(kind)){
|
||||||
|
//代码策略:kind之后是代码与最小注码,无爆缆开关、无行记录
|
||||||
|
pPolicy = new TChipPolicy;
|
||||||
|
|
||||||
|
if(fread(&clen, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
if(clen>262144) goto __fail; //代码长度上限,防止超大分配
|
||||||
|
if(clen>0){
|
||||||
|
char * cbuf = new char[clen];
|
||||||
|
if(fread(cbuf, sizeof(char), clen, fp)!=(size_t)clen) goto __fail;
|
||||||
|
if (ver >= 0x0A) EncryptBytes(cbuf, clen); // 读入后解密
|
||||||
|
pPolicy->code = String((UTF8String)cbuf);
|
||||||
|
delete[] cbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ver>=9){
|
||||||
|
if(fread(&pPolicy->miniChip, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pPolicy->miniChip==0)
|
||||||
|
pPolicy->miniChip = 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(kind==KIND_CHIP_HAN)
|
||||||
|
pPolicy = new TTierPolicy;
|
||||||
|
else if(kind==KIND_CHIP_LEV || kind==KIND_CHIP_COM)
|
||||||
|
pPolicy = new TLevelPolicy;
|
||||||
|
else if(kind==KIND_CHIP_WLD)
|
||||||
|
pPolicy = new TWLDiffPolicy;
|
||||||
|
else
|
||||||
|
pPolicy = new TChipPolicy;
|
||||||
|
|
||||||
|
op = (pPolicy->deadPause<<16) | pPolicy->dead;
|
||||||
|
if(fread(&op, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
pPolicy->dead = op & 0xFF;
|
||||||
|
pPolicy->deadPause = (op & 0xFF0000)>>16;
|
||||||
|
|
||||||
|
if(kind==KIND_CHIP_HAN){
|
||||||
|
if(fread(&op, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
((TTierPolicy*)pPolicy)->bTierWinRet = op & 0x1; // op & 0xFF;
|
||||||
|
if(ver>6){
|
||||||
|
((TTierPolicy*)pPolicy)->bTierAccChip = op & 0x2;
|
||||||
|
((TTierPolicy*)pPolicy)->bTierLos0 = op & 0x4;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
((TTierPolicy*)pPolicy)->bTierAccChip = op & 0x10000; // (op & 0xFF0000)>>16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if((kind>=KIND_CHIP_LEV && kind<=KIND_CHIP_WLD) && ver>=6){
|
||||||
|
if(fread(&op, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
((TLevelPolicy*)pPolicy)->bTotalDiff = op & 0x1;
|
||||||
|
((TLevelPolicy*)pPolicy)->bInstant = op & 0x2;
|
||||||
|
|
||||||
|
if(kind==KIND_CHIP_WLD)
|
||||||
|
((TWLDiffPolicy*)pPolicy)->bIndie = op & 0x10000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(ver>=1){
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
char dead = num & 0x0F,
|
||||||
|
pause = (num & 0xF0)>>4,
|
||||||
|
kind = ver<3 ? (num & 0x100)>>8 : (num & 0xFF00)>>8;
|
||||||
|
|
||||||
|
if(kind==KIND_CHIP_HAN){
|
||||||
|
pPolicy = new TTierPolicy;
|
||||||
|
((TTierPolicy*)pPolicy)->bTierWinRet = ver<3 ? (num & 0x200)>>9 : (num & 0x10000)>>16;
|
||||||
|
((TTierPolicy*)pPolicy)->bTierAccChip = ver<3 ? (num & 0x400)>>10 : (num & 0x20000)>>17;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pPolicy = new TChipPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPolicy->dead = dead;
|
||||||
|
pPolicy->deadPause = pause;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pPolicy = new TChipPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPolicy->type = type;
|
||||||
|
pPolicy->kind = kind;
|
||||||
|
pPolicy->name = ver<=7 ? GBKToUTF8(name) : String((UTF8String)name); //旧版本GBK;新版本UTF-8(0x08起统一)
|
||||||
|
pPolicy->desc = String((UTF8String)desc); //desc只在ver>=8,恒为UTF-8
|
||||||
|
pPolicy->id = id;
|
||||||
|
pPolicy->actived = true;
|
||||||
|
|
||||||
|
if(!IsCodePolicy(kind)){
|
||||||
|
if(fread(&num, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
|
||||||
|
for(int j=0; j<num; j++){
|
||||||
|
TChipRow* row = kind==KIND_CHIP_HAN ? new TTierRow
|
||||||
|
: kind==KIND_CHIP_LEV || kind==KIND_CHIP_WLD ? new TLevelRow
|
||||||
|
: kind==KIND_CHIP_COM ? new TComboRow
|
||||||
|
: new TChipRow;
|
||||||
|
|
||||||
|
if(fread(&row->chip, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
if(fread(&row->iWin, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
if(fread(&row->iLos, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
|
||||||
|
if(pPolicy->kind==KIND_CHIP_HAN){
|
||||||
|
if(fread(&((TTierRow*)row)->hands, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
}
|
||||||
|
else if(pPolicy->kind>=KIND_CHIP_LEV){
|
||||||
|
if(pPolicy->kind==KIND_CHIP_COM){
|
||||||
|
if(fread(&((TComboRow*)row)->id, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fread(&((TLevelRow*)row)->nCondWin, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
if(fread(&((TLevelRow*)row)->nCondLos, sizeof(int), 1, fp)!=1){ delete row; goto __fail; }
|
||||||
|
}
|
||||||
|
|
||||||
|
row->iSeq = j+1;
|
||||||
|
pPolicy->aRows.push_back(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
//行记录之后是最小非0注码(0x09起)
|
||||||
|
if(ver>=9){
|
||||||
|
if(fread(&pPolicy->miniChip, sizeof(int), 1, fp)!=1) goto __fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
posEnd = ftell(fp);
|
||||||
|
if(bBookkeep){
|
||||||
|
g_aChipPolicies.push_back(pPolicy);
|
||||||
|
u_aUserCPLen.push_back(posEnd-posStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
iLen = posEnd - posStart;
|
||||||
|
pOut = pPolicy;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
__fail:
|
||||||
|
delete pPolicy;
|
||||||
|
pOut = NULL;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void __fastcall LoadUserBetPolicies()
|
void __fastcall LoadUserBetPolicies()
|
||||||
{
|
{
|
||||||
@@ -1049,7 +1397,6 @@ void __fastcall LoadUserBetPolicies()
|
|||||||
if(!fp)
|
if(!fp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char buf[1024];
|
|
||||||
char head[8];
|
char head[8];
|
||||||
TBPFHEADER header;
|
TBPFHEADER header;
|
||||||
int ret = fread( (void*)head, 1, sizeof(header), fp );
|
int ret = fread( (void*)head, 1, sizeof(header), fp );
|
||||||
@@ -1059,103 +1406,12 @@ void __fastcall LoadUserBetPolicies()
|
|||||||
fread(&size, sizeof(int), 1, fp);
|
fread(&size, sizeof(int), 1, fp);
|
||||||
|
|
||||||
for(int i=0; i<size; i++){
|
for(int i=0; i<size; i++){
|
||||||
int posStart = ftell(fp);
|
TBetPolicy* pPolicy = NULL;
|
||||||
TBetPolicy* pPolicy = new TBetPolicy;
|
int iLen = 0;
|
||||||
|
if(ParseBetPolicyRecord(fp, head[3], pPolicy, iLen, true))
|
||||||
int num;
|
break; //解析失败:提前结束,照旧 fclose
|
||||||
fread(&num, sizeof(int), 1, fp);
|
}
|
||||||
fread(buf, sizeof(char), num, fp);
|
}
|
||||||
|
|
||||||
pPolicy->name = head[3]<=3 ? GBKToUTF8(buf) : String((UTF8String)buf); //旧版本GBK;新版本UTF-8(bytes为0x04起统一)
|
|
||||||
if(head[3]>=4){ //新版本才记录desc,紧跟name之后,恒为UTF-8
|
|
||||||
fread(&num, sizeof(int), 1, fp);
|
|
||||||
fread(buf, sizeof(char), num, fp);
|
|
||||||
pPolicy->desc = String((UTF8String)buf);
|
|
||||||
}
|
|
||||||
pPolicy->actived = true;
|
|
||||||
|
|
||||||
fread(&pPolicy->type, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
if(head[3]>=3){
|
|
||||||
int id;
|
|
||||||
fread(&id, sizeof(int), 1, fp);
|
|
||||||
pPolicy->id = id;
|
|
||||||
|
|
||||||
if(id>u_iUserBetId)
|
|
||||||
u_iUserBetId = id;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
pPolicy->id = ++u_iUserBetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(head[3]>0)
|
|
||||||
fread(&pPolicy->kind, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
//打注一体用TBetChipPolicy(带miniChip),其余仍为TBetPolicy
|
|
||||||
if(pPolicy->kind==KIND_BET_WCH){
|
|
||||||
TBetChipPolicy* pChip = new TBetChipPolicy;
|
|
||||||
pChip->name = pPolicy->name;
|
|
||||||
pChip->desc = pPolicy->desc;
|
|
||||||
pChip->type = pPolicy->type;
|
|
||||||
pChip->id = pPolicy->id;
|
|
||||||
pChip->kind = pPolicy->kind;
|
|
||||||
pChip->actived = pPolicy->actived;
|
|
||||||
delete pPolicy;
|
|
||||||
pPolicy = pChip;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(IsCodePolicy(pPolicy->kind)){
|
|
||||||
//代码策略:kind之后是代码,无road、无行记录
|
|
||||||
int clen = 0;
|
|
||||||
fread(&clen, sizeof(int), 1, fp);
|
|
||||||
if(clen>0){
|
|
||||||
vector<char> cbuf(clen+1);
|
|
||||||
fread(&cbuf[0], sizeof(char), clen, fp);
|
|
||||||
cbuf[clen] = 0;
|
|
||||||
pPolicy->code = String((UTF8String)&cbuf[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//打注一体在代码之后记录最小非0注码
|
|
||||||
if(pPolicy->kind==KIND_BET_WCH)
|
|
||||||
fread(&((TBetChipPolicy*)pPolicy)->miniChip, sizeof(int), 1, fp);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
fread(&pPolicy->road, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
fread(&num, sizeof(int), 1, fp);
|
|
||||||
for(int k=0; k<num; k++){
|
|
||||||
TBetRow* row = new TBetRow;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
if(head[3]<2){
|
|
||||||
int bet;
|
|
||||||
fread(&bet, sizeof(int), 1, fp);
|
|
||||||
row->bets.push_back((char)bet);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
fread(&count, sizeof(int), 1, fp);
|
|
||||||
for(int j=0; j<count; j++){
|
|
||||||
char bet;
|
|
||||||
fread(&bet, sizeof(char), 1, fp);
|
|
||||||
row->bets.push_back(bet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fread(&count, sizeof(int), 1, fp);
|
|
||||||
for(int j=0; j<count; j++){
|
|
||||||
int cond;
|
|
||||||
fread(&cond, sizeof(int), 1, fp);
|
|
||||||
row->cond.push_back(cond);
|
|
||||||
}
|
|
||||||
pPolicy->aRows.push_back(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int posEnd = ftell(fp);
|
|
||||||
g_aBetPolicies.push_back(pPolicy);
|
|
||||||
u_aUserBPLen.push_back(posEnd-posStart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
@@ -1221,6 +1477,9 @@ void __fastcall LoadSystemChipPolicies()
|
|||||||
((TWLDiffPolicy*)pPolicy)->bIndie = op & 0x4;
|
((TWLDiffPolicy*)pPolicy)->bIndie = op & 0x4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(kind==KIND_CHIP_RAN){
|
||||||
|
pPolicy->miniChip = g_RandomChip.minChip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(iPart==2){
|
else if(iPart==2){
|
||||||
int err = pPolicy->ParsePolicy(tmp, TYPE_P_CHIP);
|
int err = pPolicy->ParsePolicy(tmp, TYPE_P_CHIP);
|
||||||
@@ -1228,27 +1487,23 @@ void __fastcall LoadSystemChipPolicies()
|
|||||||
|
|
||||||
//随机注码无行数据,取全局设置;其余在解析行时顺便算最小非0注码
|
//随机注码无行数据,取全局设置;其余在解析行时顺便算最小非0注码
|
||||||
int miniChip = -1;
|
int miniChip = -1;
|
||||||
if(pPolicy->kind==KIND_CHIP_RAN)
|
for(int j=0; j<(int)pPolicy->aRows.size(); j++){
|
||||||
miniChip = g_RandomChip.minChip;
|
TChipRow* pRow = (TChipRow*)pPolicy->aRows[j];
|
||||||
else{
|
if(pPolicy->kind==KIND_CHIP_COM){
|
||||||
for(int j=0; j<(int)pPolicy->aRows.size(); j++){
|
//组合策略:引用前面已入 vector 的策略
|
||||||
TChipRow* pRow = (TChipRow*)pPolicy->aRows[j];
|
TComboRow* pCR = (TComboRow*)pRow;
|
||||||
if(pPolicy->kind==KIND_CHIP_COM){
|
if(pCR->id <= g_aChipPolicies.size()){
|
||||||
//组合策略:引用前面已入 vector 的策略
|
TChipPolicy* pRef = (TChipPolicy*)g_aChipPolicies[pCR->id-1];
|
||||||
TComboRow* pCR = (TComboRow*)pRow;
|
int refMini = (pRef->kind==KIND_CHIP_RAN) ? g_RandomChip.minChip : pRef->miniChip;
|
||||||
if(pCR->iPolicy < g_aChipPolicies.size()){
|
int comboChip = refMini * pRow->chip;
|
||||||
TChipPolicy* pRef = (TChipPolicy*)g_aChipPolicies[pCR->iPolicy];
|
if(comboChip>0 && (miniChip<0 || comboChip<miniChip))
|
||||||
int refMini = (pRef->kind==KIND_CHIP_RAN) ? g_RandomChip.minChip : pRef->miniChip;
|
miniChip = comboChip;
|
||||||
int comboChip = refMini * pRow->chip;
|
|
||||||
if(comboChip>0 && (miniChip<0 || comboChip<miniChip))
|
|
||||||
miniChip = comboChip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(pRow->chip>0 && (miniChip<0 || pRow->chip<miniChip))
|
|
||||||
miniChip = pRow->chip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(pRow->chip>0 && (miniChip<0 || pRow->chip<miniChip))
|
||||||
|
miniChip = pRow->chip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pPolicy->miniChip = miniChip;
|
pPolicy->miniChip = miniChip;
|
||||||
}
|
}
|
||||||
@@ -1290,7 +1545,6 @@ void __fastcall LoadUserChipPolicies()
|
|||||||
if(!fp)
|
if(!fp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char buf[1024];
|
|
||||||
char head[8];
|
char head[8];
|
||||||
TCPFHEADER header;
|
TCPFHEADER header;
|
||||||
int ret = fread( (void*)head, 1, sizeof(header), fp );
|
int ret = fread( (void*)head, 1, sizeof(header), fp );
|
||||||
@@ -1299,157 +1553,12 @@ void __fastcall LoadUserChipPolicies()
|
|||||||
int size;
|
int size;
|
||||||
fread(&size, sizeof(int), 1, fp);
|
fread(&size, sizeof(int), 1, fp);
|
||||||
|
|
||||||
int num;
|
|
||||||
int type;
|
|
||||||
int id;
|
|
||||||
char name[64];
|
|
||||||
for(int i=0; i<size; i++){
|
for(int i=0; i<size; i++){
|
||||||
int posStart = ftell(fp);
|
|
||||||
TChipPolicy* pPolicy = NULL;
|
TChipPolicy* pPolicy = NULL;
|
||||||
|
int iLen = 0;
|
||||||
fread(&num, sizeof(int), 1, fp);
|
if(ParseChipPolicyRecord(fp, head[3], pPolicy, iLen, true))
|
||||||
fread(name, sizeof(char), num, fp);
|
break; //解析失败:提前结束,照旧 fclose
|
||||||
|
}
|
||||||
//新版本才记录desc,紧跟name之后;char[1024]清零保证旧版本时为空串
|
|
||||||
char desc[1024] = {0};
|
|
||||||
if(head[3]>=8){
|
|
||||||
fread(&num, sizeof(int), 1, fp);
|
|
||||||
fread(desc, sizeof(char), num, fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
fread(&type, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
if(head[3]>=5){
|
|
||||||
fread(&id, sizeof(int), 1, fp);
|
|
||||||
if(id>u_iUserChipId)
|
|
||||||
u_iUserChipId = id;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
id = ++u_iUserChipId;
|
|
||||||
}
|
|
||||||
|
|
||||||
int kind = 0;
|
|
||||||
if(head[3]>=4){
|
|
||||||
fread(&kind, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
if(IsCodePolicy(kind)){
|
|
||||||
//代码策略:kind之后是代码与最小注码,无爆缆开关、无行记录
|
|
||||||
pPolicy = new TChipPolicy;
|
|
||||||
|
|
||||||
int clen = 0;
|
|
||||||
fread(&clen, sizeof(int), 1, fp);
|
|
||||||
if(clen>0){
|
|
||||||
vector<char> cbuf(clen+1);
|
|
||||||
fread(&cbuf[0], sizeof(char), clen, fp);
|
|
||||||
cbuf[clen] = 0;
|
|
||||||
pPolicy->code = String((UTF8String)&cbuf[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(head[3]>=9)
|
|
||||||
fread(&pPolicy->miniChip, sizeof(int), 1, fp);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(kind==KIND_CHIP_HAN)
|
|
||||||
pPolicy = new TTierPolicy;
|
|
||||||
else if(kind==KIND_CHIP_LEV || kind==KIND_CHIP_COM)
|
|
||||||
pPolicy = new TLevelPolicy;
|
|
||||||
else if(kind==KIND_CHIP_WLD)
|
|
||||||
pPolicy = new TWLDiffPolicy;
|
|
||||||
else
|
|
||||||
pPolicy = new TChipPolicy;
|
|
||||||
|
|
||||||
int op = (pPolicy->deadPause<<16) | pPolicy->dead;
|
|
||||||
fread( &op, sizeof(int), 1, fp );
|
|
||||||
pPolicy->dead = op & 0xFF;
|
|
||||||
pPolicy->deadPause = (op & 0xFF0000)>>16;
|
|
||||||
|
|
||||||
if(kind==KIND_CHIP_HAN){
|
|
||||||
fread( &op, sizeof(int), 1, fp );
|
|
||||||
((TTierPolicy*)pPolicy)->bTierWinRet = op & 0x1; // op & 0xFF;
|
|
||||||
if(head[3]>6){
|
|
||||||
((TTierPolicy*)pPolicy)->bTierAccChip = op & 0x2;
|
|
||||||
((TTierPolicy*)pPolicy)->bTierLos0 = op & 0x4;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
((TTierPolicy*)pPolicy)->bTierAccChip = op & 0x10000; // (op & 0xFF0000)>>16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if((kind>=KIND_CHIP_LEV && kind<=KIND_CHIP_WLD) && head[3]>=6){
|
|
||||||
fread( &op, sizeof(int), 1, fp );
|
|
||||||
((TLevelPolicy*)pPolicy)->bTotalDiff = op & 0x1;
|
|
||||||
((TLevelPolicy*)pPolicy)->bInstant = op & 0x2;
|
|
||||||
|
|
||||||
if(kind==KIND_CHIP_WLD)
|
|
||||||
((TWLDiffPolicy*)pPolicy)->bIndie = op & 0x10000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(head[3]>=1){
|
|
||||||
fread(&num, sizeof(int), 1, fp);
|
|
||||||
char dead = num & 0x0F,
|
|
||||||
pause = (num & 0xF0)>>4,
|
|
||||||
kind = head[3]<3 ? (num & 0x100)>>8 : (num & 0xFF00)>>8;
|
|
||||||
|
|
||||||
if(kind==KIND_CHIP_HAN){
|
|
||||||
pPolicy = new TTierPolicy;
|
|
||||||
((TTierPolicy*)pPolicy)->bTierWinRet = head[3]<3 ? (num & 0x200)>>9 : (num & 0x10000)>>16;
|
|
||||||
((TTierPolicy*)pPolicy)->bTierAccChip = head[3]<3 ? (num & 0x400)>>10 : (num & 0x20000)>>17;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
pPolicy = new TChipPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPolicy->dead = dead;
|
|
||||||
pPolicy->deadPause = pause;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
pPolicy = new TChipPolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPolicy->type = type;
|
|
||||||
pPolicy->kind = kind;
|
|
||||||
pPolicy->name = head[3]<=7 ? GBKToUTF8(name) : String((UTF8String)name); //旧版本GBK;新版本UTF-8(0x08起统一)
|
|
||||||
pPolicy->desc = String((UTF8String)desc); //desc只在head[3]>=8,恒为UTF-8
|
|
||||||
pPolicy->id = id;
|
|
||||||
pPolicy->actived = true;
|
|
||||||
|
|
||||||
if(!IsCodePolicy(kind)){
|
|
||||||
fread(&num, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
for(int j=0; j<num; j++){
|
|
||||||
TChipRow* row = kind==KIND_CHIP_HAN ? new TTierRow
|
|
||||||
: kind==KIND_CHIP_LEV || kind==KIND_CHIP_WLD ? new TLevelRow
|
|
||||||
: kind==KIND_CHIP_COM ? new TComboRow
|
|
||||||
: new TChipRow;
|
|
||||||
|
|
||||||
fread(&row->chip, sizeof(int), 1, fp);
|
|
||||||
fread(&row->iWin, sizeof(int), 1, fp);
|
|
||||||
fread(&row->iLos, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
if(pPolicy->kind==KIND_CHIP_HAN){
|
|
||||||
fread(&((TTierRow*)row)->hands, sizeof(int), 1, fp);
|
|
||||||
}
|
|
||||||
else if(pPolicy->kind>=KIND_CHIP_LEV){
|
|
||||||
if(pPolicy->kind==KIND_CHIP_COM)
|
|
||||||
fread(&((TComboRow*)row)->id, sizeof(int), 1, fp);
|
|
||||||
|
|
||||||
fread(&((TLevelRow*)row)->nCondWin, sizeof(int), 1, fp);
|
|
||||||
fread(&((TLevelRow*)row)->nCondLos, sizeof(int), 1, fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
row->iSeq = j+1;
|
|
||||||
pPolicy->aRows.push_back(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
//行记录之后是最小非0注码(0x09起)
|
|
||||||
if(head[3]>=9)
|
|
||||||
fread(&pPolicy->miniChip, sizeof(int), 1, fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
int posEnd = ftell(fp);
|
|
||||||
g_aChipPolicies.push_back(pPolicy);
|
|
||||||
u_aUserCPLen.push_back(posEnd-posStart);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -1481,4 +1590,102 @@ void __fastcall LoadPolicies()
|
|||||||
LoadUserChipPolicies();
|
LoadUserChipPolicies();
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
//导出单条策略:4字节头 + 一条记录(不写count);成功0,打开失败-1
|
||||||
|
int __fastcall ExportPolicy(int type, TBasePolicy* pPolicy, const String& file)
|
||||||
|
{
|
||||||
|
char szFile[1024];
|
||||||
|
sprintf(szFile, "%s", UTF8String(file).c_str()); //用户文件名可能带中文,显式转UTF-8字节
|
||||||
|
FILE* fp = fopen(szFile, "wb");
|
||||||
|
if(!fp)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if(type==TYPE_P_BET){
|
||||||
|
TBPFHEADER header;
|
||||||
|
fwrite((void*)&header, sizeof(header), 1, fp);
|
||||||
|
SaveBetPolicy((TBetPolicy*)pPolicy, fp);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
TCPFHEADER header;
|
||||||
|
fwrite((void*)&header, sizeof(header), 1, fp);
|
||||||
|
SaveChipPolicy((TChipPolicy*)pPolicy, fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//导入单条策略:0成功 1打开失败 2magic与当前标签页类型不符 3版本过低 4解析失败 5内容非法
|
||||||
|
int __fastcall ImportPolicy(int type, const String& file, TBasePolicy*& pOut)
|
||||||
|
{
|
||||||
|
char szFile[1024];
|
||||||
|
sprintf(szFile, "%s", UTF8String(file).c_str()); //用户文件名可能带中文,显式转UTF-8字节
|
||||||
|
FILE* fp = fopen(szFile, "rb");
|
||||||
|
if(!fp){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char head[8];
|
||||||
|
if(fread((void*)head, 1, 4, fp)!=4){
|
||||||
|
fclose(fp);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type==TYPE_P_BET && memcmp(head, "BPF", 3) ||
|
||||||
|
type==TYPE_P_CHIP && memcmp(head, "CPF", 3)){
|
||||||
|
fclose(fp);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ver = (unsigned char)head[3];
|
||||||
|
if(type==TYPE_P_BET ? ver<5 : ver<9){
|
||||||
|
fclose(fp);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
int len = 0;
|
||||||
|
if(type==TYPE_P_BET){
|
||||||
|
TBetPolicy* p = NULL;
|
||||||
|
if(ParseBetPolicyRecord(fp, ver, p, len, false) || !p){
|
||||||
|
delete p;
|
||||||
|
fclose(fp);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//内容校验:名称非空,kind白名单 {0,101,102}
|
||||||
|
if(Trim(p->name).IsEmpty()
|
||||||
|
|| (p->kind!=KIND_BET_NOR && p->kind!=KIND_BET_SPE && p->kind!=KIND_BET_WCH)){
|
||||||
|
delete p;
|
||||||
|
fclose(fp);
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->type = 2; //用户自定义,统一覆盖文件里带的旧type
|
||||||
|
fclose(fp);
|
||||||
|
pOut = p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
TChipPolicy* p = NULL;
|
||||||
|
if(ParseChipPolicyRecord(fp, ver, p, len, false) || !p){
|
||||||
|
delete p;
|
||||||
|
fclose(fp);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//内容校验:名称非空,kind白名单 {0,1,2,4,121}
|
||||||
|
if(Trim(p->name).IsEmpty()
|
||||||
|
|| (p->kind!=KIND_CHIP_NOR && p->kind!=KIND_CHIP_HAN && p->kind!=KIND_CHIP_LEV
|
||||||
|
&& p->kind!=KIND_CHIP_WLD && p->kind!=KIND_CHIP_SPE)){
|
||||||
|
delete p;
|
||||||
|
fclose(fp);
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->type = 2; //用户自定义,统一覆盖文件里带的旧type
|
||||||
|
fclose(fp);
|
||||||
|
pOut = p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -13,7 +13,7 @@
|
|||||||
#define KIND_BET_ASK 2
|
#define KIND_BET_ASK 2
|
||||||
#define KIND_BET_DIF 3
|
#define KIND_BET_DIF 3
|
||||||
#define KIND_BET_SPE 101 //特殊打法:代码策略 calcBet(road,context) -> bet
|
#define KIND_BET_SPE 101 //特殊打法:代码策略 calcBet(road,context) -> bet
|
||||||
#define KIND_BET_WCH 103 //打注一体:代码策略 calcBetWithChip(road,mult,context) -> bet+chip
|
#define KIND_BET_WCH 102 //打注一体:代码策略 calcBetWithChip(road,mult,context) -> bet+chip
|
||||||
|
|
||||||
#define KIND_CHIP_NOR 0
|
#define KIND_CHIP_NOR 0
|
||||||
#define KIND_CHIP_HAN 1
|
#define KIND_CHIP_HAN 1
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#define KIND_CHIP_COM 3
|
#define KIND_CHIP_COM 3
|
||||||
#define KIND_CHIP_WLD 4
|
#define KIND_CHIP_WLD 4
|
||||||
#define KIND_CHIP_RAN 8
|
#define KIND_CHIP_RAN 8
|
||||||
#define KIND_CHIP_SPE 102 //特殊注码:代码策略 calcChip(result,mult,context) -> chip
|
#define KIND_CHIP_SPE 121 //特殊注码:代码策略 calcChip(result,mult,context) -> chip
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
int id; //唯一ID
|
int id; //唯一ID
|
||||||
int kind; //自定义类型 CHIP:0=普通 1=手数层级 2=组合层级 4=随机 ... BET:0=普通 2=庄闲问路 3=庄闲差...
|
int kind; //自定义类型 CHIP:0=普通 1=手数层级 2=组合层级 4=随机 ... BET:0=普通 2=庄闲问路 3=庄闲差...
|
||||||
bool actived; //是否激活
|
bool actived; //是否激活
|
||||||
String code; //代码策略的JS源码(KIND_BET_SPE/KIND_BET_WCH/KIND_CHIP_SPE专用,其余为空)
|
String code; //代码策略的JS源码(KIND_BET_SPE/KIND_BET_WCH/KIND_CHIP_SPE专用,其余为空);代码打法另用road
|
||||||
vector<TBaseRow*> aRows;
|
vector<TBaseRow*> aRows;
|
||||||
|
|
||||||
virtual void AddNewRow()=0;
|
virtual void AddNewRow()=0;
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
TBasePolicy(){id=type=kind=0;}
|
TBasePolicy(){id=type=kind=0;}
|
||||||
~TBasePolicy();
|
virtual ~TBasePolicy();
|
||||||
};
|
};
|
||||||
|
|
||||||
//打法策略
|
//打法策略
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
class TBetPolicy : public TBasePolicy{
|
class TBetPolicy : public TBasePolicy{
|
||||||
public:
|
public:
|
||||||
int road; //适用路单
|
int road; //适用路单 0=珠盘 1=大路 2=大眼路 3=小路 4=小强路(代码打法同样适用)
|
||||||
|
|
||||||
TBetPolicy& operator = (const TBetPolicy& b);
|
TBetPolicy& operator = (const TBetPolicy& b);
|
||||||
bool operator == (const TBetPolicy& b);
|
bool operator == (const TBetPolicy& b);
|
||||||
@@ -175,7 +175,7 @@ public:
|
|||||||
typedef struct tagRandomChip{
|
typedef struct tagRandomChip{
|
||||||
int minChip, //最小随机
|
int minChip, //最小随机
|
||||||
maxChip; //最大随机
|
maxChip; //最大随机
|
||||||
tagRandomChip(){minChip=20, maxChip=100;}
|
tagRandomChip(){minChip=1, maxChip=5;}
|
||||||
}TRandomChip;
|
}TRandomChip;
|
||||||
|
|
||||||
typedef struct tagBPAskBet{
|
typedef struct tagBPAskBet{
|
||||||
@@ -191,6 +191,8 @@ typedef struct tagBPDiffBet{
|
|||||||
}TBPDiffBet;
|
}TBPDiffBet;
|
||||||
|
|
||||||
void __fastcall LoadPolicies();
|
void __fastcall LoadPolicies();
|
||||||
|
int __fastcall ExportPolicy(int type, TBasePolicy* pPolicy, const String& file);
|
||||||
|
int __fastcall ImportPolicy(int type, const String& file, TBasePolicy*& pOut);
|
||||||
bool IsCodePolicy(int kind);
|
bool IsCodePolicy(int kind);
|
||||||
int __fastcall SavePolicy(int type, TBasePolicy* pPolicy, int index);
|
int __fastcall SavePolicy(int type, TBasePolicy* pPolicy, int index);
|
||||||
int __fastcall DeletePolicy(int type, int index);
|
int __fastcall DeletePolicy(int type, int index);
|
||||||
|
|||||||
+9
-7
@@ -80,7 +80,7 @@
|
|||||||
<Defines>_RBM_;$(Defines)</Defines>
|
<Defines>_RBM_;$(Defines)</Defines>
|
||||||
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
|
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
|
||||||
<IncludePath>..\Global\;..\CEF4Delphi\$(Platform)\hpps;$(IncludePath)</IncludePath>
|
<IncludePath>..\Global\;..\CEF4Delphi\$(Platform)\hpps;$(IncludePath)</IncludePath>
|
||||||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=5.0.0.0;InternalName=RBmaster;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=红蓝大师;ProductVersion=3.0;Comments=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=5.1.0.0;InternalName=RBmaster;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=红蓝大师;ProductVersion=3.0;Comments=</VerInfo_Keys>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||||
<AllPackageLibs>rtl.lib;vcl.lib;fmx.lib;vclimg.lib;xmlrtl.lib;vclactnband.lib;vclx.lib;CEF4DelphiVCLRTL.lib;vclwinx.lib;bindengine.lib;TPNGButton.lib</AllPackageLibs>
|
<AllPackageLibs>rtl.lib;vcl.lib;fmx.lib;vclimg.lib;xmlrtl.lib;vclactnband.lib;vclx.lib;CEF4DelphiVCLRTL.lib;vclwinx.lib;bindengine.lib;TPNGButton.lib</AllPackageLibs>
|
||||||
@@ -102,6 +102,7 @@
|
|||||||
<UWP_CppLogo150>$(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png</UWP_CppLogo150>
|
<UWP_CppLogo150>$(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png</UWP_CppLogo150>
|
||||||
<VerInfo_MajorVer>5</VerInfo_MajorVer>
|
<VerInfo_MajorVer>5</VerInfo_MajorVer>
|
||||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_MinorVer>1</VerInfo_MinorVer>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
<Debugger_CWD>..\Deploy\$(Platform)\$(Config)\</Debugger_CWD>
|
<Debugger_CWD>..\Deploy\$(Platform)\$(Config)\</Debugger_CWD>
|
||||||
@@ -165,12 +166,10 @@
|
|||||||
<ILINK_TranslatedLibraryPath>$(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath)</ILINK_TranslatedLibraryPath>
|
<ILINK_TranslatedLibraryPath>$(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath)</ILINK_TranslatedLibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||||
<VerInfo_Keys>CompanyName=;FileVersion=5.0.0.0;InternalName=RBmaster;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=红蓝大师;ProductVersion=3.0;Comments=;ProgramID=;FileDescription=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileVersion=5.1.0.0;InternalName=RBmaster;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=红蓝大师;ProductVersion=3.0;Comments=;ProgramID=;FileDescription=</VerInfo_Keys>
|
||||||
<LinkPackageStatics>rtl.lib;vcl.lib;fmx.lib;vclimg.lib;xmlrtl.lib;vclactnband.lib;vclx.lib;CEF4DelphiVCLRTL.lib;vclwinx.lib;bindengine.lib;TPNGButton.lib</LinkPackageStatics>
|
|
||||||
<AppExecutionLevel>requireAdministrator</AppExecutionLevel>
|
|
||||||
<BT_BuildType>Debug</BT_BuildType>
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
<Debugger_RunParams>-testing</Debugger_RunParams>
|
<Debugger_RunParams>-testing</Debugger_RunParams>
|
||||||
<Icon_MainIcon>..\res\RBmaster.Artwork\Windows\AppIcon.ico</Icon_MainIcon>
|
<LinkPackageStatics>rtl.lib;vcl.lib;fmx.lib;vclimg.lib;xmlrtl.lib;vclactnband.lib;vclx.lib;CEF4DelphiVCLRTL.lib;vclwinx.lib;bindengine.lib;TPNGButton.lib</LinkPackageStatics>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
@@ -188,7 +187,7 @@
|
|||||||
<TASM_Debugging>None</TASM_Debugging>
|
<TASM_Debugging>None</TASM_Debugging>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<VerInfo_Keys>CompanyName=;FileVersion=5.0.0.0;InternalName=RBmaster;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=红蓝大师;ProductVersion=3.0;Comments=;ProgramID=;FileDescription=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileVersion=5.1.0.0;InternalName=RBmaster;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=红蓝大师;ProductVersion=3.0;Comments=;ProgramID=;FileDescription=</VerInfo_Keys>
|
||||||
<LinkPackageStatics>rtl.lib;vcl.lib;fmx.lib;vclimg.lib;xmlrtl.lib;vclactnband.lib;vclx.lib;CEF4DelphiVCLRTL.lib;vclwinx.lib;bindengine.lib;TPNGButton.lib</LinkPackageStatics>
|
<LinkPackageStatics>rtl.lib;vcl.lib;fmx.lib;vclimg.lib;xmlrtl.lib;vclactnband.lib;vclx.lib;CEF4DelphiVCLRTL.lib;vclwinx.lib;bindengine.lib;TPNGButton.lib</LinkPackageStatics>
|
||||||
<AppExecutionLevel>requireAdministrator</AppExecutionLevel>
|
<AppExecutionLevel>requireAdministrator</AppExecutionLevel>
|
||||||
<Debugger_CWD>..\Deploy\$(Platform)\$(Config)\</Debugger_CWD>
|
<Debugger_CWD>..\Deploy\$(Platform)\$(Config)\</Debugger_CWD>
|
||||||
@@ -223,6 +222,9 @@
|
|||||||
<DependentOn>..\Global\HttpThread.h</DependentOn>
|
<DependentOn>..\Global\HttpThread.h</DependentOn>
|
||||||
<BuildOrder>16</BuildOrder>
|
<BuildOrder>16</BuildOrder>
|
||||||
</CppCompile>
|
</CppCompile>
|
||||||
|
<CppCompile Include="..\Global\SHA2.cpp">
|
||||||
|
<BuildOrder>53</BuildOrder>
|
||||||
|
</CppCompile>
|
||||||
<CppCompile Include="..\Global\SimpleMutex.cpp">
|
<CppCompile Include="..\Global\SimpleMutex.cpp">
|
||||||
<DependentOn>..\Global\SimpleMutex.h</DependentOn>
|
<DependentOn>..\Global\SimpleMutex.h</DependentOn>
|
||||||
<BuildOrder>25</BuildOrder>
|
<BuildOrder>25</BuildOrder>
|
||||||
@@ -489,8 +491,8 @@
|
|||||||
<FormResources Include="Chip02FrameUnit.dfm"/>
|
<FormResources Include="Chip02FrameUnit.dfm"/>
|
||||||
<FormResources Include="ChartFormUnit.dfm"/>
|
<FormResources Include="ChartFormUnit.dfm"/>
|
||||||
<FormResources Include="BetLogFormUnit.dfm"/>
|
<FormResources Include="BetLogFormUnit.dfm"/>
|
||||||
<FormResources Include="ChipsFormUnit.dfm"/>
|
|
||||||
<FormResources Include="CodesFrameUnit.dfm"/>
|
<FormResources Include="CodesFrameUnit.dfm"/>
|
||||||
|
<FormResources Include="ChipsFormUnit.dfm"/>
|
||||||
<BuildConfiguration Include="Base">
|
<BuildConfiguration Include="Base">
|
||||||
<Key>Base</Key>
|
<Key>Base</Key>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
|
|||||||
@@ -219,7 +219,25 @@ void InitUserPath()
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
USEFORM("SettingFormUnit.cpp", SettingForm);
|
||||||
|
USEFORM("ResetFormUnit.cpp", ResetForm);
|
||||||
|
USEFORM("PolicySave.cpp", PolicySaveForm);
|
||||||
|
USEFORM("PolicyEditFormUnit.cpp", PolicyEditForm);
|
||||||
USEFORM("RBmasterMain.cpp", MainForm);
|
USEFORM("RBmasterMain.cpp", MainForm);
|
||||||
|
USEFORM("TableUnit.cpp", TableFrame); /* TFrame: File Type */
|
||||||
|
USEFORM("TableSet.cpp", TabSetForm);
|
||||||
|
USEFORM("TableIPFormUnit.cpp", TableIPForm);
|
||||||
|
USEFORM("Bet03FrameUnit.cpp", Bet03Frame); /* TFrame: File Type */
|
||||||
|
USEFORM("Bet02FrameUnit.cpp", Bet02Frame); /* TFrame: File Type */
|
||||||
|
USEFORM("AIFormUnit.cpp", AIForm);
|
||||||
|
USEFORM("ActCodeFormUnit.cpp", ActCodeForm);
|
||||||
|
USEFORM("InfoFrameUnit.cpp", InfoFrame); /* TFrame: File Type */
|
||||||
|
USEFORM("LoginUnit.cpp", LoginForm);
|
||||||
|
USEFORM("Chip02FrameUnit.cpp", Chip02Frame); /* TFrame: File Type */
|
||||||
|
USEFORM("ChartFormUnit.cpp", ChartForm);
|
||||||
|
USEFORM("BetLogFormUnit.cpp", BetLogForm);
|
||||||
|
USEFORM("CodesFrameUnit.cpp", CodesFrame); /* TFrame: File Type */
|
||||||
|
USEFORM("ChipsFormUnit.cpp", ChipsForm);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool Startup()
|
bool Startup()
|
||||||
{
|
{
|
||||||
|
|||||||
+104
-23
@@ -146,6 +146,7 @@ __fastcall TMainForm::TMainForm(TComponent* Owner)
|
|||||||
m_bDragReady = m_bDraging = false;
|
m_bDragReady = m_bDraging = false;
|
||||||
m_pDragTimer = NULL;
|
m_pDragTimer = NULL;
|
||||||
m_iLastSel = -1;
|
m_iLastSel = -1;
|
||||||
|
m_iLastChipPolicy = -1;
|
||||||
|
|
||||||
sprintf(urServer, "%s:98", g_apiServer);
|
sprintf(urServer, "%s:98", g_apiServer);
|
||||||
}
|
}
|
||||||
@@ -280,6 +281,8 @@ void __fastcall TMainForm::FormCreate(TObject *Sender)
|
|||||||
m_leChipMul->Enabled = true;
|
m_leChipMul->Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdjustChipMode(false); //打注一体:禁用注码选择,沿用已保存的倍数
|
||||||
|
|
||||||
if(g_iPlatform > m_pmLogin->Items->Count)
|
if(g_iPlatform > m_pmLogin->Items->Count)
|
||||||
g_iPlatform = 0;
|
g_iPlatform = 0;
|
||||||
else if(g_iPlatform>0)
|
else if(g_iPlatform>0)
|
||||||
@@ -1938,7 +1941,7 @@ TStringList* __fastcall TMainForm::GetJQValue( String& str, _di_ICefFrame frame,
|
|||||||
|
|
||||||
v8Values->Clear();
|
v8Values->Clear();
|
||||||
frame->ExecuteJavaScript( str, "", 0 );
|
frame->ExecuteJavaScript( str, "", 0 );
|
||||||
DWORD dwRet = WaitForSingleObject( hV8ValueSema, bCode ? 500 : 2000 );
|
DWORD dwRet = WaitForSingleObject( hV8ValueSema, bCode ? 1000 : 2000 );
|
||||||
|
|
||||||
TStringList* values = NULL;
|
TStringList* values = NULL;
|
||||||
if( dwRet==WAIT_OBJECT_0 ){
|
if( dwRet==WAIT_OBJECT_0 ){
|
||||||
@@ -1984,7 +1987,10 @@ bool __fastcall TMainForm::EvalJSCode(int kind, const String& sCode,
|
|||||||
TJSONValue* pRoot = NULL;
|
TJSONValue* pRoot = NULL;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
String strJS = sPrelude + L" var context=" + (sCtx.Length() ? sCtx : String("{}") ) + L";" + sCode;
|
String strCode = StringReplace(sCode, "\n", "", TReplaceFlags() << rfReplaceAll);
|
||||||
|
String strJS = sPrelude + L" var context=" + (sCtx.Length() ? sCtx : String("{}") ) + L";" + strCode;
|
||||||
|
|
||||||
|
// TLog::WriteLog(strJS);
|
||||||
|
|
||||||
values = GetJQValue( strJS, m_chrmCode->Browser->MainFrame, true );
|
values = GetJQValue( strJS, m_chrmCode->Browser->MainFrame, true );
|
||||||
if( values && values->Count>0 && values->Strings[0].Length() ){
|
if( values && values->Count>0 && values->Strings[0].Length() ){
|
||||||
@@ -2324,7 +2330,7 @@ void __fastcall TMainForm::UMJsHandled(TMessage &msg)
|
|||||||
InitBrowser(true); //初始化代码执行浏览器
|
InitBrowser(true); //初始化代码执行浏览器
|
||||||
|
|
||||||
FileUserWeb();
|
FileUserWeb();
|
||||||
// InitBrowser(); //初始化游戏平台浏览器
|
InitBrowser(); //初始化游戏平台浏览器
|
||||||
m_lblTips->Caption = "请登录游戏";
|
m_lblTips->Caption = "请登录游戏";
|
||||||
|
|
||||||
if(m_sActCode.Length())
|
if(m_sActCode.Length())
|
||||||
@@ -2989,6 +2995,8 @@ void __fastcall TMainForm::UMStateUpdate(TMessage &msg)
|
|||||||
|
|
||||||
if(g_iChipPolicy>=0 && g_aChipPolicies[g_iChipPolicy]->kind!=KIND_CHIP_COM)
|
if(g_iChipPolicy>=0 && g_aChipPolicies[g_iChipPolicy]->kind!=KIND_CHIP_COM)
|
||||||
RecalcMultiRate();
|
RecalcMultiRate();
|
||||||
|
else if(g_iBetPolicy>=0 && g_aBetPolicies[g_iBetPolicy]->kind==KIND_BET_WCH)
|
||||||
|
AdjustChipMode(); //打注一体:限红变动后按最小注码重算倍数
|
||||||
}
|
}
|
||||||
else if(type==STATE_BET_R){
|
else if(type==STATE_BET_R){
|
||||||
int wl = msg.LParam;
|
int wl = msg.LParam;
|
||||||
@@ -3566,6 +3574,7 @@ void __fastcall TMainForm::InitBrowser(bool bCode)
|
|||||||
chrm->OnBeforeContextMenu = WebBeforeContextMenu;
|
chrm->OnBeforeContextMenu = WebBeforeContextMenu;
|
||||||
chrm->OnBeforePopup = WebBeforePopup;
|
chrm->OnBeforePopup = WebBeforePopup;
|
||||||
chrm->OnJsdialog = WebJsdialog;
|
chrm->OnJsdialog = WebJsdialog;
|
||||||
|
chrm->OnProcessMessageReceived = WebProcessMessageReceived;
|
||||||
|
|
||||||
if(bCode){
|
if(bCode){
|
||||||
chrm->DefaultUrl = "about:blank";
|
chrm->DefaultUrl = "about:blank";
|
||||||
@@ -3574,7 +3583,6 @@ void __fastcall TMainForm::InitBrowser(bool bCode)
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
chrm->OnAfterCreated = WebAfterCreated;
|
chrm->OnAfterCreated = WebAfterCreated;
|
||||||
chrm->OnProcessMessageReceived = WebProcessMessageReceived;
|
|
||||||
chrm->OnLoadEnd = WebLoadEnd;
|
chrm->OnLoadEnd = WebLoadEnd;
|
||||||
chrm->OnResourceLoadComplete = WebResourceLoadComplete;
|
chrm->OnResourceLoadComplete = WebResourceLoadComplete;
|
||||||
chrm->OnLoadError = WebLoadError;
|
chrm->OnLoadError = WebLoadError;
|
||||||
@@ -3618,7 +3626,7 @@ void __fastcall TMainForm::OnStartClick(TObject *Sender)
|
|||||||
goto Start_Click_Exit;
|
goto Start_Click_Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_iChipPolicy<0){
|
if(g_iChipPolicy<0 && g_aBetPolicies[g_iBetPolicy]->kind!=KIND_BET_WCH){ //打注一体注码由打法自带
|
||||||
ShowMessage( "请先选择注码" );
|
ShowMessage( "请先选择注码" );
|
||||||
goto Start_Click_Exit;
|
goto Start_Click_Exit;
|
||||||
}
|
}
|
||||||
@@ -3741,12 +3749,18 @@ void __fastcall TMainForm::OnPolicyEditClick(TObject *Sender)
|
|||||||
int iType = Sender==m_lblBetChipEdit;
|
int iType = Sender==m_lblBetChipEdit;
|
||||||
TComboBox* pCB = iType ? m_cbBetChips : m_cbBetWays;
|
TComboBox* pCB = iType ? m_cbBetChips : m_cbBetWays;
|
||||||
|
|
||||||
TPolicyEditForm* pForm = new TPolicyEditForm(this, iType);
|
//打注一体由打法策略自带注码,无需编辑注码策略
|
||||||
|
if(iType==TYPE_P_CHIP && g_iBetPolicy>=0 && g_aBetPolicies[g_iBetPolicy]->kind==KIND_BET_WCH){
|
||||||
if(pForm->ShowModal()==mrOk){
|
ShowMessage("打注一体由打法策略自带注码,无需设置注码策略");
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
TPolicyEditForm* pForm = new TPolicyEditForm(this, iType);
|
||||||
|
|
||||||
delete pForm;
|
if(pForm->ShowModal()==mrOk){
|
||||||
|
}
|
||||||
|
|
||||||
|
delete pForm;
|
||||||
|
}
|
||||||
|
|
||||||
SetTableFocus();
|
SetTableFocus();
|
||||||
}
|
}
|
||||||
@@ -3769,23 +3783,29 @@ void __fastcall TMainForm::OnPolicyChange(TObject *Sender)
|
|||||||
m_leChipMul->Text = "";
|
m_leChipMul->Text = "";
|
||||||
m_leChipMul->Enabled = false;
|
m_leChipMul->Enabled = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
AdjustChipMode(); //取消打法选择后恢复注码下拉
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(combo==m_cbBetChips){ //根据最小注码调整倍数
|
if(combo==m_cbBetChips){ //根据最小注码调整倍数
|
||||||
if(g_aChipPolicies[ind]->kind==KIND_CHIP_COM){
|
// if(g_aChipPolicies[ind]->kind==KIND_CHIP_COM){
|
||||||
g_nChipMul = 0;
|
// g_nChipMul = 0;
|
||||||
m_leChipMul->Text = "";
|
// m_leChipMul->Text = "";
|
||||||
m_leChipMul->Enabled = false;
|
// m_leChipMul->Enabled = false;
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
RecalcMultiRate();
|
RecalcMultiRate();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else{ //根据打法改变路珠显示
|
else{ //根据打法改变路珠显示
|
||||||
m_cbRoad->ItemIndex = ((TBetPolicy*)g_aBetPolicies[ind])->road;
|
TBetPolicy* pBP = (TBetPolicy*)g_aBetPolicies[ind];
|
||||||
|
|
||||||
|
m_cbRoad->ItemIndex = pBP->road;
|
||||||
OnRoadChange(m_cbRoad);
|
OnRoadChange(m_cbRoad);
|
||||||
|
|
||||||
|
AdjustChipMode(); //打注一体禁用注码选择,倍数按其最小注码计算
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_bGameOn){
|
if(g_bGameOn){
|
||||||
@@ -3804,19 +3824,71 @@ void __fastcall TMainForm::OnPolicyChange(TObject *Sender)
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//打注一体(KIND_BET_WCH)的注码由打法策略自带,无需选注码:
|
||||||
|
//禁用注码下拉并按该策略的最小非0注码换算倍数;其余打法恢复正常
|
||||||
|
void __fastcall TMainForm::AdjustChipMode(bool bResetMul)
|
||||||
|
{
|
||||||
|
TBetPolicy* pBP = g_iBetPolicy>=0 ? (TBetPolicy*)g_aBetPolicies[g_iBetPolicy] : NULL;
|
||||||
|
|
||||||
|
if(pBP && pBP->kind==KIND_BET_WCH){
|
||||||
|
if(g_iChipPolicy>=0) //记住原注码,切回普通打法时恢复
|
||||||
|
m_iLastChipPolicy = g_iChipPolicy;
|
||||||
|
|
||||||
|
g_iChipPolicy = -1;
|
||||||
|
m_cbBetChips->Enabled = false;
|
||||||
|
m_cbBetChips->ItemIndex = -1;
|
||||||
|
m_cbBetChips->Text = "打注一体";
|
||||||
|
|
||||||
|
if(bResetMul || g_nChipMul<=0){ //按最小非0注码计算倍数
|
||||||
|
int minChip = ((TBetChipPolicy*)pBP)->miniChip;
|
||||||
|
int multi = 0;
|
||||||
|
if(minChip>0){
|
||||||
|
multi = g_MinOnBet / minChip;
|
||||||
|
if(g_MinOnBet % minChip) multi++;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_nChipMul = multi;
|
||||||
|
m_leChipMul->Text = multi>0 ? IntToStr(multi) : String("");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_leChipMul->Enabled = true; //倍数允许用户输入
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_cbBetChips->Enabled = true;
|
||||||
|
|
||||||
|
if(g_iChipPolicy<0){ //切回普通打法:恢复原注码
|
||||||
|
int ind = m_iLastChipPolicy;
|
||||||
|
if(ind>=0 && ind<(int)g_aChipPolicies.size()){
|
||||||
|
m_cbBetChips->ItemIndex = ind;
|
||||||
|
g_iChipPolicy = ind;
|
||||||
|
|
||||||
|
RecalcMultiRate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_cbBetChips->Text = m_cbBetChips->Hint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void __fastcall TMainForm::RecalcMultiRate()
|
void __fastcall TMainForm::RecalcMultiRate()
|
||||||
{
|
{
|
||||||
int minChip = ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->miniChip;
|
if(g_iChipPolicy<0) //未选注码(含打注一体)不换算倍数
|
||||||
|
return;
|
||||||
|
|
||||||
|
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[g_iChipPolicy];
|
||||||
|
|
||||||
|
int minChip = pCP->kind==KIND_CHIP_RAN ? g_RandomChip.minChip : pCP->miniChip;
|
||||||
if(minChip>0){
|
if(minChip>0){
|
||||||
int multi = g_MinOnBet / minChip;
|
int multi = g_MinOnBet / minChip;
|
||||||
if(g_MinOnBet % minChip) multi++;
|
if(g_MinOnBet % minChip) multi++;
|
||||||
|
|
||||||
if(g_nChipMul<multi){
|
if(g_nChipMul!=multi){
|
||||||
g_nChipMul = multi;
|
g_nChipMul = multi;
|
||||||
m_leChipMul->Text = IntToStr(multi);
|
m_leChipMul->Text = IntToStr(multi);
|
||||||
m_leChipMul->Enabled = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -3910,9 +3982,18 @@ void __fastcall TMainForm::OnAccountClick(TObject *Sender)
|
|||||||
|
|
||||||
void __fastcall TMainForm::OnChipMulExit(TObject *Sender)
|
void __fastcall TMainForm::OnChipMulExit(TObject *Sender)
|
||||||
{
|
{
|
||||||
int minChip = ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->miniChip;
|
int minChip;
|
||||||
|
if(g_iBetPolicy>=0 && g_aBetPolicies[g_iBetPolicy]->kind==KIND_BET_WCH)
|
||||||
|
minChip = ((TBetChipPolicy*)g_aBetPolicies[g_iBetPolicy])->miniChip; //打注一体
|
||||||
|
else if(g_iChipPolicy>=0)
|
||||||
|
minChip = ((TChipPolicy*)g_aChipPolicies[g_iChipPolicy])->miniChip;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
int mul = m_leChipMul->Text.ToInt();
|
int mul = m_leChipMul->Text.ToInt();
|
||||||
if(minChip * mul < g_MinOnBet){
|
if(minChip<=0) //无最小注码可参考,倍数直接生效
|
||||||
|
g_nChipMul = m_leChipMul->Text.ToInt();
|
||||||
|
else if(minChip * mul < g_MinOnBet){
|
||||||
int multi = g_MinOnBet / minChip;
|
int multi = g_MinOnBet / minChip;
|
||||||
if(g_MinOnBet % minChip) multi++;
|
if(g_MinOnBet % minChip) multi++;
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -3,7 +3,7 @@ object MainForm: TMainForm
|
|||||||
Top = 0
|
Top = 0
|
||||||
ParentCustomHint = False
|
ParentCustomHint = False
|
||||||
Caption = #32418#34013#22823#24072
|
Caption = #32418#34013#22823#24072
|
||||||
ClientHeight = 830
|
ClientHeight = 861
|
||||||
ClientWidth = 1240
|
ClientWidth = 1240
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
CustomTitleBar.Control = m_tbp
|
CustomTitleBar.Control = m_tbp
|
||||||
@@ -49,7 +49,7 @@ object MainForm: TMainForm
|
|||||||
TextHeight = 13
|
TextHeight = 13
|
||||||
object m_panWeb: TScrollBox
|
object m_panWeb: TScrollBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 152
|
Top = 183
|
||||||
Width = 1240
|
Width = 1240
|
||||||
Height = 678
|
Height = 678
|
||||||
Margins.Left = 0
|
Margins.Left = 0
|
||||||
@@ -139261,7 +139261,6 @@ object MainForm: TMainForm
|
|||||||
ParentCustomHint = False
|
ParentCustomHint = False
|
||||||
OnPaint = TitleBarPaint
|
OnPaint = TitleBarPaint
|
||||||
CustomButtons = <>
|
CustomButtons = <>
|
||||||
ExplicitWidth = 1234
|
|
||||||
object m_imgLogo: TImage
|
object m_imgLogo: TImage
|
||||||
Left = 10
|
Left = 10
|
||||||
Top = 10
|
Top = 10
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ private: // User declarations
|
|||||||
|
|
||||||
TTimer *m_pDragTimer; //拖动滚屏定时器
|
TTimer *m_pDragTimer; //拖动滚屏定时器
|
||||||
int m_iLastSel; //最后单独选中台桌
|
int m_iLastSel; //最后单独选中台桌
|
||||||
|
int m_iLastChipPolicy; //打注一体前的全局注码,切回普通打法时恢复
|
||||||
set<int> m_aSelTabs; //选中台桌集合
|
set<int> m_aSelTabs; //选中台桌集合
|
||||||
|
|
||||||
TBitmap *m_bmTBPBackTile, //标题栏背景贴条
|
TBitmap *m_bmTBPBackTile, //标题栏背景贴条
|
||||||
@@ -227,6 +228,7 @@ private: // User declarations
|
|||||||
void __fastcall RBReport();
|
void __fastcall RBReport();
|
||||||
void __fastcall LoadUrl();
|
void __fastcall LoadUrl();
|
||||||
void __fastcall RecalcMultiRate();
|
void __fastcall RecalcMultiRate();
|
||||||
|
void __fastcall AdjustChipMode(bool bResetMul=true);
|
||||||
void __fastcall SetTableFocus();
|
void __fastcall SetTableFocus();
|
||||||
int __fastcall GetTableByPos(int x, int y);
|
int __fastcall GetTableByPos(int x, int y);
|
||||||
void __fastcall SelectTables(int x1, int y1, int x2, int y2);
|
void __fastcall SelectTables(int x1, int y1, int x2, int y2);
|
||||||
|
|||||||
+48
-4
@@ -41,6 +41,24 @@ void __fastcall TTableIPForm::FormCreate(TObject *Sender)
|
|||||||
m_leChipMul->Enabled = true;
|
m_leChipMul->Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//打注一体:注码由打法策略自带,禁用注码选择
|
||||||
|
if(m_iBet>=0 && g_aBetPolicies[m_iBet]->kind==KIND_BET_WCH){
|
||||||
|
m_iChip = -1;
|
||||||
|
m_cbChips->Enabled = false;
|
||||||
|
m_cbChips->ItemIndex = -1;
|
||||||
|
m_cbChips->Text = "打注一体";
|
||||||
|
|
||||||
|
int minChip = ((TBetChipPolicy*)g_aBetPolicies[m_iBet])->miniChip;
|
||||||
|
if(minChip>0 && m_nMul<=0){
|
||||||
|
int mul = g_MinOnBet / minChip;
|
||||||
|
if(g_MinOnBet % minChip) mul++;
|
||||||
|
|
||||||
|
m_nMul = mul;
|
||||||
|
m_leChipMul->Text = IntToStr(mul);
|
||||||
|
m_leChipMul->Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_cbIndPolicy->Checked = m_pGame->bIndPolicy;
|
m_cbIndPolicy->Checked = m_pGame->bIndPolicy;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -53,7 +71,7 @@ void __fastcall TTableIPForm::OkClick(TObject *Sender)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_iChip<0){
|
if(m_iChip<0 && g_aBetPolicies[m_iBet]->kind!=KIND_BET_WCH){ //打注一体注码由打法自带
|
||||||
ShowMessage("请选择注码策略");
|
ShowMessage("请选择注码策略");
|
||||||
m_cbChips->SetFocus();
|
m_cbChips->SetFocus();
|
||||||
return;
|
return;
|
||||||
@@ -120,6 +138,26 @@ void __fastcall TTableIPForm::PolicyChange(TObject *Sender)
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
m_cbRoad->ItemIndex = ((TBetPolicy*)g_aBetPolicies[ind])->road;
|
m_cbRoad->ItemIndex = ((TBetPolicy*)g_aBetPolicies[ind])->road;
|
||||||
|
|
||||||
|
if(g_aBetPolicies[ind]->kind==KIND_BET_WCH){ //打注一体:禁用注码选择,倍数按最小注码计算
|
||||||
|
m_iChip = -1;
|
||||||
|
m_cbChips->Enabled = false;
|
||||||
|
m_cbChips->ItemIndex = -1;
|
||||||
|
m_cbChips->Text = "打注一体";
|
||||||
|
|
||||||
|
int minChip = ((TBetChipPolicy*)g_aBetPolicies[ind])->miniChip;
|
||||||
|
if(minChip>0){
|
||||||
|
int mul = g_MinOnBet / minChip;
|
||||||
|
if(g_MinOnBet % minChip) mul++;
|
||||||
|
|
||||||
|
m_nMul = mul;
|
||||||
|
m_leChipMul->Text = IntToStr(mul);
|
||||||
|
}
|
||||||
|
m_leChipMul->Enabled = true; //倍数允许用户输入
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
m_cbChips->Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,8 +174,13 @@ void __fastcall TTableIPForm::ChipMulExit(TObject *Sender)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int minChip = ((TChipPolicy*)g_aChipPolicies[m_iChip])->miniChip;
|
int minChip = 0;
|
||||||
if(minChip * mul < g_MinOnBet){
|
if(m_iBet>=0 && g_aBetPolicies[m_iBet]->kind==KIND_BET_WCH) //打注一体
|
||||||
|
minChip = ((TBetChipPolicy*)g_aBetPolicies[m_iBet])->miniChip;
|
||||||
|
else if(m_iChip>=0)
|
||||||
|
minChip = ((TChipPolicy*)g_aChipPolicies[m_iChip])->miniChip;
|
||||||
|
|
||||||
|
if(minChip>0 && minChip * mul < g_MinOnBet){
|
||||||
int multi = g_MinOnBet / minChip;
|
int multi = g_MinOnBet / minChip;
|
||||||
if(g_MinOnBet % minChip) multi++;
|
if(g_MinOnBet % minChip) multi++;
|
||||||
|
|
||||||
@@ -159,7 +202,8 @@ void __fastcall TTableIPForm::ChipMulKeyDown(TObject *Sender, WORD &Key, TShiftS
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void __fastcall TTableIPForm::SetChanged()
|
void __fastcall TTableIPForm::SetChanged()
|
||||||
{
|
{
|
||||||
if(m_iBet>=0 && m_iChip>=0 && (m_iBet!=g_iBetPolicy || m_iChip!=g_iChipPolicy
|
if(m_iBet>=0 && (m_iChip>=0 || g_aBetPolicies[m_iBet]->kind==KIND_BET_WCH)
|
||||||
|
&& (m_iBet!=g_iBetPolicy || m_iChip!=g_iChipPolicy
|
||||||
|| m_nMul!=g_nChipMul)){
|
|| m_nMul!=g_nChipMul)){
|
||||||
m_cbIndPolicy->Checked = true;
|
m_cbIndPolicy->Checked = true;
|
||||||
m_btnOk->SetFocus();
|
m_btnOk->SetFocus();
|
||||||
|
|||||||
+9
-6
@@ -600,9 +600,10 @@ void __fastcall TTableFrame::UMLogUpdate(TMessage &msg)
|
|||||||
UpdateLogs();
|
UpdateLogs();
|
||||||
}
|
}
|
||||||
else if(iState==ST_PAID){ //显示输赢结果日志
|
else if(iState==ST_PAID){ //显示输赢结果日志
|
||||||
int ret = msg.LParam & 0xFFFF;
|
int ret = msg.LParam & 0xFF;
|
||||||
int dead = (msg.LParam >> 16) & 0xFF;
|
int dead = (msg.LParam >> 16) & 0xFF;
|
||||||
int stop = msg.LParam >> 24;
|
int stop = msg.LParam >> 24;
|
||||||
|
int blastMin = (msg.LParam >> 8) & 0xFF; //代码策略爆纤暂停分钟
|
||||||
|
|
||||||
if(ret==0){ //有错误发生
|
if(ret==0){ //有错误发生
|
||||||
m_sgBets->Cells[3][m_logRows] = "X";
|
m_sgBets->Cells[3][m_logRows] = "X";
|
||||||
@@ -614,17 +615,19 @@ void __fastcall TTableFrame::UMLogUpdate(TMessage &msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_bGameOn && (dead || stop)){
|
if(g_bGameOn && (dead || stop)){
|
||||||
int pause = 0;
|
int pause = blastMin ? blastMin : 0; //先取代码策略爆纤暂停分钟
|
||||||
if(dead && (m_pGame->bIndPolicy || !g_aGames.pRankChip)){ //独立策略或非全局注码
|
if(dead && (m_pGame->bIndPolicy || !g_aGames.pRankChip)){ //独立策略或非全局注码
|
||||||
m_logRows++;
|
m_logRows++;
|
||||||
m_sgBets->Cells[0][m_logRows] = "爆缆";
|
m_sgBets->Cells[0][m_logRows] = "爆缆";
|
||||||
if(dead==3){
|
if(dead==3){
|
||||||
int iCP = m_pGame->bIndPolicy ? m_pGame->iChipPolicy : g_iChipPolicy;
|
int iCP = m_pGame->bIndPolicy ? m_pGame->iChipPolicy : g_iChipPolicy;
|
||||||
TChipPolicy* pCP = (TChipPolicy*)g_aChipPolicies[iCP];
|
int pm = blastMin;
|
||||||
m_sgBets->Cells[1][m_logRows] = pCP->deadPause ? "暂停" : "重启";
|
if(!pm && iCP>=0) //打注一体无全局注码
|
||||||
|
pm = ((TChipPolicy*)g_aChipPolicies[iCP])->deadPause;
|
||||||
|
m_sgBets->Cells[1][m_logRows] = pm ? "暂停" : "重启";
|
||||||
|
|
||||||
if(pause<pCP->deadPause)
|
if(pause<pm)
|
||||||
pause = pCP->deadPause;
|
pause = pm;
|
||||||
}
|
}
|
||||||
else if(dead==2)
|
else if(dead==2)
|
||||||
m_sgBets->Cells[1][m_logRows] = "局停";
|
m_sgBets->Cells[1][m_logRows] = "局停";
|
||||||
|
|||||||
@@ -1,9 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<assemblyIdentity type="win32" name="RBmaster" version="1.0.0.0"/>
|
<assemblyIdentity type="win32" name="RBmaster" version="1.0.0.0"/>
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- Windows 10 / 11 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
|
<!-- 如需兼容更早系统,可保留以下条目 -->
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<!-- <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> -->
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<!-- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> -->
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<!-- <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> -->
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges>
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
<application>
|
<application>
|
||||||
<windowsSettings>
|
<windowsSettings>
|
||||||
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
|
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
|
||||||
</windowsSettings>
|
</windowsSettings>
|
||||||
</application>
|
</application>
|
||||||
|
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||||
|
<dpiAware>True/PM</dpiAware>
|
||||||
|
</asmv3:windowsSettings>
|
||||||
|
</asmv3:application>
|
||||||
</assembly>
|
</assembly>
|
||||||
Reference in New Issue
Block a user