#1 2013-07-11 20:37:58

 Rolus

*@@*RoluseK*@@*

19799437
Zarejestrowany: 2013-07-11
Posty: 12
Punktów :   

Reborn System - MazurskiOTS

Dziś przedstawiam Reborn System praktycznie taki sam jak na MazurskimOTS.

1. Opis:
Po wbiciu danego poziomu (Do ustawienia w config.lua):
- postać automatycznie otrzymuje reborn.
- postać automatycznie dostaje 10 poziom.
- postać dostaje "ileś %" dmg (Do ustawienia w config.lua).
- postać otrzymuje połowę hp,mp z poprzedniego rebornu (Co to znaczy? Jeżeli postać na poziomie np. 700,000 ma 2,000,000 HP to po rebornie będzie posiadać 1,000,000).
- postać dostaje wiadomość o tym że wbiła reborn.

2. Autorzy: Rolus
Autorem jestem Ja: Rolus jednak przy dzieleniu hp,mp na pół i zwiększaniu dmg pomógł mi Wizard.

3. Przedstawienie kodu:
W ioplayerxml.cpp pod:

   

Kod:

    nodeValue = (char*)xmlGetProp(root, (const xmlChar *) "cap");
    if(nodeValue) {
    player->capacity = atoi(nodeValue);
    xmlFreeOTSERV(nodeValue);
    }
    else
    isLoaded = false;

dodajemy:

   

Kod:

#ifdef AUTO_REB
    nodeValue = (char*)xmlGetProp(root, (const xmlChar *) "reborn");
    if(nodeValue) {
    player->reborn = (atoi(nodeValue) != 0);
    xmlFreeOTSERV(nodeValue);
    }
    else
    isLoaded = false;
    #endif //AUTO_REB

dalej pod:

   

Kod:

    sb << player->getCapacity(); xmlSetProp(root, (const xmlChar*) "cap", (const xmlChar*)sb.str().c_str()); sb.str("");

dodajemy:

   

Kod:

 #ifdef AUTO_REB
    sb << player->reborn; xmlSetProp(root, (const xmlChar*) "reborn", (const xmlChar*)sb.str().c_str()); sb.str("");
    #endif //AUTO_REB

Teraz w player.cpp pod:

       

Kod:

guildId = 0;

dodajemy:

   

Kod:

#ifdef AUTO_REB
    reborn = 0;
    #endif //AUTO_REB

dalej pod:

   

Kod:

    if(guildNick.length())
    s << " (" << guildNick << ")";

    s << ".";
    }

dodajemy:

Kod:

    #ifdef AUTO_REB
    if(reborn > 0){
    s << "Reborn: " << reborn << ".";
    }
    #endif //AUTO_REB

dalej w tym samym pliku zamieniamy całą funkcje:

   

Kod:

void Player::addExp(exp_t exp)

na moją:

 

Kod:

  #ifdef AUTO_REB
    void Player::addExp(exp_t exp)
    {
    this->experience += exp;
    int lastLv = this->level;
    while (this->experience >= this->getExpForLv(this->level+1)) {
    this->level++;
    this->healthmax += g_config.HP_GAIN[(int)vocation];
    this->health += g_config.HP_GAIN[(int)vocation];
    this->manamax += g_config.MANA_GAIN[(int)vocation];
    this->mana += g_config.MANA_GAIN[(int)vocation];
    this->capacity += g_config.CAP_GAIN[(int)vocation];
    }
    if(lastLv != this->level)
    {
    this->setNormalSpeed();
    g_game.changeSpeed(this->getID(), this->getSpeed());
    std::stringstream lvMsg,rebMsg;
    if(this->level > g_config.getGlobalNumber("rebornLvl"))
    {
    this->level = 10;
    this->experience = 9300;
    this->reborn++;
    this->healthmax /= 2;
    this->health /= 2;
    this->manamax /= 2;
    this->mana /= 2;
    lvMsg << "Awansowales z poziomu " << lastLv << " na poziom " << level << ".";
    rebMsg << "Gratulacje! Osiagnales reborn.";
    this->sendTextMessage(MSG_INFO,rebMsg.str().c_str());
    this->sendTextMessage(MSG_ADVANCE,lvMsg.str().c_str());
    }else
    {
    lvMsg << "Awansowales z poziomu " << lastLv << " na poziom " << level << ".";
    this->sendTextMessage(MSG_ADVANCE,lvMsg.str().c_str());
    this->sendStats();
    }

    }
    }
    #endif //AUTO_REB

Na koniec w player.h pod:

 

Kod:

class Player : public Creature
    {
    public:

dodajemy:

   

Kod:

#ifdef AUTO_REB
    short reborn;
    #endif //AUTO_REB

Jeszcze w game.cpp pod:

   

Kod:

    if (damage != 0)
    {

dodaj:

   

Kod:

    #ifdef AUTO_REB
    if(attackPlayer && attackPlayer->reborn > 0){
    damage += (int)(damage*(0.01*(attackPlayer->reborn*(g_config.getGlobalNumber("rebornDmg", 2)))));
    }
    #endif//AUTO_REB

No i jeszcze dodamy do Parametrów (ALT + P):

Kod:

 :-DAUTO_REB

i do config.lua na samym końcu pliku:

Kod:

    ----- Reborn System © by Rolus, Wizard ----
    rebornDmg = 140 -- Ile % DMG postac ma dostawac za kazdy reborn.
    rebornLvl = 700 -- Od jakiego poziomu ma byc reborn.
    ----- Reborn System © by Rolus, Wizard ----

Przebuduj i gotowe

Offline

 

#2 2013-07-11 20:50:26

 Kule

Administrator

693006
Zarejestrowany: 2013-07-11
Posty: 9
Punktów :   

Re: Reborn System - MazurskiOTS

Ooo bardzo mi się to przyda. Dzięki.

Offline

 

Stopka forum

RSS
Powered by PunBB 1.2.23
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.nevrwinter65.pun.pl www.bsw-logistyka.pun.pl www.or-cosinus.pun.pl www.astrayah.pun.pl www.proanamotyle.pun.pl