Changeset 178

Show
Ignore:
Timestamp:
12/29/09 04:02:50 (8 months ago)
Author:
sausage
Message:

Barber NPC support,
Fixed typos in config,
Add some location sensitive packets to the action queue,
Fix direction calculation and type,
Fix hit rate formula

Location:
eoserv/trunk
Files:
1 added
21 modified

Legend:

Unmodified
Added
Removed
  • eoserv/trunk/Makefile.all

    r171 r178  
    6363       $(OBJDIR)/handlers/Attack.o \ 
    6464       $(OBJDIR)/handlers/Bank.o \ 
     65       $(OBJDIR)/handlers/Barber.o \ 
    6566       $(OBJDIR)/handlers/Board.o \ 
    6667       $(OBJDIR)/handlers/Book.o \ 
  • eoserv/trunk/config.extra.ini

    r172 r178  
    6868CreateMaxSkin = 3 
    6969 
     70## BarberBase (number) 
     71# Base price for a haircut 
     72BarberBase = 0 
     73 
     74## BarberStep (number) 
     75# Cost per level for a haircut 
     76# A level 0 is charged the same as a level 1 
     77BarberStep = 200 
     78 
    7079## BankUpgradeBase (number) 
    7180# Base cost for a bank upgrade 
  • eoserv/trunk/config.ini

    r177 r178  
    130130ArenasFile = ./data/arenas.ini 
    131131 
    132 ## ForumasFile (string) 
    133 # File containing forumulas 
     132## FormulasFile (string) 
     133# File containing stat/combat/class formulas 
    134134FormulasFile = ./data/formulas.ini 
    135135 
  • eoserv/trunk/data/formulas.ini

    r177 r178  
    1515 
    1616# Hit rate and damage 
    17 hit_rate = 0.8 1.2 critical ? 200 accuracy / + 200 modifier target_evade * / + 0.2 max 1.0 min 
     17hit_rate = 200 modifier target_evade * / 0.8 1.2 critical ? 200 accuracy / + - 0.2 max 1.0 min 
    1818damage = 3 target_armor / modifier * damage - 0.1 damage * ceil max 1 1.5 critical ? * 
    1919 
  • eoserv/trunk/project/mingw.cbp

    r171 r178  
    181181                <Unit filename="..\src\handlers\Attack.cpp" /> 
    182182                <Unit filename="..\src\handlers\Bank.cpp" /> 
     183                <Unit filename="..\src\handlers\Barber.cpp" /> 
    183184                <Unit filename="..\src\handlers\Board.cpp" /> 
    184185                <Unit filename="..\src\handlers\Book.cpp" /> 
  • eoserv/trunk/src/character.cpp

    r177 r178  
    139139        this->x = GetRow<int>(row, "x"); 
    140140        this->y = GetRow<int>(row, "y"); 
    141         this->direction = GetRow<int>(row, "direction"); 
     141        this->direction = static_cast<Direction>(GetRow<int>(row, "direction")); 
    142142 
    143143        this->spawnmap = GetRow<int>(row, "spawnmap"); 
     
    184184        this->shop_npc = 0; 
    185185        this->bank_npc = 0; 
     186        this->barber_npc = 0; 
    186187 
    187188        this->next_arena = 0; 
     
    641642        this->shop_npc = 0; 
    642643        this->bank_npc = 0; 
     644        this->barber_npc = 0; 
    643645        this->jukebox_open = true; 
    644646 
  • eoserv/trunk/src/character.hpp

    r177 r178  
    7575                unsigned char hairstyle, haircolor; 
    7676                short mapid; 
    77                 unsigned char x, y, direction; 
     77                unsigned char x, y; 
     78                Direction direction; 
    7879                short spawnmap; 
    7980                unsigned char spawnx, spawny; 
     
    111112                NPC *shop_npc; 
    112113                NPC *bank_npc; 
     114                NPC *barber_npc; 
    113115                bool jukebox_open; 
    114116 
     
    209211                SCRIPT_REGISTER_VARIABLE("uint8", x); 
    210212                SCRIPT_REGISTER_VARIABLE("uint8", y); 
    211                 SCRIPT_REGISTER_VARIABLE("uint8", direction); 
     213                SCRIPT_REGISTER_VARIABLE("Direction", direction); 
    212214                SCRIPT_REGISTER_VARIABLE("int16", spawnmap); 
    213215                SCRIPT_REGISTER_VARIABLE("uint8", spawnx); 
     
    253255                SCRIPT_REGISTER_VARIABLE("NPC @", shop_npc); 
    254256                SCRIPT_REGISTER_VARIABLE("NPC @", bank_npc); 
     257                SCRIPT_REGISTER_VARIABLE("NPC @", barber_npc); 
    255258                SCRIPT_REGISTER_VARIABLE("bool", jukebox_open); 
    256259                SCRIPT_REGISTER_VARIABLE("WarpAnimation", warp_anim); 
  • eoserv/trunk/src/eoclient.cpp

    r175 r178  
    116116                CLIENT_F_HANDLE(PACKET_BANK,Bank); 
    117117                CLIENT_F_HANDLE(PACKET_LOCKER,Locker); 
     118                CLIENT_F_HANDLE(PACKET_BARBER,Barber); 
    118119                CLIENT_F_HANDLE(PACKET_GUILD,Guild); 
    119120                CLIENT_F_HANDLE(PACKET_SIT,Sit); 
  • eoserv/trunk/src/eoclient.hpp

    r175 r178  
    153153                CLIENT_F_FUNC(Bank); 
    154154                CLIENT_F_FUNC(Locker); 
     155                CLIENT_F_FUNC(Barber); 
    155156                CLIENT_F_FUNC(Guild); 
    156157                CLIENT_F_FUNC(Sit); 
  • eoserv/trunk/src/eoserver.cpp

    r176 r178  
    106106                                QUEUE_F_HANDLE(PACKET_BANK,Bank); 
    107107                                QUEUE_F_HANDLE(PACKET_LOCKER,Locker); 
     108                                QUEUE_F_HANDLE(PACKET_BARBER,Barber); 
    108109                                QUEUE_F_HANDLE(PACKET_GUILD,Guild); 
    109110                                QUEUE_F_HANDLE(PACKET_SIT,Sit); 
  • eoserv/trunk/src/handlers/Bank.cpp

    r173 r178  
    2020                { 
    2121                        if (this->state < EOClient::Playing) return false; 
     22                        CLIENT_QUEUE_ACTION(0.0) 
    2223 
    2324                        short id = reader.GetShort(); 
  • eoserv/trunk/src/handlers/Chest.cpp

    r171 r178  
    119119                { 
    120120                        if (this->state < EOClient::Playing) return false; 
     121                        CLIENT_QUEUE_ACTION(0.0) 
    121122 
    122123                        int x = reader.GetChar(); 
  • eoserv/trunk/src/handlers/Item.cpp

    r177 r178  
    2020                { 
    2121                        if (this->state < EOClient::PlayingModal) return false; 
     22                        CLIENT_QUEUE_ACTION(0.0) 
    2223 
    2324                        int id = reader.GetShort(); 
     
    162163                { 
    163164                        if (this->state < EOClient::PlayingModal) return false; 
     165                        CLIENT_QUEUE_ACTION(0.0) 
    164166 
    165167                        int id = reader.GetShort(); 
     
    262264                { 
    263265                        if (this->state < EOClient::Playing) return false; 
     266                        CLIENT_QUEUE_ACTION(0.0) 
    264267 
    265268                        int uid = reader.GetShort(); 
  • eoserv/trunk/src/handlers/Jukebox.cpp

    r172 r178  
    1818                { 
    1919                        if (this->state < EOClient::PlayingModal) return false; 
     20                        CLIENT_QUEUE_ACTION(0.0) 
    2021 
    2122                        unsigned char x = reader.GetChar(); 
  • eoserv/trunk/src/handlers/Shop.cpp

    r171 r178  
    134134                { 
    135135                        if (this->state < EOClient::Playing) return false; 
     136                        CLIENT_QUEUE_ACTION(0.0) 
    136137 
    137138                        short id = reader.GetShort(); 
  • eoserv/trunk/src/handlers/Walk.cpp

    r177 r178  
    5252                                        this->player->character->shop_npc = 0; 
    5353                                        this->player->character->bank_npc = 0; 
     54                                        this->player->character->barber_npc = 0; 
    5455                                        this->player->character->jukebox_open = true; 
    5556                                        if (!this->player->character->Walk(direction)) 
  • eoserv/trunk/src/main.cpp

    r177 r178  
    370370                eoserv_config_default(config, "CriticalRate"       , 0.08); 
    371371                eoserv_config_default(config, "SpawnRate"          , 1.0); 
     372                eoserv_config_default(config, "BarberBase"         , 0); 
     373                eoserv_config_default(config, "BarberStep"         , 200); 
    372374                eoserv_config_default(config, "BankUpgradeBase"    , 1000); 
    373375                eoserv_config_default(config, "BankUpgradeStep"    , 1000); 
  • eoserv/trunk/src/map.cpp

    r177 r178  
    12691269                                double rand = util::rand(0.0, 1.0); 
    12701270                                // Checks if target is facing you 
    1271                                 bool critical = std::abs(npc->direction - from->direction) != 2 || rand < static_cast<double>(this->world->config["CriticalRate"]); 
     1271                                bool critical = std::abs(int(npc->direction) - from->direction) != 2 || rand < static_cast<double>(this->world->config["CriticalRate"]); 
    12721272 
    12731273                                std::map<std::string, double> formula_vars; 
     
    12821282                                double hit_rate = rpn_eval(rpn_parse(this->world->formulas_config["hit_rate"]), formula_vars); 
    12831283 
     1284                                printf("damage %i / %g > %g", amount, rand, hit_rate); 
     1285 
    12841286                                if (rand > hit_rate) 
    12851287                                { 
     
    13521354                                double rand = util::rand(0.0, 1.0); 
    13531355                                // Checks if target is facing you 
    1354                                 bool critical = std::abs(character_ptr->direction - from->direction) != 2 || rand < static_cast<double>(this->world->config["CriticalRate"]); 
     1356                                bool critical = std::abs(int(character_ptr->direction) - from->direction) != 2 || rand < static_cast<double>(this->world->config["CriticalRate"]); 
    13551357 
    13561358                                std::map<std::string, double> formula_vars; 
  • eoserv/trunk/src/npc.cpp

    r177 r178  
    727727        double rand = util::rand(0.0, 1.0); 
    728728        // Checks if target is facing you 
    729         bool critical = std::abs(target->direction - this->direction) != 2 || rand < static_cast<double>(this->map->world->config["CriticalRate"]); 
     729        bool critical = std::abs(int(target->direction) - this->direction) != 2 || rand < static_cast<double>(this->map->world->config["CriticalRate"]); 
    730730 
    731731        std::map<std::string, double> formula_vars; 
  • eoserv/trunk/src/packet.cpp

    r175 r178  
    4848                case PACKET_BANK: return "Bank"; 
    4949                case PACKET_LOCKER: return "Locker"; 
     50                case PACKET_BARBER: return "Barber"; 
    5051                case PACKET_GUILD: return "Guild"; 
    5152                case PACKET_SIT: return "Sit"; 
  • eoserv/trunk/src/packet.hpp

    r175 r178  
    4545        PACKET_BANK = 36, 
    4646        PACKET_LOCKER = 37, 
     47        PACKET_BARBER = 38, 
    4748        PACKET_GUILD = 39, 
    4849        PACKET_SIT = 41,