Oskar
Forum friend
- Joined
- Jan 24, 2009
- Messages
- 2,256
- Reaction score
- 331
~~monster.cpp~~
W??czamy monster.cpp i szukamy:
PHP:
hideName = mType->hideName, hideHealth = mType->hideHealth;
Pod tym doklejamy:
PHP:
randomDamage = monsterLevel = 10;
Szukamy:
PHP:
void Monster::dropLoot(Container* corpse)
I podmieniamy ca?? funkcj? na:
PHP:
void Monster::dropLoot(Container* corpse)
{
if(corpse && lootDrop == LOOT_DROP_FULL)
mType->dropLoot(corpse, randomDamage);
}
Nast?pnie szukamy funkcji:
PHP:
bool Monster::getCombatValues(int32_t& min, int32_t& max)
I podmieniamy j? z:
PHP:
bool Monster::getCombatValues(int32_t& min, int32_t& max)
{
if(!minCombatValue && !maxCombatValue)
return false;
double multiplier;
if(maxCombatValue > 0) //defense
multiplier = g_config.getDouble(ConfigManager::RATE_MONSTER_DEFENSE);
else //attack
multiplier = g_config.getDouble(ConfigManager::RATE_MONSTER_ATTACK);
min = (int32_t)(minCombatValue * multiplier + (minCombatValue * randomDamage / 10));
max = (int32_t)(maxCombatValue * multiplier + (maxCombatValue * randomDamage / 10));
return true;
}
Nast?pnie w??czamy monster.h i pod:
PHP:
int32_t targetChangeCooldown;
Doklejamy:
PHP:
int32_t randomDamage;
int32_t monsterLevel;
Oraz pod:
PHP:
void removeList() {autoList.erase(id);}
PHP:
void doMonsterSetCombatValues(int32_t randomStats) {randomDamage = randomStats;}
void doMonsterSetLevel(int32_t newLevel) {monsterLevel = newLevel;}
virtual int32_t getMonsterLevel() const {return monsterLevel;}
~~spawn.cpp~~
Szukamy funkcji:
PHP:
bool Spawn::spawnMonster(uint32_t spawnId, MonsterType* mType, const Position& pos, Direction dir, bool startup /*= false*/)
I podmieniamy j? na:
PHP:
bool Spawn::spawnMonster(uint32_t spawnId, MonsterType* mType, const Position& pos, Direction dir, bool startup /*= false*/)
{
int32_t normHealth = mType->health, normMaxHealth = mType->healthMax, normExp = mType->experience, normDef = mType->defense, normArm = mType->armor;
int32_t maxLevelValue = mType->maxLevel;
if(g_config.getNumber(ConfigManager::MAX_MONSTER_LEVEL) > 0)
maxLevelValue = std::max(maxLevelValue , g_config.getNumber(ConfigManager::MAX_MONSTER_LEVEL));
int32_t monsterLevel = random_range(5, maxLevelValue + 5);
mType->health = (uint64_t)std::ceil(mType->health * monsterLevel / 10);
mType->healthMax = (uint64_t)std::ceil(mType->healthMax * monsterLevel / 10);
mType->experience = (uint64_t)std::ceil(mType->experience * monsterLevel / 10);
mType->defense = (uint64_t)std::ceil(mType->defense * monsterLevel / 10);
mType->armor = (uint64_t)std::ceil(mType->armor * monsterLevel / 10);
Monster* monster = Monster::createMonster(mType);
monster->doMonsterSetCombatValues(monsterLevel - 10);
monster->doMonsterSetLevel(monsterLevel - 5);
mType->health = normHealth;
mType->healthMax = normMaxHealth;
mType->experience = normExp;
mType->defense = normDef;
mType->armor = normArm;
if(!monster)
return false;
if(startup)
{
//No need to send out events to the surrounding since there is no one out there to listen!
if(!g_game.internalPlaceCreature(monster, pos, false, true))
{
delete monster;
return false;
}
}
else
{
if(!g_game.placeCreature(monster, pos, false, true))
{
delete monster;
return false;
}
}
monster->setSpawn(this);
monster->addRef();
monster->setMasterPosition(pos, radius);
monster->setDirection(dir);
spawnedMap.insert(SpawnedPair(spawnId, monster));
spawnMap[spawnId].lastSpawn = OTSYS_TIME();
return true;
}
~~configmanager.cpp~~
Szukamy:
PHP:
m_confDouble[RATE_MONSTER_DEFENSE] = getGlobalDouble("rateMonsterDefense", 1);
I pod tym dodajemy:
PHP:
m_confNumber[MAX_MONSTER_LEVEL] = getGlobalNumber("maxMonsterLevel", 10);
Za? w configmanager.h, pod:
PHP:
BAN_MONTHLY_LIMIT,
Dodajemy:
PHP:
MAX_MONSTER_LEVEL,
~~monsters.cpp~~
I ostatnia cz???. Szukamy:
PHP:
race = RACE_BLOOD;
I nad tym dodajemy:
PHP:
maxLevel = 10;
Znajdujemy:
PHP:
if(readXMLInteger(root, "experience", intValue))
mType->experience = intValue;
I pod tym dodajemy:
PHP:
if(readXMLInteger(root, "maxLevel", intValue))
mType->maxLevel = intValue;
Szukamy:
PHP:
void MonsterType::dropLoot(Container* corpse)
I zamieniamy ca?? funkcj? na:
PHP:
void MonsterType::dropLoot(Container* corpse, int32_t randomDamage)
{
Item* tmpItem = NULL;
for(LootItems::const_iterator it = lootItems.begin(); it != lootItems.end() && !corpse->full(); ++it)
{
if((tmpItem = createLoot(*it, randomDamage)))
{
if(Container* container = tmpItem->getContainer())
{
if(createChildLoot(container, (*it), randomDamage))
corpse->__internalAddThing(tmpItem);
else
delete container;
}
else
corpse->__internalAddThing(tmpItem);
}
}
corpse->__startDecaying();
uint32_t ownerId = corpse->getCorpseOwner();
if(!ownerId)
return;
Player* owner = g_game.getPlayerByID(ownerId);
if(!owner)
return;
LootMessage_t message = lootMessage;
if(message == LOOTMSG_IGNORE)
message = (LootMessage_t)g_config.getNumber(ConfigManager::LOOT_MESSAGE);
if(message < LOOTMSG_PLAYER)
return;
std::stringstream ss;
ss << "Loot of " << nameDescription << ": " << corpse->getContentDescription() << ".";
if(owner->getParty() && message > LOOTMSG_PLAYER)
owner->getParty()->broadcastMessage((MessageClasses)g_config.getNumber(ConfigManager::LOOT_MESSAGE_TYPE), ss.str());
else if(message == LOOTMSG_PLAYER || message == LOOTMSG_BOTH)
owner->sendTextMessage((MessageClasses)g_config.getNumber(ConfigManager::LOOT_MESSAGE_TYPE), ss.str());
}
Potem ni?ej szukamy:
PHP:
Item* MonsterType::createLoot(const LootBlock& lootBlock)
I podmieniamy ca?? funkcj? na
PHP:
Item* MonsterType::createLoot(const LootBlock& lootBlock, int32_t randomDamage)
{
uint16_t item = lootBlock.ids[0], random = Monsters::getLootRandom() + (Monsters::getLootRandom() * randomDamage / 10);
if(lootBlock.ids.size() > 1)
item = lootBlock.ids[random_range((size_t)0, lootBlock.ids.size() - 1)];
Item* tmpItem = NULL;
if(Item::items[item].stackable)
{
if(random < lootBlock.chance)
tmpItem = Item::CreateItem(item, (random % lootBlock.count + 1));
}
else if(random < lootBlock.chance)
tmpItem = Item::CreateItem(item, 0);
if(!tmpItem)
return NULL;
if(lootBlock.subType != -1)
tmpItem->setSubType(lootBlock.subType);
if(lootBlock.actionId != -1)
tmpItem->setActionId(lootBlock.actionId);
if(lootBlock.uniqueId != -1)
tmpItem->setUniqueId(lootBlock.uniqueId);
if(!lootBlock.text.empty())
tmpItem->setText(lootBlock.text);
return tmpItem;
}
Troch? ni?ej znajdujemy:
PHP:
bool MonsterType::createChildLoot(Container* parent, const LootBlock& lootBlock)
I podmieniamy ca?? funkcj? na:
PHP:
bool MonsterType::createChildLoot(Container* parent, const LootBlock& lootBlock, int32_t randomDamage)
{
LootItems::const_iterator it = lootBlock.childLoot.begin();
if(it == lootBlock.childLoot.end())
return true;
Item* tmpItem = NULL;
for(; it != lootBlock.childLoot.end() && !parent->full(); ++it)
{
if((tmpItem = createLoot(*it, randomDamage)))
{
if(Container* container = tmpItem->getContainer())
{
if(createChildLoot(container, (*it), randomDamage))
parent->__internalAddThing(container);
else
delete container;
}
else
parent->__internalAddThing(tmpItem);
}
}
return !parent->empty();
}
~~monsters.h~~
Szukamy:
PHP:
void dropLoot(Container* corpse);
Item* createLoot(const LootBlock& lootBlock);
bool createChildLoot(Container* parent, const LootBlock& lootBlock);
I zamieniamy na:
PHP:
void dropLoot(Container* corpse, int32_t randomDamage);
Item* createLoot(const LootBlock& lootBlock, int32_t randomDamage);
bool createChildLoot(Container* parent, const LootBlock& lootBlock, int32_t randomDamage);
Znajdujemy:
PHP:
lightLevel, lightColor, changeTargetSpeed, changeTargetChance;
I zamieniamy na:
PHP:
lightLevel, lightColor, changeTargetSpeed, changeTargetChance, maxLevel;
OPCJONALNIE POZIOM PRZY NAZWIE POTWORA
~~protocolgame.cpp~~
~~protocolgame.cpp~~
Szukamy:
PHP:
void ProtocolGame::AddCreature(NetworkMessage_ptr msg, const Creature* creature, bool known, uint32_t remove)
W tej funkcji znajdujemy:
PHP:
msg->AddString(creature->getHideName() ? "" : creature->getName());
I zamieniamy na:
PHP:
std::stringstream ss;
ss << creature->getName();
if(creature->getMonster())
ss << " [L. " << creature->getMonster()->getMonsterLevel() << "]";
msg->AddString(creature->getHideName() ? "" : ss.str());
S??wko wyja?nienia. Ilo?? poziom?w danego potwora mo?na dodawa? na dwa sposoby. Indywidualnie dla ka?dego potwora z osobna, sposobem takim - ko?o experience="xxx" dodajemy maxLevel="xx", gdzie 'xx' to maksymalny poziom. Poziom pierwszy potwora os?abia go o 50%, poziom dziesi?ty wzmacnia o 50%. Jeden poziom to 10% wi?cej/mniej si?y. Wi?cej hp, expa, wi?ksze obra?enia i co tam tylko mo?na. Drugi spos?b to ustawienie w config.lua maksymalnego poziomu dla wszystkich potwor?w za pomoc?:
PHP:
maxMonsterLevel = xx
Je?li czego? zapomnia?em napisa?, wkrad?a si? liter?wka czy cokolwiek innego, pisa?.