Browse Source

updates and rework structure in place

Saegusa 9 years ago
parent
commit
d2bc761051
2 changed files with 238 additions and 25 deletions
  1. 16 25
      README.md
  2. 222 0
      rework.js

+ 16 - 25
README.md

@@ -2,7 +2,12 @@
 
   Written for tera-proxy, a free script filled with features dedicated to improve your fps, in the open world and in dungeons.
 
-  **To support development and me:** I accept any amount of MWA as donations on the EU-Killian server (I have debts to pay off) Saegusa/Saegusa-chan or PM me on discord Saegusa#3195 thanks.
+  ~**To support development and me:**~ ~~I accept any amount of MWA as donations on the EU-Killian server (I have debts to pay off) Saegusa/Saegusa-chan or PM me on discord Saegusa#3195 thanks.~~
+
+  I now have a [patreon page](https://www.patreon.com/saegusa) where you can show your support, for reminder all my mods will remain 100% free and the free users will keep getting my mods and updates for free. Free.
+
+### ps.
+The commands list here is for the next update which will be FpsUtils3, some will work some won't approach with caution, and yes !fps 2 is still a meme, using is not advised.
 
 ## How to use:
 * Setup tera-proxy by meishuu (https://github.com/meishuu/tera-proxy)
@@ -11,33 +16,19 @@
 * Now you have access to fps-utils commands
 
 ## Commands:
-* **!fps:**
-    * **usage:** !fps [arg] [opt. arg2]
-    * **valid arguments:** 0, 1, 2, me, show, hide, help
-    * **description:** Toggles between fps-utils states to interact with the game client in various ways to improve fps, input 0 as argument to disable.
-* **!fps 0:** disable main states, and spawn all non-blocked players.
-* **!fps 1:** enable fps state 1 and remove skill particles and projectiles.
-* **!fps 2:** enable fps state 2 and remove all skill animations.
-* **!fps 3:** enable fps state 3 and remove any and all players from your screen.
-* **!fps fireworks:** toggle fireworks flag (true: fireworks enabled / false: fireworks disabled) to save MASSIVE fps on guild bams and/or trigger Cairu. xd
-* **!fps hide:**
-    * **usage:** !fps hide [arg1]
-    * **valid arguments:** dps, healers, tanks, any username
-    * **description:** Hide a certain role or any user individually
-* **!fps show:**
-    * **usage:** !fps show [arg1]
-    * **valid arguments:** dps, healers, tanks, any username
-    * **description:** see fps-hide
-* **!fps list:**
-    * **usage:** !fps list
-    * **description:** List individual players you're currently hiding with !fps hide
+
+Command | Argument(s) | Usage | Alias* | Description
+---|---|---|---|---
+!fps | 0, 1, 2, 3 | !fps [state] | --- | Sets the current fps-utils oprtimization state. Check further in the notes for the states' details.
+!fps | fireworks | !fps fireworks | firework, fireworks, fw | Enables/Disables hiding of firework entities in open world (true = shown / false = hidden)
+!fps | hide | !fps hide [args] | hide, delete, h | Takes *dps*, *healers*, *tanks* or *any username* as a sub argument, tries to hide all respective characters of said specifics off the screen.
+!fps | show | !fps show [args] | show, s | Again takes *healers*, *tanks* or *any username* as a sub argument, tries to show all hidden characters of said specifics on the screen.
+!fps | list | !fps list | list, l | Prints a list of characters currently hidden by *hide* command to chat.
+!fps | save | !fps save | save, config | Saves your current settings to the configuration file for the next launch.
 
 
 ## Work In Progress:
 * Overall improvements.
 * Save configuration upon exit to remember last state.
 * button toggle between fps states 0-1-2-3
-
-## Notes:
-
-Apparently !fps 2 mode is bugged somewhat in the current version, I am working on fixes to the desyncing issues that come with it.
+* Revive !fps 2 to it's full glory and screw this "2 IS A MEME" gaem.

+ 222 - 0
rework.js

@@ -0,0 +1,222 @@
+/*
+// FpsUtils3 indev-0.1 currently not functional.
+// Written by Saegusa with love<3 and memes
+//
+// This is a development structral version of
+// FpsUtils' new version, which will be the
+// third iteration of this mod, which includes
+// the same features as before but in a better
+// code structure to make it more understandable
+// and easier to work on for people other than gooses.
+// 
+// FpsUtils3 currently includes the new command
+// system i thought up for "masterwork" and is beastin
+// Pls forward any future requests to my Patreon page:
+// https://www.patreon.com/saegusa
+//
+// Original code repository is placed at:
+// https://github.com/Saegusae/fps-utils
+*/
+
+let config = require('./config.json');
+
+const format = require('./format'),
+      fs = require('fs');
+
+module.exports = function FpsUtils3(dispatch) {
+
+    const CLASSES = config.classes;
+
+    let debug = config.debug || false;
+
+    let player,
+        cid,
+        model,
+        clss;
+
+    let state = config.state || 0,
+        lastState = state || 0,
+        hiddenPlayers = {},
+        hiddenIndividual = {};
+
+    let flags = {
+        fireworks: false,
+        hide: {
+            tanks: false,
+            healers: false,
+            dps: false
+        }
+    }
+
+    function getClass(mdl) {
+        return (m % 100);
+    }
+
+    const commands = {
+        state: {
+            alias: ["0", "1", "2", "3"],
+            help: "Changes fps state to given argument.",
+            run: function(args) {
+
+                lastState = state;
+                state = parseInt(args[0]);
+                config.state = state;
+
+                switch(state) {
+                    // State 0: Disable fps-utils optimization.
+                    case 0:
+ 
+                        if(lastState > 2) {
+                            // Display all hidden players.
+                        }
+                        break;
+                    // State 1: Hide skill particles and projectiles.
+                    case 1:
+
+                        if(lastState > 2) {
+                            // Display all hidden players, except individuals.
+                        }
+                        break;
+                    // State 2: Hide skill animations.
+                    case 2:
+
+                        if(lastState > 2) {
+                            // Display all hidden players, except individuals.
+                        }
+                        break;
+                    // State 3: Hide all players.
+                    case 3:
+
+                        if(lastState < 3) {
+                            // Hide all players.
+                        }
+                        break;
+                    default:
+                        break;
+                }
+            }
+        },
+        save: {
+            alias: ['save', 'config'],
+            help: "Saves current settings to config file for next launch.",
+            run: function(args) {
+                save((err) => {
+                    if(err) {
+                        log('Save to config failed.');
+                    } else {
+                        log('Settings successfully saved to config');
+                    }
+                });
+            }
+        },
+        fireworks: {
+            alias: ['firework', 'fireworks', 'fw'],
+            help: "Hide fireworks, and their pesky animations. (true = show | false = hide)",
+            run: function(args) {
+                flags.fireworks = !flags.fireworks;
+                log(`toggled fireworks: ${flags.fireworks}`);
+            }
+        },
+        hide: {
+            alias: ['hide', 'h', 'delete'],
+            help: "",
+            run: function(args) {
+                if(args.length < 2) {
+                    // Missing argument, throw help function.
+                } else {
+                    if(state < 3)
+                        switch(args[1]) {
+                            case "dps":
+                            case "healers":
+                            case "tanks":
+
+                                // Hide all characters of said class.
+
+                                break;
+                            default:
+
+                                // Hide individuals by username.
+
+                                break;
+                        }
+                }
+            }
+        },
+        show: {
+            alias: ['show', 's'],
+            help: "",
+            run: function(args) {
+
+                if(args.length < 2) {
+                    // Missing argument, throw help.
+                } else {
+                    if(state < 3)
+                        switch(args[1]) {
+                            case "dps":
+                            case "healers":
+                            case "tanks":
+                                // Show chosen class.
+                                break;
+                            default:
+                                // Show individual by name.
+                                break;
+                        }
+                }
+
+            }
+        },
+        list: {
+            alias: ['list', 'l'],
+            help: "Show a list of players hidden by 'hide' command.",
+            run: function(args) {
+                let hiddenArray = [];
+                for(let pl in hiddenIndividual) hiddenArray.push(hiddenIndividual[pl].name);
+                log(`Hidden Players: ${hiddenArray}`);
+            }
+        }
+    }
+
+    dispatch.hook('C_CHAT', 1, (event) => {
+        if(!event.message.includes('!fps'))
+            return;
+
+        let command = format.stripTags(event.message).split(' ');
+
+        if(command.length > 1) {
+            command = command.splice(1, 1);
+            for(let cmd in commands) {
+                if(commands[cmd].alias.indexOf(command[0])) {
+                    commands[cmd].run(command);
+                }            
+            }
+        }
+
+        return false;
+    });
+
+
+    function help(cmd) {
+
+    }
+
+    function log(msg) {
+        if(debug) console.log('[fps-utils3] ' + msg);
+        dispatch.toClient('S_CHAT', 1, {
+            channel: 24,
+            authorID: 0,
+            unk1: 0,
+            gm: 0,
+            unk2: 0,
+            authorName: '',
+            message: ' (fps-utils3) ' + msg
+        });
+    }
+
+    function save(callback) {
+        fs.writeFile('./config.json', config, 'utf8', (err) => { 
+            if(!err) log("config file overwritten successfully"); 
+            else callback(err);
+        });
+    }
+
+}