Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 21:17

  • Please register to post and access all features, it's quick, easy and FREE!

 

item resource var stats algorithm .

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
item resource var stats algorithm .

while digging in itemresource table especially the stats "varX_X" columns

I can see that the stats are combination of base stats id's .

524288, 8192, 65536, 512, 1024, 128, 256, 2048, 4096, 131072, 262144, 268435457, 134217728, 16777216, 268435456, 33554432, 1048576, 16384, 32768, 1, 2, 16, 32, 4, 8, 2097152, 4194304, 64


and each one represents a stat value in game .
for example .
mdef + pdef = 1536
that means 1024 (mdef) + 512 (pdef)

and so on ,

my goal isn't the combination itself ... it's how to reverse it in seconds .

I used this algorithm and it is so slow for large numbers .

Code:
public class Solver {

    private List<List<decimal>> mResults;

    public List<List<decimal>> Solve(decimal goal, decimal[] elements) {

        mResults = new List<List<decimal>>();
        RecursiveSolve(goal, 0.0m, 
            new List<decimal>(), new List<decimal>(elements), 0);
        return mResults; 
    }

    private void RecursiveSolve(decimal goal, decimal currentSum, 
        List<decimal> included, List<decimal> notIncluded, int startIndex) {

        for (int index = startIndex; index < notIncluded.Count; index++) {

            decimal nextValue = notIncluded[index];
            if (currentSum + nextValue == goal) {
                List<decimal> newResult = new List<decimal>(included);
                newResult.Add(nextValue);
                mResults.Add(newResult);
            }
            else if (currentSum + nextValue < goal) {
                List<decimal> nextIncluded = new List<decimal>(included);
                nextIncluded.Add(nextValue);
                List<decimal> nextNotIncluded = new List<decimal>(notIncluded);
                nextNotIncluded.Remove(nextValue);
                RecursiveSolve(goal, currentSum + nextValue,
                    nextIncluded, nextNotIncluded, startIndex++);
            }
        }
    }
}
Code:
class Program {
    static void Main(string[] args) {

        string input;
        decimal goal;
        decimal element;

        do {
            input = "IN COMBINATION";
        }
        while (!decimal.TryParse(input, out goal));

        input = "524288 8192 65536 512 1024 128 256 2048 4096 131072 262144 268435457 134217728 16777216 268435456 33554432 1048576 16384 32768 1 2 16 32 4 8 2097152 4194304 64";
        string[] elementsText = input.Split(' ');
        List<decimal> elementsList = new List<decimal>();
        foreach (string elementText in elementsText) {
            if (decimal.TryParse(elementText, out element)) {
                elementsList.Add(element);
            }
        }

        Solver solver = new Solver();
        List<List<decimal>> results = solver.Solve(goal, elementsList.ToArray());
        foreach(List<decimal> result in results) {
            foreach (decimal value in result) {
                Console.Write("{0}\t", value);
            }
            Console.WriteLine();
        }


        Console.ReadLine();
    }
}
any ideas ?

*knapsack problem*


btw: I'm interested in raskim new db manager hoping that he has a solution in it



TheSuperKiller is offline  
Old   #2
 
elite*gold: 0
Join Date: Oct 2012
Posts: 124
Received Thanks: 12
i think you should look into RappelzItemModder's source


MrStubborn is offline  
Old   #3
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
rappelz item modder takes the info from xml file , that xml file has some basic stats and it doesn't read it from the db reversing the numbers that was taken from ...
that's why it doesn't load stats like 1064960 etc because its not identified in the xml file .
or the solution would be to make a program that takes forever to make the full xml file .
TheSuperKiller is offline  
Old   #4
 
elite*gold: 30
Join Date: Mar 2012
Posts: 626
Received Thanks: 280
Quote:
Originally Posted by TheSuperKiller View Post
rappelz item modder takes the info from xml file , that xml file has some basic stats and it doesn't read it from the db reversing the numbers that was taken from ...
that's why it doesn't load stats like 1064960 etc because its not identified in the xml file .
or the solution would be to make a program that takes forever to make the full xml file .
stats are made as 2^x not as randomly as seems.
you can count combined stat with the following algorithm:

if you have, for example, stat no. 1536, it appears between 1024 and 2048.
and there is a simple math: [combined stat] - [previous non-combined stat] = [second stat].
1536 - 1024 = 512. so you have 1024 (mdef) and 512 (pdef).

example in LUA:


mongreldogg is online now  
Old   #5
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
what about 3 or more stats combined that will never work :O
TheSuperKiller is offline  
Old   #6
 
elite*gold: 30
Join Date: Mar 2012
Posts: 626
Received Thanks: 280
Quote:
Originally Posted by TheSuperKiller View Post
what about 3 or more stats combined that will never work :O
simple ^_^
make a loop!


and list of general stats as a LUA table is everything you get as well as everything you want:


P.S. youll never get 1 stat twice, thats why every general stat is previous_stat*2


mongreldogg is online now  
Thanks
1 User
Reply



« Previous Thread | Next Thread »

Similar Threads
Item Stats are all 100% oO?
Hey guys uhm i wanted to ask why all Stats are 100% is it a visual bug or what and how can i fix this ? clean items.. btw http://epvpimg.com/L9idg
4 Replies - SRO PServer Ask the Experts
[HELP]Item Stats
Hey i have problem in my new item if anyone helped me it would be awesomeee TY :)
5 Replies - EO PServer Hosting
[Just another graph-related algorithm] Kruskal`s algorithm
(Scroll down for the code if you aren`t interested in my wall of text.) Okay, my previous post on Dijkstra`s algorithm didn`t really get the...
11 Replies - CO2 Programming
char stats, and item stats
hi all today.. on a private server. i made a verry strange exp..... some clannies called me to come to HS to help for pvp as i came there i seen...
6 Replies - Lineage 2
1 to +12 item stats any one?
:confused: 1 to +12 item stats any one?
3 Replies - CO2 Main - Discussions / Questions



All times are GMT +2. The time now is 21:17.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.