How to use const_value method in wpt

Best JavaScript code snippet using wpt

constant_data.js

Source: constant_data.js Github

copy

Full Screen

1var json_config_file=require("./​json_config_file");2var log_data=require("./​log_data");3var log_data_logic=require("./​help_log_data_logic");45var ConstValue=function()6{7 /​*需在Excel表中配置的常量*/​8 /​/​升级体力上限增加数量9 this.STAMINA_ADD = 0;10 /​/​初始好友上限11 this.FRIEND_INIT_LIMIT = [];12 /​/​单个好友每日使用次数限制13 this.FRIEND_USE_TIMES = 0;14 /​/​武将空间初始上限15 this.CARD_BAG_LIMIT = 0;16 /​/​每次扩充武将背包上限17 this.BAG_EXPEND_LIMIT=0;18 /​/​扩充武将背包消耗元宝19 this.BAG_EXPAND_COST = 0;20 /​/​体力恢复时间21 this.POINT_TICK = 0;22 /​/​体力最大值23 this.STAMINA_MAX = 0;24 /​/​战前邀请好友数量25 this.FIGHT_FRIEND_NUM = 0;26 /​/​邀请好友人获得积分27 this.FRIEND_SCORE = 0;28 /​/​邀请陌生人获得积分29 this.USER_SCORE = 0;30 /​/​补满探索个数花费31 this.EXPLORE_COST = [];32 /​/​初始探索上限33 this.EXPLORE_INIT_LIMIT = 0;34 /​/​探索恢复时间35 this.EXPLORE_TICK=0;36 /​/​十连抽折扣37 this.RECRUIT_DISCOUNT=0;38 /​/​月卡39 this.CD_REWARD_TIME=0;404142 /​/​强化武将经验金钱参数43 this.Up_CARD_COST_MONEY_RATIO=0;44 /​/​聊天免费次数45 this.CHAT_FREE_TIMES=0;46 /​/​聊天花费RMB47 this.CHAT_COST=0;48 /​/​吃鸡增加体力49 this.CHICK_ADD=0;50 /​/​兑换店倒计时(毫秒值)51 this.EXCHANGE_MS=0;52 /​/​兑换店刷新花费53 this.EXCHANGE_COST=0;54 /​/​转生等级限制55 this.REBORN_LEVEL=[];56 /​/​探索开启等级57 this.EXPLORE_LEVEL=0;58 /​/​升级恢复体力59 this.UP_ADD_POWER=0;60 /​/​摇钱树获取的铜钱61 this.MT_GOLD=0;62 /​/​摇钱花费63 this.MT_COST=[];64 /​/​摇钱树VIP次数65 this.MT_VIP_TIMES=[];66 /​/​摇钱树低级暴击概率67 this.MT_Crit_LOW=0;68 /​/​摇钱树高级暴击概率69 this.MT_Crit_HIGH=0;70 /​/​霸业铜钱奖励71 this.TOWN_COIN_REWARD=0;72 /​/​熊猫卡包ID73 this.PANDA_ITEM_ID=0;74 /​/​肥猪卡包ID75 this.PIG_ITEM_ID=0;76 /​/​熊猫卡牌ID77 this.PANDA_CARD_ID=0;78 /​/​肥猪卡牌ID79 this.PIG_CARD_ID=0;80 /​/​重置扫荡花费81 this.RESET_SWEEP_COST=[];82 /​/​VIP对应的充值额度83 this.VIP=[];84 /​/​战斗复活花费85 this.REVIVE_COST=[];86 /​/​战斗复活VIP次数87 this.REVIVE_TIMES=[];88 /​/​转生花费铜钱89 this.REBORN_COST=[];90919293 /​*需在Excel表中配置的常量*/​949596 /​*程序自定义常量*/​9798 /​/​最大邮件数量99 this.MAIL_MAX=30;100101 /​/​武将状态102 this.CARD_STATUS_OFF=1;/​/​下阵103 this.CARD_STATUS_ON=2;/​/​上阵104 this.CARD_STATUS_LEADER=3;/​/​统帅105 this.CARD_STATUS_VAN=4;/​/​先锋106 this.CARD_STATUS_GUARD=5;/​/​城守107108 /​/​奖励分类109 this.REWARD_TYPE_CARD=1;/​/​卡牌110 this.REWARD_TYPE_SOUL=2;/​/​魂魄111 this.REWARD_TYPE_ITEM=3;/​/​道具112 this.REWARD_TYPE_RMB=4;/​/​人民币113 this.REWARD_TYPE_MONEY=5;/​/​游戏币114 this.REWARD_TYPE_SCORE=6;/​/​积分115 this.REWARD_TYPE_EXP=7;/​/​经验116 this.REWARD_TYPE_POINT=8;/​/​体力117118 /​/​道具分类119 this.ITEM_TYPE_BOX=1;/​/​宝箱120 this.ITEM_TYPE_KEY=2;/​/​钥匙121 this.ITEM_TYPE_STAMINA=3;/​/​包子122 this.ITEM_TYPE_EQUIP=4;/​/​装备123 this.ITEM_TYPE_EQUIP_FRAG=5;/​/​装备碎片124125 /​/​卡牌装备上限126 this.CARD_EQUIP_LIMIT=3;127128 /​/​关卡战斗分类129 this.FIGHT_TYPE_GATE=1; /​/​普通关卡战斗130 this.FIGHT_TYPE_TOWN=2; /​/​城池战斗(挑战)131 this.FIGHT_TYPE_BATTLE=3; /​/​战场战斗(活动)132133 /​/​卡牌背包最大限制134 this.CARD_BAG_MAX_LIMIT=200;135136 /​/​成就类型137 this.ACHI_TYPE_GATE=1; /​/​通关关卡138 /​/​this.ACHI_TYPE_RECHARGE_TIMES=2; /​/​充值次数139 /​/​this.ACHI_TYPE_RECHARGE_SUM=3; /​/​充值金额140 this.ACHI_TYPE_EXPLORE_TIMES=4; /​/​探索次数141 /​/​this.ACHI_TYPE_BUY_EXPLORE=5; /​/​补充探索次数142 /​/​this.ACHI_TYPE_LOGIN=7; /​/​连续登录天数143 /​/​this.ACHI_TYPE_SKILL_VAN=8; /​/​先锋技能次数144 /​/​this.ACHI_TYPE_NINE=10; /​/​九连释放次数145 this.ACHI_TYPE_KILL_NUM=11; /​/​击杀数量146 this.ACHI_TYPE_LEVEL=12; /​/​玩家等级147 this.ACHI_TYPE_CARD_STAR=13; /​/​5星级武将数量148 this.ACHI_TYPE_EQUIP_NUM=14; /​/​装备获得数量149 this.ACHI_TYPE_CARD_EVOLVE_COUNT=15; /​/​转生的武将个数150 this.ACHI_TYPE_CARD_EVOLVE_LEVEL=16; /​/​转生的武将等级151 /​/​this.ACHI_TYPE_GRIFFIN=17; /​/​战斗中召唤神兽次数152 /​/​this.ACHI_TYPE_TOWNS=18; /​/​占领城池数量153 this.ACHI_TYPE_TOWNS_FIGHT=19; /​/​霸业挑战次数154155156 this.EXCHANGE_LIST_NUM=5;/​/​兑换列表数量157158 /​/​邮件类型159 this.MAIL_TYPE_REWARD=1;/​/​可以领取奖励的邮件160 this.MAIL_TYPE_READ_SUCC=2;/​/​我占领了城池,只读161 this.MAIL_TYPE_READ_FAIL=3;/​/​我的城池被夺走,只读162163 /​/​城池状态164 this.TOWN_STATUS_INIT=1;/​/​初始状态165 this.TOWN_STATUS_CARD=2;/​/​关卡通关 武将未领取166 this.TOWN_STATUS_BEAUTY=3;/​/​美女未领取167 this.TOWN_STATUS_OK=4;/​/​通关168169 /​/​摇钱树低级暴击触发获得倍率170 this.MT_LOW_GAIN=1.5;171 /​/​摇钱树高级暴击触发获得倍率172 this.MT_HIGH_GAIN=2;173174 /​*程序自定义常量*/​175176};177178var const_value=new ConstValue();179exports.const_value=const_value;180181182function init()183{184 load_constant_data();185}186exports.init=init;187188function load_constant_data()189{190 global.log("load_constant_data");191 var file="const.json";192 var data=json_config_file.json_config_file_list[file];193194 var ks=Object.keys(data["CONST"]);195 var count=ks.length;196 /​/​实现完全拷贝197 for(var i=1 ; i<=count ; i++)198 {199 const_value.STAMINA_ADD=Number(data["CONST"][i].StaminaAdd);200201 (data["CONST"][i].FriendInitLimit).split(',').forEach(function(e){202 const_value.FRIEND_INIT_LIMIT.push(Number(e));203 });204205 const_value.FRIEND_USE_TIMES=Number(data["CONST"][i].EveryFirendUseTimes);206 const_value.CARD_BAG_LIMIT=Number(data["CONST"][i].CardBagLimit);207 const_value.BAG_EXPEND_LIMIT=Number(data["CONST"][i].BagExpandLimit);208 const_value.BAG_EXPAND_COST=Number(data["CONST"][i].BagExpandCost);209 const_value.POINT_TICK= Number(data["CONST"][i].Point_Tick);210 const_value.STAMINA_MAX= Number(data["CONST"][i].StaminaMax);211 const_value.FIGHT_FRIEND_NUM= Number(data["CONST"][i].FightFriendNum);212 const_value.FRIEND_SCORE= Number(data["CONST"][i].FriendScore);213 const_value.USER_SCORE= Number(data["CONST"][i].UserScore);214 const_value.TOWN_COIN_REWARD= Number(data["CONST"][i].TownRewardCoin);215 (data["CONST"][i].ExploreCost).split(',').forEach(function(e){216 const_value.EXPLORE_COST.push(Number(e));217 });218 const_value.EXPLORE_INIT_LIMIT= Number(data["CONST"][i].ExploreInitLimit);219 const_value.EXPLORE_TICK= Number(data["CONST"][i].ExploreTick);220 const_value.RECRUIT_DISCOUNT= Number(data["CONST"][i].RecruitDiscount);221 const_value.CD_REWARD_TIME= Number(data["CONST"][i].CdRewardTime);222 const_value.Up_CARD_COST_MONEY_RATIO= Number(data["CONST"][i].UpWarriorCostMoneyRatio);223 const_value.CHAT_FREE_TIMES= Number(data["CONST"][i].ChatFreeTimes);224 const_value.CHAT_COST= Number(data["CONST"][i].ChatCost);225 const_value.CHICK_ADD= Number(data["CONST"][i].ChickAdd);226 const_value.EXCHANGE_MS= Number(data["CONST"][i].ExchangeHour)*60*60*1000;227 const_value.EXCHANGE_COST= Number(data["CONST"][i].ExchangeCost);228229230 (data["CONST"][i].RebornLevel).split(',').forEach(function(e){231 const_value.REBORN_LEVEL.push(Number(e));232 });233 const_value.EXPLORE_LEVEL= Number(data["CONST"][i].ExploreLv);234 const_value.UP_ADD_POWER= Number(data["CONST"][i].UpGradePower);235 const_value.MT_GOLD= Number(data["CONST"][i].MTGold);236 (data["CONST"][i].MTCost).split(',').forEach(function(e){237 const_value.MT_COST.push(Number(e));238 });239240 (data["CONST"][i].MTVipTimes).split(',').forEach(function(e){241 const_value.MT_VIP_TIMES.push(Number(e));242 });243 const_value.MT_Crit_LOW= Number(data["CONST"][i].MTCritLow)*10;244 const_value.MT_Crit_HIGH= Number(data["CONST"][i].MTCritHigh)*10+const_value.MT_Crit_LOW;245 const_value.PANDA_ITEM_ID= data["CONST"][i].PandaItemId;246 const_value.PIG_ITEM_ID= data["CONST"][i].PigItemId;247 const_value.PANDA_CARD_ID= data["CONST"][i].PandaCardId;248 const_value.PIG_CARD_ID= data["CONST"][i].PigCardId;249250 (data["CONST"][i].ResetSweepCost).split(',').forEach(function(e){251 const_value.RESET_SWEEP_COST.push(Number(e));252 });253254 (data["CONST"][i].Vip).split(',').forEach(function(e){255 const_value.VIP.push(Number(e));256 });257258 (data["CONST"][i].ReviveCost).split(',').forEach(function(e){259 const_value.REVIVE_COST.push(Number(e));260 });261262 (data["CONST"][i].ReviveTimes).split(',').forEach(function(e){263 const_value.REVIVE_TIMES.push(Number(e));264 });265266 (data["CONST"][i].RebornCost).split(',').forEach(function(e){267 const_value.REBORN_COST.push(Number(e));268 });269270 break;271 }272273 var log_content={"count":count,"const_value":const_value};274 var logData=log_data_logic.help_create_log_data("sys","sys","sys","sys","sys","load_constant_data",log_content,log_data.logType.LOG_CONFIG);275 log_data_logic.log(logData);276277} ...

Full Screen

Full Screen

analysis.js

Source: analysis.js Github

copy

Full Screen

1var fs = require('fs');2var readline = require('readline');3const CONST_VALUE = '1';4function analysis() {5 fs.readFile('/​Users/​sexychen/​myFile/​work/​console/​car/​data.json', "utf8", function (err, data) {6 if (!data) {7 console.error('data is null');8 return;9 }10 var jsonData = JSON.parse(data);11 if (!jsonData || jsonData.length <= 0) {12 console.error('parse json error');13 return;14 }15 replaceImgPath(jsonData)16 /​/​ extractBrand(jsonData);17 /​/​ filterPrice(jsonData);18 });19}20/​/​ 替换logo和车身外观的图片地址为线上的地址21function replaceImgPath(jsonData) {22 /​/​ logo文件: /​Users/​sexychen/​myFile/​work/​console/​car/​logo_name23 var logoNameMap = {};24 var fRead = fs.createReadStream('/​Users/​sexychen/​myFile/​work/​console/​car/​logo_name');25 var objReadline = readline.createInterface({26 input: fRead27 });28 objReadline.on('line',function (line) {29 logoNameMap[line] = CONST_VALUE;30 });31 objReadline.on('close',function () {32 readAppearanceName(logoNameMap, jsonData);33 });34}35function readAppearanceName(logoNameMap, jsonData) {36 /​/​ 外观文件: /​Users/​sexychen/​myFile/​work/​console/​car/​appearance_name37 var appearanceNameMap = {};38 var fRead2 = fs.createReadStream('/​Users/​sexychen/​myFile/​work/​console/​car/​appearance_name');39 var objReadline2 = readline.createInterface({40 input: fRead241 });42 objReadline2.on('line',function (line) {43 appearanceNameMap[line] = CONST_VALUE44 });45 objReadline2.on('close',function () {46 doReplace(logoNameMap, appearanceNameMap, jsonData);47 });48}49function doReplace(logoNameMap, appearanceNameMap, jsonData){50 /​/​ 判断源数据的是否存在logo和车身外观的真实文件51 for (let index = 0; index < jsonData.length; index++) {52 var car = jsonData[index];53 var logoSmallName = car.bCode + '_1';54 var logoLargeName = car.bCode + '_2';55 /​/​ 存在logo大图56 if (logoNameMap[logoLargeName] === CONST_VALUE) {57 car.logo = 'https:/​/​img.117sport.com/​miniprogram/​car/​garage/​logo/​' + logoLargeName + '.jpg';58 }59 /​/​ 只有小图,同时打个标60 else if (logoNameMap[logoSmallName] === CONST_VALUE){61 car.logo = 'https:/​/​img.117sport.com/​miniprogram/​car/​garage/​logo/​' + logoSmallName + '.jpg';62 car.sLogo = true;63 }64 /​/​ 每个车系车身外观的处理65 var series = car.series;66 for (let index = 0; index < series.length; index++) {67 const carSeries = series[index];68 carSeries.imgs = [];69 /​/​ 三张图70 var first = carSeries.sCode + '_1';71 if (appearanceNameMap[first] === CONST_VALUE) {72 carSeries.imgs.push({73 path: 'https:/​/​img.117sport.com/​miniprogram/​car/​garage/​appearance/​' + first + '.jpg'74 })75 }76 var second = carSeries.sCode + '_2';77 if (appearanceNameMap[second] === CONST_VALUE) {78 carSeries.imgs.push({79 path: 'https:/​/​img.117sport.com/​miniprogram/​car/​garage/​appearance/​' + second + '.jpg'80 })81 }82 var third = carSeries.sCode + '_3';83 if (appearanceNameMap[third] === CONST_VALUE) {84 carSeries.imgs.push({85 path: 'https:/​/​img.117sport.com/​miniprogram/​car/​garage/​appearance/​' + third + '.jpg'86 })87 }88 /​/​ 清除不需要的数据89 carSeries.img1 = undefined;90 carSeries.img2 = undefined;91 carSeries.img3 = undefined;92 carSeries.page = undefined;93 }94 }95 /​/​ 重新排个序96 var newJsonData = []97 jsonData.forEach(element => {98 newJsonData.push({99 char: element.char,100 bCode: element.bCode,101 bName: element.bName,102 sLogo: element.sLogo,103 logo: element.logo,104 bMinP: element.bMinP,105 bMaxP: element.bMaxP,106 series: element.series107 });108 });109 /​/​ 保存替换之后的json110 fs.writeFileSync('/​Users/​sexychen/​myFile/​work/​console/​car/​data_replace_img.json', JSON.stringify(newJsonData));111}112/​/​ 转换成特定的格式113function extractBrand(jsonData) {114 var data = [];115 for (let index = 0; index < jsonData.length; index++) {116 var car = jsonData[index];117 data.push({118 bName: car.bName,119 bCode: car.bCode120 })121 }122 fs.writeFileSync('/​Users/​sexychen/​myFile/​work/​console/​car/​convert.json', JSON.stringify(data))123}124/​/​ 过滤价格125function filterPrice(jsonData) {126 for (let index = 0; index < jsonData.length; index++) {127 var car = jsonData[index];128 /​/​ if (car.bMaxP && car.bMaxP >= 100 && car.bMinP && car.bMinP >= 30) {129 if (!car.bMaxP && !car.bMinP && car.bName.match(/​^[a-zA-Z]+/​)) {130 console.error(car.bName + ': ' + car.series[0].page);131 }132 }133}...

Full Screen

Full Screen

640.求解方程.js

Source: 640.求解方程.js Github

copy

Full Screen

1var solveEquation = function (equation) {2 let xishu = 0;3 let const_value = 0;4 equation = equation.replaceAll("-", "+-");5 let [left, right] = equation.split('=');6 left = left.split("+"); /​/​已加号分割,如果包含x,则7 for (let item of left) {8 if (item !== "") {9 if (item.includes("x")) {10 /​/​ 包含x的项11 if (item === "x") {12 xishu += 1;13 } else {14 xishu += +item.split("x")[0];15 }16 } else {17 const_value -= parseInt(item);18 }19 }20 }21 right = right.split("+");22 for (let item of right) {23 if (item !== "") {24 if (item.includes("x")) {25 if (item === "x") {26 xishu -= 1;27 } else {28 xishu -= +item.split("x")[0];29 }30 /​/​ 包含x的项31 } else {32 const_value += parseInt(item);33 }34 }35 }36 if (xishu === 0) {37 if (const_value === 0) {38 return "Infinite solutions"39 } else {40 return "No solution"41 }42 }43 let value = parseInt(const_value /​ xishu);44 return "x=" + value;45};...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('webpagetest');2const wptInstance = wpt('API_KEY');3}, function(err, data) {4 if (err) return console.error(err);5 console.log('testId', data.data.testId);6 console.log('ownerKey', data.data.ownerKey);7 wptInstance.getTestResults(data.data.testId, data.data.ownerKey, function(err, data) {8 if (err) return console.error(err);9 console.log('data', data);10 });11});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { const_value } = require('./​wpt');2console.log(const_value);3const { wpt } = require('./​wpt');4console.log(wpt);5const { get } = require('./​wpt');6console.log(get());7const { set } = require('./​wpt');8console.log(set(10));9const { add } = require('./​wpt');10console.log(add(10));11const { sub } = require('./​wpt');12console.log(sub(10));

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Test Automation Frameworks: The 2021 List

Automation frameworks enable automation testers by simplifying the test development and execution activities. A typical automation framework provides an environment for executing test plans and generating repeatable output. They are specialized tools that assist you in your everyday test automation tasks. Whether it is a test runner, an action recording tool, or a web testing tool, it is there to remove all the hard work from building test scripts and leave you with more time to do quality checks. Test Automation is a proven, cost-effective approach to improving software development. Therefore, choosing the best test automation framework can prove crucial to your test results and QA timeframes.

Aug&#8217; 20 Updates: Live Interaction In Automation, macOS Big Sur Preview &#038; More

Hey Testers! We know it’s been tough out there at this time when the pandemic is far from gone and remote working has become the new normal. Regardless of all the hurdles, we are continually working to bring more features on-board for a seamless cross-browser testing experience.

A Complete Guide To CSS Container Queries

In 2007, Steve Jobs launched the first iPhone, which revolutionized the world. But because of that, many businesses dealt with the problem of changing the layout of websites from desktop to mobile by delivering completely different mobile-compatible websites under the subdomain of ‘m’ (e.g., https://m.facebook.com). And we were all trying to figure out how to work in this new world of contending with mobile and desktop screen sizes.

August &#8217;21 Updates: Live With iOS 14.5, Latest Browsers, New Certifications, &#038; More!

Hey Folks! Welcome back to the latest edition of LambdaTest’s product updates. Since programmer’s day is just around the corner, our incredible team of developers came up with several new features and enhancements to add some zing to your workflow. We at LambdaTest are continuously upgrading the features on our platform to make lives easy for the QA community. We are releasing new functionality almost every week.

Webinar: Building Selenium Automation Framework [Voices of Community]

Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful