Browse Source

Auto pickup gold

pull/1115/head
qndel 5 years ago committed by Anders Jenbo
parent
commit
2d055e3a2e
  1. 2
      Source/diablo.cpp
  2. 3
      Source/diablo.h
  3. 1
      Source/player.cpp
  4. 22
      SourceX/qol.cpp
  5. 1
      SourceX/qol.h

2
Source/diablo.cpp

@ -428,6 +428,7 @@ static void SaveOptions()
setIniInt("Game", "Test Barbarian", sgOptions.bTestBarbarian);
setIniInt("Game", "Experience Bar", sgOptions.bExperienceBar);
setIniInt("Game", "Enemy Health Bar", sgOptions.bEnemyHealthBar);
setIniInt("Game", "Auto Gold Pickup", sgOptions.bAutoGoldPickup);
setIniValue("Network", "Bind Address", sgOptions.szBindAddress);
}
@ -472,6 +473,7 @@ static void LoadOptions()
sgOptions.bTestBarbarian = getIniBool("Game", "Test Barbarian", false);
sgOptions.bExperienceBar = getIniBool("Game", "Experience Bar", false);
sgOptions.bEnemyHealthBar = getIniBool("Game", "Enemy Health Bar", false);
sgOptions.bAutoGoldPickup = getIniBool("Game", "Auto Gold Pickup", false);
getIniValue("Network", "Bind Address", sgOptions.szBindAddress, sizeof(sgOptions.szBindAddress), "0.0.0.0");
}

3
Source/diablo.h

@ -41,11 +41,12 @@ typedef struct Options {
bool bGrabInput; // Do not let the mouse leave the application window
bool bTheoQuest; // Enable the Theo quest
bool bCowQuest; // Enable the cow quest
bool bFriendlyFire; // Will players still damage other players in non-PvP mode
bool bTestBard; // Enable the bard hero class
bool bTestBarbarian; // Enable the babarian hero class
bool bExperienceBar; // Show the current level progress
bool bEnemyHealthBar; // Show enemy health at the top of the screen
bool bFriendlyFire; // Will players still damage other players in non-PvP mode
bool bAutoGoldPickup; // Automatically pick up goald when walking on to it
char szBindAddress[129]; // Optionally bind to a specific network interface
} Options;

1
Source/player.cpp

@ -2227,6 +2227,7 @@ bool PM_DoWalk(int pnum, int variant)
ChangeLightOff(plr[pnum]._plid, 0, 0);
}
AutoGoldPickup(pnum);
return true;
} else { //We didn't reach new tile so update player's "sub-tile" position
PM_ChangeOffset(pnum);

22
SourceX/qol.cpp

@ -174,4 +174,26 @@ void DrawXPBar()
FastDrawVertLine(xPos - 1 + (barWidth * i / numDividers), yPos - dividerHeight - 1, barHeight + dividerHeight * 2 + 2, frameColor);
}
void AutoGoldPickup(int pnum)
{
if (!sgOptions.bAutoGoldPickup)
return;
if (pnum != myplr)
return;
if (leveltype == DTYPE_TOWN)
return;
for (int dir = 0; dir < 8; dir++) {
int x = plr[pnum]._px + pathxdir[dir];
int y = plr[pnum]._py + pathydir[dir];
if (dItem[x][y] != 0) {
int itemIndex = dItem[x][y] - 1;
if (item[itemIndex]._itype == ITYPE_GOLD) {
NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, pnum, pnum, itemIndex);
item[itemIndex]._iRequest = TRUE;
}
}
}
}
DEVILUTION_END_NAMESPACE

1
SourceX/qol.h

@ -10,6 +10,7 @@ DEVILUTION_BEGIN_NAMESPACE
void DrawMonsterHealthBar();
void DrawXPBar();
void AutoGoldPickup(int pnum);
DEVILUTION_END_NAMESPACE

Loading…
Cancel
Save