Tibia Mod
Forum zostało Przeniesione tutaj:
http://tibiamod.xaa.pl/

Zapraszam.

Join the forum, it's quick and easy

Tibia Mod
Forum zostało Przeniesione tutaj:
http://tibiamod.xaa.pl/

Zapraszam.
Tibia Mod
Czy chcesz zareagować na tę wiadomość? Zarejestruj się na forum za pomocą kilku kliknięć lub zaloguj się, aby kontynuować.

Reborn System

Go down

Reborn System Empty Reborn System

Pisanie by darkes Czw Lis 15, 2012 7:38 pm

1. Autor: Xelix
2. Opis:

  • Po wbiciu odpowiedniego poziomu pojawia się napis o informacji potrzeby rebornu.
  • Po wpisaniu !reborn automatycznie nas wylogowuje z postaci.
  • Po zalogowaniu na postać mamy zresetowany lvl,exp oraz pojawiamy się w pozycji podanej w config.lua
  • Zwiększa procent zadawanych obrażeń po rebornie (config).
  • Po kliknięciu "Look" na gracza wyświetlana jest ilość wykonanych rebornów.


3. Klient: 7.60
4. Przedstawienie kodu:

Commands.cpp
Pod:
Kod:
//table of commands
s_defcommands Commands::defined_commands[] = {
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
    {"!reborn",&Commands::reborn},
#endif //_XELIX_REBORN_
Na sam koniec dodaj:
Kod:
#ifdef _XELIX_REBORN_
bool Commands::reborn(Creature* c, const std::string &cmd, const std::string ¶m)
{
   int reborn_level = (g_config.getGlobalNumber("reborn_level", 2));
    Player* player = dynamic_cast<Player*>(c);
    Position pos;
    if(!player)
        return false;
    if(player->level >= reborn_level){
        pos.x = (g_config.getGlobalNumber("pos_x", 123));
        pos.y = (g_config.getGlobalNumber("pos_y", 123));
        pos.z = (g_config.getGlobalNumber("pos_z", 7));
        game->teleport(player, pos);
        player->experience = 0;
        player->level = 1;
        player->reborn++;
        player->kickPlayer(); //Wyrzuca postac
    }else{
      std::stringstream text;
      text << "Musisz miec " << reborn_level << " poziom.";
        player->sendTextMessage(MSG_BLUE_TEXT, text.str().c_str());
    }
    return true;
}

#endif //_XELIX_REBORN_
Commands.h
Pod:
Kod:
protected:
   bool loaded;
   Game *game;
   std::string datadir;

   //commands
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
   bool reborn(Creature* c, const std::string &cmd, const std::string ¶m);
#endif //_XELIX_REBORN_
Game.cpp
Pod:
Kod:
      if (damage != 0)
      {
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
if(attackPlayer && attackPlayer->reborn > 0){
    damage += (int)(damage*(0.01*(attackPlayer->reborn*(g_config.getGlobalNumber("addRebornDMG", 2)))));
}
#endif //_XELIX_REBORN_
Ioplayerxml.cpp
Nad:
Kod:
      nodeValue = (char*)xmlGetProp(root, (const xmlChar *) "cap");
      if(nodeValue) {
         player->capacity = atoi(nodeValue);
         xmlFreeOTSERV(nodeValue);
      }
      else
         isLoaded = false;
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
      nodeValue = (char*)xmlGetProp(root, (const xmlChar *) "reborn");
      if(nodeValue) {
         player->reborn = (atoi(nodeValue) != 0);
         xmlFreeOTSERV(nodeValue);
      }
      else
         isLoaded = false;
#endif //_XELIX_REBORN_
Pod:
Kod:
   sb << player->maglevel;             xmlSetProp(root, (const xmlChar*) "maglevel", (const xmlChar*)sb.str().c_str());  sb.str("");
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
    sb << player->reborn;             xmlSetProp(root, (const xmlChar*) "reborn", (const xmlChar*)sb.str().c_str());  sb.str("");
#endif //_XELIX_REBORN_
Player.cpp
Pod:
Kod:
   maglevel  = 20;
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
    reborn = 0;
#endif //XELIX_REBORN_
Pod:
Kod:
#ifdef YUR_PREMIUM_PROMOTION
         if (isPromoted() && access == 0 && vocation == 0)
            s << " is "<< g_config.PROMOTED_VOCATIONS[(int)vocation] << ".";
         else
#endif //YUR_PREMIUM_PROMOTION
            s << " is "<< g_config.VOCATIONS[(int)vocation] << ".";
}
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
            if(reborn > 0){
                s << "Posiada " << reborn << ".";
            }else{
                s << "Nie posiada rebornu.";
            }
#endif //_XELIX_REBORN_
Player.h
Pod:
Kod:
class Player : public Creature
{
public:
Dodaj:
Kod:
#ifdef _XELIX_REBORN_
      int reborn;
#endif //_XELIX_REBORN_
Config.lua
Na samym końcu dodaj:
Kod:

----XELIX REBORN SYSTEM----
-- Ile % dmg ma dodawac reborn
addRebornDMG = 2
-- Od ktorego poziomu mozna robic reborn
reborn_level = 400000
-- Pozycje do spawnu po rebornie
pos_x = 123
pos_y = 123
pos_z = 7
ALT+P >> Parametry >> Kompilator C++ >>

darkes
Uploader

Liczba postów : 27
Join date : 13/11/2012

Powrót do góry Go down

Powrót do góry

- Similar topics

 
Permissions in this forum:
Nie możesz odpowiadać w tematach