#include #include "W3SIncs/War3Source_Interface" public Plugin:myinfo= { name="War3Source Menus playerinfo raceinfo", author="Ownz (DarkEnergy)", description="War3Source Core Plugins", version="1.0", url="http://war3source.com/" }; new raceinfoshowskillnumber[MAXPLAYERSCUSTOM]; public OnPluginStart() { } public OnWar3Event(W3EVENT:event,client){ if(W3()){ if(event==DoShowRaceinfoMenu){ ShowMenuRaceinfo(client); } if(event==DoShowPlayerinfoMenu){ War3_PlayerInfoMenu(client,"") } if(event==DoShowPlayerinfoEntryWithArg){ PlayerInfoMenuEntry(client); } if(event==DoShowParticularRaceInfo){ War3_ShowParticularRaceInfoMenu(client,W3GetVar(RaceinfoRaceToShow)); } if(event==DoShowPlayerInfoTarget){ War3_playertargetMenu(client,W3GetVar(EventArg1)) ; } } } ShowMenuRaceinfo(client){ SetTrans(client); new Handle:hMenu=CreateMenu(War3_raceinfoSelected); SetMenuExitButton(hMenu,true); SetMenuTitle(hMenu,"%T\n ","[War3Source] Select a race for more info",client); // Iteriate through the races and print them out decl String:rbuf[4]; decl String:rracename[64]; decl String:rdisp[128]; new racelist[MAXRACES]; new racedisplay=W3GetRaceList(racelist); //if(GetConVarInt(W3GetVar(hSortByMinLevelCvar))<1){ // for(new x=0;x"); } else if(W3GetPendingRace(client)==raceid){ Format(extra,sizeof(extra),"<"); } Format(rdisp,sizeof(rdisp),"%s%s (%d,%d)",extra,rracename,yourteam,otherteam); AddMenuItem(hMenu,rbuf,rdisp); } DisplayMenu(hMenu,client,MENU_TIME_FOREVER); } public War3_raceinfoSelected(Handle:menu,MenuAction:action,client,selection) { if(action==MenuAction_Select) { if(ValidPlayer(client)) { decl String:SelectionInfo[4]; decl String:SelectionDispText[256]; new SelectionStyle; GetMenuItem(menu,selection,SelectionInfo,sizeof(SelectionInfo),SelectionStyle, SelectionDispText,sizeof(SelectionDispText)); new race_selected=StringToInt(SelectionInfo); raceinfoshowskillnumber[client]=-1; War3_ShowParticularRaceInfoMenu(client,race_selected); } } if(action==MenuAction_End) { CloseHandle(menu); } } public War3_ShowParticularRaceInfoMenu(client,raceid){ SetTrans(client); new Handle:hMenu=CreateMenu(War3_particularraceinfoSelected); SetMenuExitButton(hMenu,true); new String:racename[64]; new String:skilldesc[1000]; new String:skillname[64]; //new String:longbuf[7000]; War3_GetRaceName(raceid,racename,sizeof(racename)); new String:selectioninfo[32]; SetMenuTitle(hMenu,"%T\n \n","[War3Source] Information for race: {racename} (LVL {amount}/{amount})",client,racename,War3_GetLevel(client,raceid),W3GetRaceMaxLevel(raceid)); new level; new SkillCount = War3_GetRaceSkillCount(raceid); for(new x=1;x<=SkillCount;x++) { decl String:str[1000]; W3GetRaceSkillName(raceid,x,skillname,sizeof(skillname)); level=War3_GetSkillLevelINTERNAL(client,raceid,x) ; if(War3_IsSkillUltimate(raceid,x)) { Format(str,sizeof(str),"%T","Ultimate: {skillname} (LVL {amount}/{amount})",client,skillname,level,W3GetRaceSkillMaxLevel(raceid,x)); } else { Format(str,sizeof(str),"%T","{skillname} (LVL {amount}/{amount})",client,skillname,level,W3GetRaceSkillMaxLevel(raceid,x)); } Format(selectioninfo,sizeof(selectioninfo),"%d,skill,%d",raceid,x); if(raceinfoshowskillnumber[client]==x){ W3GetRaceSkillDesc(raceid,x,skilldesc,sizeof(skilldesc)) ; // AddMenuItem(hMenu,selectioninfo,skilldesc,ITEMDRAW_RAWLINE); //,ITEMDRAW_DISABLED|ITEMDRAW_RAWLINE Format(str,sizeof(str),"%s \n%s \n",str,skilldesc); //Format(longbuf,sizeof(longbuf),"%s\n%s%s (Level %d/%d)\n%s\n ",longbuf,,skillname,level,,skilldesc); } if(x==War3_GetRaceSkillCount(raceid)&&raceinfoshowskillnumber[client]==x){ Format(str,sizeof(str),"%s \n",str); //extend whitespace } else if(x==War3_GetRaceSkillCount(raceid)){ Format(str,sizeof(str),"%s \n \n",str); //extend whitespace } AddMenuItem(hMenu,selectioninfo,str); } Format(selectioninfo,sizeof(selectioninfo),"%d,raceinfo,%d",raceid,0); new String:str[100]; Format(str,sizeof(str),"%T \n \n","Back to raceinfo",client); AddMenuItem(hMenu,selectioninfo,str); Format(selectioninfo,sizeof(selectioninfo),"%d,0,%d",raceid,0); AddMenuItem(hMenu,selectioninfo,"",ITEMDRAW_NOTEXT); //empty line new String:selectionDisplayBuff[64]; Format(selectionDisplayBuff,sizeof(selectionDisplayBuff),"%T \n \n","See all players with race {racename}",client,racename) ; Format(selectioninfo,sizeof(selectioninfo),"%d,seeall,%d",raceid,0); AddMenuItem(hMenu,selectioninfo,selectionDisplayBuff); DisplayMenu(hMenu,client,MENU_TIME_FOREVER); } public War3_particularraceinfoSelected(Handle:menu,MenuAction:action,client,selection) { if(action==MenuAction_Select) { if(ValidPlayer(client)) { new String:exploded[3][32]; decl String:SelectionInfo[32]; decl String:SelectionDispText[256]; new SelectionStyle; GetMenuItem(menu,selection,SelectionInfo,sizeof(SelectionInfo),SelectionStyle, SelectionDispText,sizeof(SelectionDispText)); ExplodeString(SelectionInfo, ",", exploded, 3, 32); new raceid=StringToInt(exploded[0]); if(StrEqual(exploded[1],"skill")){ new skillnum=StringToInt(exploded[2]); if(raceinfoshowskillnumber[client]==selection){ raceinfoshowskillnumber[client]=-1; } else{ raceinfoshowskillnumber[client]=skillnum; } War3_ShowParticularRaceInfoMenu(client,raceid); } else if(StrEqual(exploded[1],"raceinfo")){ ShowMenuRaceinfo(client); } else if(StrEqual(exploded[1],"seeall")){ //show all players with this raceid War3_playersWhoAreThisRaceMenu(client,raceid); } } } if(action==MenuAction_End) { CloseHandle(menu); } } War3_playersWhoAreThisRaceMenu(client,raceid){ new Handle:hMenu=CreateMenu(War3_playersWhoAreThisRaceSel); SetMenuExitButton(hMenu,true); new String:racename[64]; War3_GetRaceName(raceid,racename,sizeof(racename)); SetMenuTitle(hMenu,"%T\n \n","[War3Source] People who are race: {racename}",client,racename); decl String:playername[64]; decl String:war3playerbuf[4]; for(new x=1;x<=MaxClients;x++) { if(ValidPlayer(x)&&War3_GetRace(x)==raceid){ Format(war3playerbuf,sizeof(war3playerbuf),"%d",x); //target index GetClientName(x,playername,sizeof(playername)); decl String:menuitemstr[100]; decl String:teamname[10]; GetShortTeamName( GetClientTeam(x),teamname,sizeof(teamname)); Format(menuitemstr,sizeof(menuitemstr),"%T","{player} (Level {amount}) [{team}]",client,playername,War3_GetLevel(x,raceid),teamname); AddMenuItem(hMenu,war3playerbuf,menuitemstr); } } DisplayMenu(hMenu,client,MENU_TIME_FOREVER); } public War3_playersWhoAreThisRaceSel(Handle:menu,MenuAction:action,client,selection) { if(action==MenuAction_Select) { decl String:SelectionInfo[4]; decl String:SelectionDispText[256]; new SelectionStyle; GetMenuItem(menu,selection,SelectionInfo,sizeof(SelectionInfo),SelectionStyle, SelectionDispText,sizeof(SelectionDispText)); new target=StringToInt(SelectionInfo); if(ValidPlayer(target)) War3_playertargetMenu(client,target); else War3_ChatMessage(client,"%T","Player has left the server",client); } if(action==MenuAction_End) { CloseHandle(menu); } } PlayerInfoMenuEntry(client){ new String:arg[32]; new Handle:dataarray=W3GetVar(hPlayerInfoArgStr); //should always be created, upper plugin closes handle GetArrayString(dataarray,0,arg,sizeof(arg)); War3_PlayerInfoMenu(client,arg); } War3_PlayerInfoMenu(client,String:arg[]){ SetTrans(client); //PrintToChatAll("%s",arg); if(strlen(arg)>10){ //has argument (space after) new String:arg2[32]; Format(arg2,sizeof(arg2),"%s",arg[11]); //PrintToChatAll("%s",arg2); new found=0; new targetlist[MAXPLAYERSCUSTOM]; new String:name[32]; for(new i=1;i<=MaxClients;i++){ if(ValidPlayer(i)){ GetClientName(i,name,sizeof(name)); if(StrContains(name,arg2,false)>-1){ targetlist[found++]=i; } } } if(found==0){ War3_ChatMessage(client,"%T","playerinfo : No target found",client); } else if(found>1){ War3_ChatMessage(client,"%T","playerinfo : More than one target found",client); //redundant code..maybe we should optmize? new Handle:hMenu=CreateMenu(War3_playerinfoSelected1); SetMenuExitButton(hMenu,true); SetMenuTitle(hMenu,"%T\n ","[War3Source] Select a player to view its information",client); // Iteriate through the players and print them out decl String:playername[32]; decl String:war3playerbuf[4]; decl String:racename[64]; decl String:menuitem[100] ; for(new i=0;i0) { Format(menuitem,sizeof(menuitem),"%T","{player} ({racename} LVL {amount})",GetTrans(),playername,racename,War3_GetLevel(clientindex,War3_GetRace(clientindex))); } else { Format(menuitem,sizeof(menuitem),"%T","{player} ({racename})",GetTrans(),playername,racename); } AddMenuItem(hMenu,war3playerbuf,menuitem); } DisplayMenu(hMenu,client,MENU_TIME_FOREVER); } else { War3_playertargetMenu(client,targetlist[0]); } } else { new Handle:hMenu=CreateMenu(War3_playerinfoSelected1); SetMenuExitButton(hMenu,true); SetMenuTitle(hMenu,"%T\n ","[War3Source] Select a player to view its information",client); // Iteriate through the players and print them out decl String:playername[32]; decl String:war3playerbuf[4]; decl String:racename[64]; decl String:menuitem[100] ; for(new x=1;x<=MaxClients;x++) { if(ValidPlayer(x)){ Format(war3playerbuf,sizeof(war3playerbuf),"%d",x); //target index GetClientName(x,playername,sizeof(playername)); War3_GetRaceName(War3_GetRace(x),racename,sizeof(racename)); if(War3_GetRace(x)>0) { Format(menuitem,sizeof(menuitem),"%T","{player} ({racename} LVL {amount})",GetTrans(),playername,racename,War3_GetLevel(x,War3_GetRace(x))); } else { Format(menuitem,sizeof(menuitem),"%T","{player} ({racename})",GetTrans(),playername,racename); } AddMenuItem(hMenu,war3playerbuf,menuitem); } } DisplayMenu(hMenu,client,MENU_TIME_FOREVER); } } public War3_playerinfoSelected1(Handle:menu,MenuAction:action,client,selection) { if(action==MenuAction_Select) { decl String:SelectionInfo[4]; decl String:SelectionDispText[256]; new SelectionStyle; GetMenuItem(menu,selection,SelectionInfo,sizeof(SelectionInfo),SelectionStyle, SelectionDispText,sizeof(SelectionDispText)); new target=StringToInt(SelectionInfo); if(ValidPlayer(target)) War3_playertargetMenu(client,target); else War3_ChatMessage(client,"%T","Player has left the server",client); } if(action==MenuAction_End) { CloseHandle(menu); } } War3_playertargetMenu(client,target) { SetTrans(client); new Handle:hMenu=CreateMenu(War3_playertargetMenuSelected); SetMenuExitButton(hMenu,true); new String:targetname[32]; GetClientName(target,targetname,sizeof(targetname)); new String:racename[64]; new String:skillname[64]; new raceid=War3_GetRace(target); War3_GetRaceName(raceid,racename,sizeof(racename)); new level; level=War3_GetLevel(target,raceid); new String:title[3000]; Format(title,sizeof(title),"%T\n \n","[War3Source] Information for {player}",client,targetname); Format(title,sizeof(title),"%s%T\n \n",title,"Total levels: {amount}",client,GetClientTotalLevels(target)); if(level