Changeset 345


Ignore:
Timestamp:
Jan 5, 2019, 3:21:40 PM (6 years ago)
Author:
alloc
Message:

Player storing fixes, webmap inventory layout fix

Location:
binary-improvements
Files:
4 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj

    r330 r345  
    3939    <DefineConstants>ENABLE_PROFILER</DefineConstants>
    4040    <Optimize>true</Optimize>
     41    <WarningLevel>4</WarningLevel>
    4142  </PropertyGroup>
    4243  <ItemGroup>
     
    7677  <ItemGroup>
    7778    <Compile Include="src\AssemblyInfo.cs" />
    78     <Compile Include="src\AllocsLogFunctions.cs" />
    7979    <Compile Include="src\LiveData\Animals.cs" />
    8080    <Compile Include="src\LiveData\Hostiles.cs" />
    81     <Compile Include="src\PlayerDataStuff.cs" />
    8281    <Compile Include="src\PersistentData\PersistentContainer.cs" />
    83     <Compile Include="src\StateManager.cs" />
    8482    <Compile Include="src\PersistentData\InvItem.cs" />
    8583    <Compile Include="src\PersistentData\Inventory.cs" />
     
    10199    <Compile Include="src\FileCache\MapTileCache.cs" />
    102100    <Compile Include="src\API.cs" />
    103     <Compile Include="src\ChatHookExample.cs" />
    104101    <Compile Include="src\AllocsUtils.cs" />
    105102    <Compile Include="src\LandClaimList.cs" />
  • binary-improvements/7dtd-server-fixes/ModInfo.xml

    r341 r345  
    55                <Description value="Common functions" />
    66                <Author value="Christian 'Alloc' Illy" />
    7                 <Version value="20" />
     7                <Version value="21" />
    88                <Website value="http://7dtd.illy.bz" />
    99        </ModInfo>
  • binary-improvements/7dtd-server-fixes/src/API.cs

    r337 r345  
    11using System.Collections.Generic;
     2using AllocsFixes.PersistentData;
     3using System;
    24
    35namespace AllocsFixes {
     
    911                        ModEvents.PlayerSpawning.RegisterHandler (PlayerSpawning);
    1012                        ModEvents.PlayerDisconnected.RegisterHandler (PlayerDisconnected);
     13                        ModEvents.PlayerSpawnedInWorld.RegisterHandler (PlayerSpawned);
    1114                        ModEvents.ChatMessage.RegisterHandler (ChatMessage);
    1215                }
    1316
    1417                public void GameAwake () {
    15                         StateManager.Awake ();
     18                        try {
     19                                PersistentContainer.Load ();
     20                        } catch (Exception e) {
     21                                Log.Out ("Error in StateManager.Awake: " + e);
     22                        }
    1623                }
    1724
    1825                public void GameShutdown () {
    19                         StateManager.Shutdown ();
     26                        try {
     27                                Log.Out ("Server shutting down!");
     28                                PersistentContainer.Instance.Save ();
     29                        } catch (Exception e) {
     30                                Log.Out ("Error in StateManager.Shutdown: " + e);
     31                        }
    2032                }
    2133
    2234                public void SavePlayerData (ClientInfo _cInfo, PlayerDataFile _playerDataFile) {
    23                         PlayerDataStuff.GM_SavePlayerData (_cInfo, _playerDataFile);
     35                        try {
     36                                PersistentContainer.Instance.Players [_cInfo.playerId, true].Update (_playerDataFile);
     37                        } catch (Exception e) {
     38                                Log.Out ("Error in GM_SavePlayerData: " + e);
     39                        }
    2440                }
    2541
    2642                public void PlayerSpawning (ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile) {
    27                         AllocsLogFunctions.RequestToSpawnPlayer (_cInfo, _chunkViewDim, _playerProfile);
     43                        try {
     44                                Log.Out ("Player connected" +
     45                                        ", entityid=" + _cInfo.entityId +
     46                                        ", name=" + _cInfo.playerName +
     47                                        ", steamid=" + _cInfo.playerId +
     48                                        ", steamOwner=" + _cInfo.ownerId +
     49                                        ", ip=" + _cInfo.ip
     50                                );
     51                        } catch (Exception e) {
     52                                Log.Out ("Error in AllocsLogFunctions.RequestToSpawnPlayer: " + e);
     53                        }
    2854                }
    2955
    3056                public void PlayerDisconnected (ClientInfo _cInfo, bool _bShutdown) {
    31                         AllocsLogFunctions.PlayerDisconnected (_cInfo, _bShutdown);
     57                        try {
     58                                Player p = PersistentContainer.Instance.Players [_cInfo.playerId, false];
     59                                if (p != null) {
     60                                        p.SetOffline ();
     61                                } else {
     62                                        Log.Out ("Disconnected player not found in client list...");
     63                                }
     64
     65                                PersistentContainer.Instance.Save ();
     66                        } catch (Exception e) {
     67                                Log.Out ("Error in AllocsLogFunctions.PlayerDisconnected: " + e);
     68                        }
    3269                }
     70
     71                public void PlayerSpawned (ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _spawnPos) {
     72                        try {
     73                                PersistentContainer.Instance.Players [_cInfo.playerId, true].SetOnline (_cInfo);
     74                                PersistentContainer.Instance.Save ();
     75                        } catch (Exception e) {
     76                                Log.Out ("Error in AllocsLogFunctions.PlayerSpawnedInWorld: " + e);
     77                        }
     78                }
     79
     80                private const string ANSWER =
     81                        "     [ff0000]I[-] [ff7f00]W[-][ffff00]A[-][80ff00]S[-] [00ffff]H[-][0080ff]E[-][0000ff]R[-][8b00ff]E[-]";
    3382
    3483                public bool ChatMessage (ClientInfo _cInfo, EChatType _type, int _senderId, string _msg, string _mainName,
    3584                        bool _localizeMain, List<int> _recipientEntityIds) {
    36                         return ChatHookExample.Hook (_cInfo, _type, _msg, _mainName);
     85                        if (string.IsNullOrEmpty (_msg) || !_msg.EqualsCaseInsensitive ("/alloc")) {
     86                                return true;
     87                        }
     88
     89                        if (_cInfo != null) {
     90                                Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId);
     91                                _cInfo.SendPackage (new NetPackageChat (EChatType.Whisper, -1, ANSWER, "", false, null));
     92                        } else {
     93                                Log.Error ("ChatHookExample: Argument _cInfo null on message: {0}", _msg);
     94                        }
     95
     96                        return false;
    3797                }
    3898        }
  • binary-improvements/MapRendering/ModInfo.xml

    r341 r345  
    55                <Description value="Render the game map to image map tiles as it is uncovered" />
    66                <Author value="Christian 'Alloc' Illy" />
    7                 <Version value="30" />
     7                <Version value="31" />
    88                <Website value="http://7dtd.illy.bz" />
    99        </ModInfo>
  • binary-improvements/server-fixes.userprefs

    r322 r345  
    11<Properties>
    22  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release_Version" />
    3   <MonoDevelop.Ide.Workbench ActiveDocument="7dtd-server-fixes/src/PersistentData/Inventory.cs">
     3  <MonoDevelop.Ide.Workbench ActiveDocument="MapRendering/ModInfo.xml">
    44    <Files>
    5       <File FileName="7dtd-server-fixes/ModInfo.xml" Line="1" Column="1" />
    6       <File FileName="AllocsCommands/ModInfo.xml" Line="1" Column="1" />
    7       <File FileName="MapRendering/ModInfo.xml" Line="7" Column="20" />
    8       <File FileName="MapRendering/Web/Web.cs" Line="240" Column="24" />
     5      <File FileName="AllocsCommands/ModInfo.xml" Line="10" Column="7" />
     6      <File FileName="7dtd-server-fixes/ModInfo.xml" Line="7" Column="21" />
     7      <File FileName="MapRendering/ModInfo.xml" Line="7" Column="21" />
     8      <File FileName="MapRendering/Web/Web.cs" Line="1" Column="1" />
    99      <File FileName="MapRendering/Commands/WebTokens.cs" Line="1" Column="1" />
    1010      <File FileName="MapRendering/API.cs" Line="1" Column="1" />
     
    1212      <File FileName="MapRendering/Web/Handlers/ItemIconHandler.cs" Line="1" Column="1" />
    1313      <File FileName="AllocsCommands/Commands/ShowInventory.cs" Line="1" Column="1" />
    14       <File FileName="7dtd-server-fixes/src/PersistentData/Inventory.cs" Line="61" Column="41" />
     14      <File FileName="7dtd-server-fixes/src/PersistentData/Inventory.cs" Line="1" Column="1" />
    1515      <File FileName="7dtd-server-fixes/src/AllocsLogFunctions.cs" Line="1" Column="1" />
    1616      <File FileName="7dtd-server-fixes/src/PersistentData/PersistentContainer.cs" Line="1" Column="1" />
     
    2424      <File FileName="AllocsCommands/PrivateMessageConnections.cs" Line="1" Column="1" />
    2525      <File FileName="AllocsCommands/Chat.cs" Line="1" Column="1" />
    26       <File FileName="MapRendering/Web/WebCommandResult.cs" Line="1" Column="1" />
    2726      <File FileName="MapRendering/Web/API/GetPlayerList.cs" Line="1" Column="1" />
    28       <File FileName="MapRendering/Web/API/GetPlayersLocation.cs" Line="31" Column="5" />
    29       <File FileName="MapRendering/Web/OpenID.cs" Line="22" Column="9" />
    30       <File FileName="MapRendering/Web/Handlers/SessionHandler.cs" Line="1" Column="1" />
    31       <File FileName="MapRendering/Commands/EnableOpenIDDebug.cs" Line="33" Column="2" />
     27      <File FileName="MapRendering/Web/API/GetPlayerInventories.cs" Line="1" Column="1" />
     28      <File FileName="MapRendering/Web/API/GetLog.cs" Line="1" Column="1" />
     29      <File FileName="MapRendering/MapRendering/MapRendering.cs" Line="29" Column="14" />
     30      <File FileName="MapRendering/MapRendering/Constants.cs" Line="1" Column="1" />
    3231    </Files>
    3332  </MonoDevelop.Ide.Workbench>
  • binary-improvements/webserver/js/inventory_dialog.js

    r256 r345  
    11var ITEMICONBASEURL = "../itemicons/";
    22
    3 var BAG_COLS = 8;
    4 var BAG_ROWS = 4;
     3var BAG_COLS = 9;
     4var BAG_ROWS = 5;
    55var BELT_COLS = 8;
    66var INV_ITEM_WIDTH = 58;
Note: See TracChangeset for help on using the changeset viewer.