Ir para conteúdo

Sistema de resetes


Kemix

Posts Recomendados

MySQL:

ALTER TABLE `players` ADD `resets` INT(11) NOT NULL DEFAULT "0";

Sources:

 

player.h

 

Procure por:

uint32_t level;

Adicione abaixo:

uint32_t resets;

iologindata.cpp

 

Procure por:

bool IOLoginData::loadPlayerById(Player* player, uint32_t id)

Substitua a parte que tenha querry por:

query << "SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `resets`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries` FROM `players` WHERE `id` = " << id;

Procure por:

bool IOLoginData::loadPlayerByName(Player* player, const std::string& name)

Substitua a parte que tenha querry por:

query << "SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `resets`, `maglevel`, `health`, `healthmax`, `blessings`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `conditions`, `skulltime`, `skull`, `town_id`, `balance`, `offlinetraining_time`, `offlinetraining_skill`, `stamina`, `skill_fist`, `skill_fist_tries`, `skill_club`, `skill_club_tries`, `skill_sword`, `skill_sword_tries`, `skill_axe`, `skill_axe_tries`, `skill_dist`, `skill_dist_tries`, `skill_shielding`, `skill_shielding_tries`, `skill_fishing`, `skill_fishing_tries` FROM `players` WHERE `name` = " << db->escapeString(name);

Procure por:

player->level = std::max<uint32_t>(1, result->getNumber<uint32_t>("level"));

Adicione abaixo:

player->resets = result->getNumber<uint32_t>("resets");

Procure por:

query << "`level` = " << player->level << ',';

Adicione abaixo:

query << "`resets` = " << player->resets << ", ";

player.cpp

 

procure por:

s << " (Level " << level << ")";

Substitua por:

s << " You are " << vocation->getVocDescription() << ". [Resets " << resets << "]";

player.h

 

procure por:

uint32_t level;

Abaixo adicione:

uint32_t resets;

procure por:

uint32_t getLevel() const {
return level;
}

Adicione abaixo:

uint32_t getResets() const {
return resets;
}


void setResets(int32_t amount) { resets += amount; if (resets < 0) { resets = 0; } }

luascript.cpp

 

Procure por:

registerMethod("Player", "getLevel", LuaScriptInterface::luaPlayerGetLevel);

Abaixo adicione:

registerMethod("Player", "getResets", LuaScriptInterface::luaPlayerGetResets);
registerMethod("Player", "setResets", LuaScriptInterface::luaPlayerSetResets);

Procure por:

int LuaScriptInterface::luaPlayerGetLevel(lua_State* L)
{
// player:getLevel()
Player* player = getUserdata<Player>(L, 1);
if (player) {
lua_pushnumber(L, player->getLevel());
} else {
lua_pushnil(L);
}
return 1;
}

Adicione abaixo:

int LuaScriptInterface::luaPlayerGetResets(lua_State* L)
{
//getResets(cid)
Player* player = getUserdata<Player>(L, 1);
if (player) {
lua_pushnumber(L, player->getResets());
}
else {
lua_pushnil(L);
}
return 1;
}


int LuaScriptInterface::luaPlayerSetResets(lua_State* L)
{
//setResets(cid, amount)
int32_t amount = getNumber<int32_t>(L, 2);
Player* player = getUserdata<Player>(L, 1);
if (player) {


player->setResets(amount);
lua_pushboolean(L, true);
}
else
{
lua_pushnil(L);
}
return 1;
}
luascript.h
procure por:
static int luaPlayerGetLevel(lua_State* L);

Adicione abaixo:

static int luaPlayerGetResets(lua_State* L);
static int luaPlayerSetResets(lua_State* L);
Npc para esse sistema:

 

Editado por Kemix
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...