sn3ejk
This account is inactive.
- Joined
- Nov 16, 2011
- Messages
- 2,121
- Solutions
- 1
- Reaction score
- 147
Capacity Overloaded
"Less Tibia, more RPG."
"Less Tibia, more RPG."
I've been playing alot Skyrim lately, and I had this idea to use the same capacity system for OpenTibia as Skyrim has. The players will now have infinite capacity, but when they carry more items than their capacity actually should be, they will be walking slower than normal.
- config.lua
Below
AddLUA:playerFollowExhaust = 0
LUA:capacityOverload = 0.75 - configmanager.cpp
Below
AddPHP:m_confNumber[FOLLOW_EXHAUST] = getGlobalNumber("playerFollowExhaust", 2000);
PHP:m_confDouble[CAPACITY_OVERLOAD] = getGlobalDouble("capacityOverload", 0.75); - configmanager.h
Below
AddPHP:FORMULA_MAGIC,
PHP:CAPACITY_OVERLOAD, - player.cpp
Replace
ForPHP:windowTextId = nextExAction = 0;
&&&PHP:windowTextId = nextExAction = capacityOverload = 0;
Replace function
ForPHP:void Player::updateInventoryWeight()
&&&PHP:void Player::updateInventoryWeight() { inventoryWeight = 0.00; if(hasFlag(PlayerFlag_HasInfiniteCapacity) || !g_config.getBool(ConfigManager::USE_CAPACITY)) return; for(int32_t i = SLOT_FIRST; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) inventoryWeight += item->getWeight(); } if (inventoryWeight >= capacity && !capacityOverload) { capacityOverload = (int32_t)(getSpeed() * g_config.getDouble(ConfigManager::CAPACITY_OVERLOAD)); g_game.changeSpeed(this, -capacityOverload); } else if (inventoryWeight < capacity && capacityOverload) { g_game.changeSpeed(this, capacityOverload); capacityOverload = 0; } }
Replace function
ForPHP:bool Player::hasCapacity(const Item*, uint32_t) const
&&&PHP:bool Player::hasCapacity(const Item*, uint32_t) const { return true; }
Replace function
ForPHP:void Player::onThink(uint32_t interval)
PHP:void Player::onThink(uint32_t interval) { Creature::onThink(interval); int64_t timeNow = OTSYS_TIME(); if(timeNow - lastPing >= 5000) { if (capacityOverload) { g_game.addMagicEffect(getPosition(), MAGIC_EFFECT_POFF); sendCancel("Your capacity is overloaded!"); } lastPing = timeNow; if(hasClient()) client->sendPing(); else if(g_config.getBool(ConfigManager::STOP_ATTACK_AT_EXIT)) setAttackedCreature(NULL); } if((timeNow - lastPong) >= 60000 && !getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isConnecting && !pzLocked && !hasCondition(CONDITION_INFIGHT)) { if(hasClient()) client->logout(true, true); else if(g_creatureEvents->playerLogout(this, false)) g_game.removeCreature(this, true); } messageTicks += interval; if(messageTicks >= 1500) { messageTicks = 0; addMessageBuffer(); } if(lastMail && lastMail < (uint64_t)(OTSYS_TIME() + g_config.getNumber(ConfigManager::MAIL_ATTEMPTS_FADE))) mailAttempts = lastMail = 0; } - player.h
Below
AddPHP:int32_t shieldBlockCount;
PHP:int32_t capacityOverload;