DWORD STDCALL manageBtnUp(sWinMessage* msg) { if (onRealm || !D2isLODGame()) return 0; Unit* ptChar = D2GetClientPlayer(); if (isOnButtonPreviousStash(msg->x,msg->y)) { log_msg("push up left button previous\n"); if (isDownBtn.previous) if (GetKeyState(VK_SHIFT)<0) updateServer(US_SELECT_PREVIOUS2); else updateServer(US_SELECT_PREVIOUS); } else if (isOnButtonNextStash(msg->x,msg->y)) { log_msg("push up left button next\n"); if (isDownBtn.next) if (GetKeyState(VK_SHIFT)<0) updateServer(US_SELECT_NEXT2); else updateServer(US_SELECT_NEXT); } else if (active_sharedStash && isOnButtonToggleSharedStash(msg->x,msg->y)) { log_msg("push up left button shared\n"); if (isDownBtn.toggleToSharedStash) if (PCPY->showSharedStash) updateServer(US_SELECT_SELF); else updateServer(US_SELECT_SHARED); } else if (isOnButtonPreviousIndexStash(msg->x,msg->y)) { log_msg("select left button previous index\n"); if (isDownBtn.previousIndex) if (GetKeyState(VK_SHIFT)<0) updateServer(US_SELECT_PREVIOUS_INDEX2); else updateServer(US_SELECT_PREVIOUS_INDEX); } else if (isOnButtonNextIndexStash(msg->x,msg->y)) { log_msg("push up left button next index\n"); if (isDownBtn.nextIndex) if (GetKeyState(VK_SHIFT)<0) updateServer(US_SELECT_NEXT_INDEX2); else updateServer(US_SELECT_NEXT_INDEX); } else if (active_sharedGold && isOnButtonPutGold(msg->x,msg->y)) { log_msg("push up left put gold\n"); if (isDownBtn.putGold) updateServer(US_PUTGOLD); } else if (active_sharedGold && isOnButtonTakeGold(msg->x,msg->y)) { log_msg("push up left take gold\n"); if (isDownBtn.takeGold) updateServer(US_TAKEGOLD); } else return 0; return 1; }
DWORD STDCALL mouseRunewordsPageLeftDown(sWinMessage* msg) { if (!D2isLODGame() || !D2GetResolution()) return -1; if (!isOnStatsPage(msg->x,msg->y)) return 1; if (isOnCloseBtn(msg->x,msg->y)) { log_msg("push down left button close\n"); isDownBtn.close = 1; D2PlaySound(4,0,0,0,0); } else if (isOnNextPageBtn(msg->x,msg->y)) { log_msg("push down left button next page\n"); isDownBtn.nextPage = 1; D2PlaySound(4,0,0,0,0); } else if (isOnPrevRunesBtn(msg->x,msg->y)) { log_msg("push down left button prev page\n"); isDownBtn.prevRunes = 1; D2PlaySound(4,0,0,0,0); } else if (isOnNextRunesBtn(msg->x,msg->y)) { log_msg("push down left button next runes\n"); isDownBtn.nextRunes = 1; D2PlaySound(4,0,0,0,0); } freeMessage(msg); return 0; }
DWORD STDCALL mouseNewStatsPageTwoLeftUp(sWinMessage* msg) { if (!D2isLODGame()) return -1; DWORD x = D2GetMouseX(); DWORD y = D2GetMouseY(); if (!isOnStatsPage(x,y)) return 1; if (isOnCloseBtn(x,y)) { log_msg("push up left button close\n"); if (isDownBtn.close) D2TogglePage(2,1,0); } else if (isOnPreviousPageBtn(x,y)) { log_msg("push up left button previous page\n"); if (isDownBtn.previousPage) GoPreviousStatPage(); } else if (isOnNextPageBtn(x,y)) { log_msg("push up left button next page\n"); if (isDownBtn.nextPage) GoNextStatPage(); } D2CleanStatMouseUp(); freeMessage(msg); isDownBtn.all=0; return 0; }
DWORD STDCALL mouseNewStatsPageTwoLeftDown(sWinMessage* msg) { if (!D2isLODGame()) return -1; DWORD x = D2GetMouseX(); DWORD y = D2GetMouseY(); if (!isOnStatsPage(x,y)) return 1; if (isOnCloseBtn(x,y)) { log_msg("push down left button close\n"); isDownBtn.close = 1; D2PlaySound(4,0,0,0,0); } else if (isOnPreviousPageBtn(x,y)) { log_msg("push down left button previous page\n"); isDownBtn.previousPage = 1; D2PlaySound(4,0,0,0,0); } else if (isOnNextPageBtn(x,y)) { log_msg("push down left button next page\n"); isDownBtn.nextPage = 1; D2PlaySound(4,0,0,0,0); } freeMessage(msg); return 0; }
void STDCALL skillsPageMouseUp() { if ( active_SkillsPoints && !onRealm && D2isLODGame() && isOnButtonUnassignSkill(D2GetMouseX(),D2GetMouseY())) { log_msg("push up left button unassign skill\n"); if (btnSkillIsDown) updateServer(US_UNASSIGN_SKILLS); } btnSkillIsDown = 0; }
Unit* STDCALL skillsPageMouseDown(sWinMessage* msg) { Unit* ptChar = D2GetClientPlayer(); if ( active_SkillsPoints && !onRealm && D2isLODGame() && isOnButtonUnassignSkill(D2GetMouseX(),D2GetMouseY())) { log_msg("push down left button unassign skill\n"); btnSkillIsDown = 1; D2PlaySound(4,0,0,0,0); freeMessage(msg); return NULL; } return ptChar; }
void STDCALL printSkillsPageBtns() { if (active_SkillsPoints && !onRealm && D2isLODGame()) { sDrawImageInfo data; ZeroMemory(&data,sizeof(data)); setImage(&data, unassignSkillsBtnImages); setFrame(&data, btnSkillIsDown); D2PrintImage(&data, getXSkillBtn(), getYSkillBtn(), -1, 5, 0); if ( isOnButtonUnassignSkill(D2GetMouseX(),D2GetMouseY())) { LPWSTR popupText = getTranslatedString(STR_SKILLS_UNASSIGN); D2PrintPopup(popupText, getXSkillBtn()+getLSkillBtn()/2, getYSkillBtn()-getHSkillBtn(), 0, 1); } } }
void STDCALL printDisabledStatsBtn(WORD statID, sDrawImageInfo* data, DWORD x, DWORD y, DWORD p4, DWORD p5, DWORD p6) { if ( onRealm || !D2isLODGame()) { D2PrintImage(data,x,y,p4,p5,p6); return; } Unit* ptChar = D2GetClientPlayer(); CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass); int minValue=1; switch (statID) { case STATS_STRENGTH: minValue = charStats->baseSTR; break; case STATS_DEXTERITY: minValue = charStats->baseDEX; break; case STATS_VITALITY: minValue = charStats->baseVIT; break; case STATS_ENERGY: minValue = charStats->baseENE; break; } int statValue = D2GetPlayerBaseStat(ptChar, statID, 0); if (isOnRect(D2GetMouseX(),D2GetMouseY(),x+5,y+5,32,32)) { WCHAR text[100]; if (active_StatsShiftClickLimit) _snwprintf(text, sizeof(text) - 1, getLocalString(STR_STATS_UNASSIGN_WITH_LIMIT), limitValueToShiftClick); else _snwprintf(text, sizeof(text) - 1, getLocalString(STR_STATS_UNASSIGN_WITHOUT_LIMIT)); wcscat(text,L"\n"); int len = wcslen(text); _snwprintf(text + len, sizeof(text) - len, getLocalString(STR_STATS_BASE_MIN), statValue, minValue); D2SetFont(1); D2PrintPopup(text, x+18, y-32, WHITE, 1); } if ( GetKeyState(keyUsedForUnassignStatPoint) >= 0) { if ( D2GetPlayerBaseStat(ptChar, 4, 0) <= 0) setFrame(data, 2); } else { setImage(data, unassignStatsBtnImages); if (minValue >= statValue) setFrame(data, 2); } D2PrintImage(data,x,y,p4,p5,p6); }
DWORD STDCALL mouseRunewordsPageLeftUp(sWinMessage* msg) { if (!D2isLODGame() || !D2GetResolution()) return -1; if (!isOnStatsPage(msg->x,msg->y)) return 1; if (isOnCloseBtn(msg->x,msg->y)) { log_msg("push up left button close\n"); if (isDownBtn.close) D2TogglePage(2,1,0); } else if (isOnNextPageBtn(msg->x,msg->y)) { log_msg("push up left button next page\n"); if (isDownBtn.nextPage) { GoStatPage(GetCurrentPage()+1); log_msg("next page press\n"); } } else if (isOnPrevRunesBtn(msg->x,msg->y)) { log_msg("push up left button prev runes\n"); if (isDownBtn.prevRunes) { if (curRunesPage) curRunesPage--; } } else if (isOnNextRunesBtn(msg->x,msg->y)) { log_msg("push up left button next runes\n"); if (isDownBtn.nextRunes) { if (curRunesPage < maxRunesPage) curRunesPage++; } } D2CleanStatMouseUp(); freeMessage(msg); isDownBtn.all=0; return 0; }
void FASTCALL printPageNumber(LPWSTR maxGoldText, DWORD x, DWORD y, DWORD color, DWORD bfalse) { if (onRealm || !D2isLODGame() ) { D2PrintString(maxGoldText,x,y,color,bfalse); return; } Unit* ptChar = D2GetClientPlayer(); WCHAR popupText[100]; if (PCPY->currentStash) { bool isShared = PCPY->currentStash->isShared; bool isIndex = PCPY->currentStash->isIndex; DWORD currentId = PCPY->currentStash->id; if (PCPY->currentStash->name && PCPY->currentStash->name[0]) mbstowcs(popupText,PCPY->currentStash->name,50);//strlen(PCPY->currentStash->name)+1 else _snwprintf(popupText, sizeof(popupText), getLocalString( isShared ? STR_SHARED_PAGE_NUMBER : STR_PERSONAL_PAGE_NUMBER), currentId+1); D2PrintString(popupText, x, y, isShared ? (isIndex ? CRYSTAL_RED : RED) : (isIndex ? BRIGHT_WHITE : WHITE), bfalse); } else { _snwprintf(popupText, sizeof(popupText), getLocalString(STR_NO_SELECTED_PAGE)); D2PrintString(popupText, x, y, WHITE, bfalse); } //printGoldMaxPopup DWORD mx = D2GetMouseX(); DWORD my = D2GetMouseY(); if ((RX(0x5E) < mx) && (mx < RX(0xF8)) && (RY(0x1C8) < my) && (my < RY(0x1B6)) ) { if (active_sharedGold) { _snwprintf(popupText, sizeof(popupText), L"%s\n%s: %u", maxGoldText, getLocalString(STR_SHARED_GOLD_QUANTITY), PCPY->sharedGold); DWORD x = D2GetPixelLen(maxGoldText); DWORD x2 = D2GetPixelLen(popupText) - x; D2PrintPopup(popupText, RX(0xA8-max(x,x2)/2), RY(0x1CA), WHITE, 0); } else D2PrintPopup(maxGoldText, RX(0xA8), RY(0x1CA), WHITE, 1); } }
DWORD STDCALL manageBtnDown(sWinMessage* msg) { if (onRealm || !D2isLODGame()) return 0; if (isOnButtonPreviousStash(msg->x,msg->y)) isDownBtn.previous = 1; else if (isOnButtonNextStash(msg->x,msg->y)) isDownBtn.next = 1; else if (active_sharedStash && isOnButtonToggleSharedStash(msg->x,msg->y)) isDownBtn.toggleToSharedStash = 1; else if (isOnButtonPreviousIndexStash(msg->x,msg->y)) isDownBtn.previousIndex = 1; else if (isOnButtonNextIndexStash(msg->x,msg->y)) isDownBtn.nextIndex = 1; else if (active_sharedGold && isOnButtonPutGold(msg->x,msg->y)) isDownBtn.putGold = 1; else if (active_sharedGold && isOnButtonTakeGold(msg->x,msg->y)) isDownBtn.takeGold = 1; else return 0; D2PlaySound(4,0,0,0,0); freeMessage(msg); return 1; }
//6FB21FAA void STDCALL printRunewordsPage() { if (!D2isLODGame() || !D2GetResolution()) return D2PrintStatsPage(); LPWSTR lpText; bDontPrintBorder = true; //Init data for print image sDrawImageInfo data; ZeroMemory(&data,sizeof(data)); //print background /* setImage(&data, newStatsInterfaceImages); setFrame(&data, 0); D2PrintImage(&data, 0, 256, -1, 5, 0); setFrame(&data, 1); D2PrintImage(&data, 256,256, -1, 5, 0); setFrame(&data, 2); D2PrintImage(&data, 0, 512, -1, 5, 0); setFrame(&data, 3); D2PrintImage(&data, 256,512, -1, 5, 0); setFrame(&data, 4); D2PrintImage(&data, 0, 552, -1, 5, 0); setFrame(&data, 5); D2PrintImage(&data, 256,552, -1, 5, 0); */ fillRect(0,0,400,552,0,5); //print button close setImage(&data, D2LoadBuySelBtn()); setFrame(&data, 10 + isDownBtn.close); D2PrintImage(&data, getXCloseBtn(), getYCloseBtn(), -1, 5, 0); //print next page button setFrame(&data, isDownBtn.nextPage); D2PrintImage(&data, getXNextPageBtn(), getYNextPageBtn(), -1, 5, 0); //print previous runes button setImage(&data, stashBtnsImages); setFrame(&data, isDownBtn.prevRunes); D2PrintImage(&data, getXPrevRunesBtn(), getYPrevRunesBtn(), -1, 5, 0); //print previous runes button setFrame(&data, 2 + isDownBtn.nextRunes); D2PrintImage(&data, getXNextRunesBtn(), getYNextRunesBtn(), -1, 5, 0); D2SetFont(6); //146;//B400 int nbRunes = *D2GetNbRunesBIN(); RunesBIN* runesFirst = nbRunes>1 ? D2GetRunesBIN(1)-1 : NULL; RunesBIN* runesLast = runesFirst? runesFirst + nbRunes : NULL; // log_msg("nbRunes(%d,%d) runesFirst(%08X, %08X) runesLast(%08X, %08X)",nbRunes,SgptDataTables->nbRunes,runesFirst, SgptDataTables->runes,runesLast,SgptDataTables->runes + SgptDataTables->nbRunes); int nbRunesCompleted=0; DWORD curNbRunes=0; for ( RunesBIN* runesData = runesFirst; runesData < runesLast; runesData++) { if (!runesData->Complete || runesData->Server) continue; nbRunesCompleted++; if ( (curRunesPage * NB_RUNES_PER_PAGE < nbRunesCompleted) && (nbRunesCompleted <= (curRunesPage+1) * NB_RUNES_PER_PAGE) ) printRuneword(runesData, curNbRunes++); } maxRunesPage = nbRunesCompleted ? (nbRunesCompleted-1) / NB_RUNES_PER_PAGE : 0; //////////////////// POPUP PRINTING //////////////////// //set MouseX & MouseY DWORD x = D2GetMouseX(); DWORD y = D2GetMouseY(); if (isOnCloseBtn(x,y)) // print popup "close" { D2PrintPopup(D2GetStringFromIndex(0x1030), getXCloseBtn()+getLCloseBtn()/2, getYCloseBtn()-getHCloseBtn(), WHITE, 1); } else if (isOnNextPageBtn(x,y)) // print popup "next page" { lpText = getLocalString(STR_NEXT_PAGE); D2PrintPopup(lpText, getXNextPageBtn()+getLNextPageBtn()/2, getYNextPageBtn()-getHNextPageBtn(), WHITE, 1); } }
void* STDCALL printBtns() { if (onRealm || !D2isLODGame()) return D2LoadBuySelBtn(); Unit* ptChar = D2GetClientPlayer(); sDrawImageInfo data; ZeroMemory(&data,sizeof(data)); setImage(&data, stashBtnsImages); setFrame(&data, 0 + isDownBtn.previous); D2PrintImage(&data, getXPreviousBtn(), getYPreviousBtn(), -1, 5, 0); setFrame(&data, 2 + isDownBtn.next); D2PrintImage(&data, getXNextBtn(), getYNextBtn(), -1, 5, 0); if (active_sharedStash) { setFrame(&data, 4 + isDownBtn.toggleToSharedStash + (PCPY->showSharedStash?2:0) ); D2PrintImage(&data, getXSharedBtn(), getYSharedBtn(), -1, 5, 0); } setFrame(&data, 8 + isDownBtn.previousIndex); D2PrintImage(&data, getXPreviousIndexBtn(), getYPreviousIndexBtn(), -1, 5, 0); setFrame(&data, 10 + isDownBtn.nextIndex); D2PrintImage(&data, getXNextIndexBtn(), getYNextIndexBtn(), -1, 5, 0); if (active_sharedGold) { setImage(&data, sharedGoldBtnsImages); setFrame(&data, 0 + isDownBtn.putGold); D2PrintImage(&data, getXPutGoldBtn(), getYPutGoldBtn(), -1, 5, 0); setFrame(&data, 2 + isDownBtn.takeGold); D2PrintImage(&data, getXTakeGoldBtn(), getYTakeGoldBtn(), -1, 5, 0); } LPWSTR lpText; WCHAR text[100]; DWORD mx = D2GetMouseX(); DWORD my = D2GetMouseY(); D2SetFont(1); if (isOnButtonPreviousStash(mx,my)) { lpText = getLocalString(STR_STASH_PREVIOUS_PAGE); D2PrintPopup(lpText, getXPreviousBtn()+getLPreviousBtn()/2, getYPreviousBtn()-getHPreviousBtn(), WHITE, 1); } else if (isOnButtonNextStash(mx,my)) { lpText = getLocalString(STR_STASH_NEXT_PAGE); D2PrintPopup(lpText, getXNextBtn()+getLNextBtn()/2, getYNextBtn()-getHNextBtn(), WHITE, 1); } else if (active_sharedStash && isOnButtonToggleSharedStash(mx,my)) { lpText = getLocalString(PCPY->showSharedStash ? STR_TOGGLE_TO_PERSONAL : STR_TOGGLE_TO_SHARED); D2PrintPopup(lpText, getXSharedBtn()+getLSharedBtn()/2, getYSharedBtn()-getHSharedBtn(), WHITE, 1); } else if (isOnButtonPreviousIndexStash(mx,my)) { _snwprintf(text, sizeof(text), getLocalString(STR_STASH_PREVIOUS_INDEX) ,nbPagesPerIndex,nbPagesPerIndex2); D2PrintPopup(text, getXPreviousIndexBtn()+getLPreviousIndexBtn()/2, getYPreviousIndexBtn()-getHPreviousIndexBtn(), 0, 0); } else if (isOnButtonNextIndexStash(mx,my)) { _snwprintf(text, sizeof(text), getLocalString(STR_STASH_NEXT_INDEX) ,nbPagesPerIndex,nbPagesPerIndex2); D2PrintPopup(text, getXNextIndexBtn()+getLNextIndexBtn()/2, getYNextIndexBtn()-getHNextIndexBtn(), WHITE, 1); } else if (active_sharedGold && isOnButtonPutGold(mx,my)) { lpText = getLocalString(STR_PUT_GOLD); D2PrintPopup(lpText, getXPutGoldBtn()+getLPutGoldBtn()/2, getYPutGoldBtn()-getHPutGoldBtn(), WHITE, 1); } else if (active_sharedGold && isOnButtonTakeGold(mx,my)) { lpText = getLocalString(STR_TAKE_GOLD); D2PrintPopup(lpText, getXTakeGoldBtn()+getLTakeGoldBtn()/2, getYTakeGoldBtn()-getHTakeGoldBtn(), WHITE, 1); } return D2LoadBuySelBtn(); }
void STDCALL printNewStatsPageTwo(int currentPage) { if (!D2isLODGame()) return D2PrintStatsPage(); WCHAR text[BUFSIZE]; LPWSTR lpText; bDontPrintBorder = false; Unit* ptChar = D2GetClientPlayer(); d2_assert(!ptChar, "Printing stats page : no character selected",__FILE__,__LINE__); d2_assert(ptChar->nUnitType != UNIT_PLAYER, "Printing stats page : bad unit type",__FILE__,__LINE__); //Init data for print image sDrawImageInfo data; ZeroMemory(&data,sizeof(data)); //print background fillRect(RX(0),RY(480),320,432,0,5);//552 setImage(&data, newStatsInterfaceImages); setFrame(&data, 0); D2PrintImage(&data, RX(0), RY(224), -1, 5, 0); setFrame(&data, 1); D2PrintImage(&data, RX(256),RY(224), -1, 5, 0);//256 setFrame(&data, 2); D2PrintImage(&data, RX(0), RY(48), -1, 5, 0);//432 setFrame(&data, 3); D2PrintImage(&data, RX(256),RY(48), -1, 5, 0); D2SetFont(1); for (int i=0; i<nbStatsInterface; i++) manageStatLine(ptChar, &statsInterface[i], currentPage, text); /* // DWORD x,y; // DWORD curValue; // CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass); // DifficultyLevelsBIN* difficultyLevels = D2GetDifficultyLevelsBIN (D2GetDifficultyLevel()); //print deadly Strike / Critical Strike x=RX(25); y=RY(445); Unit* ptItem = D2GetSkillItem(ptChar); DWORD cs = ptItem ? D2GetCriticalStrikeFromMasteries(ptChar,ptItem,0,2) : 0; cs = cs>100?100:cs; cs += D2GetPlayerStat(ptChar, STATS_PASSIVE_CRITICAL_STRIKE, 0)*(100-cs)/100; cs = cs>100?100:cs; //SkillDescBIN* skilldesc = SgptDataTables->skilldesc + 9; LPWSTR lpCS = D2GetStringFromIndex(skilldesc->strNameID); lpText = D2GetStringFromIndex(getDescStrPos(STATS_ITEM_DEADLYSTRIKE)); curValue = D2GetPlayerStat(ptChar, STATS_ITEM_DEADLYSTRIKE, 0); cs += curValue*(100-cs)/100; curValue = cs>100?100:cs; swprintf(text,L"%i%% %s/%s",curValue,lpCS,lpText); D2SetFont(1); D2SetFont( D2GetPixelLen(text)>0x110 ? 6 : 1); D2PrintString(text, x, y, WHITE, 0); */ //print background previous/next page buttons setImage(&data, statsBackgroundImages); setFrame(&data, D2GetResolution()?1:0); D2PrintImage(&data, getXPreviousPageBtn()-7, getYPreviousPageBtn()+8, -1, 5, 0); //print button close setImage(&data, D2LoadBuySelBtn()); setFrame(&data, 10 + isDownBtn.close); D2PrintImage(&data, getXCloseBtn(), getYCloseBtn(), -1, 5, 0); //print previous page button setFrame(&data, 12 + isDownBtn.previousPage); D2PrintImage(&data, getXPreviousPageBtn(), getYPreviousPageBtn(), -1, 5, 0); //print next page button setFrame(&data, 14 + isDownBtn.nextPage); D2PrintImage(&data, getXNextPageBtn(), getYNextPageBtn(), -1, 5, 0); //////////////////// POPUP PRINTING //////////////////// //set MouseX & MouseY DWORD mx = D2GetMouseX(); DWORD my = D2GetMouseY(); D2SetFont(1); if (isOnCloseBtn(mx,my)) // print popup "close" { D2PrintPopup(D2GetStringFromIndex(0x1030), getXCloseBtn()+getLCloseBtn()/2, getYCloseBtn()-getHCloseBtn(), WHITE, 1); } else if (isOnPreviousPageBtn(mx,my)) //print popup "previous page" { lpText = getLocalString(STR_PREVIOUS_PAGE); D2PrintPopup(lpText, getXPreviousPageBtn()+getLPreviousPageBtn()/2, getYPreviousPageBtn()-getHPreviousPageBtn(), WHITE, 1); } else if (isOnNextPageBtn(mx,my)) //print popup "next page" { lpText = getLocalString(STR_NEXT_PAGE); D2PrintPopup(lpText, getXNextPageBtn()+getLNextPageBtn()/2, getYNextPageBtn()-getHNextPageBtn(), WHITE, 1); } }