void shellcodeCreator_linux86() { lastMenu = shellcodeCreator; currentMenu = shellcodeCreator_linux86; freeMenu(); addItemMenu("Write", processInstruction); addItemMenu("Read", processInstruction); addItemMenu("Exec", processInstruction); addItemMenu("Exit", processInstruction); addItemMenu("Help", printHelp); addItemMenu("Look Assembly", printFileContent); addItemMenu("Create Shellcode", createShellcode); addItemMenu("Back", lastMenu); printMenu(); }
void CClient::Menu_Setup( RESOURCE_ID_BASE rid, CObjBase * pObj ) { ADDTOCALLSTACK("CClient::Menu_Setup"); // Menus for general purpose // Expect PacketMenuChoice::onReceive() back. CResourceLock s; if ( ! g_Cfg.ResourceLock( s, rid )) { return; } if ( pObj == NULL ) { pObj = m_pChar; } s.ReadKey(); // get title for the menu. pObj->ParseText( s.GetKeyBuffer(), m_pChar ); CMenuItem item[MAX_MENU_ITEMS]; item[0].m_sText = s.GetKey(); // item[0].m_id = rid.m_internalrid; // general context id size_t i = 0; while (s.ReadKeyParse()) { if ( ! s.IsKey( "ON" )) continue; i++; if ( ! item[i].ParseLine( s.GetArgRaw(), pObj, m_pChar )) i--; if ( i >= (COUNTOF( item ) - 1)) break; } m_tmMenu.m_ResourceID = rid; ASSERT(i < COUNTOF(item)); addItemMenu( CLIMODE_MENU, item, i, pObj ); }
void shellcodeCreator() { lastMenu = mainMenu; currentMenu = shellcodeCreator; freeMenu(); addItemMenu("Linux x86", shellcodeCreator_linux86); addItemMenu("Linux x86_x64", shellcodeCreator_linux64); addItemMenu("Windows x86", shellcodeCreator_windows86); addItemMenu("Windows x64", shellcodeCreator_windows64); addItemMenu("Help", printHelp); addItemMenu("Back", lastMenu); printMenu(); }
bool CClient::Cmd_Skill_Menu( RESOURCE_ID_BASE rid, int iSelect ) { ADDTOCALLSTACK("CClient::Cmd_Skill_Menu"); // Build the skill menu for the curent active skill. // Only list the things we have skill and ingrediants to make. // // ARGS: // m_Targ_UID = the object used to get us here. // rid = which menu ? // iSelect = -2 = Just a test of the whole menu., // iSelect = -1 = 1st setup. // iSelect = 0 = cancel // iSelect = x = execute the selection. // // RETURN: false = fail/cancel the skill. // m_tmMenu.m_Item = the menu entries. ASSERT(m_pChar); if ( rid.GetResType() != RES_SKILLMENU ) return false; bool fShowMenu = false; bool fLimitReached = false; if ( iSelect == 0 ) // menu cancelled return (Cmd_Skill_Menu_Build(rid, iSelect, NULL, 0, fShowMenu, fLimitReached) > 0); CMenuItem item[minimum(COUNTOF(m_tmMenu.m_Item), MAX_MENU_ITEMS)]; size_t iShowCount = Cmd_Skill_Menu_Build(rid, iSelect, item, COUNTOF(item), fShowMenu, fLimitReached); if ( iSelect < -1 ) // just a test return iShowCount ? true : false; if ( iSelect > 0 ) // seems our resources disappeared. { if ( iShowCount <= 0 ) SysMessageDefault(DEFMSG_CANT_MAKE); return iShowCount > 0 ? true : false; } if ( iShowCount <= 0 ) { SysMessageDefault(DEFMSG_CANT_MAKE_RES); return false; } if ( iShowCount == 1 && fShowMenu && !fLimitReached ) { static int sm_iReentrant = 0; if ( sm_iReentrant < 12 ) { sm_iReentrant++; // If there is just one menu then select it. bool fSuccess = Cmd_Skill_Menu(rid, m_tmMenu.m_Item[1]); sm_iReentrant--; return fSuccess; } if ( g_Cfg.m_wDebugFlags & DEBUGF_SCRIPTS ) g_Log.EventDebug("SCRIPT: Too many empty skill menus to continue seeking through menu '%s'\n", g_Cfg.ResourceGetDef(rid)->GetResourceName()); } ASSERT(iShowCount < COUNTOF(item)); addItemMenu(CLIMODE_MENU_SKILL, item, iShowCount); return true; }
void CClient::Cmd_EditItem( CObjBase *pObj, int iSelect ) { ADDTOCALLSTACK("CClient::Cmd_EditItem"); // ARGS: // iSelect == -1 = setup. // m_Targ_Text = what are we doing to it ? // if ( !pObj ) return; CContainer *pContainer = dynamic_cast<CContainer *>(pObj); if ( !pContainer ) { addGumpDialogProps(pObj->GetUID()); return; } if ( iSelect == 0 ) // cancelled return; if ( iSelect > 0 ) // we selected an item { if ( static_cast<size_t>(iSelect) >= COUNTOF(m_tmMenu.m_Item) ) return; if ( m_Targ_Text.IsEmpty() ) addGumpDialogProps(m_tmMenu.m_Item[static_cast<size_t>(iSelect)]); else OnTarg_Obj_Set(CGrayUID(m_tmMenu.m_Item[static_cast<size_t>(iSelect)]).ObjFind()); return; } CMenuItem item[minimum(COUNTOF(m_tmMenu.m_Item), MAX_MENU_ITEMS)]; // Most as we want to display at one time. item[0].m_sText.Format("Contents of %s", pObj->GetName()); size_t count = 0; for ( CItem *pItem = pContainer->GetContentHead(); pItem != NULL; pItem = pItem->GetNext() ) { count++; m_tmMenu.m_Item[count] = pItem->GetUID(); item[count].m_sText = pItem->GetName(); ITEMID_TYPE idi = pItem->GetDispID(); item[count].m_id = static_cast<WORD>(idi); item[count].m_color = 0; if ( !pItem->IsType(IT_EQ_MEMORY_OBJ) ) { HUE_TYPE wHue = pItem->GetHue(); if ( wHue != 0 ) { wHue = (wHue == 1 ? 0x7FF : wHue - 1); item[count].m_color = wHue; } } if ( count >= (COUNTOF(item) - 1) ) break; } ASSERT(count < COUNTOF(item)); addItemMenu(CLIMODE_MENU_EDIT, item, count, pObj); }
bool CClient::Cmd_Skill_Tracking( WORD track_sel, bool bExec ) { ADDTOCALLSTACK("CClient::Cmd_Skill_Tracking"); // look around for stuff. ASSERT(m_pChar); if ( track_sel == USHRT_MAX ) { // Unlike others skills, Tracking is used during menu setup m_pChar->Skill_Cleanup(); // clean up current skill CMenuItem item[6]; item[0].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_TITLE); item[1].m_id = ITEMID_TRACK_HORSE; item[1].m_color = 0; item[1].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_ANIMALS); item[2].m_id = ITEMID_TRACK_OGRE; item[2].m_color = 0; item[2].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_MONSTERS); item[3].m_id = ITEMID_TRACK_MAN; item[3].m_color = 0; item[3].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_NPCS); item[4].m_id = ITEMID_TRACK_WOMAN; item[4].m_color = 0; item[4].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_PLAYERS); m_tmMenu.m_Item[0] = 0; addItemMenu(CLIMODE_MENU_SKILL_TRACK_SETUP, item, 4); return true; } if ( track_sel > 0 ) // Not Cancelled { ASSERT(track_sel < COUNTOF(m_tmMenu.m_Item)); if ( bExec ) { // Tracking menu got us here. Start tracking the selected creature. m_pChar->SetTimeout(1 * TICK_PER_SEC); m_pChar->m_Act_Targ = static_cast<CGrayUID>(m_tmMenu.m_Item[track_sel]); m_pChar->Skill_Start(SKILL_TRACKING); return true; } static const NPCBRAIN_TYPE sm_Track_Brain[] = { NPCBRAIN_QTY, // not used here NPCBRAIN_ANIMAL, NPCBRAIN_MONSTER, NPCBRAIN_HUMAN, NPCBRAIN_NONE // players }; if ( track_sel >= COUNTOF(sm_Track_Brain) ) track_sel = COUNTOF(sm_Track_Brain) - 1; NPCBRAIN_TYPE track_type = sm_Track_Brain[track_sel]; CMenuItem item[minimum(MAX_MENU_ITEMS, COUNTOF(m_tmMenu.m_Item))]; size_t count = 0; item[0].m_sText = g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_SKILLMENU_TITLE); m_tmMenu.m_Item[0] = track_sel; CWorldSearch AreaChars(m_pChar->GetTopPoint(), m_pChar->Skill_GetBase(SKILL_TRACKING) / 10 + 10); for (;;) { CChar *pChar = AreaChars.GetChar(); if ( !pChar ) break; if ( pChar == m_pChar ) continue; if ( pChar->GetNPCBrain() != track_type ) continue; if ( pChar->IsStatFlag(STATF_DEAD) ) // can't track ghosts continue; if ( pChar->m_pPlayer ) { // Prevent track hidden GMs if ( pChar->IsStatFlag(STATF_Insubstantial) && (pChar->GetPrivLevel() > GetPrivLevel()) ) continue; // Check action difficulty when trying to track players int tracking = m_pChar->Skill_GetBase(SKILL_TRACKING); int detectHidden = m_pChar->Skill_GetBase(SKILL_DETECTINGHIDDEN); if ( (g_Cfg.m_iRacialFlags & RACIALF_ELF_DIFFTRACK) && pChar->IsElf() ) tracking /= 2; // elves are more difficult to track (Difficult to Track racial trait) int hiding = pChar->Skill_GetBase(SKILL_HIDING); int stealth = pChar->Skill_GetBase(SKILL_STEALTH); int divisor = maximum(hiding + stealth, 1); int chance; if ( g_Cfg.m_iFeatureSE & FEATURE_SE_UPDATE ) chance = 50 * (tracking * 2 + detectHidden) / divisor; else chance = 50 * (tracking + detectHidden + 10 * Calc_GetRandVal(20)) / divisor; if ( Calc_GetRandVal(100) > chance ) continue; } CCharBase *pCharDef = pChar->Char_GetDef(); if ( !pCharDef ) continue; count++; item[count].m_id = static_cast<WORD>(pCharDef->m_trackID); item[count].m_color = 0; item[count].m_sText = pChar->GetName(); m_tmMenu.m_Item[count] = pChar->GetUID(); if ( count >= COUNTOF(item) - 1 ) break; } // Some credit for trying if ( count > 0 ) { m_pChar->Skill_UseQuick(SKILL_TRACKING, 20 + Calc_GetRandLLVal(30)); ASSERT(count < COUNTOF(item)); addItemMenu(CLIMODE_MENU_SKILL_TRACK, item, count); return true; } else { // Tracking failed or cancelled m_pChar->Skill_UseQuick(SKILL_TRACKING, 10 + Calc_GetRandLLVal(30)); static LPCTSTR const sm_Track_FailMsg[] = { g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_FAIL_ANIMAL), g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_FAIL_MONSTER), g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_FAIL_PEOPLE), g_Cfg.GetDefaultMsg(DEFMSG_TRACKING_FAIL_PEOPLE) }; if ( sm_Track_FailMsg[track_sel - 1] ) SysMessage(sm_Track_FailMsg[track_sel - 1]); } } return false; }