From cfd3ecf63a4fcab77ee0926f1043a8fdc254f743 Mon Sep 17 00:00:00 2001 From: dennydai Date: Fri, 15 Jan 2016 20:55:47 +0800 Subject: [PATCH] add api --- plugins/wowCN.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/wowCN.php b/plugins/wowCN.php index a4d87df..898908b 100644 --- a/plugins/wowCN.php +++ b/plugins/wowCN.php @@ -1,4 +1,22 @@ msg($plugin_sendto, $plugin_text); \ No newline at end of file +$plugin_wow_init = explode(' ',$plugin_text,2); +$plugin_wow_api_url_prefix = "http://www.battlenet.com.cn/api/wow/character/"; +$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_profile = json_decode(file_get_contents($plugin_wow_api_url_root."?fields="), true); + +if(isset($plugin_wow_profile['lastModified'])){ + $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"]."\n". + "Name: ".$plugin_wow_profile["name"]."\n". + "Level: ".$plugin_wow_profile["level"]."\n". + "Pic: ".$plugin_wow_thumbnail."\n"; + "Achievement Points ".$plugin_wow_profile["achievementPoints"]."\n"; + $BOT->msg($plugin_sendto, $msg); +}else{ + $BOT->msg($plugin_sendto, 'Somthing happened.'); +}