diff --git a/config.php b/config.php index 35f3d45..6d0d9a7 100644 --- a/config.php +++ b/config.php @@ -21,4 +21,5 @@ define('WQ_Cookie', 'YOUR_WEBQQ_COOKIE_HERE'); //For plugins define('PLUGIN_GITHUB_TOKEN', 'YOUR_GITHUB_TOKEN_HERE'); -define('PLUGIN_STEAM_KEY', 'YOUR_STEAM_KEY_HERE'); \ No newline at end of file +define('PLUGIN_STEAM_KEY', 'YOUR_STEAM_KEY_HERE'); +define("PLUGIN_BATTLENET_KEY","YOUR_BATTLENET_KEY_HERE"); \ No newline at end of file diff --git a/plugins/wowCN.php b/plugins/wowCN.php index d79c6dd..c2b426f 100644 --- a/plugins/wowCN.php +++ b/plugins/wowCN.php @@ -2,14 +2,14 @@ PluginSet("Find Somebody on WoW"); $plugin_wow_init = explode(' ',$plugin_text,2); -$plugin_wow_api_url_prefix = "http://www.battlenet.com.cn/api/wow/character/"; +$plugin_wow_api_url_prefix = "https://api.battlenet.com.cn/wow/"; $plugin_wow_realm = $plugin_wow_init[0]; $plugin_wow_characterName = $plugin_wow_init[1]; -$plugin_wow_api_url_root = $plugin_wow_api_url_prefix.$plugin_wow_realm."/".$plugin_wow_characterName; +$plugin_wow_api_url_root = $plugin_wow_api_url_prefix."character/".$plugin_wow_realm."/".$plugin_wow_characterName; -$plugin_wow_profile = json_decode(file_get_contents($plugin_wow_api_url_root."?fields=stats"), true); -$plugin_wow_db_races = json_decode(file_get_contents("http://www.battlenet.com.cn/api/wow/data/character/races"), true); -$plugin_wow_db_classes = json_decode(file_get_contents("http://www.battlenet.com.cn/api/wow/data/character/classes"), true); +$plugin_wow_profile = json_decode(file_get_contents($plugin_wow_api_url_root."?fields=stats&apikey=".PLUGIN_BATTLENET_KEY), true); +$plugin_wow_db_races = json_decode(file_get_contents($plugin_wow_api_url_prefix."data/character/races?apikey=".PLUGIN_BATTLENET_KEY), true); +$plugin_wow_db_classes = json_decode(file_get_contents($plugin_wow_api_url_prefix."data/character/classes?apikey=".PLUGIN_BATTLENET_KEY), true); if(isset($plugin_wow_profile['lastModified']) and isset($plugin_wow_db_classes['classes']) and isset($plugin_wow_db_races['races'])){ foreach ($plugin_wow_db_races["races"] as $plugin_wow_db_races_list) { @@ -24,19 +24,20 @@ if(isset($plugin_wow_profile['lastModified']) and isset($plugin_wow_db_classes[' } $plugin_wow_thumbnail = str_replace("avatar","profilemain","http://render-api-cn.worldofwarcraft.com/static-render/cn/".$plugin_wow_profile['thumbnail']); - $msg = "Realm: ".$plugin_wow_profile["realm"]." | ". - "Name: ".$plugin_wow_profile["name"]."\n". - "Race: ".$plugin_wow_profile_race." | ". - "Class: ".$plugin_wow_profile_class."\n". - "Level: ".$plugin_wow_profile["level"]." | ". - "Achievement Points :".$plugin_wow_profile["achievementPoints"]."\n". - "Pic: ".$plugin_wow_thumbnail."\n\n". - "Health: ".$plugin_wow_profile["stats"]["health"]." | ". - "Power[".$plugin_wow_profile["stats"]["powerType"]."]: ".$plugin_wow_profile["stats"]["power"]."\n". - "Strength: ".$plugin_wow_profile["stats"]["str"]." | ". - "Agility: ".$plugin_wow_profile["stats"]["agi"]."\n". - "Intellect: ".$plugin_wow_profile["stats"]["int"]." | ". - "Stamina: ".$plugin_wow_profile["stats"]["sta"]."\n" + $msg = "所在区服: ".$plugin_wow_profile["realm"]." | ". + "角色名称: ".$plugin_wow_profile["name"]."\n". + "种族: ".$plugin_wow_profile_race." | ". + "职业: ".$plugin_wow_profile_class."\n". + "等级: ".$plugin_wow_profile["level"]." | ". + "成就点数: ".$plugin_wow_profile["achievementPoints"]."\n". + "预览图片: ".$plugin_wow_thumbnail."\n\n". + "生命上限: ".$plugin_wow_profile["stats"]["health"]." | ". + "法力上限[".$plugin_wow_profile["stats"]["powerType"]."]: ".$plugin_wow_profile["stats"]["power"]."\n". + "力量: ".$plugin_wow_profile["stats"]["str"]." | ". + "敏捷: ".$plugin_wow_profile["stats"]["agi"]."\n". + "智力: ".$plugin_wow_profile["stats"]["int"]." | ". + "耐力: ".$plugin_wow_profile["stats"]["sta"]."\n". + "\n详细资料: "."http://www.battlenet.com.cn/wow/zh/character/".urlencode($plugin_wow_realm)."/".urlencode($plugin_wow_characterName)."/simple" ;