Advertisement
Klee_from_Space

Untitled

Oct 8th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 15.42 KB | None | 0 0
  1. ______________________________________________________________________________functions.cs
  2.  
  3. //Fact Window
  4.  
  5. package RoleplayClient
  6. {
  7. function setGuiPanel(%this, %panel) {
  8.   CharacterCreation_FactCharacterCreator.visible = false;
  9.   CharacterCreation_FactCharacterEditor.visible = false;
  10.  
  11.   %panelObj = ("CharacterCreation_" @ %panel @ "Panel");
  12.  
  13.   if (isObject(%panelObj)) {
  14.     %panelObj.visible = true;
  15.   }
  16. } //turn off things
  17.  
  18.  
  19. //Character things
  20.  
  21. function addnewCharacter() //add a new char to roster and save it
  22. {
  23.     %name = CharacterCreation_newnamebox.getvalue();
  24.     %desc = CharacterCreation_newdescbox.getvalue();
  25.     CharacterCreation_Roster.insertAfter(%rowcount, %name); //puts char on roster after the last one made
  26.     $Client::RPMod::Name[%client.getBLID()] = %name; export("$Client::RPMod::Name*", "config/Client/RPData.cs");
  27.     $Client::RPMod::Desc[%client.getBLID()] = %desc; export("$Client::RPMod::Desc*", "config/Client/RPData.cs"); //basically just saving the info so it doesnt get lost
  28.     CharacterCreation_FactCharacterCreator.visible = false;
  29. }
  30.  
  31. function EditCharacter() //load a character u wanna edit
  32. {
  33.     CharacterCreation_EditButton.visible = false;
  34.     %name = CharacterCreation_Roster.getSelectedRow.getValue(); //might not work lol
  35.     CharacterCreation_EditName.setValue(%name);
  36.    
  37.     %desc = $Pref::Client::Desc[%name]; //Reminder to save this way too
  38.     CharacterCreation_EditDesc.setvalue(%desc);
  39. }
  40.  
  41. function SaveEdited() //save a character u edited
  42. {
  43.     %name = CharacterCreation_EditName.getvalue();
  44.     %desc = CharacterCreation_EditDesc.getvalue();
  45.    
  46.     $Client::RPMod::Desc[%name] = %desc; export("$Client::RPMod::Name*", "config/client/RPData.cs");
  47.     $Client::RPMod::Name[%name] = %name; export("$Client::RPMod::Desc*", "config/client/RPData.cs");
  48.     CharacterCreation_EditButton.visible = true;
  49.     CharacterCreation_FactCharacterEditor.visible = false;
  50. }
  51.  
  52. function Loadchar() //load a selected character
  53. {
  54.     %name = CharacterCreation_Roster.getSelectedRow.getValue();
  55.     %desc = $Pref::Client::Desc[%name];
  56.     serverCmdSetRPChar(%name, %desc);
  57.    
  58.     $Client::RPMod::Last[%client.getBLID] = %name; export("$Client::RPMod::Last*", "config/Client/RPData.cs"); //save previously loaded char
  59. }
  60.  
  61. function LoadPrev() //load last used character
  62. {
  63.     %name = $Client::RPMod::Last[%client.getBLID];
  64.     %desc = $Client::RPMod::Desc[%name];
  65.     serverCmdSetRPChar(%name, %desc);
  66. }
  67.  
  68.  
  69.  
  70.  
  71. //Roster stuff
  72.  
  73. function GuiTextListCtrl::insertAfter(%this, %index, %value) {
  74.   %count = %this.rowCount();
  75.  
  76.   if (%index >= %count - 1) {
  77.     %this.addRow(%count, %value);
  78.   }
  79.   else {
  80.     %index++;
  81.     %previousRow = %this.getRowText(%index);
  82.  
  83.     for (%i = %index; %i < %count; %i++) {
  84.       if (%i == %index) {
  85.         %this.setRow(%i, %value);
  86.       }
  87.       else {
  88.         %currentRow = %this.getRowText(%i);
  89.         %this.setRow(%i, %previousRow);
  90.  
  91.         %previousRow = %currentRow;
  92.       }
  93.     }
  94.  
  95.     %this.addRow(%count, %previousRow);
  96.   }
  97. }
  98.  
  99.  
  100. function GuiTextListCtrl::getSelectedRow(%this) {
  101.   %id = %this.getSelectedId();
  102.   return %this.getRowNumById(%id);
  103. }
  104.  
  105.  
  106. function GuiTextListCtrl::setRow(%this, %index, %value) {
  107.   %id = %this.getRowId(%index);
  108.  
  109.   if (%id == -1) {
  110.     %this.addRow(%this.rowCount(), %value);
  111.   }
  112.   else {
  113.     %this.setRowById(%id, %value);
  114.   }
  115. }
  116. }; //end of package
  117.  
  118. activatePackage(RoleplayClient);
  119.  
  120.  
  121.  
  122.  
  123. _______________________________________________________________________________________________GUI FILE
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. //--- OBJECT WRITE BEGIN ---
  132. new GuiControl(CharacterCreation) {
  133.    profile = "GuiDefaultProfile";
  134.    horizSizing = "right";
  135.    vertSizing = "bottom";
  136.    position = "0 0";
  137.    extent = "1024 640";
  138.    minExtent = "8 2";
  139.    enabled = "1";
  140.    visible = "1";
  141.    clipToParent = "1";
  142.  
  143.    new GuiWindowCtrl(Fact) {
  144.       profile = "GuiWindowProfile";
  145.       horizSizing = "right";
  146.       vertSizing = "bottom";
  147.       position = "181 180";
  148.       extent = "534 311";
  149.       minExtent = "8 2";
  150.       enabled = "1";
  151.       visible = "1";
  152.       clipToParent = "1";
  153.       text = "Fact";
  154.       maxLength = "255";
  155.       resizeWidth = "1";
  156.       resizeHeight = "1";
  157.       canMove = "1";
  158.       canClose = "1";
  159.       canMinimize = "1";
  160.       canMaximize = "1";
  161.       minSize = "50 50";
  162.  
  163.       new GuiControl(FactCharMenu) {
  164.          profile = "GuiDefaultProfile";
  165.          horizSizing = "right";
  166.          vertSizing = "bottom";
  167.          position = "5 24";
  168.          extent = "523 281";
  169.          minExtent = "8 2";
  170.          enabled = "1";
  171.          visible = "1";
  172.          clipToParent = "1";
  173.  
  174.          new GuiControl(FactCharacterCreator) {
  175.             profile = "GuiDefaultProfile";
  176.             horizSizing = "right";
  177.             vertSizing = "bottom";
  178.             position = "17 60";
  179.             extent = "283 207";
  180.             minExtent = "8 2";
  181.             enabled = "1";
  182.             visible = "0";
  183.             clipToParent = "1";
  184.  
  185.             new GuiTextEditCtrl(newnamebox) {
  186.                profile = "GuiTextEditProfile";
  187.                horizSizing = "right";
  188.                vertSizing = "bottom";
  189.                position = "83 19";
  190.                extent = "165 21";
  191.                minExtent = "165 21";
  192.                enabled = "1";
  193.                visible = "1";
  194.                clipToParent = "1";
  195.                maxLength = "255";
  196.                historySize = "0";
  197.                password = "0";
  198.                tabComplete = "0";
  199.                sinkAllKeyEvents = "0";
  200.             };
  201.             new GuiTextCtrl() {
  202.                profile = "GuiMediumTextProfile";
  203.                horizSizing = "right";
  204.                vertSizing = "bottom";
  205.                position = "5 15";
  206.                extent = "60 28";
  207.                minExtent = "8 2";
  208.                enabled = "1";
  209.                visible = "1";
  210.                clipToParent = "1";
  211.                text = "Name:";
  212.                maxLength = "255";
  213.             };
  214.             new GuiTextCtrl() {
  215.                profile = "GuiMediumTextProfile";
  216.                horizSizing = "right";
  217.                vertSizing = "bottom";
  218.                position = "5 65";
  219.                extent = "112 28";
  220.                minExtent = "8 2";
  221.                enabled = "1";
  222.                visible = "1";
  223.                clipToParent = "1";
  224.                text = "Description:";
  225.                maxLength = "255";
  226.             };
  227.             new GuiTextEditCtrl(newdescbox) {
  228.                profile = "GuiTextEditProfile";
  229.                horizSizing = "right";
  230.                vertSizing = "bottom";
  231.                position = "5 101";
  232.                extent = "256 62";
  233.                minExtent = "256 62";
  234.                enabled = "1";
  235.                visible = "1";
  236.                clipToParent = "1";
  237.                text = "This box is for PHYSICAL DETAIL only!";
  238.                maxLength = "255";
  239.                historySize = "0";
  240.                password = "0";
  241.                tabComplete = "0";
  242.                sinkAllKeyEvents = "0";
  243.             };
  244.             new GuiBitmapButtonCtrl() {
  245.                profile = "BlockButtonProfile";
  246.                horizSizing = "right";
  247.                vertSizing = "bottom";
  248.                position = "120 171";
  249.                extent = "140 30";
  250.                minExtent = "8 2";
  251.                enabled = "1";
  252.                visible = "1";
  253.                clipToParent = "1";
  254.                command = "addnewCharacter();";
  255.                text = "Save Attributes";
  256.                groupNum = "-1";
  257.                buttonType = "PushButton";
  258.                bitmap = "base/client/ui/button1";
  259.                lockAspectRatio = "0";
  260.                alignLeft = "0";
  261.                alignTop = "0";
  262.                overflowImage = "0";
  263.                mKeepCached = "0";
  264.                mColor = "255 255 255 255";
  265.             };
  266.          };
  267.          new GuiScrollCtrl() {
  268.             profile = "GuiScrollProfile";
  269.             horizSizing = "right";
  270.             vertSizing = "bottom";
  271.             position = "344 58";
  272.             extent = "154 200";
  273.             minExtent = "8 2";
  274.             enabled = "1";
  275.             visible = "1";
  276.             clipToParent = "1";
  277.             willFirstRespond = "0";
  278.             hScrollBar = "alwaysOn";
  279.             vScrollBar = "alwaysOn";
  280.             constantThumbHeight = "0";
  281.             childMargin = "0 0";
  282.             rowHeight = "40";
  283.             columnWidth = "30";
  284.  
  285.             new GuiTextListCtrl(Roster) {
  286.                profile = "GuiTextListProfile";
  287.                horizSizing = "right";
  288.                vertSizing = "bottom";
  289.                position = "1 1";
  290.                extent = "137 2";
  291.                minExtent = "8 2";
  292.                enabled = "1";
  293.                visible = "1";
  294.                clipToParent = "1";
  295.                enumerate = "0";
  296.                resizeCell = "1";
  297.                columns = "0";
  298.                fitParentWidth = "1";
  299.                clipColumnText = "0";
  300.             };
  301.          };
  302.          new GuiBitmapButtonCtrl() {
  303.             profile = "BlockButtonProfile";
  304.             horizSizing = "right";
  305.             vertSizing = "bottom";
  306.             position = "23 11";
  307.             extent = "139 40";
  308.             minExtent = "8 2";
  309.             enabled = "1";
  310.             visible = "1";
  311.             clipToParent = "1";
  312.             command = "setGuiPanel(\"FactCharacterCreator\");";
  313.             text = "Create New";
  314.             groupNum = "-1";
  315.             buttonType = "PushButton";
  316.             bitmap = "base/client/ui/button2";
  317.             lockAspectRatio = "0";
  318.             alignLeft = "0";
  319.             alignTop = "0";
  320.             overflowImage = "0";
  321.             mKeepCached = "0";
  322.             mColor = "255 255 128 255";
  323.          };
  324.          new GuiBitmapButtonCtrl() {
  325.             profile = "BlockButtonProfile";
  326.             horizSizing = "right";
  327.             vertSizing = "bottom";
  328.             position = "186 11";
  329.             extent = "139 40";
  330.             minExtent = "8 2";
  331.             enabled = "1";
  332.             visible = "1";
  333.             clipToParent = "1";
  334.             command = "LoadPrev();";
  335.             text = "Load Previous";
  336.             groupNum = "-1";
  337.             buttonType = "PushButton";
  338.             bitmap = "base/client/ui/button2";
  339.             lockAspectRatio = "0";
  340.             alignLeft = "0";
  341.             alignTop = "0";
  342.             overflowImage = "0";
  343.             mKeepCached = "0";
  344.             mColor = "124 233 241 255";
  345.          };
  346.          new GuiBitmapButtonCtrl() {
  347.             profile = "BlockButtonProfile";
  348.             horizSizing = "right";
  349.             vertSizing = "bottom";
  350.             position = "350 11";
  351.             extent = "139 40";
  352.             minExtent = "8 2";
  353.             enabled = "1";
  354.             visible = "1";
  355.             clipToParent = "1";
  356.             command = "Loadchar();";
  357.             text = "Load Character";
  358.             groupNum = "-1";
  359.             buttonType = "PushButton";
  360.             bitmap = "base/client/ui/button2";
  361.             lockAspectRatio = "0";
  362.             alignLeft = "0";
  363.             alignTop = "0";
  364.             overflowImage = "0";
  365.             mKeepCached = "0";
  366.             mColor = "138 255 128 255";
  367.          };
  368.          new GuiControl(FactCharacterEditor) {
  369.             profile = "GuiDefaultProfile";
  370.             horizSizing = "right";
  371.             vertSizing = "bottom";
  372.             position = "17 60";
  373.             extent = "283 207";
  374.             minExtent = "8 2";
  375.             enabled = "1";
  376.             visible = "0";
  377.             clipToParent = "1";
  378.  
  379.             new GuiTextEditCtrl() {
  380.                profile = "GuiTextEditProfile";
  381.                horizSizing = "right";
  382.                vertSizing = "bottom";
  383.                position = "83 19";
  384.                extent = "165 21";
  385.                minExtent = "165 21";
  386.                enabled = "1";
  387.                visible = "1";
  388.                clipToParent = "1";
  389.                command = "";
  390.                maxLength = "255";
  391.                historySize = "0";
  392.                password = "0";
  393.                tabComplete = "0";
  394.                sinkAllKeyEvents = "0";
  395.             };
  396.             new GuiTextCtrl() {
  397.                profile = "GuiMediumTextProfile";
  398.                horizSizing = "right";
  399.                vertSizing = "bottom";
  400.                position = "5 15";
  401.                extent = "60 28";
  402.                minExtent = "8 2";
  403.                enabled = "1";
  404.                visible = "1";
  405.                clipToParent = "1";
  406.                text = "Name:";
  407.                maxLength = "255";
  408.             };
  409.             new GuiTextCtrl() {
  410.                profile = "GuiMediumTextProfile";
  411.                horizSizing = "right";
  412.                vertSizing = "bottom";
  413.                position = "5 65";
  414.                extent = "112 28";
  415.                minExtent = "8 2";
  416.                enabled = "1";
  417.                visible = "1";
  418.                clipToParent = "1";
  419.                text = "Description:";
  420.                maxLength = "255";
  421.             };
  422.             new GuiTextEditCtrl() {
  423.                profile = "GuiTextEditProfile";
  424.                horizSizing = "right";
  425.                vertSizing = "bottom";
  426.                position = "5 101";
  427.                extent = "256 62";
  428.                minExtent = "256 62";
  429.                enabled = "1";
  430.                visible = "1";
  431.                clipToParent = "1";
  432.                command = "";
  433.                maxLength = "255";
  434.                historySize = "0";
  435.                password = "0";
  436.                tabComplete = "0";
  437.                sinkAllKeyEvents = "0";
  438.             };
  439.             new GuiBitmapButtonCtrl() {
  440.                profile = "BlockButtonProfile";
  441.                horizSizing = "right";
  442.                vertSizing = "bottom";
  443.                position = "120 171";
  444.                extent = "140 30";
  445.                minExtent = "8 2";
  446.                enabled = "1";
  447.                visible = "1";
  448.                clipToParent = "1";
  449.                command = "SaveEdited();";
  450.                text = "Save Attributes";
  451.                groupNum = "-1";
  452.                buttonType = "PushButton";
  453.                bitmap = "base/client/ui/button1";
  454.                lockAspectRatio = "0";
  455.                alignLeft = "0";
  456.                alignTop = "0";
  457.                overflowImage = "0";
  458.                mKeepCached = "0";
  459.                mColor = "255 255 255 255";
  460.             };
  461.          };
  462.          new GuiBitmapButtonCtrl(EditButton) {
  463.             profile = "BlockButtonProfile";
  464.             horizSizing = "right";
  465.             vertSizing = "bottom";
  466.             position = "186 73";
  467.             extent = "140 30";
  468.             minExtent = "8 2";
  469.             enabled = "1";
  470.             visible = "0";
  471.             clipToParent = "1";
  472.             command = "EditCharacter();";
  473.             text = "Edit Selected Char";
  474.             groupNum = "-1";
  475.             buttonType = "PushButton";
  476.             bitmap = "base/client/ui/button1";
  477.             lockAspectRatio = "0";
  478.             alignLeft = "0";
  479.             alignTop = "0";
  480.             overflowImage = "0";
  481.             mKeepCached = "0";
  482.             mColor = "255 255 255 255";
  483.          };
  484.       };
  485.    };
  486. };
  487. //--- OBJECT WRITE END ---
  488.  
  489. function pushcreategui(%Gui)
  490. {
  491.    %Gui = canvas.pushDialog(CharacterCreation);
  492. }
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499. ________________________________________________________________________________________Client.cs
  500.  
  501.  
  502. exec("./CharacterCreation.gui");
  503. exec("./functions.cs");
  504. moveMap.bind(keyboard, "g", pushcreategui);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement