Commit Graph

66 Commits (f35d35741e0989010d996f027e37b4d6731c1c1a)

Author SHA1 Message Date
Koncord 585c24cee8 [Server] Optimize CellController 7 years ago
Koncord ff8b5061b4 [Server] Modernize CellController singleton 7 years ago
David Cernat ad61d88cb1 [General] Fix typos and use consistent style for recent additions 7 years ago
Koncord 392e645fe5 [Server] Add isMarkedForDeleteion function 7 years ago
Koncord aa183e6844 [General] Introduce chat channels 7 years ago
David Cernat fc5e883160 [General] Rework PlayerStatsDynamic packets so they are of minimal size 7 years ago
David Cernat bd9e8bd10f [General] Simplify storing of attribute and skill index changes 7 years ago
David Cernat 901fe72471 [Server] Fix variable shadowing in Player 7 years ago
David Cernat a796f81444 [General] Add and use utility function for int value checks in vectors 7 years ago
Koncord 4ebfcc4a21 [Server] Limit handshake attempts 7 years ago
David Cernat b0965f094a [General] Rework PlayerAttribute packets so they are of minimal size
Previously, whenever a single attribute value changed for a player, that player then sent a PlayerAttribute packet with all values for all 8 attributes.

This did not cause anywhere as much packet spam as PlayerSkill used to, but there was no good reason not to fix it as well.
7 years ago
David Cernat ef79a98544 [General] Rework PlayerSkill packets so they are of minimal size
Previously, whenever a single skill value changed for a player, that player then sent a PlayerSkill packet with all values for all 27 skills, plus the player's progress towards the next level and the bonuses to each attribute on the next level up as the result of sklll increases thus far.

This commit makes PlayerSkill contain only the values of specific skills, moves the player's progress towards the next level to PlayerLevel packets, and moves the bonuses to each attribute on the next level up to PlayerAttribute packets.

Players now also send a PlayerSkill packet whenever their progress towards a new point in a skill changes. This was previously avoided so as to not have massive packet spam.
7 years ago
David Cernat 07d75abdf8 [Server] Use consistent order for includes 7 years ago
David Cernat 010a80ceca [Server] Place getters and setters in consistent order 7 years ago
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