[Release] MuOnline CWScript.cws editor

Results 1 to 7 of 7
  1. #1
    0x4D696E68 myheart is offline
    MemberRank
    Jun 2017 Join Date
    354Posts

    [Release] MuOnline CWScript.cws editor

    this is small code used for edit CWScriptxx.cws

    may struct not correct 100% but work!

    Download: https://mega.nz/#!idlmjACQ!KFlwBWOik...D2WjS2D98tGbMs
    GUI version: https://mega.nz/#F!aB9jiQ7a!8JwUDLjma-qYDb_ksvC65w
    Spoiler:

    // DecryptCws.cpp : This file contains the 'main' function. Program execution begins and ends there.
    //

    #include "stdafx.h"
    #include <Windows.h>
    #include <iostream>
    #include "MemScript.h"
    #include <vector>

    #pragma pack(push, 1)
    struct CWS_INFO
    {
    BYTE c1;
    BYTE c2;
    WORD c3;
    float c4;
    float c6;
    float c7;
    float c8;
    float c9;
    float c10;
    };
    #pragma pack(pop)

    std::vector<CWS_INFO> m_CwsInfo;

    bool LoadTxt(const char * path)
    {
    CMemScript * lpMemScript = new CMemScript;

    if (!lpMemScript)
    {
    return false;
    }

    if (lpMemScript->SetBuffer((char*)path) == 0)
    {
    char aaaa[MAX_PATH] = { 0 };
    wsprintfA(aaaa, "Could not find %s", path);
    MessageBoxA(0, aaaa, 0, 0);
    return false;
    }

    try
    {
    while (true)
    {
    if (lpMemScript->GetToken() == TOKEN_END)
    {
    break;
    }

    if (strcmp("end", lpMemScript->GetString()) == 0)
    {
    break;
    }

    CWS_INFO info;
    memset(&info, 0, sizeof(info));

    info.c1 = lpMemScript->GetNumber();
    info.c2 = lpMemScript->GetAsNumber();
    info.c3 = lpMemScript->GetAsNumber();
    info.c4 = lpMemScript->GetAsFloatNumber();
    info.c6 = lpMemScript->GetAsFloatNumber();
    info.c7 = lpMemScript->GetAsFloatNumber();
    info.c8 = lpMemScript->GetAsFloatNumber();
    info.c9 = lpMemScript->GetAsFloatNumber();
    info.c10 = lpMemScript->GetAsFloatNumber();

    m_CwsInfo.push_back(info);
    }
    }
    catch (...)
    {

    }

    delete lpMemScript;

    return true;
    }

    int main(int argc, char *argv[], char *envp[])
    {
    #if(TOOL_TYPE == 1)

    if (LoadTxt("CWScript74.txt") == false)
    {
    return 0;
    }

    FILE *fileOut;

    fopen_s(&fileOut, "CWScript74.cws", "wb");

    if (!fileOut)
    {
    return 0;
    }

    int blocksize = sizeof(CWS_INFO);

    fwrite("CWS", 4, 1, fileOut);

    int Count = m_CwsInfo.size();

    fwrite(&Count, 4, 1, fileOut);

    for (std::vector<CWS_INFO>::iterator it = m_CwsInfo.begin(); it != m_CwsInfo.end(); it++)
    {
    fwrite(&it[0], blocksize, 1, fileOut);
    }

    fclose(fileOut);

    #else
    FILE *file;
    fopen_s(&file, "CWScript74.cws", "rb");

    if (!file)
    {
    MessageBoxA(0, "Could not find CWScript74.cws", 0, 0);
    return 0;
    }

    char FileType[4];
    int Count = 0;

    fread(FileType, 4, 1, file);

    fread(&Count, 4, 1, file);

    int blocksize = sizeof(CWS_INFO);

    for (int n = 0; n < Count; n++)
    {
    unsigned char * Buffer = new unsigned char[blocksize];
    fread(Buffer, blocksize, 1, file);
    m_CwsInfo.push_back(*(CWS_INFO*)Buffer);
    delete[] Buffer;
    }

    fclose(file);

    FILE *fileOut;

    fopen_s(&fileOut, "CWScript74.txt", "wb");

    if (!fileOut)
    {
    MessageBoxA(0, "Could not Save CWScript74.txt", 0, 0);
    return 0;
    }

    for (std::vector<CWS_INFO>::iterator it = m_CwsInfo.begin(); it != m_CwsInfo.end(); it++)
    {
    fprintf(fileOut, "%d %d %d %g %g %g %g %g %g\n",
    it->c1,
    it->c2,
    it->c3,
    it->c4,
    it->c6,
    it->c7,
    it->c8,
    it->c9,
    it->c10
    );
    }

    fprintf(fileOut, "end\n");

    fclose(fileOut);

    #endif
    return 0;
    }
    Last edited by myheart; 25-08-18 at 07:05 AM.


  2. #2
    RZ's most loyal knight Dios is offline
    ModeratorRank
    Apr 2005 Join Date
    ArgentinaLocation
    5,238Posts

    re: [Release] MuOnline CWScript.cws editor

    Approved!

  3. #3
    c# Programmer martinx09 is offline
    MemberRank
    Aug 2008 Join Date
    391Posts

    Re: [Release] MuOnline CWScript.cws editor

    Pretty cool, could anyone tell me what every value means?

    Example:
    Code:
    112	207	0	11200	20700	169.5	0	12	10
    109	209	0	10900	20900	169.5	0	12.7	9
    105	211	0	10500	21100	169.5	0	12.8	9
    99	212	0	9900	21200	169.5	0	12	8
    93	211	0	9300	21100	169.5	0	12.2	10
    88	209	0	8800	20900	169.5	0	11.9	11
    83	206	0	8300	20600	169.5	0	20	12
    78	202	0	7800	20200	169.5	0	12.4	11
    73	197	0	7300	19700	169.5	0	12	10
    67	189	0	6700	18900	169.5	0	12.3	10
    62	184	0	6200	18400	169.5	0	12	10
    56	180	0	5600	18000	169.5	0	12	10
    49	178	0	4900	17800	169.5	0	12	10
    43	180	0	4300	18000	322.5	0	12.8	10
    38	184	0	3800	18400	322.5	0	12	10
    34	187	0	3400	18700	322.5	0	12.7	10
    32	192	0	3200	19200	322.5	0	12	10
    32	198	0	3200	19800	169.5	0	12	10
    35	205	0	3500	20500	169.5	0	12	10
    40	211	0	4000	21100	169.5	0	12	10
    48	215	0	4800	21500	169.5	0	12	10
    54	217	0	5400	21700	169.5	0	12	10
    59	215	0	5900	21500	169.5	0	12	10
    64	211	0	6400	21100	169.5	0	12	10
    69	205	0	6900	20500	169.5	0	12	10
    71	200	0	7100	20000	169.5	0	12	10
    74	192	0	7400	19200	169.5	0	12.1	10
    78	186	0	7800	18600	169.5	0	12	10
    82	182	0	8200	18200	169.5	0	12	10
    89	179	0	8900	17900	169.5	0	12	10
    96	179	0	9600	17900	169.5	0	12	10
    103	182	0	10300	18200	169.5	0	12	10
    112	189	0	11200	18900	169.5	0	11.1	10
    115	194	0	11500	19400	169.5	0	12	10
    116	199	0	11600	19900	169.5	0	12	10
    116	203	0	11600	20300	169.5	0	12	10
    113	206	0	11300	20600	169.5	0	12.9	10
    end
    Is it something like
    Code:
    X - Y - ? - RotationX - RotationY - ? - ? - ? - Height
    This is just what I suppose, could anyone explain? :)

  4. #4
    0x4D696E68 myheart is offline
    MemberRank
    Jun 2017 Join Date
    354Posts

    Re: [Release] MuOnline CWScript.cws editor

    Quote Originally Posted by martinx09 View Post
    Pretty cool, could anyone tell me what every value means?

    Code:
    X - Y - ? - RotationX - RotationY - ? - ? - ? - Height
    This is just what I suppose, could anyone explain? :)
    X - Y - ? - RotationX - RotationY - ? - ? - Movespeed - Height

  5. #5
    c# Programmer martinx09 is offline
    MemberRank
    Aug 2008 Join Date
    391Posts

    Re: [Release] MuOnline CWScript.cws editor

    Edit:

    Code:
    X - Y - 0 - X00 - Y00 - ROT - 0 - MOV - HEIGHT
    This is what I've got testing for now:
    X00 and Y00 are just the same as X and Y but with 00 at the end, no idea why it need the coords 2 times,
    but yeah.. who knows.
    ROT is how much to rotate, if you put 169.5 it will rotate 169.5 grades and then stop.
    MOV is how much time to move for.. so how much that line lasts for.
    The bigger the number, the more it lasts.

    So for example if you want the camera to shake really fast just do 2 lines with big different rotation,
    and a small number on mov.
    If you want the camera to rotate really slowly on it's own place,
    don't change the coords, put 180 degrees on both lines and big number on MOV like 20-30.
    It will keep rotating 360 degrees non stop.

    And another detail: there has to be at least 2 lines, won't work with just 1 line or 0.
    And depending on the version of the main, it can start always from the top, or start at a random line,
    for example on Season 4 (that desert map) it starts at random line.

    - - - Updated - - -

    Okay edit, I was wrong, it's lower number for faster time, and higher number for slower time. (On MOV)
    Last edited by martinx09; 24-08-18 at 11:25 PM.

  6. #6
    0x4D696E68 myheart is offline
    MemberRank
    Jun 2017 Join Date
    354Posts

    Re: [Release] MuOnline CWScript.cws editor

    added GUI version!

  7. #7
    0x4D696E68 myheart is offline
    MemberRank
    Jun 2017 Join Date
    354Posts

    Re: [Release] MuOnline CWScript.cws editor

    added petdata.bmd, for people looking for new pets movement fix.



Advertisement