#RequireContext CMapEditorPlugin /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /* Grand2020 by */ /* jovenium */ /* based on Grand2 by LeGask and Reaby */ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #Include "TextLib" as TextLib #Include "MathLib" as MathLib #Include "TimeLib" as TiL #Include "MapUnits" as MapUnits //#Setting S_HOSTNAME "http://localhost:8080" #Setting S_HOSTNAME "https://grand2020.jovenium.net" #Struct JsonBlock { Text Modif; Int3 Coord; Text ModelName; Integer Direction; Text login; Integer role; Integer Color; Integer Timestamp; Boolean ForcePlace; Boolean GhostMode; } #Struct JsonBlockList { JsonBlock[] JsonBlocks; Text token; } #Struct SClassicBlock { Int3 Coord; CMapEditorPlugin::CardinalDirections Dir; Text Name; Text Url; } #Struct SGhostBlock { Int3 Coord; CMapEditorPlugin::CardinalDirections Dir; Text Name; } #Const Version "v0.1.3" #Const ScriptName "Grand2020.Script.txt" #Const C_AllowedPlaceMode [ CMapEditorPlugin::PlaceMode::Block, CMapEditorPlugin::PlaceMode::Unknown, CMapEditorPlugin::PlaceMode::Skin, CMapEditorPlugin::PlaceMode::Test, CMapEditorPlugin::PlaceMode::Plugin ] declare Text HOST; declare Int3 SelectionStartCoord; declare Int3 SelectionEndCoord; declare Integer G_TimeLastModif; declare JsonBlockList G_ListModif; declare Boolean ListenerRequestUp; declare Integer G_TimeListenerClosed; declare Text G_Token; declare Text G_LobbyId; declare Integer G_IsAdmin; //layers declare CUILayer UIModalStartOrQuit; declare CUILayer UIMainModal; declare CUILayer UIServerSettings; declare CUILayer UIParameter;//icon + parameter modal declare CUILayer UIChat;//icon + t input + chat modal declare CUILayer UIDebugView;//debug modal declare CUILayer UIChatPopup;//messagePopup declare CUILayer UIUpdateModal; Void HttpGet(Text _address) { Http.CreateGet(_address, False); } CHttpRequest HttpPost(Text _address, Text[Text] _params) { declare content = ""; foreach (Key => Param in _params) { content = """{"data" : {{{Param}}} }"""; } declare len = TextLib::Length(content)-1; declare req = Http.CreatePost(_address, content,"Content-Type: application/json"); return req; } Text getUpdateModalManialink() { return """