D-Bot/plugins/wowCN.php

49 lines
2.7 KiB
PHP
Raw Normal View History

2016-01-15 06:31:04 -06:00
<?php
PluginSet("Find Somebody on WoW");
2016-01-15 06:55:47 -06:00
$plugin_wow_init = explode(' ',$plugin_text,2);
2016-04-30 22:50:43 -05:00
$plugin_wow_api_url_prefix = "https://api.battlenet.com.cn/wow/";
2016-01-15 06:55:47 -06:00
$plugin_wow_realm = $plugin_wow_init[0];
$plugin_wow_characterName = $plugin_wow_init[1];
2016-04-30 22:50:43 -05:00
$plugin_wow_api_url_root = $plugin_wow_api_url_prefix."character/".$plugin_wow_realm."/".$plugin_wow_characterName;
2016-01-15 06:55:47 -06:00
2016-04-30 22:50:43 -05:00
$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);
2016-01-15 06:55:47 -06:00
2016-01-17 20:28:19 -06:00
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) {
if ($plugin_wow_db_races_list["id"] == $plugin_wow_profile["race"]) {
$plugin_wow_profile_race = $plugin_wow_db_races_list["name"];
}
}
foreach ($plugin_wow_db_classes["classes"] as $plugin_wow_db_classes_list) {
if ($plugin_wow_db_classes_list["id"] == $plugin_wow_profile["class"]) {
$plugin_wow_profile_class = $plugin_wow_db_classes_list["name"];
}
}
2016-01-15 06:55:47 -06:00
$plugin_wow_thumbnail = str_replace("avatar","profilemain","http://render-api-cn.worldofwarcraft.com/static-render/cn/".$plugin_wow_profile['thumbnail']);
2016-04-30 22:50:43 -05:00
$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"
2016-01-17 20:28:19 -06:00
;
2016-01-15 06:55:47 -06:00
$BOT->msg($plugin_sendto, $msg);
}else{
$BOT->msg($plugin_sendto, 'Somthing happened.');
}