Browse Source

GetStaffPower bin exact (#1080)

pull/100/head
qndel 7 years ago committed by Anders Jenbo
parent
commit
f4becf4521
  1. 106
      Source/items.cpp
  2. 2
      Source/items.h

106
Source/items.cpp

@ -1138,74 +1138,60 @@ void GetBookSpell(int i, int lvl)
item[i]._iCurs = ICURS_BOOK_GREY; item[i]._iCurs = ICURS_BOOK_GREY;
} }
void GetStaffPower(int i, int lvl, int bs, unsigned char onlygood) void GetStaffPower(int i, int lvl, int bs, BOOL onlygood)
{ {
int v4; // esi int l[256];
int v5; // ebx char istr[128];
int v6; // edx int nl, j, preidx;
int v7; // ecx BYTE addok;
int v9; // edi
int v10; // ecx preidx = -1;
int v11; // ST14_4 if (random(15, 10) == 0 || onlygood) {
int v12; // esi nl = 0;
char *v13; // edi for (j = 0; PL_Prefix[j].PLPower != -1; j++) {
int l[256]; // [esp+Ch] [ebp-484h] if (PL_Prefix[j].PLIType & PLT_STAFF && PL_Prefix[j].PLMinLvl <= lvl) {
char istr[128]; // [esp+40Ch] [ebp-84h] addok = TRUE;
int ia; // [esp+48Ch] [ebp-4h] if (onlygood && !PL_Prefix[j].PLOk)
char *v17; // [esp+49Ch] [ebp+Ch] addok = FALSE;
if (addok) {
v4 = lvl; l[nl] = j;
ia = i; nl++;
v5 = -1; if (PL_Prefix[j].PLDouble) {
if (!random(15, 10) || onlygood) { l[nl] = j;
v6 = 0; nl++;
v7 = 0; }
if (PL_Prefix[0].PLPower != -1) {
do {
if (PL_Prefix[v7].PLIType & 0x100 && PL_Prefix[v7].PLMinLvl <= v4 && (!onlygood || PL_Prefix[v7].PLOk)) {
l[v6++] = v7;
if (PL_Prefix[v7].PLDouble)
l[v6++] = v7;
} }
++v7;
} while (PL_Prefix[v7].PLPower != -1);
if (v6) {
v5 = l[random(16, v6)];
v9 = ia;
v17 = item[ia]._iIName;
sprintf(istr, "%s %s", PL_Prefix[v5].PLName, item[ia]._iIName);
strcpy(v17, istr);
v10 = ia;
v11 = PL_Prefix[v5].PLMultVal;
item[v9]._iMagical = ITEM_QUALITY_MAGIC;
SaveItemPower(
v10,
PL_Prefix[v5].PLPower,
PL_Prefix[v5].PLParam1,
PL_Prefix[v5].PLParam2,
PL_Prefix[v5].PLMinVal,
PL_Prefix[v5].PLMaxVal,
v11);
item[v9]._iPrePower = PL_Prefix[v5].PLPower;
} }
} }
if (nl != 0) {
preidx = l[random(16, nl)];
sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName);
strcpy(item[i]._iIName, istr);
item[i]._iMagical = ITEM_QUALITY_MAGIC;
SaveItemPower(
i,
PL_Prefix[preidx].PLPower,
PL_Prefix[preidx].PLParam1,
PL_Prefix[preidx].PLParam2,
PL_Prefix[preidx].PLMinVal,
PL_Prefix[preidx].PLMaxVal,
PL_Prefix[preidx].PLMultVal);
item[i]._iPrePower = PL_Prefix[preidx].PLPower;
}
} }
v12 = ia; if (!control_WriteStringToBuffer((BYTE *)item[i]._iIName)) {
v13 = item[ia]._iIName; strcpy(item[i]._iIName, AllItemsList[item[i].IDidx].iSName);
if (!control_WriteStringToBuffer((BYTE *)item[ia]._iIName)) { if (preidx != -1) {
strcpy(v13, AllItemsList[item[v12].IDidx].iSName); sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName);
if (v5 != -1) { strcpy(item[i]._iIName, istr);
sprintf(istr, "%s %s", PL_Prefix[v5].PLName, v13);
strcpy(v13, istr);
} }
sprintf(istr, "%s of %s", v13, spelldata[bs].sNameText); sprintf(istr, "%s of %s", item[i]._iIName, spelldata[bs].sNameText);
strcpy(v13, istr); strcpy(item[i]._iIName, istr);
if (item[v12]._iMagical == ITEM_QUALITY_NORMAL) if (item[i]._iMagical == ITEM_QUALITY_NORMAL)
strcpy(item[v12]._iName, v13); strcpy(item[i]._iName, item[i]._iIName);
} }
CalcItemValue(ia); CalcItemValue(i);
} }
// 420514: using guessed type int var_484[256];
void GetStaffSpell(int i, int lvl, unsigned char onlygood) void GetStaffSpell(int i, int lvl, unsigned char onlygood)
{ {

2
Source/items.h

@ -38,7 +38,7 @@ void GetSuperItemSpace(int x, int y, char inum);
void GetSuperItemLoc(int x, int y, int *xx, int *yy); void GetSuperItemLoc(int x, int y, int *xx, int *yy);
void CalcItemValue(int i); void CalcItemValue(int i);
void GetBookSpell(int i, int lvl); void GetBookSpell(int i, int lvl);
void GetStaffPower(int i, int lvl, int bs, unsigned char onlygood); void GetStaffPower(int i, int lvl, int bs, BOOL onlygood);
void GetStaffSpell(int i, int lvl, unsigned char onlygood); void GetStaffSpell(int i, int lvl, unsigned char onlygood);
void GetItemAttrs(int i, int idata, int lvl); void GetItemAttrs(int i, int idata, int lvl);
int RndPL(int param1, int param2); int RndPL(int param1, int param2);

Loading…
Cancel
Save