[Share] Teleporter

Koner

Прославленный
Проверенный
Сообщения
258
Розыгрыши
0
Репутация
1 181
Реакции
284
Баллы
1 483
Мой очень старый код, пример для новичков:
Код:
class 1 teleporter : announce_raid_boss_position
{
parameter:
   string ShopName = "";
   string fnHi = "thi.htm";
   string fnYouAreChaotic = "tcm.htm";
   string fnNobless = "";
   string fnNoNobless = "";
   string fnNoNoblessItem = "";
   int PrimeHours = 0;
   int PHfromHour = 20;
   int PHtoHour = 8;
   int PHfromDay = 1;
   int PHtoDay = 7;
   int High76Level = 0;

property:
   TelPosList Position = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoobie = {{"Talking Island"; -84169; 244693; -3729; 0; 0}};
   TelPosList PositionPrimeHours = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoblessNeedItemTown = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoblessNoItemTown = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoblessNeedItemField = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoblessNoItemField = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoblessNeedItemSSQ = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionNoblessNoItemSSQ = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList Position76Lvl = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList TournamentTeleportList = {{"Talking Island"; -84169; 244693; -3729; 100000; 0}};
   TelPosList PositionFree61Lev = {{"Talking Island"; -84169; 244693; -3729; 0; 0}};

handler:
   EventHandler TALKED( talker )
   {
     if( talker.karma > 0 )
     {
       myself::ShowPage( talker, fnYouAreChaotic );
     }
     if( talker.equiped_weapon_class_id == 8190 || talker.equiped_weapon_class_id == 8689 )
     {
       myself::ShowPage( talker, "rapunzel003.htm" );
     }
     else
     {
       myself::ShowPage( talker, fnHi );
     }
   }

   EventHandler TELEPORT_REQUESTED( i0, i1, talker )
   {
     if( PrimeHours == 1 )
     {
       i0 = gg::GetDateTime( 0, 3 );
       i1 = gg::GetDateTime( 0, 6 );
       if( i1 >= PHfromDay && i1 <= PHtoDay )
       {
         if( i0 >= PHfromHour || i0 <= PHtoHour )
         {
           if( talker.level <= 0 )
           {
             myself::Teleport( talker, PositionNoobie, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
             return;
           }
           else if( High76Level == 1 )
           {
             if( talker.level <= 61 )
             {
               myself::Teleport( talker, PositionFree61Lev, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
             }
             else if( talker.level >= 76 )
             {
               myself::Teleport( talker, Position76Lvl, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
             }
             else
             {
               myself::Teleport( talker, PositionPrimeHours, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
               return;
             }
           }
           else
           {
             myself::Teleport( talker, PositionPrimeHours, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
             return;
           }
         }
       }
     }
     if( talker.level <= 0 )
     {
       myself::Teleport( talker, PositionNoobie, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
     }
     else if( High76Level == 1 )
     {
       if( talker.level <= 61 )
       {
         myself::Teleport( talker, PositionFree61Lev, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       }
       else if( talker.level >= 76 )
       {
         myself::Teleport( talker, Position76Lvl, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       }
       else
       {
         myself::Teleport( talker, Position, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
         return;
       }
     }
     else
     {
       myself::Teleport( talker, Position, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       return;
     }
   }

   EventHandler MENU_SELECTED( talker, ask, reply, i0, i1, i2, quest_id )
   {
     if( ask == 255 )
     {
       if( myself::CanLotto() == 1 )
       {
         i0 = myself::GetMemoStateEx( talker, 255, 1 );
         i0 = i0 % 100;
         if( i0 >= 95 || i0 < 0 )
         {
           i0 = 0;
         }
         if( reply == 1 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 100 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 2 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 200 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 3 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 300 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 4 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 400 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 5 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 500 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 6 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 600 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 7 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 700 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 8 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 800 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 9 )
         {
           if( i0 < 100 )
           {
             myself::SetMemoStateEx( talker, 255, 1, i0 + 900 );
             myself::InstantTeleport( talker, 12661, 181687, -3540 );
             return;
           }
         }
         else if( reply == 10 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 1000 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 11 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 1100 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
         else if( reply == 12 )
         {
           myself::SetMemoStateEx( talker, 255, 1, i0 + 1200 );
           myself::InstantTeleport( talker, 12661, 181687, -3540 );
           return;
         }
       }
       else if( reply == 9 )
       {
         myself::ShowPage( talker, "race_gatekeeper1004.htm" );
       }
       else
       {
         myself::ShowPage( talker, "race_cant_teleport001.htm" );
       }
     }
     else if( ask == -1816 )
     {
       if( reply == 3 )
       {
         if( gg::Rand( 100 ) < 25 )
         {
           myself::InstantTeleport( talker, -58752, -56898, -2032 );
         }
         else if( gg::Rand( 100 ) < 50 )
         {
           myself::InstantTeleport( talker, -59716, -57868, -2032 );
         }
         else if( gg::Rand( 100 ) < 75 )
         {
           myself::InstantTeleport( talker, -60691, -56893, -2032 );
         }
         else
         {
           myself::InstantTeleport( talker, -59720, -55921, -2032 );
         }
       }
     }
     else if( ask == -19 )
     {
       if( talker.nobless_type == 1 )
       {
         myself::ShowPage( talker, fnNobless );
       }
       else
       {
         myself::ShowPage( talker, fnNoNobless );
       }
     }
     else if( ask == -20 )
     {
       if( reply == 1 )
       {
         if( myself::OwnItemCount( talker, @nobless_gate_pass ) != 0 )
         {
           myself::Teleport( talker, PositionNoblessNeedItemTown, ShopName, "", "", "", 6651, myself::MakeFString( 1000454, "", "", "", "", "" ) );
         }
         else
         {
           myself::ShowPage( talker, fnNoNoblessItem );
         }
       }
       else if( reply == 2 )
       {
         if( myself::OwnItemCount( talker, @nobless_gate_pass ) != 0 )
         {
           myself::Teleport( talker, PositionNoblessNeedItemField, ShopName, "", "", "", 6651, myself::MakeFString( 1000454, "", "", "", "", "" ) );
         }
         else
         {
           myself::ShowPage( talker, fnNoNoblessItem );
         }
       }
       else if( reply == 3 )
       {
         if( myself::OwnItemCount( talker, @nobless_gate_pass ) != 0 )
         {
           myself::Teleport( talker, PositionNoblessNeedItemSSQ, ShopName, "", "", "", 6651, myself::MakeFString( 1000454, "", "", "", "", "" ) );
         }
         else
         {
           myself::ShowPage( talker, fnNoNoblessItem );
         }
       }
     }
     else if( ask == -21 )
     {
       if( reply == 1 )
       {
         myself::Teleport( talker, PositionNoblessNoItemTown, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       }
       if( reply == 2 )
       {
         myself::Teleport( talker, PositionNoblessNoItemField, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       }
       if( reply == 3 )
       {
         myself::Teleport( talker, PositionNoblessNoItemSSQ, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       }
       if ( reply == 4 )
       {
         myself::Teleport( talker, TournamentTeleportList, ShopName, "", "", "", 57, myself::MakeFString( 1000308, "", "", "", "", "" ) );
       }
     }
     else if( ask == -22 )
     {
       myself::ShowPage( talker, myself.sm.name + "001.htm" );
     }
     super;
   }
}

В данном примере следующий функционал:
1. Игроки до 61го(включительно) могут использовать телепорты "бесплатно".
2. Игроки начиная с 76го лвла платят в двойне за телепорты.

Далее потребуется в каждом отдельном АИ гейткиперов(например: rapunzel ), дописать списки телепортов, например:
Код:
telposlist_begin PositionFree61Lev
     {"The Village of Gludin"; -80749; 149834; -3043; 0; 0 }
     {"Dark Elf Village"; 9716; 15502; -4500; 0; 0 }
     {"Dwarven Village"; 115120; -178112; -880; 0; 0 }
     {"Elven Village"; 46890; 51531; -2976; 0; 0 }
     {"Orc Village"; -45186; -112459; -236; 0; 0 }
     {"Elven Ruins"; -112367; 234703; -3688; 0; 0 }
     {"Singing Waterfall"; -111728; 244330; -3448; 0; 0 }
     {"Talking Island, Western Territory (Northern Area)"; -106696; 214691; -3424; 0; 0 }
     {"Obelisk of Victory"; -99586; 237637; -3568; 0; 0 }
   telposlist_end
Список платных( для 76+ ) телепортов:
Код:
telposlist_begin Position76Lvl
     {"The Village of Gludin"; -80749; 149834; -3043; 90000; 0 }
     {"Dark Elf Village"; 9716; 15502; -4500; 120000; 0 }
     {"Dwarven Village"; 115120; -178112; -880; 230000; 0 }
     {"Elven Village"; 46890; 51531; -2976; 115000; 0 }
     {"Orc Village"; -45186; -112459; -236; 175000; 0 }
     {"Elven Ruins"; -112367; 234703; -3688; 4150; 0 }
     {"Singing Waterfall"; -111728; 244330; -3448; 3850; 0 }
     {"Talking Island, Western Territory (Northern Area)"; -106696; 214691; -3424; 5000; 0 }
     {"Obelisk of Victory"; -99586; 237637; -3568; 2350; 0 }
   telposlist_end

В итоге ГК исходя от лвла игрока будет показывать ему определенный список телепортов, в штмл менять ничего не надо.
 

Назад
Сверху Снизу