Changeset 172
- Timestamp:
- 12/15/09 18:08:17 (9 months ago)
- Location:
- eoserv/trunk
- Files:
-
- 11 modified
-
config.extra.ini (modified) (1 diff)
-
config.ini (modified) (1 diff)
-
src/character.cpp (modified) (2 diffs)
-
src/character.hpp (modified) (2 diffs)
-
src/handlers/Jukebox.cpp (modified) (3 diffs)
-
src/handlers/Walk.cpp (modified) (1 diff)
-
src/hook.cpp (modified) (1 diff)
-
src/hook.hpp (modified) (1 diff)
-
src/main.cpp (modified) (1 diff)
-
src/map.cpp (modified) (1 diff)
-
src/map.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eoserv/trunk/config.extra.ini
r169 r172 74 74 ## BankUpgradeStep (number) 75 75 # Amount extra each upgrade costs 76 BankUpgradeStep = 1000 76 BankUpgradeStep = 1000 77 78 ## JukeboxSongs (number) 79 # Number of songs a jukebox has 80 JukeboxSongs = 20 81 82 ## JukeboxPrice (number) 83 # Cost to play a song on a jukebox 84 JukeboxPrice = 25 77 85 78 86 -
eoserv/trunk/config.ini
r171 r172 480 480 Deadly = no 481 481 482 ## JukeboxTimer (number) 483 # Amount of time to lock a jukebox after a song is requested 484 # 0 to disable 485 JukeboxTimer = 1m30s 486 482 487 483 488 ## RATES ## -
eoserv/trunk/src/character.cpp
r171 r172 214 214 this->party = 0; 215 215 this->map = this->world->GetMap(0); 216 217 this->jukebox_open = false; 216 218 } 217 219 … … 733 735 this->y = y; 734 736 this->sitting = SIT_STAND; 737 738 this->shop_npc = 0; 739 this->bank_npc = 0; 740 this->jukebox_open = true; 735 741 736 742 this->warp_anim = animation; -
eoserv/trunk/src/character.hpp
r171 r172 111 111 NPC *shop_npc; 112 112 NPC *bank_npc; 113 bool jukebox_open; 113 114 114 115 WarpAnimation warp_anim; … … 250 251 SCRIPT_REGISTER_VARIABLE("NPC @", " shop_npc", shop_npc); 251 252 SCRIPT_REGISTER_VARIABLE("NPC @", " bank_npc", bank_npc); 253 SCRIPT_REGISTER_VARIABLE("bool", " jukebox_open", jukebox_open); 252 254 SCRIPT_REGISTER_VARIABLE("WarpAnimation", "warp_anim", warp_anim); 253 255 SCRIPT_REGISTER_VARIABLE("PtrList<Character_Item>", "inventory", inventory); -
eoserv/trunk/src/handlers/Jukebox.cpp
r168 r172 6 6 7 7 #include "handlers.h" 8 9 #include "map.hpp" 8 10 9 11 CLIENT_F_FUNC(Jukebox) … … 15 17 case PACKET_OPEN: // Opened the jukebox listing 16 18 { 19 if (this->state < EOClient::PlayingModal) return false; 17 20 21 unsigned char x = reader.GetChar(); 22 unsigned char y = reader.GetChar(); 23 24 if (!this->player->character->InRange(x, y) 25 || this->player->character->map->GetSpec(x, y) != Map_Tile::Jukebox) 26 { 27 return true; 28 } 29 30 reply.SetID(PACKET_JUKEBOX, PACKET_OPEN); 31 reply.AddShort(this->player->character->mapid); 32 33 if (this->player->character->map->jukebox_protect > Timer::GetTime()) 34 { 35 reply.AddString(this->player->character->map->jukebox_player); 36 } 37 38 this->player->character->jukebox_open = true; 39 40 CLIENT_SEND(reply); 18 41 } 19 42 break; … … 21 44 case PACKET_MSG: // Requested a song 22 45 { 46 if (this->state < EOClient::PlayingModal) return false; 23 47 48 reader.GetChar(); 49 reader.GetChar(); 50 short track = reader.GetShort(); 51 52 if (!this->player->character->jukebox_open 53 || this->player->character->map->jukebox_protect > Timer::GetTime() 54 || (track < 0 || track > static_cast<int>(this->server->world->config["JukeboxSongs"])) 55 || this->player->character->HasItem(1) < static_cast<int>(this->server->world->config["JukeboxPrice"])) 56 { 57 return true; 58 } 59 60 this->player->character->DelItem(1, static_cast<int>(this->server->world->config["JukeboxPrice"])); 61 62 this->player->character->map->jukebox_player = this->player->character->name; 63 this->player->character->map->jukebox_protect = Timer::GetTime() + static_cast<int>(this->server->world->config["JukeboxTimer"]); 64 65 reply.SetID(PACKET_JUKEBOX, PACKET_AGREE); 66 reply.AddInt(this->player->character->HasItem(1)); 67 68 CLIENT_SEND(reply); 69 70 PacketBuilder builder(PACKET_JUKEBOX, PACKET_USE); 71 builder.AddShort(track + 1); 72 UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character) 73 { 74 character->player->client->SendBuilder(builder); 75 } 24 76 } 25 77 break; -
eoserv/trunk/src/handlers/Walk.cpp
r171 r172 52 52 this->player->character->shop_npc = 0; 53 53 this->player->character->bank_npc = 0; 54 this->player->character->jukebox_open = true; 54 55 if (!this->player->character->Walk(direction)) 55 56 { -
eoserv/trunk/src/hook.cpp
r171 r172 77 77 #include <typeinfo> 78 78 79 template <> void Hook_Call::SetArg<Shared *>(ScriptContext *ctx, int argc, Shared *arg) { printf("A %s [%i = %x]\n", typeid(arg).name(), argc, arg); ctx->as->SetArgAddress(argc, arg); }80 79 template <> void Hook_Call::SetArg<asBYTE>(ScriptContext *ctx, int argc, asBYTE arg) { printf("A %s [%i = %i]\n", typeid(arg).name(), argc, arg); ctx->as->SetArgByte(argc, arg); } 81 80 template <> void Hook_Call::SetArg<char>(ScriptContext *ctx, int argc, char arg) { return SetArg(ctx, argc, (asBYTE)arg); } -
eoserv/trunk/src/hook.hpp
r171 r172 79 79 } 80 80 81 template <typename T> static void SetArg(ScriptContext *ctx, int argc, T arg) { ctx->as->SetArgObject(argc, &arg); }81 template <typename T> static void SetArg(ScriptContext *ctx, int argc, T arg) { ctx->as->SetArgObject(argc, arg); } 82 82 83 83 template <typename T> Hook_Call &operator [](T arg) -
eoserv/trunk/src/main.cpp
r171 r172 377 377 eoserv_config_default(config, "BankUpgradeBase" , 1000); 378 378 eoserv_config_default(config, "BankUpgradeStep" , 1000); 379 eoserv_config_default(config, "JukeboxSongs" , 20); 380 eoserv_config_default(config, "JukeboxPrice" , 25); 381 eoserv_config_default(config, "JukeboxTimer" , 90); 379 382 eoserv_config_default(config, "MaxBankGold" , 2000000000); 380 383 eoserv_config_default(config, "MaxItem" , 10000000); -
eoserv/trunk/src/map.cpp
r171 r172 213 213 this->world = world; 214 214 this->exists = false; 215 this->jukebox_protect = 0.0; 215 216 216 217 if (world->arenas_config[util::to_string(id) + ".enabled"]) -
eoserv/trunk/src/map.hpp
r171 r172 279 279 PtrVector<PtrVector<Map_Tile> > tiles; 280 280 bool exists; 281 double jukebox_protect; 282 std::string jukebox_player; 281 283 282 284 Arena *arena; … … 357 359 SCRIPT_REGISTER_VARIABLE("PtrVector<PtrVector<Map_Tile>>", "tiles", tiles); 358 360 SCRIPT_REGISTER_VARIABLE("bool", "exists", exists); 361 SCRIPT_REGISTER_VARIABLE("double", "jukebox_protect", jukebox_protect); 362 SCRIPT_REGISTER_VARIABLE("string", "jukebox_player", jukebox_player); 359 363 SCRIPT_REGISTER_VARIABLE("Arena @", " arena", arena); 360 364 SCRIPT_REGISTER_FUNCTION("int GenerateItemID()", GenerateItemID);
