Commit Graph

52 Commits (947b3f76be9fbd6986e8a78c799e8304bf055125)

Author SHA1 Message Date
David Cernat 947b3f76be [Server] Replace Player's isMale() and setIsMale() with gender property
For simplicity and clarity.
7 years ago
David Cernat a3e2ab4d4e [Server] Send correct packet for inventory changes 7 years ago
David Cernat 4cc0216e0a [Server] Send cell changes before position changes, and prioritize both
Previously, a script changing a player's cell and position at the same time would end up sending a position packet first and then a cell change packet that overrode the former, with the player ending up at the center of the destination cell instead of at the correct position.
7 years ago
David Cernat 80be664139 [Server] Fix skill-related script functions
Add getSkillIncrease() and setSkillIncrease() script functions to get and set the attribute bonuses received at the next level up as a result of skill increases.

Previously, getSkill() and setSkill() attempted to return and set the attribute bonuses, respectively. However, they mistakenly used a skill ID as a parameter for the attribute bonuses, when in fact npcStats.mSkillIncrease is an integer array of size 8 where the key stands for an attribute's ID. As a result, setSkill() had the unexpected side effect of messing up a player's major and minor skills because of the invalid values it was setting for npcStats.mSkillIncreases.
7 years ago
David Cernat 57a0415ba3 [Server] Send level packets in Player's update() at the appropriate time
Previously, trying to send a level packet after base info and character class packets in a script actually led to the level packet being sent first and then being overridden by the others, with the player ending up at level 1 on their client.
7 years ago
David Cernat 494b10b97e [Server] Send player packets in a more appropriate order
Previously, the fact that a character class packet got sent after a dynamic stats packet caused the dynamic stats to get overridden on the client by the class change.
7 years ago
David Cernat 1272b03f25 [Server] Fix typo in player script function 7 years ago
David Cernat 926106cf8c [General] Rework CharGen slightly for clarity purposes
Previously, charGenStage.end was doing double duty as both the variable indicating the number of CharGen stages and – when set to 0 – the variable indicating that CharGen was over. The latter role is now filled by a new boolean.
7 years ago
Koncord dffd3bfa7d [Server] Add customData to Player
example:
counter = 0

Event.register(Events.ON_PLAYER_CONNECT, function(player)
    player.customData.counter = counter
    counter = counter + 1
    return true
end)

CommandController.registerCommand("test", function(player, args)
    player:message(player.customData.counter, false)
    return true
end, "")
7 years ago
David Cernat bbac26294f [Server] Fix typos and make all files end with newlines 7 years ago
Koncord 2d0840cb3a [General] Modernize Script API
This commit changes the style of tes3mp serverside scripting mods. Short list of changes:
* Break compatibility with old server mods
* OOP style lua API
* Basic dependency checker, allowing the installation of multiple server mods without changing configs
* Remove support for C++ plugins
* Change outdated LuaBridge to [sol2](https://github.com/ThePhD/sol2);
* Support GCC, Clang and MSVC compilers
* New environment variables: "TES3MP_SERVER_DIR" and "TES3MP_SERVER_USERDIR";
* New entity "Command controller" for registering new chat commands;
* New Event system
* Simplified Timer API
* All Lua mods now run in their own environments
* Add global namespace - Data that can be used for communicating between mods
* Player and Actor inherit base class NetActor
7 years ago
David Cernat d543edbd9a [Server] Make sure players are initialized as non-werewolves 8 years ago
David Cernat 3c30801eac [Server] Try to fix server crash from iterations through invalid players 8 years ago
David Cernat 4d81455020 [General] Rework and simplify death reasons so they work with NPCs 8 years ago
David Cernat c6c0e4acc9 [Server] Fix Cell::sendToLoaded() part 2, and fix Player::sendToLoaded() 8 years ago
Koncord 690211ad99 [General] Extract BaseEvent & BasePlayer from packets to functions
Move Send and Read functions to BasePacket
8 years ago
Koncord 0442ebd607 [Server] Remove redundant newlines & keep ~120 columns 8 years ago
David Cernat 0baada0aa2 [Server] Add GetLastPlayerId() script function in Miscellaneous category 8 years ago
Koncord 78f5a760f4 [Server] Use variable instead method in Player. 8 years ago
Koncord ec4d016100 [Server] Don't crash server every time a player disconnects. Again. 8 years ago
David Cernat 887b436ee7 [Server] Make style for new methods consistent with rest of project 8 years ago
Koncord 67099e437a [Server] Remove player from Cells when disconnected 8 years ago
Koncord f2ce46ffed [Server] Rename doForNearest to forEachLoaded 8 years ago
Koncord ca68831395 [Server] Rename sendToNearest to sendToLoaded 8 years ago
Koncord cce49e355a [Server] Some fixes to sendToNearest & doForNearest 8 years ago
Koncord 033472d939 [Server] Add doForNearest function 8 years ago
Koncord b760015071 [Server] Send some packets only to nearest players 8 years ago
Koncord 8887a267c7 [Server] Add Cell and CellController 8 years ago
David Cernat 63c8a98083 [General] Stop using virtual functions in BasePlayer 8 years ago
Koncord 32615d05cf Prevent allocate memory if player doesn't exists 8 years ago
Koncord 6e6237541a Fix "comparison between signed and unsigned integer expressions" 8 years ago
David Cernat 9e290ad799 Fix spacing irregularities 8 years ago
Koncord 902e968fd9 Use RakNetGUID instead uint64_t in TPlayers 8 years ago
David Cernat 1a25434d33 Turn overlooked instance of GetCell() into getCell() 8 years ago
David Cernat 25dc2b19e7 Use lowerCamelCase in tes3mp server networking function names 8 years ago
David Cernat eebe1f156a Change logic for death reasons so it makes sense 8 years ago
David Cernat 6929cd6c4c Delete debug about player map that is no longer needed 8 years ago
David Cernat c91e240664 Simplify the type of map that player objects are stored in 8 years ago
David Cernat a9f6ea4d8d Use the name "guid" for RakNet IDs so as to not confuse with int IDs 8 years ago
David Cernat ef6f20e3f7 In server console, print number of players remaining when one leaves 8 years ago
David Cernat b2688777c1 Create marker once a player has been initialized properly and fix debug 8 years ago
Koncord 79532cf797 Detecting reason of death 8 years ago
David Cernat bc0aa86bcf Make variable names more consistent and easier to understand 8 years ago
Koncord 24617589e4 Fix packet spam 8 years ago
Koncord fe10821528 Add loaded/isLoaded to server player 8 years ago
David Cernat 941d76fce0 Fix setting of default classes and initialize classes safely on server 8 years ago
David Cernat c4f49e05e3 Remove manual newlines for logger 9 years ago
Koncord d3c9864fb0 Fix maximum connections 9 years ago
David Cernat e1955b440f Fix player initialization on server 9 years ago
David Cernat cba01af683 Log player initialization on server 9 years ago