Skip to content

Commit

Permalink
fixed bug where zoo status ratings required the perfect zoo hack to w…
Browse files Browse the repository at this point in the history
…ork correctly
  • Loading branch information
GoosiferIO committed Jan 27, 2024
1 parent a0325c2 commit 1ac163f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
12 changes: 9 additions & 3 deletions EmuAPI/EmuLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,25 @@ typedef void (__cdecl *_setGuestRating)(int); // define original setGuestRating

void __cdecl SetGuestRating(int rating) {
_setGuestRating ogSetGuestRating = (_setGuestRating)setGuestRatingAddress;
rating = zoo_models->_guestRating;
if (zoo_models->_emuGuestRatingSet == true) {
rating = zoo_models->_guestRating;
}
ogSetGuestRating(rating);
}

void __cdecl SetZooRating(int rating) {
_setZooRating ogSetZooRating = (_setZooRating)setZooRatingAddress;
rating = zoo_models->_zooRating;
if (zoo_models->_emuZooRatingSet == true) {
rating = zoo_models->_zooRating;
}
ogSetZooRating(rating);
}

void __cdecl SetAnimalRating(int rating) {
_setAnimalRating ogSetAnimalRating = (_setAnimalRating)setAnimalRatingAddress;
rating = zoo_models->_animalRating;
if (zoo_models->_emuAnimalRatingSet == true) {
rating = zoo_models->_animalRating;
}
ogSetAnimalRating(rating);
}

Expand Down
18 changes: 15 additions & 3 deletions EmuAPI/emu/EmuScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,31 @@ ZooModels EmuScriptMgr::executeScripts() {
// lua_close (lua);
// // return 1;
lua_getglobal(lua, "_globalAnimalRating");
if (lua_isnumber(lua, -1)) {
if (lua_isnil(lua, -1)) {
zoo_models._emuAnimalRatingSet = false;
}
else if (lua_isnumber(lua, -1)) {
int animalRating = (int)lua_tointeger(lua, -1);
zoo_models._animalRating = animalRating;
zoo_models._emuAnimalRatingSet = true;
}
lua_getglobal(lua, "_globalGuestRating");
if (lua_isnumber(lua, -1)) {
if (lua_isnil(lua, -1)) {
zoo_models._emuGuestRatingSet = false;
}
else if (lua_isnumber(lua, -1)) {
int guestRating = (int)lua_tointeger(lua, -1);
zoo_models._guestRating = guestRating;
zoo_models._emuGuestRatingSet = true;
}
lua_getglobal(lua, "_globalZooRating");
if (lua_isnumber(lua, -1)) {
if (lua_isnil(lua, -1)) {
zoo_models._emuZooRatingSet = false;
}
else if (lua_isnumber(lua, -1)) {
int zooRating = (int)lua_tointeger(lua, -1);
zoo_models._zooRating = zooRating;
zoo_models._emuZooRatingSet = true;
}
lua_pop(lua, 1);
}
Expand Down
3 changes: 3 additions & 0 deletions EmuAPI/resources/ZooModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

struct ZooModels
{
bool _emuAnimalRatingSet;
bool _emuGuestRatingSet;
bool _emuZooRatingSet;
int _animalRating;
int _guestRating;
int _zooRating;
Expand Down

0 comments on commit 1ac163f

Please sign in to comment.