Changeset 184
- Timestamp:
- 01/10/10 05:58:12 (8 months ago)
- Location:
- eoserv/trunk
- Files:
-
- 18 modified
-
admin.ini (modified) (6 diffs)
-
config.ini (modified) (2 diffs)
-
src/character.cpp (modified) (5 diffs)
-
src/character.hpp (modified) (5 diffs)
-
src/eoconst.hpp (modified) (2 diffs)
-
src/guild.cpp (modified) (1 diff)
-
src/handlers/AdminInteract.cpp (modified) (2 diffs)
-
src/handlers/Board.cpp (modified) (2 diffs)
-
src/handlers/Players.cpp (modified) (2 diffs)
-
src/handlers/Talk.cpp (modified) (3 diffs)
-
src/handlers/Warp.cpp (modified) (1 diff)
-
src/handlers/Welcome.cpp (modified) (3 diffs)
-
src/main.cpp (modified) (4 diffs)
-
src/map.cpp (modified) (5 diffs)
-
src/npc.cpp (modified) (6 diffs)
-
src/npc.hpp (modified) (2 diffs)
-
src/world.cpp (modified) (2 diffs)
-
src/world.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eoserv/trunk/admin.ini
r174 r184 1 1 # This file determines the minimum access level required for admin commands 2 # No command should be set to level 0 since the EO client will not allow the3 # commands to be entered at that access level. (unless the prefix is changed)4 2 5 3 # 0 = Player … … 40 38 41 39 42 ## PLAYER CONTROL COMMANDS ##40 ## MAP/PLAYER CONTROL COMMANDS ## 43 41 44 42 # Disconnect a player from the server … … 80 78 warpmeto = 2 81 79 80 # Hides the player from maps and the online list 81 # $hide 82 hide = 2 83 82 84 # Evacuates a map 83 85 # $evacuate … … 88 90 remap = 4 89 91 90 # Reloads pub files91 # $repub92 repub = 493 94 92 # Forces an arena launch on the current map 95 93 # $arena 96 94 arena = 1 95 96 # Opens any board in the world 97 # $board [id] 98 # If no id is given defaults to AdminBoard 99 board = 1 97 100 98 101 … … 106 109 # $rehash 107 110 rehash = 4 111 112 # Reloads pub files 113 # $repub 114 repub = 4 108 115 109 116 … … 175 182 boardmod = 1 176 183 177 # Recieve reports 184 # Recieve reports and allows access to AdminBoard 178 185 reports = 1 186 187 # Allows #nowall (walk through walls) 188 nowall = 2 189 190 # See hidden players 191 seehide = 3 179 192 180 193 -
eoserv/trunk/config.ini
r183 r184 337 337 # Adds "(x minutes ago)" text to every post on a board 338 338 BoardDatePosts = yes 339 340 ## AdminBoard (number) 341 # Board number that reports/requests are logged (1 to 8) 342 # This board can't be accessed by players if placed in-game 343 # 0 to disable 344 AdminBoard = 8 345 346 ## AdminBoardLimit (number) 347 # Maximum number of posts that the AdminBoard can hold 348 AdminBoardLimit = 100 339 349 340 350 … … 539 549 JukeboxTimer = 1m30s 540 550 551 ## RespawnBossChildren (bool) 552 # Respawns boss children 553 RespawnBossChildren = yes 554 555 ## OldReports (bool) 556 # Uses the old admin chat report method 557 OldReports = no 558 541 559 542 560 ## RATES ## -
eoserv/trunk/src/character.cpp
r182 r184 115 115 Database_Result res = this->world->db.Query("SELECT `name`, `title`, `home`, `partner`, `admin`, `class`, `gender`, `race`, `hairstyle`, `haircolor`, `map`," 116 116 "`x`, `y`, `direction`, `spawnmap`, `spawnx`, `spawny`, `level`, `exp`, `hp`, `tp`, `str`, `int`, `wis`, `agi`, `con`, `cha`, `statpoints`, `skillpoints`, " 117 "`karma`, `sitting`, `bankmax`, `goldbank`, `usage`, `inventory`, `bank`, `paperdoll`, `spells`, `guild`, `guild_rank` FROM `characters` WHERE `name` = '$'", name.c_str()); 117 "`karma`, `sitting`, `bankmax`, `goldbank`, `usage`, `inventory`, `bank`, `paperdoll`, `spells`, `guild`, `guild_rank`, `quest`, `vars` FROM `characters` " 118 "WHERE `name` = '$'", name.c_str()); 118 119 std::map<std::string, util::variant> row = res.front(); 119 120 … … 195 196 196 197 this->sitting = static_cast<SitAction>(GetRow<int>(row, "sitting")); 198 this->hidden = false; 197 199 198 200 this->bankmax = GetRow<int>(row, "bankmax"); … … 764 766 builder.AddShort(this->world->eif->Get(character->paperdoll[Character::Weapon])->dollgraphic); 765 767 builder.AddChar(character->sitting); 766 builder.AddChar( 0); // visible768 builder.AddChar(character->hidden); 767 769 builder.AddByte(255); 768 770 } … … 1078 1080 } 1079 1081 1082 void Character::Hide() 1083 { 1084 this->hidden = true; 1085 1086 PacketBuilder builder(PACKET_ADMININTERACT, PACKET_REMOVE); 1087 builder.AddShort(this->player->id); 1088 1089 UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character) 1090 { 1091 character->player->client->SendBuilder(builder); 1092 } 1093 } 1094 1095 void Character::Unhide() 1096 { 1097 this->hidden = false; 1098 1099 PacketBuilder builder(PACKET_ADMININTERACT, PACKET_AGREE); 1100 builder.AddShort(this->player->id); 1101 1102 UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character) 1103 { 1104 character->player->client->SendBuilder(builder); 1105 } 1106 } 1107 1080 1108 #define v(x) vars[prefix + #x] = x; 1081 1109 #define vv(x, n) vars[prefix + n] = x; … … 1164 1192 "`str` = #, `int` = #, `wis` = #, `agi` = #, `con` = #, `cha` = #, `statpoints` = #, `skillpoints` = #, `karma` = #, `sitting` = #, " 1165 1193 "`bankmax` = #, `goldbank` = #, `usage` = #, `inventory` = '$', `bank` = '$', `paperdoll` = '$', " 1166 "`spells` = '$', `guild` = '$', guild_rank = # WHERE `name` = '$'",1194 "`spells` = '$', `guild` = '$', guild_rank = #, `quest` = '$', `vars` = '$' WHERE `name` = '$'", 1167 1195 this->title.c_str(), this->home.c_str(), this->partner.c_str(), this->clas, this->gender, this->race, 1168 1196 this->hairstyle, this->haircolor, this->mapid, this->x, this->y, this->direction, this->level, this->exp, this->hp, this->tp, 1169 1197 this->str, this->intl, this->wis, this->agi, this->con, this->cha, this->statpoints, this->skillpoints, this->karma, this->sitting, 1170 1198 this->bankmax, this->goldbank, this->Usage(), ItemSerialize(this->inventory).c_str(), ItemSerialize(this->bank).c_str(), 1171 DollSerialize(this->paperdoll).c_str(), "", (this->guild ? this->guild->tag.c_str() : ""), this->guild_rank, this->name.c_str());1199 DollSerialize(this->paperdoll).c_str(), "", (this->guild ? this->guild->tag.c_str() : ""), this->guild_rank, "", "", this->name.c_str()); 1172 1200 } 1173 1201 -
eoserv/trunk/src/character.hpp
r182 r184 88 88 short karma; 89 89 SitAction sitting; 90 unsigned char visible;90 bool hidden; 91 91 int bankmax; 92 92 int goldbank; … … 179 179 void CalculateStats(); 180 180 void DropAll(Character *killer); 181 void Hide(); 182 void Unhide(); 181 183 182 184 void FormulaVars(std::map<std::string, double> &vars, std::string prefix = ""); … … 198 200 SCRIPT_REGISTER_REF(Character) 199 201 SCRIPT_REGISTER_FACTORY("Character @f(string name, World @)", ScriptFactory); 202 203 SCRIPT_REGISTER_ENUM("EquipLocation") 204 SCRIPT_REGISTER_ENUM_VALUE(Boots); 205 SCRIPT_REGISTER_ENUM_VALUE(Accessory); 206 SCRIPT_REGISTER_ENUM_VALUE(Gloves); 207 SCRIPT_REGISTER_ENUM_VALUE(Belt); 208 SCRIPT_REGISTER_ENUM_VALUE(Armor); 209 SCRIPT_REGISTER_ENUM_VALUE(Necklace); 210 SCRIPT_REGISTER_ENUM_VALUE(Hat); 211 SCRIPT_REGISTER_ENUM_VALUE(Shield); 212 SCRIPT_REGISTER_ENUM_VALUE(Weapon); 213 SCRIPT_REGISTER_ENUM_VALUE(Ring1); 214 SCRIPT_REGISTER_ENUM_VALUE(Ring2); 215 SCRIPT_REGISTER_ENUM_VALUE(Armlet1); 216 SCRIPT_REGISTER_ENUM_VALUE(Armlet2); 217 SCRIPT_REGISTER_ENUM_VALUE(Bracer1); 218 SCRIPT_REGISTER_ENUM_VALUE(Bracer2); 219 SCRIPT_REGISTER_ENUM_END() 200 220 201 221 SCRIPT_REGISTER_VARIABLE("int", login_time); … … 236 256 SCRIPT_REGISTER_VARIABLE("int16", karma); 237 257 SCRIPT_REGISTER_VARIABLE("SitAction", sitting); 238 SCRIPT_REGISTER_VARIABLE(" uint8", visible);258 SCRIPT_REGISTER_VARIABLE("bool", hidden); 239 259 SCRIPT_REGISTER_VARIABLE("int", bankmax); 240 260 SCRIPT_REGISTER_VARIABLE("int", goldbank); … … 304 324 SCRIPT_REGISTER_FUNCTION("void CalculateStats()", CalculateStats); 305 325 SCRIPT_REGISTER_FUNCTION("void DropAll(Character @killer)", DropAll); 326 SCRIPT_REGISTER_FUNCTION("void Hide()", Hide); 327 SCRIPT_REGISTER_FUNCTION("void Unhide()", Unhide); 328 SCRIPT_REGISTER_FUNCTION("void Logout()", Logout); 306 329 SCRIPT_REGISTER_FUNCTION("void Save()", Save); 307 330 -
eoserv/trunk/src/eoconst.hpp
r182 r184 117 117 INIT_PLAYERS = 8, 118 118 INIT_MAP_MUTATION = 9, 119 INIT_ NOISE= 10,119 INIT_FRIEND_LIST_PLAYERS = 10, 120 120 INIT_FILE_ECF = 11 121 121 }; … … 321 321 SCRIPT_REGISTER_ENUM_VALUE(INIT_PLAYERS); 322 322 SCRIPT_REGISTER_ENUM_VALUE(INIT_MAP_MUTATION); 323 SCRIPT_REGISTER_ENUM_VALUE(INIT_ NOISE);323 SCRIPT_REGISTER_ENUM_VALUE(INIT_FRIEND_LIST_PLAYERS); 324 324 SCRIPT_REGISTER_ENUM_VALUE(INIT_FILE_ECF); 325 325 SCRIPT_REGISTER_ENUM_END() -
eoserv/trunk/src/guild.cpp
r182 r184 505 505 } 506 506 507 this->Save(); 508 507 509 this->manager->Release(); 508 510 } -
eoserv/trunk/src/handlers/AdminInteract.cpp
r174 r184 19 19 std::string message = reader.GetEndString(); 20 20 21 message = "[Request] " + message; 22 23 this->server->world->AdminMsg(this->player->character, message, static_cast<int>(this->server->world->admin_config["reports"])); 21 if (this->server->world->config["OldReports"]) 22 { 23 message = "[Request] " + message; 24 this->server->world->AdminMsg(this->player->character, message, static_cast<int>(this->server->world->admin_config["reports"])); 25 } 26 else 27 { 28 this->server->world->AdminRequest(this->player->character, message); 29 } 24 30 } 25 31 break; … … 32 38 std::string message = reader.GetEndString(); 33 39 34 message = "[Report:" + reportee + "] " + message; 35 36 this->server->world->AdminMsg(this->player->character, message, static_cast<int>(this->server->world->admin_config["reports"])); 40 if (this->server->world->config["OldReports"]) 41 { 42 message = "[Report:" + reportee + "] " + message; 43 this->server->world->AdminMsg(this->player->character, message, static_cast<int>(this->server->world->admin_config["reports"])); 44 } 45 else 46 { 47 this->server->world->AdminReport(this->player->character, reportee, message); 48 } 37 49 } 38 50 break; -
eoserv/trunk/src/handlers/Board.cpp
r181 r184 112 112 this->player->character->board->posts.push_front(newpost); 113 113 114 if (this->player->character->board-> posts.size() > static_cast<std::size_t>(static_cast<int>(this->server->world->config["BoardMaxPosts"])))114 if (this->player->character->board->id == static_cast<int>(this->server->world->config["AdminBoard"])) 115 115 { 116 this->player->character->board->posts.pop_back(); 116 if (this->player->character->board->posts.size() > static_cast<std::size_t>(static_cast<int>(this->server->world->config["AdminBoardLimit"]))) 117 { 118 this->player->character->board->posts.pop_back(); 119 } 120 } 121 else 122 { 123 if (this->player->character->board->posts.size() > static_cast<std::size_t>(static_cast<int>(this->server->world->config["BoardMaxPosts"]))) 124 { 125 this->player->character->board->posts.pop_back(); 126 } 117 127 } 118 128 … … 159 169 } 160 170 161 for (std::size_t y = 0; y < this->player->character->map->height; ++y) 171 if (boardid != static_cast<int>(this->server->world->config["AdminBoard"]) - 1 172 || this->player->character->admin >= static_cast<int>(this->server->world->admin_config["reports"])) 162 173 { 163 for (std::size_t x = 0; x < this->player->character->map->width; ++x)174 for (std::size_t y = 0; y < this->player->character->map->height; ++y) 164 175 { 165 if (this->player->character->InRange(x, y) 166 && this->player->character->map->GetSpec(x, y) == static_cast<Map_Tile::TileSpec>(Map_Tile::Board1 + boardid)) 176 for (std::size_t x = 0; x < this->player->character->map->width; ++x) 167 177 { 168 this->player->character->board = this->server->world->boards[boardid]; 178 if (this->player->character->InRange(x, y) 179 && this->player->character->map->GetSpec(x, y) == static_cast<Map_Tile::TileSpec>(Map_Tile::Board1 + boardid)) 180 { 181 this->player->character->board = this->server->world->boards[boardid]; 182 } 169 183 } 170 184 } -
eoserv/trunk/src/handlers/Players.cpp
r171 r184 20 20 Character *victim = this->server->world->GetCharacter(name); 21 21 22 if (victim )22 if (victim && !victim->hidden) 23 23 { 24 24 if (victim->mapid == this->player->character->mapid && !victim->nowhere) … … 40 40 } 41 41 42 case PACKET_LIST: // Opened friends list 42 43 case PACKET_REQUEST: // Requested a list of online players 43 44 { 45 int online = this->server->world->characters.size(); 46 47 UTIL_PTR_VECTOR_FOREACH(this->server->world->characters, Character, character) 48 { 49 if (character->hidden) 50 { 51 --online; 52 } 53 } 54 44 55 reply.SetID(0); 45 reply.AddChar( INIT_PLAYERS);46 reply.AddShort( this->server->world->characters.size());56 reply.AddChar(action == PACKET_LIST ? INIT_FRIEND_LIST_PLAYERS : INIT_PLAYERS); 57 reply.AddShort(online); 47 58 reply.AddByte(255); 48 59 UTIL_PTR_VECTOR_FOREACH(this->server->world->characters, Character, character) 49 60 { 61 if (character->hidden) 62 { 63 continue; 64 } 65 50 66 reply.AddBreakString(character->name); 51 67 reply.AddBreakString(character->title); -
eoserv/trunk/src/handlers/Talk.cpp
r182 r184 90 90 } 91 91 92 if (to )92 if (to && !to->hidden) 93 93 { 94 94 to->Msg(this->player->character, message); … … 134 134 { 135 135 this->server->world->Kick(this->player->character, victim, command[0] != 's'); 136 } 137 } 138 } 139 else if (command.length() >= 2 && command.compare(0,2,"bo") == 0 && this->player->character->admin >= static_cast<int>(this->server->world->admin_config["board"])) 140 { 141 short boardid = ((arguments.size() >= 1) ? util::to_int(arguments[0]) : static_cast<int>(this->server->world->config["AdminBoard"])) - 1; 142 143 if (boardid != static_cast<int>(this->server->world->config["AdminBoard"]) - 1 144 || this->player->character->admin >= static_cast<int>(this->server->world->admin_config["reports"])) 145 { 146 if (static_cast<std::size_t>(boardid) < this->server->world->boards.size()) 147 { 148 this->player->character->board = this->server->world->boards[boardid]; 149 this->player->character->ShowBoard(); 136 150 } 137 151 } … … 388 402 this->player->character->map->Effect(MAP_EFFECT_QUAKE, strength); 389 403 } 404 else if (command.length() >= 1 && command.compare(0,1,"h") == 0 && this->player->character->admin >= static_cast<int>(this->server->world->admin_config["hide"])) 405 { 406 if (this->player->character->hidden) 407 { 408 this->player->character->Unhide(); 409 } 410 else 411 { 412 this->player->character->Hide(); 413 } 414 } 390 415 } 391 416 else -
eoserv/trunk/src/handlers/Warp.cpp
r173 r184 98 98 reply.AddShort(this->server->world->eif->Get(character->paperdoll[Character::Weapon])->dollgraphic); 99 99 reply.AddChar(character->sitting); 100 reply.AddChar( 0); // visible100 reply.AddChar(character->hidden); 101 101 reply.AddByte(255); 102 102 } -
eoserv/trunk/src/handlers/Welcome.cpp
r182 r184 101 101 reply.AddChar(this->player->character->clas); 102 102 reply.AddString(this->player->character->PaddedGuildTag()); 103 // Tell a guardian's client they're a GM so they can use #nowall 104 reply.AddChar((this->player->character->admin == ADMIN_GUARDIAN) ? ADMIN_GM : this->player->character->admin); 103 104 // Tell a player's client they're a higher level admin than they are to enable some features 105 106 AdminLevel lowest_command = ADMIN_HGM; 107 108 UTIL_MAP_FOREACH_ALL(this->server->world->admin_config, std::string, util::variant, ac) 109 { 110 if (ac.first == "killnpc" 111 || ac.first == "reports") 112 { 113 continue; 114 } 115 116 lowest_command = std::min<AdminLevel>(lowest_command, static_cast<AdminLevel>(util::to_int(ac.second))); 117 } 118 119 if (this->player->character->admin >= static_cast<int>(this->server->world->admin_config["seehide"]) 120 && this->player->character->admin < ADMIN_HGM) 121 { 122 reply.AddChar(ADMIN_HGM); 123 } 124 else if (this->player->character->admin >= static_cast<int>(this->server->world->admin_config["nowall"]) 125 && this->player->character->admin < ADMIN_GM) 126 { 127 reply.AddChar(ADMIN_GM); 128 } 129 else if (this->player->character->admin >= lowest_command 130 && this->player->character->admin < ADMIN_GUIDE) 131 { 132 reply.AddChar(ADMIN_GUIDE); 133 } 134 else 135 { 136 reply.AddChar(this->player->character->admin); 137 } 138 105 139 reply.AddChar(this->player->character->level); 106 140 reply.AddInt(this->player->character->exp); … … 162 196 reply.AddShort(10); // ? 163 197 reply.AddShort(10); // ? 198 reply.AddShort(0); // Admin command flood rate 164 199 reply.AddShort(2); // ? 165 reply.AddShort(2); // ? 166 reply.AddChar(4); // ? 200 reply.AddChar(0); // Login warning message 167 201 reply.AddByte(255); 168 202 … … 317 351 reply.AddShort(this->server->world->eif->Get(character->paperdoll[Character::Weapon])->dollgraphic); 318 352 reply.AddChar(character->sitting); 319 reply.AddChar( 0); // visible353 reply.AddChar(character->hidden); 320 354 reply.AddByte(255); 321 355 } -
eoserv/trunk/src/main.cpp
r182 r184 310 310 eoserv_config_default(config, "BoardMaxPostLength" , 2048); 311 311 eoserv_config_default(config, "BoardDatePosts" , true); 312 eoserv_config_default(config, "AdminBoard" , 8); 313 eoserv_config_default(config, "AdminBoardLimit" , 100); 312 314 eoserv_config_default(config, "ShowLevel" , false); 313 315 eoserv_config_default(config, "WarpBubbles" , true); … … 384 386 eoserv_config_default(config, "JukeboxPrice" , 25); 385 387 eoserv_config_default(config, "JukeboxTimer" , 90); 388 eoserv_config_default(config, "RespawnBossChildren", true); 389 eoserv_config_default(config, "OldReports" , false); 386 390 eoserv_config_default(config, "DoorTimer" , 3.0); 387 391 eoserv_config_default(config, "ChatMaxWidth" , 1500); … … 415 419 eoserv_config_default(aconfig, "warptome" , 2); 416 420 eoserv_config_default(aconfig, "warpmeto" , 2); 421 eoserv_config_default(aconfig, "hide" , 2); 417 422 eoserv_config_default(aconfig, "evacuate" , 2); 418 423 eoserv_config_default(aconfig, "remap" , 4); 419 eoserv_config_default(aconfig, "repub" , 4);420 424 eoserv_config_default(aconfig, "arena" , 1); 425 eoserv_config_default(aconfig, "board" , 1); 421 426 eoserv_config_default(aconfig, "shutdown" , 4); 422 427 eoserv_config_default(aconfig, "rehash" , 4); 428 eoserv_config_default(aconfig, "repub" , 4); 423 429 eoserv_config_default(aconfig, "sitem" , 3); 424 430 eoserv_config_default(aconfig, "ditem" , 3); … … 453 459 eoserv_config_default(aconfig, "boardmod" , 1); 454 460 eoserv_config_default(aconfig, "reports" , 1); 461 eoserv_config_default(aconfig, "seehide" , 4); 455 462 456 463 Console::Styled[1] = Console::Styled[0] = config["StyleConsole"]; -
eoserv/trunk/src/map.cpp
r182 r184 619 619 builder.AddShort(this->world->eif->Get(character->paperdoll[Character::Weapon])->dollgraphic); 620 620 builder.AddChar(character->sitting); 621 builder.AddChar( 0); // visible621 builder.AddChar(character->hidden); 622 622 builder.AddChar(animation); 623 623 builder.AddByte(255); … … 688 688 PacketBuilder builder; 689 689 int seedistance = this->world->config["SeeDistance"]; 690 691 // TODO: Check for open/closed doors692 690 693 691 unsigned char target_x = from->x; … … 933 931 builder.AddShort(this->world->eif->Get(from->paperdoll[Character::Weapon])->dollgraphic); 934 932 builder.AddChar(from->sitting); 935 builder.AddChar( 0); // visible933 builder.AddChar(from->hidden); 936 934 builder.AddByte(255); 937 935 builder.AddChar(1); // 0 = NPC, 1 = player … … 970 968 rbuilder.AddShort(this->world->eif->Get(character->paperdoll[Character::Weapon])->dollgraphic); 971 969 rbuilder.AddChar(character->sitting); 972 rbuilder.AddChar( 0); // visible970 rbuilder.AddChar(character->hidden); 973 971 rbuilder.AddByte(255); 974 972 rbuilder.AddChar(1); // 0 = NPC, 1 = player … … 1629 1627 close->y = y; 1630 1628 1631 TimeEvent *event = new TimeEvent(map_close_door, close, this->world->config["DoorTimer"], 1); // TODO: Make this a config variable1629 TimeEvent *event = new TimeEvent(map_close_door, close, this->world->config["DoorTimer"], 1); 1632 1630 this->world->timer.Register(event); 1633 1631 event->Release(); -
eoserv/trunk/src/npc.cpp
r183 r184 59 59 } 60 60 61 this->parent = 0; 62 61 63 this->LoadShopDrop(); 62 64 } … … 182 184 if (npc->Data()->child) 183 185 { 184 npc->Spawn(*npc); 185 } 186 } 187 } 188 189 this->parent = parent; 186 npc->Spawn(this); 187 } 188 } 189 } 190 191 if (parent) 192 { 193 this->parent = parent; 194 } 190 195 191 196 if (this->spawn_type < 7) … … 311 316 continue; 312 317 } 313 314 int distance = util::path_length(opponent->attacker->x, opponent->attacker->y, parent->x, parent->y); 318 int distance = util::path_length(opponent->attacker->x, opponent->attacker->y, this->x, this->y); 315 319 316 320 if ((distance < attacker_distance) || (distance == attacker_distance && opponent->damage > attacker_damage)) … … 760 764 this->totaldamage = 0; 761 765 766 short childid = -1; 767 762 768 if (this->Data()->boss) 763 769 { … … 766 772 if (npc->Data()->child && !npc->Data()->boss) 767 773 { 768 npc->Die(); 774 if (childid == -1 || childid == npc->Data()->id) 775 { 776 npc->Die(false); 777 childid = npc->Data()->id; 778 } 779 else 780 { 781 npc->Die(true); 782 } 769 783 } 784 } 785 } 786 787 if (childid != -1) 788 { 789 PacketBuilder builder(PACKET_NPC, PACKET_JUNK); 790 builder.AddShort(childid); 791 792 UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character) 793 { 794 character->player->client->SendBuilder(builder); 770 795 } 771 796 } … … 814 839 } 815 840 816 void NPC::Die( )841 void NPC::Die(bool show) 817 842 { 818 843 this->alive = false; 819 844 this->dead_since = int(Timer::GetTime()); 820 845 821 PacketBuilder builder(PACKET_NPC, PACKET_SPEC); 822 builder.AddShort(0); // killer pid 823 builder.AddChar(0); // killer direction 824 builder.AddShort(this->index); 825 builder.AddShort(0); // dropped item uid 826 builder.AddShort(0); // dropped item id 827 builder.AddChar(this->x); 828 builder.AddChar(this->y); 829 builder.AddInt(0); // dropped item amount 830 builder.AddThree(this->hp); // damage 831 832 UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character) 833 { 834 if (character->InRange(this)) 835 { 836 character->player->client->SendBuilder(builder); 846 UTIL_PTR_LIST_FOREACH(this->damagelist, NPC_Opponent, opponent) 847 { 848 erase_first(opponent->attacker->unregister_npc, this); 849 } 850 851 this->damagelist.clear(); 852 this->totaldamage = 0; 853 854 if (show) 855 { 856 PacketBuilder builder(PACKET_NPC, PACKET_SPEC); 857 builder.AddShort(0); // killer pid 858 builder.AddChar(0); // killer direction 859 builder.AddShort(this->index); 860 builder.AddShort(0); // dropped item uid 861 builder.AddShort(0); // dropped item id 862 builder.AddChar(this->x); 863 builder.AddChar(this->y); 864 builder.AddInt(0); // dropped item amount 865 builder.AddThree(this->hp); // damage 866 867 UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character) 868 { 869 if (character->InRange(this)) 870 { 871 character->player->client->SendBuilder(builder); 872 } 837 873 } 838 874 } -
eoserv/trunk/src/npc.hpp
r182 r184 133 133 void Damage(Character *from, int amount); 134 134 void RemoveFromView(Character *target); 135 void Die( );135 void Die(bool show = true); 136 136 137 137 void Attack(Character *target); … … 177 177 SCRIPT_REGISTER_FUNCTION("void Damage(Character @, int)", Damage); 178 178 SCRIPT_REGISTER_FUNCTION("void RemoveFromView(Character @)", RemoveFromView); 179 SCRIPT_REGISTER_FUNCTION("void Die( )", Die);179 SCRIPT_REGISTER_FUNCTION("void Die(bool show)", Die); 180 180 SCRIPT_REGISTER_FUNCTION("void Attack(Character @)", Attack); 181 181 SCRIPT_REGISTER_END() -
eoserv/trunk/src/world.cpp
r182 r184 35 35 UTIL_PTR_VECTOR_FOREACH(map->npcs, NPC, npc) 36 36 { 37 if (!npc->alive && npc->dead_since + (double(npc->spawn_time) * spawnrate) < current_time && !npc->Data()->child) 37 if ((!npc->alive && npc->dead_since + (double(npc->spawn_time) * spawnrate) < current_time) 38 && (!npc->Data()->child || (npc->parent && npc->parent->alive && world->config["RespawnBossChildren"]))) 38 39 { 39 40 #ifdef DEBUG … … 372 373 } 373 374 375 void World::AdminReport(Character *from, std::string reportee, std::string message) 376 { 377 message = util::text_cap(message, static_cast<int>(this->config["ChatMaxWidth"]) - util::text_width(util::ucfirst(from->name) + " reports: " + reportee + ", ")); 378 379 PacketBuilder builder(PACKET_ADMININTERACT, PACKET_REPLY); 380 builder.AddChar(2); // message type 381 builder.AddByte(255); 382 builder.AddBreakString(from->name); 383 builder.AddBreakString(message); 384 builder.AddBreakString(reportee); 385 386 UTIL_PTR_VECTOR_FOREACH(this->characters, Character, character) 387 { 388 if (character->admin >= static_cast<int>(this->admin_config["reports"])) 389 { 390 character->player->client->SendBuilder(builder); 391 } 392 } 393 394 short boardid = static_cast<int>(this->server->world->config["AdminBoard"]) - 1; 395 396 if (static_cast<std::size_t>(boardid) < this->server->world->boards.size()) 397 { 398 Board *admin_board = this->server->world->boards[boardid]; 399 400 Board_Post *newpost = new Board_Post; 401 newpost->id = ++admin_board->last_id; 402 newpost->author = from->name; 403 newpost->author_admin = from->admin; 404 newpost->subject = std::string(" [Report] ") + util::ucfirst(from->name) + " reports: " + reportee; 405 newpost->body = message; 406 newpost->time = Timer::GetTime(); 407 408 admin_board->posts.push_front(newpost); 409 410 if (admin_board->posts.size() > static_cast<std::size_t>(static_cast<int>(this->server->world->config["AdminBoardLimit"]))) 411 { 412 admin_board->posts.pop_back(); 413 } 414 } 415 } 416 417 void World::AdminRequest(Character *from, std::string message) 418 { 419 message = util::text_cap(message, static_cast<int>(this->config["ChatMaxWidth"]) - util::text_width(util::ucfirst(from->name) + " needs help: ")); 420 421 PacketBuilder builder(PACKET_ADMININTERACT, PACKET_REPLY); 422 builder.AddChar(1); // message type 423 builder.AddByte(255); 424 builder.AddBreakString(from->name); 425 builder.AddBreakString(message); 426 427 UTIL_PTR_VECTOR_FOREACH(this->characters, Character, character) 428 { 429 if (character->admin >= static_cast<int>(this->admin_config["reports"])) 430 { 431 character->player->client->SendBuilder(builder); 432 } 433 } 434 435 short boardid = static_cast<int>(this->server->world->config["AdminBoard"]) - 1; 436 437 if (static_cast<std::size_t>(boardid) < this->server->world->boards.size()) 438 { 439 Board *admin_board = this->server->world->boards[boardid]; 440 441 Board_Post *newpost = new Board_Post; 442 newpost->id = ++admin_board->last_id; 443 newpost->author = from->name; 444 newpost->author_admin = from->admin; 445 newpost->subject = std::string(" [Request] ") + util::ucfirst(from->name) + " needs help"; 446 newpost->body = message; 447 newpost->time = Timer::GetTime(); 448 449 admin_board->posts.push_front(newpost); 450 451 if (admin_board->posts.size() > static_cast<std::size_t>(static_cast<int>(this->server->world->config["AdminBoardLimit"]))) 452 { 453 admin_board->posts.pop_back(); 454 } 455 } 456 } 457 374 458 void World::Rehash() 375 459 { -
eoserv/trunk/src/world.hpp
r182 r184 104 104 void AnnounceMsg(Character *from, std::string message, bool echo = true); 105 105 void ServerMsg(std::string message); 106 void AdminReport(Character *from, std::string reportee, std::string message); 107 void AdminRequest(Character *from, std::string message); 106 108 107 109 void Reboot(); … … 164 166 SCRIPT_REGISTER_FUNCTION("void AnnounceMsg(Character @, string, bool echo)", AnnounceMsg); 165 167 SCRIPT_REGISTER_FUNCTION("void ServerMsg(string)", ServerMsg); 168 SCRIPT_REGISTER_FUNCTION("void AdminReport(Character @, string reportee, string message)", AdminReport); 169 SCRIPT_REGISTER_FUNCTION("void AdminRequest(Character @, string message)", AdminRequest); 166 170 //SCRIPT_REGISTER_FUNCTION_PR("void Reboot()", Reboot, (), void); 167 171 //SCRIPT_REGISTER_FUNCTION_PR("void Reboot(int, string)", Reboot, (int, std::string), void);
