Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local scw, sch = term.getSize()
- os.loadAPI("graphics")
- term.clear()
- buffer1 = graphics.addBuffer()
- local playerMdl = {
- {{0,128,256,0},
- {128,128,128,256},
- {0,4096,16,0},
- {4096,16,512,0},
- {4096,4096,256,128},
- {4096,128,256,0},
- {0,8,8,0},
- { 0,4096,4096,0},
- },
- {},
- {{0,0,0,0,0},
- {0,0,128,256,0},
- {0,128,128,128,256},
- {0,0,4096,16,0},
- {0,4096,256,256,0},
- {4096,4096,128,256,128},
- {0,4096,8,8,8},
- {4096,8,8,0,4096}},
- }
- local ghostMdl = {
- {{0,128,128,0,0}, -- default
- {128,256,256,128,0},
- {0,256,256,0,0},
- {128,16,16,128,0},
- {16384,16,16,16384,0},
- {16384,512,8,16384,0},
- {0,0,512,0,0}},
- {{0,128,128,0,0}, -- attack
- {0,128,128,0,0},
- {0,256,256,0,0},
- {128,16,16,128,0},
- {16384,16,16,16384,0},
- {0,512,8,0,0},
- {0,0,512,0,0}},
- }
- local zombie1Mdl = {
- {{0,4096,4096,0},
- {0,8192,32,0},
- {128,256,256,128},
- {8192,128,128,8192},
- {0,128,256,0},
- {0,8192,8,0},
- {0,4096,4096,0}}
- }
- local habitant1Mdl = {
- {{0,128,128,0},
- {0,16,16,0},
- {4096,256,256,4096},
- {4096,8,8,4096},
- {0,256,256,0},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local habitant2Mdl = {
- {{0,128,128,0},
- {0,16,16,0},
- {128,256,256,4096},
- {4096,8,8,4096},
- {0,256,256,0},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local habitant3Mdl = {
- {{0,128,128,0},
- {0,16,16,0},
- {128,256,256,4096},
- {4096,512,512,4096},
- {0,256,256,0},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local tailor1Mdl = {
- {{0,128,128,0},
- {0,16,16,0},
- {4096,256,256,4096},
- {4096,16,16,4096},
- {0,256,256,0},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local bsmith1Mdl = {
- {{0,128,128,0},
- {0,16,16,0},
- {4096,256,256,4096},
- {4096,2,2,4096},
- {0,256,256,0},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local apothecary1Mdl = {
- {{0,128,128,0},
- {0,16,16,0},
- {4096,256,256,4096},
- {4096,32,32,4096},
- {0,256,256,0},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local greenslimeMdl = {
- {{0,0,32,8192,8192,0,0},
- {0,8192,8192,8192,8192,32,0},
- {0,8192,32,8192,32,8192,0},
- {0,8192,32,8192,32,8192,8192},
- {8192,32,8192,8192,8192,8192,32},
- {8192,8192,256,8192,8192,8192,256}},
- }
- local silversnakeMdl = {
- {{0,0,256,128,128,256,0,0,256,256,128,128,256,128},
- {256,256,128,0,0,256,128,128,128,0,0,0,0,0}},
- }
- local femaleghostMdl = {
- {{0,2048,2048,0,0},
- {2048,1,1,2048,0},
- {2048,1,1,2048,0},
- {128,128,128,128,0},
- {1,128,128,1,0},
- {1,512,8,1,0},
- {0,0,512,0,0}},
- }
- local spiritofplaceMdl = {
- {{0,0,0,0,0},
- {0,1,1,0,0},
- {0,1,1,0,0},
- {128,128,128,128,0},
- {1,128,128,1,0},
- {1,512,8,1,0},
- {0,0,512,0,0}},
- }
- local bushMdl = {
- {{0,0,8192,32,0,0},
- {0,8192,8192,32,8192,0},
- {0,32,8192,8192,32,8192,0},
- {8192,8192,4096,8192,32,8192},
- {4096,8192,8192,4096,8192,8192}},
- }
- local stoneturtleMdl = {
- {{0,0,256,16,256,16,256,0,0},
- {0,256,16,256,16,256,16,256,4096},
- {256,128,256,128,256,128,256,128,256}},
- }
- local woodMdl = {
- {{0,32,8192,8192,0,0},
- {32,32,32,8192,32,0},
- {8192,32,8192,8192,8192,8192},
- {32,8192,4096,8192,8192,8192},
- {0,8192,4096,4096,8192,4096},
- {8192,0,128,4096,0,8192},
- {0,128,4096,4096,0,8192},
- {0,4096,4096,128,0,0},
- {4096,0,128,4096,0,0}},
- }
- local sceletonarcherMdl = {
- {{0,128,128,0,0},
- {0,256,256,0,0},
- {128,256,0,128,0},
- {256,256,256,256,4096},
- {256,0,256,256,4096},
- {0,256,128,4096,0},
- {0,256,256,0,0},
- {0,256,256,0,0}},
- }
- local venomousghoulMdl = {
- {{0,128,128,0},
- {0,8192,8192,0},
- {128,512,256,128},
- {256,256,512,256},
- {256,128,128,8192},
- {0,128,128,0},
- {0,4096,4096,0}},
- }
- local decayingghoulMdl = {
- {{0,128,128,0},
- {0,1,8192,0},
- {128,128,128,128},
- {256,128,128,1},
- {32768,256,256,256},
- {0,256,256,0},
- {0,4096,4096,0}},
- }
- local stonegolemMdl = {
- {{0,0,128,128,0,0},
- {0,0,128,128,0,0},
- {128,256,256,256,256,128},
- {128,128,256,256,128,128},
- {128,128,256,256,128,128},
- {0,0,256,256,0,0},
- {0,0,256,256,0,0},
- {0,0,128,128,0,0}},
- }
- local ironturtleMdl = {
- {{0,0,256,512,256,512,256,0,0},
- {0,256,512,256,512,256,512,256,128},
- {256,128,256,128,256,128,256,128,256}},
- }
- local copperoreMdl = {
- {{0,0,2,128,0},
- {256,128,128,4096,128}},
- }
- local treerootMdl = {
- {{0,4096,0},
- {0,4096,4096},
- {4096,4096,128}},
- }
- local ironoreMdl = {
- {{0,0,128,128,0},
- {256,128,128,256,128}},
- }
- local gravelMdl = {
- {{0,0,256,256,0},
- {256,128,256,256,128}},
- }
- local windelmentalMdl = {
- {{0,0,256,256,0,0},
- {0,0,256,256,0,0},
- {0,128,0,0,128,0},
- {128,0,256,256,0,128},
- {256,128,0,256,128,256},
- {0,0,256,0,0,0},
- {0,0,0,256,0,0}}
- }
- local goblinheghtuMdl = {
- {{0,4096,4096,0,0,0},
- {0,4096,4096,0,0,0},
- {256,256,128,256,0,4096},
- {256,128,256,256,4096,0},
- {0,256,256,4096,0,0},
- {0,256,4096,0,0,0},
- {0,4096,4096,0,0,0}},
- }
- local devilmaggotMdl = {
- {{0,16,16,0},
- {16,32768,32768,16},
- {16,32768,32768,16},
- {2,16,16,2},
- {0,16,16,0},
- {4096,2,2,4096},
- {4096,0,0,4096}},
- }
- local zombiewarriorMdl = {
- {{0,128,128,0},
- {0,8192,256,0},
- {4096,16,16,4096},
- {4096,256,256,4096},
- {0,128,256,0},
- {0,256,256,0},
- {0,128,128,0}},
- }
- local sagespiritMdl = {
- {{0,0,0,0,0}, -- default
- {0,1,1,0,0},
- {0,1,1,0,0},
- {128,8,8,128,0},
- {256,8,8,256,0},
- {256,512,8,256,0},
- {0,0,512,0,0}},
- }
- local soullessMdl = {
- {{0,1,128,0},
- {0,1,1,0},
- {4096,256,256,4096},
- {4096,16,128,4096},
- {0,128,256,0},
- {0,128,256,0},
- {0,4096,4096,0}},
- }
- local itemimg = {
- [1]={
- {8,8,8,8,8,8,8},
- {8,8,2,2,2,8,8},
- {8,2,16,16,16,2,8},
- {2,16,16,16,2,8,8},
- {8,2,2,2,8,8,8},
- },
- [2]={
- {8,8,8,4096,4096,4096,8},
- {8,8,4096,4096,4096,8,8},
- {8,4096,4096,4096,8,8,8},
- {4096,4096,4096,8,8,8,8},
- {8,4096,4096,4096,4096,8,8},
- },
- [3]={
- {8,8,8,8,8,8,8},
- {4096,4096,128,128,128,4096,4096},
- {4096,4096,4096,256,4096,4096,4096},
- {8,4096,4096,4096,4096,4096,8},
- {8,4096,128,4096,128,4096,8},
- },
- [4]={
- {8,8,4096,4096,4096,8,8},
- {8,4096,4096,4096,4096,8,8},
- {8,4096,4096,4096,4096,4096,8},
- {8,8,4096,4096,4096,4096,8},
- {8,8,4096,4096,4096,8,8},
- },
- [5]={
- {512,512,512,512,512,512,4096},
- {512,512,512,4096,512,4096,512},
- {512,512,512,512,4096,512,512},
- {512,512,4096,4096,512,4096,512},
- {512,4096,4096,512,512,512,512},
- },
- [6]={
- {8,8,4096,4096,4096,8,8},
- {8,4096,4096,4096,4096,8,8},
- {8,4096,4096,4096,4096,8,8},
- {8,8,4096,4096,4096,4096,8},
- {8,8,4096,4096,4096,8,8},
- },
- [7]={
- {8,4096,4096,4096,4096,4096,8},
- {4096,4096,128,128,128,4096,4096},
- {4096,128,128,128,128,128,4096},
- {4096,4096,128,128,128,4096,4096},
- {8,8,8,8,8,8,8},
- },
- [8]={
- {8,8,8,8,8,8,8},
- {8,8,128,128,128,8,8},
- {8,128,256,256,256,128,8},
- {128,256,256,256,128,8,8},
- {8,128,128,128,8,8,8},
- },
- [9]={
- {8,8,8,8,8,8,8},
- {8,8,8,256,8,8,8},
- {8,8,256,256,256,8,8},
- {8,8,16,16,16,8,8},
- {8,8,16,16,16,8,8},
- },
- [10]={
- {8,8,8,8,32,32,8},
- {8,8,8,8192,8192,32,8},
- {8,8,32,8192,8192,32,8},
- {8,32,8192,8192,32,8,8},
- {8,8,8,32,32,32,8},
- },
- [11]={
- {8,8,128,128,128,8,8},
- {8,128,128,128,128,8,8},
- {8,128,128,128,128,128,8},
- {8,8,128,128,128,128,8},
- {8,8,128,128,128,8,8},
- },
- [12]={
- {16,16,4096,4096,4096,16,16},
- {16,16,256,256,256,16,16},
- {16,16,256,256,256,16,16},
- {16,16,256,256,256,16,16},
- {16,16,16384,16384,16384,16,16},
- },
- [13]={
- {16,16,4096,4096,4096,16,16},
- {16,16,256,256,256,16,16},
- {16,16,256,256,256,16,16},
- {16,16,256,256,256,16,16},
- {16,16,2048,2048,2048,16,16},
- },
- [14]={
- {8,8,8,8,8,8,8},
- {8,8,2,2,2,8,8},
- {8,2,2,2,2,2,8},
- {2,2,2,2,2,8,8},
- {8,2,2,2,8,8,8},
- },
- [15]={
- {8,4096,4096,4096,4096,4096,8},
- {8,4096,4096,4096,4096,4096,8},
- {8,4096,4096,8,4096,4096,8},
- {8,4096,128,8,128,4096,8},
- {8,128,4096,8,4096,128,8},
- },
- [16]={
- {8,256,8,8,8,256,8},
- {256,8,8,8,8,8,256},
- {8,256,8,8,8,256,8},
- {8,8,2,2,2,8,8},
- {8,8,8,2,8,8,8},
- },
- [17]={
- {8,8,1024,1024,1024,8,8},
- {8,1024,1024,1024,64,1024,8},
- {8,1024,1024,1024,1024,1024,8},
- {8,1024,4,4,4,1024,8},
- {8,8,8,8,8,8,8},
- },
- [18]={
- {512,512,512,512,512,512,4096},
- {512,512,512,4096,512,4096,512},
- {512,512,512,512,4096,512,512},
- {512,512,128,256,512,4096,512},
- {512,128,256,512,512,512,512},
- },
- [19]={
- {512,512,512,512,512,512,4096},
- {512,512,512,128,512,4096,512},
- {512,512,512,512,128,512,512},
- {512,512,128,256,512,128,512},
- {512,128,256,512,512,512,512},
- },
- [20]={
- {8,256,8,8,8,256,8},
- {256,8,8,8,8,8,256},
- {8,256,8,8,8,256,8},
- {8,8,1,256,1,8,8},
- {8,8,8,1,8,8,8},
- },
- [21]={
- {32768,32768,32768,32768,128,4096,4096},
- {32768,32768,32768,128,4096,4096,4096},
- {32768,32768,128,4096,4096,4096,4096},
- {32768,128,4096,4096,4096,4096,4096},
- {128,4096,4096,4096,4096,4096,4096},
- },
- [22]={
- {8,4096,4096,4096,4096,4096,8},
- {4096,4096,128,128,128,4096,4096},
- {4096,4096,128,128,128,4096,4096},
- {4096,4096,128,128,128,4096,4096},
- {256,8,8,8,8,8,256},
- }, -- шапка
- [23]={
- {8,128,4096,4096,4096,128,8},
- {8,4096,4096,4096,4096,4096,8},
- {8,4096,4096,8,4096,4096,8},
- {8,256,256,8,256,256,8},
- {8,4096,256,8,256,4096,8},
- }, -- штаны
- [24]={
- {8,8,8,8,8,8,8},
- {4096,4096,128,128,128,4096,4096},
- {4096,4096,256,4096,256,4096,4096},
- {8,4096,4096,256,4096,4096,8},
- {8,4096,256,4096,256,4096,8},
- }, -- броня
- [25]={
- {8,8,256,4096,4096,4096,8},
- {8,8,4096,4096,4096,8,8},
- {8,4096,4096,4096,8,8,8},
- {4096,256,4096,8,8,8,8},
- {8,4096,4096,4096,4096,4096,8},
- }, -- сапог
- [26]={
- {16,16,4096,4096,4096,16,16},
- {16,16,256,256,256,16,16},
- {16,16,256,256,256,16,16},
- {16,16,16384,16384,16384,16,16},
- {16,16,16384,16384,16384,16,16},
- },
- [27]={
- {16,16,4096,4096,4096,16,16},
- {16,16,256,256,256,16,16},
- {16,16,256,256,256,16,16},
- {16,16,2048,2048,2048,16,16},
- {16,16,2048,2048,2048,16,16},
- },
- [28]={
- {16,16,4096,4096,4096,16,16},
- {16,16,256,256,256,16,16},
- {16,16,16384,16384,16384,16,16},
- {16,16,16384,16384,16384,16,16},
- {16,16,16384,16384,16384,16,16},
- },
- [29]={
- {16,16,4096,4096,4096,16,16},
- {16,16,256,256,256,16,16},
- {16,16,2048,2048,2048,16,16},
- {16,16,2048,2048,2048,16,16},
- {16,16,2048,2048,2048,16,16},
- },
- [30]={
- {16,16,4096,4096,4096,16,16},
- {16,16,16384,16384,16384,16,16},
- {16,16,16384,16384,16384,16,16},
- {16,16,16384,16384,16384,16,16},
- {16,16,16384,16384,16384,16,16},
- },
- [31]={
- {16,16,4096,4096,4096,16,16},
- {16,16,2048,2048,2048,16,16},
- {16,16,2048,2048,2048,16,16},
- {16,16,2048,2048,2048,16,16},
- {16,16,2048,2048,2048,16,16},
- },
- [32]={
- {8,8,8,8,256,256,256},
- {8,256,256,256,256,256,128},
- {256,4096,4096,128,256,128,8},
- {256,4096,4096,128,128,8,8},
- {8,256,128,8,8,8,8},
- },
- [33]={
- {512,512,512,512,512,128,512},
- {512,128,512,512,4096,512,512},
- {512,512,128,4096,512,512,512},
- {512,256,128,128,512,512,512},
- {256,256,256,512,128,512,512},
- },
- [34]={
- {8,8,8,256,8,8,8},
- {8,16,16,256,16,16,8},
- {16,16,16,16,16,16,16},
- {8,256,256,16,16,16,8},
- {8,8,8,256,8,8,8},
- },
- [35]={
- {8,8,8,8,8,8,8},
- {4096,4096,128,128,128,4096,4096},
- {4096,256,4096,4096,4096,256,4096},
- {8,4096,4096,4096,4096,4096,8},
- {8,4096,4096,4096,4096,4096,8},
- },
- [36]={
- {8,128,4096,128,4096,128,8},
- {8,4096,256,4096,256,4096,8},
- {8,4096,4096,8,4096,4096,8},
- {8,4096,4096,8,4096,4096,8},
- {8,256,4096,8,4096,256,8},
- },
- [37]={
- {8,128,128,128,128,8,8},
- {8,8,4096,4096,4096,128,8},
- {8,8,8,4096,4096,4096,8},
- {8,8,8,8,4096,4096,4096},
- {8,256,4096,4096,4096,4096,8},
- },
- [38]={
- {8,8,4096,128,4096,8,8},
- {8,4096,128,4096,128,4096,8},
- {8,4096,256,256,256,4096,8},
- {8,4096,256,256,256,4096,8},
- {8,8,8,8,8,8,8},
- },
- [39]={
- {8,8,8,128,8,8,8},
- {8,256,256,128,256,256,8},
- {256,256,256,256,256,256,256},
- {8,128,128,256,256,256,8},
- {8,8,8,128,8,8,8},
- },
- [40]={
- {512,512,512,512,512,128,512},
- {512,128,512,512,4096,512,512},
- {512,512,128,4096,512,512,512},
- {512,256,128,128,512,512,512},
- {256,128,256,512,128,512,512},
- },
- [41]={
- {8,8,8,128,128,8,8},
- {8,8,2,2,16,2,8},
- {8,2,2,16,2,2,2},
- {8,2,4096,4096,4096,2,2},
- {8,8,2,4096,4096,2,8},
- },
- [42]={
- {4096,4096,128,128,128,4096,4096},
- {256,256,256,256,256,256,256},
- {8,4096,128,256,128,4096,8},
- {8,256,256,256,256,256,8},
- {8,256,128,256,128,256,8},
- },
- [43]={
- {8,4096,4096,128,4096,4096,8},
- {8,128,256,256,256,128,8},
- {8,256,256,8,256,256,8},
- {8,4096,256,8,256,4096,8},
- {8,256,4096,8,4096,256,8},
- },
- [44]={
- {8,4096,256,4096,256,8,8},
- {8,8,4096,4096,4096,8,8},
- {8,8,8,4096,4096,4096,8},
- {8,8,8,8,4096,4096,4096},
- {8,4096,4096,4096,4096,4096,128},
- },
- [45]={
- {8,256,8,8,8,256,8},
- {256,8,8,8,8,8,256},
- {8,256,8,8,8,256,8},
- {8,8,1,256,1,8,8},
- {8,8,1,8,1,8,8},
- },
- [46]={
- {8,16,8,8,8,16,8},
- {16,8,8,8,8,8,16},
- {8,16,8,8,8,16,8},
- {8,8,16,1,16,8,8},
- {8,8,1,1,1,8,8},
- },
- [47]={
- {8,8,8,8,8,8,8},
- {8,128,8,8,8,8,8},
- {128,256,128,128,8,8,8},
- {256,256,256,256,128,8,8},
- {128,256,256,256,128,128,256},
- },
- [48]={
- {512,512,512,512,512,512,128},
- {512,128,128,512,512,4096,512},
- {512,512,512,128,4096,512,512},
- {512,512,8,256,128,512,512},
- {512,8,256,256,512,128,512},
- },
- [49]={
- {512,4096,512,512,512,512,512},
- {512,512,16,512,512,128,512},
- {512,512,512,16,128,512,512},
- {512,512,512,128,4096,256,512},
- {512,512,128,512,256,4096,256},
- },
- [50]={
- {512,512,512,128,128,512,128},
- {512,512,512,256,256,16,512},
- {512,512,256,256,128,256,128},
- {512,256,256,128,256,256,128},
- {256,256,128,256,256,512,512},
- },
- }
- imgWoodenhouse1 = {
- {0,0,0,0,0,0,16,16,0,0,0,0,0,0},
- {0,0,0,0,0,16,128,128,16,0,0,0,0,0},
- {0,0,0,16,16,128,256,256,256,16,16,0,0,0},
- {0,16,16,256,256,256,256,256,256,256,256,16,16,0},
- {16,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,16},
- {0,4096,4096,256,256,128,128,128,128,256,256,4096,4096,0},
- {0,4096,256,4096,256,128,32768,32768,128,256,4096,256,4096,0},
- {0,4096,256,256,4096,256,256,256,256,4096,256,256,4096,0},
- {0,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,0},
- {0,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,0},
- {0,128,128,256,128,128,256,128,128,256,128,128,256,128,0},
- {0,256,128,128,128,128,128,256,128,256,128,128,256,128,0},
- }
- local emptyArmorImageHelmet = {
- {128,256,256,256,256,256,128},
- {256,256,256,256,256,256,256},
- {256,128,128,256,128,128,256},
- {256,128,128,128,128,128,256},
- {128,128,128,128,128,128,128},
- }
- local emptyArmorImageBodywear = {
- {128,128,128,128,128,128,128},
- {256,256,128,128,128,256,256},
- {256,256,256,256,256,256,256},
- {128,256,256,256,256,256,128},
- {128,256,256,256,256,256,128},
- }
- local emptyArmorImagePants = {
- {128,256,256,256,256,256,128},
- {128,256,256,256,256,256,128},
- {128,256,256,128,256,256,128},
- {128,256,256,128,256,256,128},
- {128,256,256,128,256,256,128},
- }
- local emptyArmorImageFootwear = {
- {128,128,128,128,128,128,128},
- {128,128,256,256,128,128,256},
- {128,128,256,256,128,128,256},
- {128,256,256,256,128,256,256},
- {256,256,256,128,256,256,256},
- }
- local emptyArmorImagePendant = {
- {128,128,128,128,128,128,128},
- {256,128,128,128,128,128,256},
- {128,256,128,128,128,256,128},
- {128,128,256,256,256,128,128},
- {128,128,128,256,128,128,128},
- }
- local emptyArmorImageWeapon = {
- {128,128,128,128,128,128,256},
- {128,128,128,256,128,256,128},
- {128,128,128,128,256,128,128},
- {128,128,128,256,128,256,128},
- {128,256,256,128,128,128,128},
- }
- local dialogwindow1 = {
- {["text"] = "Hello, good man!"},
- {["text"] = "Quests", ["action"] = "dialog",
- ["do"] = {
- {["text"] = "Take quests"},
- {["text"] = ">Decaying ghoul", ["action"] = "getquest", ["do"] = 5},
- {["text"] = ">Turtles", ["action"] = "getquest", ["do"] = 4},
- {["text"] = ">Swamp slugs", ["action"] = "getquest", ["do"] = 3},
- {["text"] = ">Zombies", ["action"] = "getquest", ["do"] = 1},
- {["text"] = ">Ghost", ["action"] = "getquest", ["do"] = 2},
- {["text"] = "Later", ["action"] = "close", ["do"] = 0},
- }},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local dialogwindow2 = {
- {["text"] = "I do not need help..."},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local dialogwindow3 = {
- {["text"] = ""},
- {["text"] = "Goods and services", ["action"] = "trade", ["do"] = 1},
- {["text"] = "Create item", ["action"] = "crafting", ["do"] = 1},
- {["text"] = "Quests", ["action"] = "dialog",
- ["do"] = {
- {["text"] = "Take quests"},
- {["text"] = "Later", ["action"] = "close", ["do"] = 0},
- }},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local dialogwindow4 = {
- {["text"] = ""},
- {["text"] = "Goods and services", ["action"] = "trade", ["do"] = 2},
- {["text"] = "Create item", ["action"] = "crafting", ["do"] = 2},
- {["text"] = "Quests", ["action"] = "dialog",
- ["do"] = {
- {["text"] = "Take quests"},
- {["text"] = ">Parasites", ["action"] = "getquest", ["do"] = 7},
- {["text"] = ">A living iron", ["action"] = "getquest", ["do"] = 6},
- {["text"] = "Later", ["action"] = "close", ["do"] = 0},
- }},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local dialogwindow5 = {
- {["text"] = ""},
- {["text"] = "Goods and services", ["action"] = "trade", ["do"] = 3},
- {["text"] = "Quests", ["action"] = "dialog",
- ["do"] = {
- {["text"] = "Take quests"},
- {["text"] = ">Tree roots", ["action"] = "getquest", ["do"] = 9},
- {["text"] = ">Green foliage", ["action"] = "getquest", ["do"] = 8},
- {["text"] = "Later", ["action"] = "close", ["do"] = 0},
- }},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local dialogwindow6 = {
- {["text"] = ""},
- {["text"] = "Goods and services", ["action"] = "trade", ["do"] = 2},
- {["text"] = "Create item", ["action"] = "crafting", ["do"] = 2},
- {["text"] = "Quests", ["action"] = "dialog",
- ["do"] = {
- {["text"] = "Take quests"},
- {["text"] = "Later", ["action"] = "close", ["do"] = 0},
- }},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local dialogwindow7 = {
- {["text"] = "Hello, good man!"},
- {["text"] = "Quests", ["action"] = "dialog",
- ["do"] = {
- {["text"] = "Take quests"},
- {["text"] = ">Soullsess soldiers", ["action"] = "getquest", ["do"] = 11},
- {["text"] = ">Ghosts", ["action"] = "getquest", ["do"] = 10},
- {["text"] = "Later", ["action"] = "close", ["do"] = 0},
- }},
- {["text"] = "See you later", ["action"] = "close", ["do"] = 0}
- }
- local tradewindow = {
- [1]={
- {["item"] = 5, ["cost"] = 82},
- {["item"] = 6, ["cost"] = 86},
- {["item"] = 7, ["cost"] = 85},
- {["item"] = 8, ["cost"] = 85},
- {["item"] = 14, ["cost"] = 82},
- {["item"] = 21, ["cost"] = 147},
- {["item"] = 22, ["cost"] = 151},
- {["item"] = 23, ["cost"] = 148},
- {["item"] = 24, ["cost"] = 148},
- {["item"] = 37, ["cost"] = 257},
- {["item"] = 38, ["cost"] = 262},
- {["item"] = 39, ["cost"] = 259},
- {["item"] = 40, ["cost"] = 258},
- {["item"] = 43, ["cost"] = 403},
- {["item"] = 44, ["cost"] = 412},
- {["item"] = 45, ["cost"] = 410},
- {["item"] = 46, ["cost"] = 410},
- },
- [2]={
- {["item"] = 17, ["cost"] = 245},
- {["item"] = 35, ["cost"] = 573},
- {["item"] = 42, ["cost"] = 804},
- {["item"] = 19, ["cost"] = 188},
- {["item"] = 18, ["cost"] = 260},
- },
- [3]={
- {["item"] = 26, ["cost"] = 25},
- {["item"] = 27, ["cost"] = 25},
- {["item"] = 28, ["cost"] = 45},
- {["item"] = 29, ["cost"] = 45},
- {["item"] = 30, ["cost"] = 70},
- {["item"] = 31, ["cost"] = 70},
- {["item"] = 32, ["cost"] = 105},
- {["item"] = 33, ["cost"] = 105},
- },
- }
- local craftingwindow = {
- [1]={
- {["item"] = 5, ["recipe"] = {{9,1},{10,1},{36,1}}, ["cost"] = 0},
- {["item"] = 6, ["recipe"] = {{9,1},{10,2},{36,1}}, ["cost"] = 0},
- {["item"] = 7, ["recipe"] = {{9,2},{10,1},{36,1}}, ["cost"] = 0},
- {["item"] = 8, ["recipe"] = {{9,1},{10,1},{36,1}}, ["cost"] = 0},
- {["item"] = 21, ["recipe"] = {{9,2},{20,1},{36,1}}, ["cost"] = 0},
- {["item"] = 22, ["recipe"] = {{9,2},{20,2},{36,1}}, ["cost"] = 0},
- {["item"] = 23, ["recipe"] = {{9,3},{20,1},{36,1}}, ["cost"] = 0},
- {["item"] = 24, ["recipe"] = {{9,2},{20,1},{36,1}}, ["cost"] = 0},
- {["item"] = 37, ["recipe"] = {{9,3},{20,2},{41,2},{13,1}}, ["cost"] = 0},
- {["item"] = 38, ["recipe"] = {{9,3},{20,3},{41,2},{13,1}}, ["cost"] = 0},
- {["item"] = 39, ["recipe"] = {{9,4},{20,2},{41,2},{13,1}}, ["cost"] = 0},
- {["item"] = 40, ["recipe"] = {{9,3},{20,2},{41,2},{13,1}}, ["cost"] = 0},
- {["item"] = 43, ["recipe"] = {{3,1},{20,4},{41,2},{10,1}}, ["cost"] = 0},
- {["item"] = 44, ["recipe"] = {{3,2},{20,4},{41,2},{13,1}}, ["cost"] = 0},
- {["item"] = 45, ["recipe"] = {{3,1},{20,4},{41,2},{13,1}}, ["cost"] = 0},
- {["item"] = 46, ["recipe"] = {{3,1},{20,4},{41,2},{13,1}}, ["cost"] = 0},
- },
- [2]={
- {["item"] = 17, ["recipe"] = {{34,1},{1,3},{49,1}}, ["cost"] = 0},
- {["item"] = 35, ["recipe"] = {{34,2},{1,1},{3,5},{49,1}}, ["cost"] = 0},
- {["item"] = 42, ["recipe"] = {{34,1},{1,2},{3,8},{49,2}}, ["cost"] = 0},
- },
- }
- local function clicked(x,y,x1,y1,x2,y2)
- if x >= x1 and x <= x2 and y >= y1 and y <= y2 then
- return true
- end
- return false
- end
- local vAttackDistance = 2
- local VAttackPause = 1
- local CDataLoad = {
- {["id"] = 1, ["name"] = "Player", ["level"] = 1, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["vrespawn"] = 0, ["roletype"] = "p", ["image"] = playerMdl[1]},
- {["id"] = 2, ["name"] = "Nibner", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["vrespawn"] = 0, ["image"] = habitant1Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow1},
- {["id"] = 3, ["name"] = "Inhabitant", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["image"] = habitant2Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow2},
- {["id"] = 4, ["name"] = "Zombie", ["level"] = 1, ["loot"] = {["exp"] = 2, ["coins"] = 2, ["items"] = {
- {26,5},{27,5},{5,1},{6,1},{7,1},{8,1},{9,3},{10,3},{14,1},{36,3},
- }}, ["atds"] = 3, ["agr"] = false, ["vrespawn"] = 30, ["image"] = zombie1Mdl[1], ["roletype"] = "e"},
- {["id"] = 5, ["name"] = "Ghost", ["level"] = 2, ["loot"] = {["exp"] = 3, ["coins"] = 3, ["items"] = {
- {26,5},{27,5},{5,1},{6,1},{7,1},{8,1},{14,1},{36,3},{9,3},{10,3},
- }},["atds"] = 5, ["agr"] = false, ["vrespawn"] = 30, ["image"] = ghostMdl[1], ["roletype"] = "e"},
- {["id"] = 6, ["name"] = "Green Slug", ["level"] = 2, ["loot"] = {["exp"] = 3, ["coins"] = 3, ["items"] = {
- {26,5},{27,5},{5,1},{6,1},{7,1},{8,1},{14,1},{36,3},{12,2},{9,3},{10,3},
- }},["atds"] = 3, ["agr"] = false, ["vrespawn"] = 30, ["image"] = greenslimeMdl[1], ["roletype"] = "e"},
- {["id"] = 7, ["name"] = "Silver Snake", ["level"] = 2, ["loot"] = {["exp"] = 3, ["coins"] = 3, ["items"] = {
- {26,5},{27,5},{5,1},{6,1},{7,1},{8,1},{14,1},{36,3},{9,3},{10,3},
- }},["atds"] = 3, ["agr"] = false, ["vrespawn"] = 30, ["image"] = silversnakeMdl[1], ["roletype"] = "e"},
- {["id"] = 8, ["name"] = "Bush", ["level"] = 3, ["loot"] = {["exp"] = 4, ["coins"] = 4, ["items"] = {
- {26,5},{27,5},{11,2},{5,1},{6,1},{7,1},{14,1},{8,1},{11,2},{18,1},{36,3},{9,3},{10,3},
- }},["atds"] = 3, ["agr"] = false, ["vrespawn"] = 30, ["image"] = bushMdl[1], ["roletype"] = "e"},
- {["id"] = 9, ["name"] = "Spirit Of Place", ["level"] = 3, ["loot"] = {["exp"] = 4, ["coins"] = 2, ["items"] = {
- {26,5},{27,5},{5,1},{6,1},{7,1},{8,1},{14,1},{13,1},{18,1},{36,3},{9,3},{10,3},
- }},["atds"] = 3, ["agr"] = false, ["vrespawn"] = 40, ["image"] = spiritofplaceMdl[1], ["roletype"] = "e"},
- {["id"] = 10, ["name"] = "Stone Turtle", ["level"] = 4, ["loot"] = {["exp"] = 6, ["coins"] = 2, ["items"] = {
- {28,5},{29,5},{11,2},{19,1},{20,2},{21,1},{22,1},{23,1},{24,1},{17,1},{18,1},{13,1},{36,3},{9,3},{10,3},
- }},["atds"] = 3, ["agr"] = false, ["vrespawn"] = 30, ["image"] = stoneturtleMdl[1], ["roletype"] = "e"},
- {["id"] = 11, ["name"] = "Swamp Tree", ["level"] = 4, ["loot"] = {["exp"] = 6, ["coins"] = 4, ["items"] = {
- {28,5},{29,5},{11,2},{19,1},{20,2},{21,1},{22,1},{23,1},{24,1},{17,1},{18,1},{34,3},{13,1},{36,3},{9,3},{10,3},
- }},["atds"] = 3, ["agr"] = false, ["vrespawn"] = 30, ["image"] = woodMdl[1], ["roletype"] = "e"},
- {["id"] = 12, ["name"] = "Tailor", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["vrespawn"] = 0, ["image"] = tailor1Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow3},
- {["id"] = 13, ["name"] = "Skeletal Archer", ["level"] = 5, ["loot"] = {["exp"] = 9, ["coins"] = 9, ["items"] = {
- {28,3},{29,3},{21,1},{22,1},{23,1},{24,1},{17,1},{20,2},{34,2},{13,1},
- }},["atds"] = 8, ["agr"] = true, ["vrespawn"] = 35, ["image"] = sceletonarcherMdl[1], ["roletype"] = "e"},
- {["id"] = 14, ["name"] = "Female Ghost", ["level"] = 5, ["loot"] = {["exp"] = 9, ["coins"] = 4, ["items"] = {
- {28,5},{29,5},{21,1},{22,1},{23,1},{24,1},{17,1},{20,1},{34,1},{13,1},
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 40, ["image"] = femaleghostMdl[1], ["roletype"] = "e"},
- {["id"] = 15, ["name"] = "Venomous Ghoul", ["level"] = 6, ["loot"] = {["exp"] = 12, ["coins"] = 6, ["items"] = {
- {28,5},{29,5},{21,1},{22,1},{23,1},{24,1},{37,1},{38,1},{39,1},{40,1},{17,1},{20,1},{34,1},{41,1},{13,1},{47,1}
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 35, ["image"] = venomousghoulMdl[1], ["roletype"] = "e"},
- {["id"] = 16, ["name"] = "Decaying Ghoul", ["level"] = 9, ["loot"] = {["exp"] = 31, ["coins"] = 17, ["items"] = {
- {30,12},{31,12},{37,2},{38,2},{39,2},{40,2},{35,2},{20,3},{34,3},{41,3},{13,1},{47,1}
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 600, ["image"] = decayingghoulMdl[1], ["roletype"] = "e"},
- {["id"] = 17, ["name"] = "Stone Golem", ["level"] = 7, ["loot"] = {["exp"] = 14, ["coins"] = 11, ["items"] = {
- {28,5},{29,5},{37,1},{38,1},{39,1},{40,1},{17,1},{20,2},{34,2},{41,2},{13,1},
- }},["atds"] = 4, ["agr"] = true, ["vrespawn"] = 35, ["image"] = stonegolemMdl[1], ["roletype"] = "e"},
- {["id"] = 18, ["name"] = "Iron Turtle", ["level"] = 7, ["loot"] = {["exp"] = 14, ["coins"] = 12, ["items"] = {
- {28,5},{29,5},{37,1},{38,1},{39,1},{40,1},{17,1},{20,2},{34,2},{41,2},{13,1},{47,1}
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 30, ["image"] = ironturtleMdl[1], ["roletype"] = "e"},
- {["id"] = 19, ["name"] = "Blacksmith", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["vrespawn"] = 0, ["image"] = bsmith1Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow4},
- {["id"] = 20, ["name"] = "Copper Ore", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {
- {1,100},{1,1}
- }}, ["vrespawn"] = 600, ["image"] = copperoreMdl[1], ["roletype"] = "r"},
- {["id"] = 21, ["name"] = "Tree Root", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {
- {34,100},{34,1}
- }}, ["vrespawn"] = 600, ["image"] = treerootMdl[1], ["roletype"] = "r"},
- {["id"] = 22, ["name"] = "Iron Ore", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {
- {3,100},{3,1}
- }}, ["vrespawn"] = 600, ["image"] = ironoreMdl[1], ["roletype"] = "r"},
- {["id"] = 23, ["name"] = "Coarse Gravel", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {
- {49,100},{49,1}
- }}, ["vrespawn"] = 600, ["image"] = gravelMdl[1], ["roletype"] = "r"},
- {["id"] = 24, ["name"] = "Wind Elemental", ["level"] = 15, ["mhp"] = 430,
- ["loot"] = {["exp"] = 42, ["coins"] = 37, ["items"] = {
- }},["atds"] = 4, ["agr"] = true, ["vrespawn"] = 21600, ["image"] = windelmentalMdl[1], ["roletype"] = "m"},
- {["id"] = 25, ["name"] = "Goblin Henghtu", ["level"] = 8, ["loot"] = {["exp"] = 16, ["coins"] = 14, ["items"] = {
- {28,5},{29,5},{30,5},{31,5},{37,1},{38,1},{39,1},{40,1},{35,1},{20,2},{34,2},{41,2},{13,1},{47,1}
- }},["atds"] = 4, ["agr"] = true, ["vrespawn"] = 35, ["image"] = goblinheghtuMdl[1], ["roletype"] = "e"},
- {["id"] = 26, ["name"] = "Demonic Maggot", ["level"] = 9, ["loot"] = {["exp"] = 18, ["coins"] = 15, ["items"] = {
- {30,5},{31,5},{37,1},{38,1},{39,1},{40,1},{35,1},{20,2},{34,2},{41,2},{13,1},{47,1}
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 40, ["image"] = devilmaggotMdl[1], ["roletype"] = "e"},
- {["id"] = 27, ["name"] = "Zombie Warrior", ["level"] = 10, ["loot"] = {["exp"] = 22, ["coins"] = 18, ["items"] = {
- {30,5},{31,5},{37,1},{38,1},{39,1},{40,1},{35,1},{20,2},{34,2},{41,2},{13,1},{48,1}
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 40, ["image"] = zombiewarriorMdl[1], ["roletype"] = "e"},
- {["id"] = 28, ["name"] = "Sage Spirit", ["level"] = 11, ["loot"] = {["exp"] = 25, ["coins"] = 23, ["items"] = {
- {30,5},{31,5},{43,1},{44,1},{45,1},{46,1},{35,1},{20,2},{34,2},{41,2},{13,1},{48,1}
- }},["atds"] = 5, ["agr"] = true, ["vrespawn"] = 40, ["image"] = sagespiritMdl[1], ["roletype"] = "e"},
- {["id"] = 29, ["name"] = "Soulless", ["level"] = 12, ["loot"] = {["exp"] = 27, ["coins"] = 28, ["items"] = {
- {30,5},{31,5},{43,1},{44,1},{45,1},{46,1},{35,1},{20,2},{34,2},{41,2},{13,1},{48,1}
- }},["atds"] = 3, ["agr"] = true, ["vrespawn"] = 40, ["image"] = soullessMdl[1], ["roletype"] = "e"},
- {["id"] = 30, ["name"] = "Apothecary", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["vrespawn"] = 0, ["image"] = apothecary1Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow5},
- {["id"] = 31, ["name"] = "Blacksmith", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["vrespawn"] = 0, ["image"] = bsmith1Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow6},
- {["id"] = 32, ["name"] = "Koletan", ["level"] = 0, ["loot"] = {["exp"] = 0, ["coins"] = 0, ["items"] = {}},
- ["image"] = habitant3Mdl[1], ["roletype"] = "f",["dialog"] = dialogwindow7},
- }
- --
- local CQuestsLoad = {
- {["name"] = "Living corpses", ["type"] = "k", ["targ"] = 4, ["num"] = 5, ["minlvl"] = 1, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 10, ["xp"] = 12, ["item"] = {26,5}}},
- {["name"] = "Ghost", ["type"] = "k", ["targ"] = 5, ["num"] = 1, ["minlvl"] = 1, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 10, ["xp"] = 14, ["item"] = {27,5}}},
- {["name"] = "Swamp slugs", ["type"] = "k", ["targ"] = 6, ["num"] = 10, ["minlvl"] = 2, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 17, ["xp"] = 22, ["item"] = {25,1}}},
- {["name"] = "Turtles", ["type"] = "k", ["targ"] = 10, ["num"] = 5, ["minlvl"] = 4, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 13, ["xp"] = 12, ["item"] = {50,1}}},
- {["name"] = "Decaying ghoul", ["type"] = "k", ["targ"] = 16, ["num"] = 1, ["minlvl"] = 6, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 37, ["xp"] = 11, ["item"] = {51,1}}},
- {["name"] = "Living iron", ["type"] = "k", ["targ"] = 18, ["num"] = 5, ["minlvl"] = 6, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 17, ["xp"] = 21, ["item"] = {52,1}}},
- {["name"] = "Parasites", ["type"] = "k", ["targ"] = 26, ["num"] = 10, ["minlvl"] = 9, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 56, ["xp"] = 29, ["item"] = {55,1}}},
- {["name"] = "Green foliage", ["type"] = "k", ["targ"] = 8, ["num"] = 5, ["minlvl"] = 3, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 5, ["xp"] = 11, ["item"] = {0,0}}},
- {["name"] = "Tree roots", ["type"] = "k", ["targ"] = 11, ["num"] = 5, ["minlvl"] = 4, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 12, ["xp"] = 25, ["item"] = {0,0}}},
- {["name"] = "Ghosts", ["type"] = "k", ["targ"] = 28, ["num"] = 5, ["minlvl"] = 10, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 68, ["xp"] = 33, ["item"] = {58,1}}},
- {["name"] = "Soullsess soldiers", ["type"] = "k", ["targ"] = 29, ["num"] = 10, ["minlvl"] = 11, ["maxlvl"] = 100, ["comp"] = 0, ["qreward"] = {["coins"] = 55, ["xp"] = 36, ["item"] = {57,1}}},
- }
- local cEffectsLoad = {
- {["name"] = "Health potion", ["type"] = "hpi", ["value"] = 10, ["duration"] = 10, ["icon"] = {{16384,"H"},{2,"P"}}},
- {["name"] = "Mana potion", ["type"] = "mpi", ["value"] = 10, ["duration"] = 10, ["icon"] = {{2048,"M"},{2,"P"}}},
- {["name"] = "Health potion", ["type"] = "hpi", ["value"] = 15, ["duration"] = 10, ["icon"] = {{16384,"H"},{2,"P"}}},
- {["name"] = "Mana potion", ["type"] = "mpi", ["value"] = 15, ["duration"] = 10, ["icon"] = {{2048,"M"},{2,"P"}}},
- {["name"] = "Health potion", ["type"] = "hpi", ["value"] = 25, ["duration"] = 10, ["icon"] = {{16384,"H"},{2,"P"}}},
- {["name"] = "Mana potion", ["type"] = "mpi", ["value"] = 25, ["duration"] = 10, ["icon"] = {{2048,"M"},{2,"P"}}},
- {["name"] = "Health potion", ["type"] = "hpi", ["value"] = 35, ["duration"] = 10, ["icon"] = {{16384,"H"},{2,"P"}}},
- {["name"] = "Mana potion", ["type"] = "mpi", ["value"] = 40, ["duration"] = 10, ["icon"] = {{2048,"M"},{2,"P"}}},
- {["name"] = "Health potion", ["type"] = "hpi", ["value"] = 60, ["duration"] = 10, ["icon"] = {{16384,"H"},{2,"P"}}},
- {["name"] = "Mana potion", ["type"] = "mpi", ["value"] = 65, ["duration"] = 10, ["icon"] = {{2048,"M"},{2,"P"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 6, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 11, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 18, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 27, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 41, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 69, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Bleeding", ["type"] = "hpd", ["value"] = 92, ["duration"] = 10, ["icon"] = {{16384,"B"},{16,"l"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 10, ["duration"] = 8, ["icon"] = {{16384,"W"},{512,"H"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 14, ["duration"] = 8, ["icon"] = {{16384,"W"},{512,"H"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 28, ["duration"] = 9, ["icon"] = {{16384,"W"},{512,"H"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 40, ["duration"] = 9, ["icon"] = {{16384,"W"},{512,"H"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 56, ["duration"] = 10, ["icon"] = {{16384,"W"},{512,"H"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 79, ["duration"] = 10, ["icon"] = {{16384,"W"},{512,"H"}}},
- {["name"] = "Warrior healing", ["type"] = "hpi", ["value"] = 94, ["duration"] = 10, ["icon"] = {{16384,"W"},{512,"H"}}},
- }
- local cSkillsLoad = {
- {["name"] = "Phisical Attack", ["distance"] = vAttackDistance, ["type"] = "attack", ["typedm"] = "p", ["level"] = 1, ["reloading"] = VAttackPause,
- ["mindamage"] = {0,0,0,0,0,0,0}, ["maxdamage"] = {1,1,1,1,1,1,1}, ["manacost"] = {0,0,0,0,0,0,0}, ["eff"] = {0,0,0,0,0,0,0}},
- {["name"] = "Deep Cut", ["distance"] = 4, ["type"] = "attack", ["typedm"] = "p", ["level"] = 1, ["reloading"] = 3,
- ["mindamage"] = {2,3,5,7,10,13,15}, ["maxdamage"] = {2,4,6,9,11,16,19}, ["manacost"] = {5,7,8,10,12,15,19}, ["eff"] = {0,0,0,0,0,0,0}},
- {["name"] = "Draw Blood", ["distance"] = 4, ["type"] = "attack", ["typedm"] = "p", ["level"] = 1, ["reloading"] = 8,
- ["mindamage"] = {1,2,4,6,9,11,13}, ["maxdamage"] = {2,3,6,8,10,13,16}, ["manacost"] = {6,8,9,11,13,16,20}, ["eff"] = {11,12,13,14,15,16,17}},
- {["name"] = "Stream Strike", ["distance"] = 5, ["type"] = "attack", ["typedm"] = "p", ["level"] = 1, ["reloading"] = 5,
- ["mindamage"] = {3,5,8,11,14,18,23}, ["maxdamage"] = {5,8,11,14,18,23,28}, ["manacost"] = {6,9,12,15,19,25,32}, ["eff"] = {0,0,0,0,0,0,0}},
- {["name"] = "Warrior Healing", ["distance"] = 0, ["type"] = "buff", ["typedm"] = "p", ["level"] = 1, ["reloading"] = 30,
- ["manacost"] = {8,10,11,13,15,18,22}, ["eff"] = {18,19,20,21,22,23,24}},
- }
- local cItemsLoad = {
- {["name"] = "Copper Ingot", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 1, ["ncolor"] = 1},
- {["name"] = "Bronze Ingot", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 14, ["ncolor"] = 1},
- {["name"] = "Iron Ingot", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 8, ["ncolor"] = 1},
- {["name"] = "Purified Iron Ingot", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 8, ["ncolor"] = 1},
- {["name"] = "Rookie's Helmet", ["level"] = 1, ["type"] = "armor", ["subtype"] = "helmet", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 14, ["magdef"] = 0}, ["stackable"] = false, ["cost"] = 5, ["icon"] = 7, ["ncolor"] = 1},
- {["name"] = "Rookie's Armor", ["level"] = 1, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 16, ["magdef"] = 11}, ["stackable"] = false, ["cost"] = 5, ["icon"] = 3, ["ncolor"] = 1},
- {["name"] = "Rookie's Pants", ["level"] = 1, ["type"] = "armor", ["subtype"] = "pants", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 15, ["magdef"] = 10}, ["stackable"] = false, ["cost"] = 5, ["icon"] = 15, ["ncolor"] = 1},
- {["name"] = "Rookie's Boots", ["level"] = 1, ["type"] = "armor", ["subtype"] = "footwear", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 15, ["magdef"] = 8}, ["stackable"] = false, ["cost"] = 5, ["icon"] = 2, ["ncolor"] = 1},
- {["name"] = "Animal Fur", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 2, ["icon"] = 4, ["ncolor"] = 1},
- {["name"] = "Rough Fur", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 3, ["icon"] = 6, ["ncolor"] = 1},
- {["name"] = "Vegetable Oil", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 1, ["icon"] = 9, ["ncolor"] = 1},
- {["name"] = "Green Slime", ["type"] = "item", ["subtype"] = "none", ["description"] = "",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 1, ["icon"] = 10, ["ncolor"] = 1},
- {["name"] = "Rough Cloth", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 1, ["icon"] = 11, ["ncolor"] = 1},
- {["name"] = "Cloth Hat", ["level"] = 1, ["type"] = "armor", ["subtype"] = "helmet", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 0, ["magdef"] = 15}, ["stackable"] = false, ["cost"] = 5, ["icon"] = 17, ["ncolor"] = 1},
- {["name"] = "Wooden Sword", ["level"] = 1, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 1, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 5, ["ncolor"] = 16},
- {["name"] = "Long Sword", ["level"] = 1, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 3, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 6, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 18, ["ncolor"] = 1},
- {["name"] = "Refined Sword", ["level"] = 2, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 9, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 14, ["icon"] = 19, ["ncolor"] = 1},
- {["name"] = "Copper Pendant", ["level"] = 2, ["type"] = "armor", ["subtype"] = "pendant", ["reqlvl"] = 3, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 10, ["magdef"] = 13}, ["stackable"] = false, ["cost"] = 12, ["icon"] = 16, ["ncolor"] = 1},
- {["name"] = "Bone Necklace", ["level"] = 1, ["type"] = "armor", ["subtype"] = "pendant", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 6, ["magdef"] = 9}, ["stackable"] = false, ["cost"] = 5, ["icon"] = 20, ["ncolor"] = 1},
- {["name"] = "Leather", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 21, ["ncolor"] = 1},
- {["name"] = "Leather Helmet", ["level"] = 2, ["type"] = "armor", ["subtype"] = "helmet", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 21, ["magdef"] = 1}, ["stackable"] = false, ["cost"] = 12, ["icon"] = 22, ["ncolor"] = 1},
- {["name"] = "Leather Armor", ["level"] = 2, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 25, ["magdef"] = 20}, ["stackable"] = false, ["cost"] = 12, ["icon"] = 24, ["ncolor"] = 1},
- {["name"] = "Leather Pants", ["level"] = 2, ["type"] = "armor", ["subtype"] = "pants", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 24, ["magdef"] = 19}, ["stackable"] = false, ["cost"] = 12, ["icon"] = 23, ["ncolor"] = 1},
- {["name"] = "Leather Boots", ["level"] = 2, ["type"] = "armor", ["subtype"] = "footwear", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 24, ["magdef"] = 17}, ["stackable"] = false, ["cost"] = 12, ["icon"] = 25, ["ncolor"] = 1},
- {["name"] = "Long Sword", ["level"] = 2, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 3, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 6, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 18, ["ncolor"] = 16},
- {["name"] = "Small Health Potion", ["type"] = "potion", ["subtype"] = "health", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = 1, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 1, ["icon"] = 12, ["ncolor"] = 1},
- {["name"] = "Small Mana Potion", ["type"] = "potion", ["subtype"] = "mana", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = 2, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 1, ["icon"] = 13, ["ncolor"] = 1},
- {["name"] = "Medium Health Potion", ["type"] = "potion", ["subtype"] = "health", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = 3, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 2, ["icon"] = 26, ["ncolor"] = 1},
- {["name"] = "Medium Mana Potion", ["type"] = "potion", ["subtype"] = "mana", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = 4, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 2, ["icon"] = 27, ["ncolor"] = 1},
- {["name"] = "Large Health Potion", ["type"] = "potion", ["subtype"] = "health", ["reqlvl"] = 10, ["description"] = "",
- ["props"] = 5, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 3, ["icon"] = 28, ["ncolor"] = 1},
- {["name"] = "Large Mana Potion", ["type"] = "potion", ["subtype"] = "mana", ["reqlvl"] = 10, ["description"] = "",
- ["props"] = 6, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 3, ["icon"] = 29, ["ncolor"] = 1},
- {["name"] = "Condensed Health Potion", ["type"] = "potion", ["subtype"] = "health", ["reqlvl"] = 15, ["description"] = "",
- ["props"] = 7, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 4, ["icon"] = 30, ["ncolor"] = 1},
- {["name"] = "Condensed Mana Potion", ["type"] = "potion", ["subtype"] = "mana", ["reqlvl"] = 15, ["description"] = "",
- ["props"] = 8, ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 4, ["icon"] = 31, ["ncolor"] = 1},
- {["name"] = "Log", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 32, ["ncolor"] = 1},
- {["name"] = "Tempered Iron Sword", ["level"] = 3, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 8, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 22, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 20, ["icon"] = 33, ["ncolor"] = 1},
- {["name"] = "Rough Thread", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 3, ["icon"] = 34, ["ncolor"] = 1},
- {["name"] = "Rough Helmet", ["level"] = 3, ["type"] = "armor", ["subtype"] = "helmet", ["reqlvl"] = 8, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 32, ["magdef"] = 5}, ["stackable"] = false, ["cost"] = 21, ["icon"] = 38, ["ncolor"] = 1},
- {["name"] = "Deerskin Armor", ["level"] = 3, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 8, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 38, ["magdef"] = 27}, ["stackable"] = false, ["cost"] = 21, ["icon"] = 35, ["ncolor"] = 1},
- {["name"] = "Deerskin Pants", ["level"] = 3, ["type"] = "armor", ["subtype"] = "pants", ["reqlvl"] = 8, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 37, ["magdef"] = 26}, ["stackable"] = false, ["cost"] = 21, ["icon"] = 36, ["ncolor"] = 1},
- {["name"] = "Deerskin Boots", ["level"] = 3, ["type"] = "armor", ["subtype"] = "footwear", ["reqlvl"] = 8, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 37, ["magdef"] = 26}, ["stackable"] = false, ["cost"] = 21, ["icon"] = 37, ["ncolor"] = 1},
- {["name"] = "Wool Thread", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 4, ["icon"] = 39, ["ncolor"] = 1},
- {["name"] = "Heavy Sword", ["level"] = 4, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 12, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 37, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 27, ["icon"] = 40, ["ncolor"] = 1},
- {["name"] = "Bronze Helmet", ["level"] = 4, ["type"] = "armor", ["subtype"] = "helmet", ["reqlvl"] = 12, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 47, ["magdef"] = 10}, ["stackable"] = false, ["cost"] = 25, ["icon"] = 41, ["ncolor"] = 1},
- {["name"] = "Ring Mail", ["level"] = 4, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 12, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 51, ["magdef"] = 44}, ["stackable"] = false, ["cost"] = 26, ["icon"] = 42, ["ncolor"] = 1},
- {["name"] = "Ring Pants", ["level"] = 4, ["type"] = "armor", ["subtype"] = "pants", ["reqlvl"] = 12, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 50, ["magdef"] = 45}, ["stackable"] = false, ["cost"] = 26, ["icon"] = 43, ["ncolor"] = 1},
- {["name"] = "Ring Boots", ["level"] = 4, ["type"] = "armor", ["subtype"] = "footwear", ["reqlvl"] = 12, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 48, ["magdef"] = 42}, ["stackable"] = false, ["cost"] = 26, ["icon"] = 44, ["ncolor"] = 1},
- {["name"] = "Fang Necklace", ["level"] = 3, ["type"] = "armor", ["subtype"] = "pendant", ["reqlvl"] = 7, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 2, ["magdef"] = 5}, ["stackable"] = false, ["cost"] = 18, ["icon"] = 45, ["ncolor"] = 1},
- {["name"] = "White Jade Amulet", ["level"] = 4, ["type"] = "armor", ["subtype"] = "pendant", ["reqlvl"] = 11, ["description"] = "",
- ["props"] = {["hp+"] = 0, ["phisdef"] = 4, ["magdef"] = 6}, ["stackable"] = false, ["cost"] = 23, ["icon"] = 46, ["ncolor"] = 1},
- {["name"] = "Gravel", ["type"] = "item", ["subtype"] = "none", ["description"] = "Can be used for crafting",
- ["stackable"] = true, ["maxstack"] = 99, ["cost"] = 5, ["icon"] = 47, ["ncolor"] = 1},
- {["name"] = "Leather Helmet", ["level"] = 2, ["type"] = "armor", ["subtype"] = "helmet", ["reqlvl"] = 5, ["description"] = "",
- ["props"] = {["hp+"] = 5, ["phisdef"] = 21, ["magdef"] = 1}, ["stackable"] = false, ["cost"] = 12, ["icon"] = 22, ["ncolor"] = 2048},
- {["name"] = "Refined Sword", ["level"] = 2, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 5, ["description"] = "Unique sword: quest reward",
- ["props"] = {["str+"] = 1, ["atds"] = 3, ["hp+"] = 0, ["phisat"] = 17, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 19, ["ncolor"] = 2048},
- {["name"] = "Rough Leather Armor", ["level"] = 2, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 6, ["description"] = "",
- ["props"] = {["sur+"] = 1, ["hp+"] = 0, ["phisdef"] = 34, ["magdef"] = 26}, ["stackable"] = false, ["cost"] = 20, ["icon"] = 24, ["ncolor"] = 2048},
- {["name"] = "Steel Sword", ["level"] = 5, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 17, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 62, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 34, ["icon"] = 48, ["ncolor"] = 1},
- {["name"] = "Nature's Blade", ["level"] = 6, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 23, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 93, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 40, ["icon"] = 49, ["ncolor"] = 1},
- {["name"] = "Two handed Sword", ["level"] = 4, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 10, ["description"] = "Unique sword: quest reward",
- ["props"] = {["str+"] = 1, ["atds"] = 3, ["hp+"] = 5, ["phisat"] = 40, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 27, ["icon"] = 40, ["ncolor"] = 2048},
- {["name"] = "Forceblade", ["level"] = 7, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 28, ["description"] = "",
- ["props"] = {["atds"] = 3, ["hp+"] = 0, ["phisat"] = 162, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 63, ["icon"] = 50, ["ncolor"] = 1},
- {["name"] = "Soul Reaper Sword", ["level"] = 5, ["type"] = "weapon", ["subtype"] = "sword", ["reqlvl"] = 12, ["description"] = "Unique sword: quest reward",
- ["props"] = {["sur+"] = 1, ["str+"] = 1, ["atds"] = 3, ["hp+"] = 0, ["phisat"] = 97, ["magat"] = 0}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 48, ["ncolor"] = 2048},
- {["name"] = "Ring Mail", ["level"] = 4, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 11, ["description"] = "Unique armor: quest reward",
- ["props"] = {["int+"] = 1, ["hp+"] = 15, ["phisdef"] = 67, ["magdef"] = 54}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 42, ["ncolor"] = 2048},
- {["name"] = "Warflame Battleplate", ["level"] = 15, ["type"] = "armor", ["subtype"] = "bodywear", ["reqlvl"] = 1, ["description"] = "",
- ["props"] = {["sur+"] = 100, ["str+"] = 100, ["int+"] = 100, ["hp+"] = 58, ["phisdef"] = 763, ["magdef"] = 608}, ["stackable"] = false, ["cost"] = 1, ["icon"] = 42, ["ncolor"] = 2},
- }
- local cBIload = {
- {["name"] = "woodenhouse", ["image"] = imgWoodenhouse1}
- }
- local worldCDataArray = {}
- local cSkillsArray = {{1,0,1},{2,0,1},{3,0,1},{4,0,1},{5,0,1},{0,0,0},{0,0,0}}
- local cQuestsArray = {} -- [1] = {1(id),0(killed),false(completed)}
- local cEffectsArray = {}
- local cBIArray = {}
- local inventory = {["weared"] = {["helmet"] = 0, ["bodywear"] = 0, ["pants"] = 0, ["footwear"] = 0, ["weapon"] = 15, ["pendant"] = 0},
- ["bag"] = {}
- }
- for f = 1, 15 do
- inventory["bag"][f] = {}
- inventory["bag"][f][1] = 0
- inventory["bag"][f][2] = 0
- end
- local sPouseMenu = false
- local paused = false
- local globalWXC = 1
- local backgroundcPos = 1
- local tbackg = paintutils.loadImage("/backgroundg.img")
- local vOpenDialogWindow = false
- local vOpenQuestsWindow = false
- local vOpenInventoryWindow = false
- local vOpenArmorInventoryWindow = false
- local vOpenstatsWindow = false
- local playername = "Player"
- local playerTurning = "r"
- local cDialog = 0
- local cTarget = 0
- local cmp = 0
- local mmp = 0
- local cxp = 0
- local mxp = 0
- local coins = 0
- local survivability = 1
- local strength = 1
- local intelligence = 1
- local vpickwait = false
- local vpcingupm = 0
- local vcpcingup = 0
- CDataLoad[1]["name"] = playername
- local secMsgArray = {}
- local tArrayms = 0
- secMsgArray[1] = ""
- local function addsecm(text)
- secMsgArray[#secMsgArray] = text
- tArrayms = 10
- end
- local function addItem(itemid,num)
- local vparInvEx = 0
- for f = 1, #inventory["bag"] do
- if inventory["bag"][f][1] == 0 and inventory["bag"][f][1] ~= itemid and not cItemsLoad[itemid]["stackable"] then
- inventory["bag"][f][1] = itemid
- inventory["bag"][f][2] = num
- break
- end
- end
- if cItemsLoad[itemid]["stackable"] and vparInvEx == 0 then
- for i = 1, #inventory["bag"] do
- if inventory["bag"][i][1] == itemid then
- inventory["bag"][i][2] = inventory["bag"][i][2] + num
- vparInvEx = 1
- break
- end
- end
- if vparInvEx == 0 then
- for i = 1, #inventory["bag"] do
- if inventory["bag"][i][1] == 0 then
- inventory["bag"][i][1] = itemid
- inventory["bag"][i][2] = num
- break
- end
- end
- end
- end
- for f = 1, 15 do
- if inventory["bag"][f][1] ~= 0 and not cItemsLoad[inventory["bag"][f][1]]["stackable"] and inventory["bag"][f][2] > 1 then
- inventory["bag"][f][2] = 1
- end
- end
- end
- -- addItem(1,1)
- --[[
- addItem(#cItemsLoad,1)
- addItem(9,10)
- addItem(10,10)
- addItem(36,10)
- addItem(3,10)
- addItem(34,10)
- addItem(20,10)
- addItem(41,10)
- addItem(1,10)
- addItem(49,10)
- addItem(42,1)
- addItem(53,1)
- addItem(55,1)
- ]]--
- local function addBackgroundItem(id,x,y)
- cBIArray[#cBIArray+1] = {}
- cBIArray[#cBIArray]["name"] = cBIload[id]["name"]
- cBIArray[#cBIArray]["image"] = cBIload[id]["image"]
- cBIArray[#cBIArray]["x"] = x
- cBIArray[#cBIArray]["y"] = y
- end
- addBackgroundItem(1,10,13)
- addBackgroundItem(1,-61,13)
- local function addCDataUnit(id,x,y)
- worldCDataArray[#worldCDataArray+1] = {}
- worldCDataArray[#worldCDataArray]["sx"] = x
- worldCDataArray[#worldCDataArray]["mx"] = x
- worldCDataArray[#worldCDataArray]["x"] = x
- worldCDataArray[#worldCDataArray]["y"] = y
- worldCDataArray[#worldCDataArray]["id"] = CDataLoad[id]["id"]
- local mxnum = 0
- for f = 1, #CDataLoad[id]["image"] do
- if #CDataLoad[id]["image"][f] > mxnum then
- mxnum = #CDataLoad[id]["image"][f]
- end
- end
- local imgWidth = mxnum
- worldCDataArray[#worldCDataArray]["width"] = imgWidth
- worldCDataArray[#worldCDataArray]["height"] = #CDataLoad[id]["image"]
- worldCDataArray[#worldCDataArray]["name"] = CDataLoad[id]["name"]
- worldCDataArray[#worldCDataArray]["level"] = CDataLoad[id]["level"]
- worldCDataArray[#worldCDataArray]["spos"] = "r"
- worldCDataArray[#worldCDataArray]["image"] = CDataLoad[id]["image"]
- worldCDataArray[#worldCDataArray]["mhp"] = math.ceil((15+CDataLoad[id]["level"]*1.85)*(CDataLoad[id]["level"]*0.75))
- worldCDataArray[#worldCDataArray]["mhp"] = math.ceil(12+(CDataLoad[id]["level"]-1)*(3*(CDataLoad[id]["level"]*0.75)))
- worldCDataArray[#worldCDataArray]["chp"] = worldCDataArray[#worldCDataArray]["mhp"]
- mxp = math.ceil(CDataLoad[id]["level"]*5+(CDataLoad[id]["level"]*21.7))
- mmp = math.ceil(CDataLoad[id]["level"]*5+(CDataLoad[id]["level"]*11.46))
- cmp = mmp
- worldCDataArray[#worldCDataArray]["phisatck"] = math.ceil(0.35+CDataLoad[id]["level"]*0.8)
- worldCDataArray[#worldCDataArray]["magatck"] = math.ceil(0.75+CDataLoad[id]["level"]*0.3)
- worldCDataArray[#worldCDataArray]["phisdef"] = math.ceil(8+CDataLoad[id]["level"]*2.4)
- worldCDataArray[#worldCDataArray]["magdef"] = math.ceil(6+CDataLoad[id]["level"]*1.1)
- worldCDataArray[#worldCDataArray]["resptime"] = 0
- worldCDataArray[#worldCDataArray]["living"] = true
- worldCDataArray[#worldCDataArray]["roletype"] = CDataLoad[id]["roletype"]
- worldCDataArray[#worldCDataArray]["attackdistance"] = CDataLoad[id]["atds"]
- worldCDataArray[#worldCDataArray]["attplayer"] = false
- worldCDataArray[#worldCDataArray]["agrtime"] = 0
- if CDataLoad[id]["roletype"] == "f" then
- worldCDataArray[#worldCDataArray]["dialog"] = CDataLoad[id]["dialog"]
- end
- worldCDataArray[#worldCDataArray]["effects"] = {}
- for f = 1, 8 do
- worldCDataArray[#worldCDataArray]["effects"][f] = {}
- worldCDataArray[#worldCDataArray]["effects"][f][1] = 0
- worldCDataArray[#worldCDataArray]["effects"][f][2] = 0
- end
- if CDataLoad[id]["roletype"] == "m" then
- worldCDataArray[#worldCDataArray]["mhp"] = CDataLoad[id]["mhp"]
- worldCDataArray[#worldCDataArray]["chp"] = worldCDataArray[#worldCDataArray]["mhp"]
- end
- end
- addCDataUnit(1,1,1)
- for f = 1, math.random(1,10) do
- addCDataUnit(20,math.random(70,4500),2)
- end
- for f = 1, math.random(1,10) do
- addCDataUnit(21,math.random(70,4500),3)
- end
- for f = 1, math.random(1,10) do
- addCDataUnit(22,math.random(70,4500),2)
- end
- for f = 1, math.random(1,10) do
- addCDataUnit(23,math.random(70,4500),2)
- end
- addCDataUnit(2,-10,8)
- addCDataUnit(3,-19,8)
- addCDataUnit(12,-31,8)
- addCDataUnit(19,-42,8)
- addCDataUnit(30,-50,8)
- addCDataUnit(4,88,8)
- addCDataUnit(4,101,8)
- addCDataUnit(4,125,8)
- addCDataUnit(4,168,8)
- addCDataUnit(4,201,8)
- addCDataUnit(4,242,8)
- addCDataUnit(4,260,8)
- addCDataUnit(4,291,8)
- addCDataUnit(5,342,9)
- addCDataUnit(5,368,9)
- for f = 1, 10 do
- addCDataUnit(6,391+f*34-34,7)
- end
- for f = 1, 4 do
- addCDataUnit(7,413+f*51-51,2)
- end
- for f = 1, 9 do
- addCDataUnit(8,714+f*28-28,6)
- end
- for f = 1, 4 do
- addCDataUnit(9,722+f*38-38,9)
- end
- for f = 1, 5 do
- addCDataUnit(10,951+f*36-36,4)
- end
- for f = 1, 6 do
- addCDataUnit(11,1127+f*41-41,10)
- end
- for f = 1, 5 do
- addCDataUnit(13,1372+f*42-42,9)
- end
- for f = 1, 7 do
- addCDataUnit(14,1387+f*39-39,9)
- end
- for f = 1, 8 do
- addCDataUnit(15,1660+f*35-35,8)
- end
- addCDataUnit(16,1957,8)
- for f = 1, 9 do
- addCDataUnit(17,2003+f*32-32,9)
- end
- for f = 1, 6 do
- addCDataUnit(18,2297+f*36-36,4)
- end
- -- addCDataUnit(24,25,9) -- wind elemental
- for f = 1, 10 do
- addCDataUnit(25,2539+f*39-39,8)
- end
- for f = 1, 9 do
- addCDataUnit(26,2929+f*41-41,8)
- end
- addCDataUnit(31,3298,8)
- addCDataUnit(32,3306,8)
- for f = 1, 10 do
- addCDataUnit(27,3379+f*35-35,8)
- end
- for f = 1, 11 do
- addCDataUnit(28,3729+f*37-37,9)
- end
- for f = 1, 8 do
- addCDataUnit(29,4135+f*34-34,8)
- end
- worldCDataArray[1]["mhp"] = worldCDataArray[1]["mhp"]+math.ceil(2+worldCDataArray[1]["level"]*1.5)
- worldCDataArray[1]["chp"] = worldCDataArray[1]["mhp"]
- local vSur = 0
- local vStr = 0
- local vInt = 0
- local vHpi = 0
- local vPdm = 0
- local vMdm = 0
- local vPdf = 0
- local vMdf = 0
- local function playerVarRef()
- vAttackDistance = 2
- vSur = 0
- vStr = 0
- vInt = 0
- vHpi = 0
- vPdm = 0
- vMdm = 0
- vPdf = 0
- vMdf = 0
- worldCDataArray[1]["mhp"] = math.ceil(4+survivability*11+(worldCDataArray[1]["level"]-1)*7)
- mmp = math.ceil(4+intelligence*6+(worldCDataArray[1]["level"]-1)*4)
- mxp = math.ceil(28+(worldCDataArray[1]["level"]-1)*34.7)
- worldCDataArray[1]["phisatck"] = math.ceil(strength*0.75+(worldCDataArray[1]["level"]-1)*0.5)
- worldCDataArray[1]["magatck"] = math.ceil(intelligence*0.25+(worldCDataArray[1]["level"]-1)*0.05)
- worldCDataArray[1]["phisdef"] = math.ceil(strength*2.4+(worldCDataArray[1]["level"]-1)*0.85)
- worldCDataArray[1]["magdef"] = math.ceil(intelligence*1.8+(worldCDataArray[1]["level"]-1)*0.5)
- if inventory["weared"]["helmet"] ~= 0 then
- if cItemsLoad[inventory["weared"]["helmet"]]["props"]["sur+"] ~= nil then
- vSur = vSur + cItemsLoad[inventory["weared"]["helmet"]]["props"]["sur+"]
- end
- if cItemsLoad[inventory["weared"]["helmet"]]["props"]["str+"] ~= nil then
- vStr = vStr + cItemsLoad[inventory["weared"]["helmet"]]["props"]["str+"]
- end
- if cItemsLoad[inventory["weared"]["helmet"]]["props"]["int+"] ~= nil then
- vInt = vInt + cItemsLoad[inventory["weared"]["helmet"]]["props"]["int+"]
- end
- if cItemsLoad[inventory["weared"]["helmet"]]["props"]["hp+"] ~= nil then
- vHpi = vHpi + cItemsLoad[inventory["weared"]["helmet"]]["props"]["hp+"]
- end
- vPdf = worldCDataArray[1]["phisdef"] + cItemsLoad[inventory["weared"]["helmet"]]["props"]["phisdef"]
- vMdf = worldCDataArray[1]["magdef"] + cItemsLoad[inventory["weared"]["helmet"]]["props"]["magdef"]
- end
- if inventory["weared"]["bodywear"] ~= 0 then
- if cItemsLoad[inventory["weared"]["bodywear"]]["props"]["sur+"] ~= nil then
- vSur = vSur + cItemsLoad[inventory["weared"]["bodywear"]]["props"]["sur+"]
- end
- if cItemsLoad[inventory["weared"]["bodywear"]]["props"]["str+"] ~= nil then
- vStr = vStr + cItemsLoad[inventory["weared"]["bodywear"]]["props"]["str+"]
- end
- if cItemsLoad[inventory["weared"]["bodywear"]]["props"]["int+"] ~= nil then
- vInt = vInt + cItemsLoad[inventory["weared"]["bodywear"]]["props"]["int+"]
- end
- if cItemsLoad[inventory["weared"]["bodywear"]]["props"]["hp+"] ~= nil then
- vHpi = vHpi + cItemsLoad[inventory["weared"]["bodywear"]]["props"]["hp+"]
- end
- vPdf = worldCDataArray[1]["phisdef"] + cItemsLoad[inventory["weared"]["bodywear"]]["props"]["phisdef"]
- vMdf = worldCDataArray[1]["magdef"] + cItemsLoad[inventory["weared"]["bodywear"]]["props"]["magdef"]
- end
- if inventory["weared"]["pants"] ~= 0 then
- if cItemsLoad[inventory["weared"]["pants"]]["props"]["sur+"] ~= nil then
- vSur = vSur + cItemsLoad[inventory["weared"]["pants"]]["props"]["sur+"]
- end
- if cItemsLoad[inventory["weared"]["pants"]]["props"]["str+"] ~= nil then
- vStr = vStr + cItemsLoad[inventory["weared"]["pants"]]["props"]["str+"]
- end
- if cItemsLoad[inventory["weared"]["pants"]]["props"]["int+"] ~= nil then
- vInt = vInt + cItemsLoad[inventory["weared"]["pants"]]["props"]["int+"]
- end
- if cItemsLoad[inventory["weared"]["pants"]]["props"]["hp+"] ~= nil then
- vHpi = vHpi + cItemsLoad[inventory["weared"]["pants"]]["props"]["hp+"]
- end
- vPdf = worldCDataArray[1]["phisdef"] + cItemsLoad[inventory["weared"]["pants"]]["props"]["phisdef"]
- vMdf = worldCDataArray[1]["magdef"] + cItemsLoad[inventory["weared"]["pants"]]["props"]["magdef"]
- end
- if inventory["weared"]["footwear"] ~= 0 then
- if cItemsLoad[inventory["weared"]["footwear"]]["props"]["sur+"] ~= nil then
- vSur = vSur + cItemsLoad[inventory["weared"]["footwear"]]["props"]["sur+"]
- end
- if cItemsLoad[inventory["weared"]["footwear"]]["props"]["str+"] ~= nil then
- vStr = vStr + cItemsLoad[inventory["weared"]["footwear"]]["props"]["str+"]
- end
- if cItemsLoad[inventory["weared"]["footwear"]]["props"]["int+"] ~= nil then
- vInt = vInt + cItemsLoad[inventory["weared"]["footwear"]]["props"]["int+"]
- end
- if cItemsLoad[inventory["weared"]["footwear"]]["props"]["hp+"] ~= nil then
- vHpi = vHpi + cItemsLoad[inventory["weared"]["footwear"]]["props"]["hp+"]
- end
- vPdf = worldCDataArray[1]["phisdef"] + cItemsLoad[inventory["weared"]["footwear"]]["props"]["phisdef"]
- vMdf = worldCDataArray[1]["magdef"] + cItemsLoad[inventory["weared"]["footwear"]]["props"]["magdef"]
- end
- if inventory["weared"]["pendant"] ~= 0 then
- if cItemsLoad[inventory["weared"]["pendant"]]["props"]["sur+"] ~= nil then
- vSur = vSur + cItemsLoad[inventory["weared"]["pendant"]]["props"]["sur+"]
- end
- if cItemsLoad[inventory["weared"]["pendant"]]["props"]["str+"] ~= nil then
- vStr = vStr + cItemsLoad[inventory["weared"]["pendant"]]["props"]["str+"]
- end
- if cItemsLoad[inventory["weared"]["pendant"]]["props"]["int+"] ~= nil then
- vInt = vInt + cItemsLoad[inventory["weared"]["pendant"]]["props"]["int+"]
- end
- if cItemsLoad[inventory["weared"]["pendant"]]["props"]["hp+"] ~= nil then
- vHpi = vHpi + cItemsLoad[inventory["weared"]["pendant"]]["props"]["hp+"]
- end
- vPdf = worldCDataArray[1]["phisdef"] + cItemsLoad[inventory["weared"]["pendant"]]["props"]["phisdef"]
- vMdf = worldCDataArray[1]["magdef"] + cItemsLoad[inventory["weared"]["pendant"]]["props"]["magdef"]
- end
- if inventory["weared"]["weapon"] ~= 0 then
- if cItemsLoad[inventory["weared"]["weapon"]]["props"]["sur+"] ~= nil then
- vSur = vSur + cItemsLoad[inventory["weared"]["weapon"]]["props"]["sur+"]
- end
- if cItemsLoad[inventory["weared"]["weapon"]]["props"]["str+"] ~= nil then
- vStr = vStr + cItemsLoad[inventory["weared"]["weapon"]]["props"]["str+"]
- end
- if cItemsLoad[inventory["weared"]["weapon"]]["props"]["int+"] ~= nil then
- vInt = vInt + cItemsLoad[inventory["weared"]["weapon"]]["props"]["int+"]
- end
- if cItemsLoad[inventory["weared"]["weapon"]]["props"]["hp+"] ~= nil then
- vHpi = vHpi + cItemsLoad[inventory["weared"]["weapon"]]["props"]["hp+"]
- end
- vPdm = worldCDataArray[1]["phisatck"] + cItemsLoad[inventory["weared"]["weapon"]]["props"]["phisat"]+(cItemsLoad[inventory["weared"]["weapon"]]["props"]["phisat"]/100*worldCDataArray[1]["level"])
- vMdm = worldCDataArray[1]["magatck"] + cItemsLoad[inventory["weared"]["weapon"]]["props"]["magat"]+(cItemsLoad[inventory["weared"]["weapon"]]["props"]["magat"]/100*worldCDataArray[1]["level"])
- vAttackDistance = cItemsLoad[inventory["weared"]["weapon"]]["props"]["atds"]
- end
- worldCDataArray[1]["mhp"] = math.ceil(4+(survivability+vSur)*11+(worldCDataArray[1]["level"]-1)*7)+vHpi
- mmp = math.ceil(4+(intelligence+vInt)*6+(worldCDataArray[1]["level"]-1)*4)
- worldCDataArray[1]["phisatck"] = math.floor(1+(strength+vStr-1)*0.9+(worldCDataArray[1]["level"]-1)*0.0025)+vPdm
- worldCDataArray[1]["magatck"] = math.floor(1+(intelligence+vInt-1)*0.25+(worldCDataArray[1]["level"]-1)*0.00015)+vMdm
- worldCDataArray[1]["phisdef"] = math.ceil(5+(strength+vStr-1)*29.4+(worldCDataArray[1]["level"]-1)*4.85)+vPdf
- worldCDataArray[1]["magdef"] = math.ceil(5+(intelligence+vInt-1)*22.8+(worldCDataArray[1]["level"]-1)*1.5)+vMdf
- end
- playerVarRef()
- local function getDistance(from,x)
- local dist = 0
- local x1, x2 = worldCDataArray[from]["x"], x
- if x1 < x2 then dist = x2-x1
- elseif x1 > x2 then dist = x1-x2
- else dist = 0
- end
- return dist
- end
- local function getDistanceToId(from,to)
- local dist = 0
- local x1, x2 = worldCDataArray[from]["x"], worldCDataArray[to]["x"]
- if x1 < x2 then dist = x2-x1-worldCDataArray[from]["width"]
- elseif x1 > x2+worldCDataArray[to]["width"] then dist = x1-x2-worldCDataArray[to]["width"]
- else dist = 0
- end
- return dist
- end
- local function movetoward(id, x, distanceLimit)
- if getDistance(id,x) < distanceLimit and x < worldCDataArray[id]["x"] then
- worldCDataArray[id]["x"] = worldCDataArray[id]["x"] - 1
- worldCDataArray[id]["spos"] = "l"
- elseif getDistance(id,x) < distanceLimit and x > worldCDataArray[id]["x"] then
- worldCDataArray[id]["x"] = worldCDataArray[id]["x"] + 1
- worldCDataArray[id]["spos"] = "r"
- end
- end
- local function pbar(buffer,x,y,size,percent,color1,color2, ... )
- if arg[3] == "rev" then percent = 100 - percent end
- local fill = {}
- for f = 1, size do
- table.insert(fill,1)
- end
- for f = 1, size do
- if 100/size*f <= percent then
- fill[size-f+1] = 0
- end
- end
- local color0 = 1
- for f = 1, size do
- if fill[f] == 1 then color0 = color1
- else color0 = color2
- end
- graphics.drawPixel(buffer,x+f-1,y,color0)
- graphics.dText(buffer,arg[1],x,y,arg[2])
- end
- end
- local function drawcBIArray()
- for f = 1, #cBIArray do
- graphics.addImage(buffer1,cBIArray[f]["image"],cBIArray[f]["x"]+20-globalWXC,19-cBIArray[f]["y"])
- end
- end
- local function drawCDataUnit()
- for f = 2, #worldCDataArray do
- if worldCDataArray[f]["living"] then
- if worldCDataArray[f]["spos"] == "r" then
- graphics.addImage(buffer1,worldCDataArray[f]["image"],worldCDataArray[f]["x"]+20-globalWXC,19-worldCDataArray[f]["y"])
- elseif worldCDataArray[f]["spos"] == "l" then
- graphics.addMImage(buffer1,worldCDataArray[f]["image"],worldCDataArray[f]["x"]+20-globalWXC,19-worldCDataArray[f]["y"])
- end
- if ( worldCDataArray[f]["roletype"] == "e" or worldCDataArray[f]["roletype"] == "p" or worldCDataArray[f]["roletype"] == "m" ) and cTarget ~= 0 and cTarget == f then
- pbar(buffer1,worldCDataArray[f]["x"]+20-globalWXC, 19-worldCDataArray[f]["y"]-2,4,math.ceil(worldCDataArray[f]["chp"])*100/worldCDataArray[f]["mhp"],colors.red,colors.gray,tostring(math.ceil(worldCDataArray[f]["chp"])).." ",1,"rev")
- elseif worldCDataArray[f]["roletype"] == "f" then
- graphics.dText(buffer1,"NPC",worldCDataArray[f]["x"]+20-globalWXC,19-worldCDataArray[f]["y"]-2,1)
- elseif worldCDataArray[f]["roletype"] == "r" and cTarget ~= 0 and cTarget == f and vpickwait then
- local vpercentr = math.ceil(vcpcingup*100/vpcingupm)
- pbar(buffer1,worldCDataArray[f]["x"]+20-globalWXC, 19-worldCDataArray[f]["y"]-2,4,vpercentr,colors.green,colors.gray,vpercentr.."% ",1,"rev")
- end
- end
- end
- end
- local drsmArray = {}
- local ftArrayms = 0
- local function addSMessage(text)
- ftArrayms = 10
- if type(text) == "string" then
- table.insert(drsmArray,string.sub(text,1,25))
- end
- end
- addSMessage("Press E to talk")
- local function addQuest(id)
- cQuestsArray[#cQuestsArray+1] = {}
- cQuestsArray[#cQuestsArray][1] = id
- cQuestsArray[#cQuestsArray][2] = 0
- cQuestsArray[#cQuestsArray][3] = false
- addSMessage("New quest: "..CQuestsLoad[id]["name"])
- end
- local function getXP(xp)
- if mxp-cxp >= xp then
- cxp = cxp + xp
- else
- xp = xp - (mxp - cxp)
- worldCDataArray[1]["level"] = worldCDataArray[1]["level"] + 1
- cxp = xp
- playerVarRef()
- worldCDataArray[1]["chp"] = worldCDataArray[1]["mhp"]
- cmp = mmp
- end
- end
- local function takeOffItem(subtype)
- addItem(inventory["weared"][subtype],1)
- inventory["weared"][subtype] = 0
- playerVarRef()
- end
- local function addEffect(target,effect)
- local tvar1 = 0
- for t = 1, #worldCDataArray[target]["effects"] do
- if worldCDataArray[target]["effects"][t][1] == effect then
- worldCDataArray[target]["effects"][t][1] = effect
- worldCDataArray[target]["effects"][t][2] = worldCDataArray[target]["effects"][t][2] + cEffectsLoad[effect]["duration"]
- tvar1 = 1
- break
- end
- end
- for t = 1, #worldCDataArray[target]["effects"] do
- if worldCDataArray[target]["effects"][t][1] == 0 and tvar1 == 0 then
- worldCDataArray[target]["effects"][t][1] = effect
- worldCDataArray[target]["effects"][t][2] = cEffectsLoad[effect]["duration"]
- break
- end
- end
- end
- local function target(x,y)
- if not vpickwait then cTarget = 0 end
- for f = 1, #worldCDataArray do
- if not vOpenDialogWindow and clicked(x, y, worldCDataArray[f]["x"]+20-globalWXC, 19-worldCDataArray[f]["y"]-2, worldCDataArray[f]["x"]+20-globalWXC+worldCDataArray[f]["width"], 19-worldCDataArray[f]["y"]+worldCDataArray[f]["height"]) then
- if worldCDataArray[f]["living"] then cTarget = f end
- end
- end
- if not vOpenDialogWindow and clicked(x,y,1,1,10,4) then
- cTarget = 1
- end
- end
- local function createNewItem(basID)
- cItemsLoad[#cItemsLoad+1] = {}
- cItemsLoad[#cItemsLoad]["name"] = cItemsLoad[basID]["name"]
- cItemsLoad[#cItemsLoad]["level"] = cItemsLoad[basID]["level"]
- cItemsLoad[#cItemsLoad]["type"] = cItemsLoad[basID]["type"]
- cItemsLoad[#cItemsLoad]["subtype"] = cItemsLoad[basID]["subtype"]
- cItemsLoad[#cItemsLoad]["reqlvl"] = cItemsLoad[basID]["reqlvl"]
- cItemsLoad[#cItemsLoad]["description"] = cItemsLoad[basID]["description"]
- cItemsLoad[#cItemsLoad]["ncolor"] = cItemsLoad[basID]["ncolor"]
- cItemsLoad[#cItemsLoad]["props"] = {}
- if math.random(1,4) == 1 then
- cItemsLoad[#cItemsLoad]["props"]["sur+"] = math.max(math.random(cItemsLoad[basID]["level"]-cItemsLoad[basID]["level"]/2,cItemsLoad[basID]["level"]+cItemsLoad[basID]["level"]/2)-1,0)
- else
- cItemsLoad[#cItemsLoad]["props"]["sur+"] = nil
- end
- if math.random(1,4) == 1 then
- cItemsLoad[#cItemsLoad]["props"]["str+"] = math.max(math.random(cItemsLoad[basID]["level"]-cItemsLoad[basID]["level"]/2,cItemsLoad[basID]["level"]+cItemsLoad[basID]["level"]/2)-1,0)
- else
- cItemsLoad[#cItemsLoad]["props"]["str+"] = nil
- end
- if math.random(1,4) == 1 then
- cItemsLoad[#cItemsLoad]["props"]["int+"] = math.max(math.random(cItemsLoad[basID]["level"]-cItemsLoad[basID]["level"]/2,cItemsLoad[basID]["level"]+cItemsLoad[basID]["level"]/2)-1,0)
- else
- cItemsLoad[#cItemsLoad]["props"]["int+"] = nil
- end
- if math.random(1,4) == 1 then
- cItemsLoad[#cItemsLoad]["props"]["hp+"] = math.max(math.random(-cItemsLoad[basID]["level"],cItemsLoad[basID]["level"]^2),0)
- else
- cItemsLoad[#cItemsLoad]["props"]["hp+"] = 0
- end
- if cItemsLoad[basID]["type"] == "armor" then
- cItemsLoad[#cItemsLoad]["props"]["phisdef"] = cItemsLoad[basID]["props"]["phisdef"]
- cItemsLoad[#cItemsLoad]["props"]["magdef"] = cItemsLoad[basID]["props"]["magdef"]
- end
- if cItemsLoad[basID]["type"] == "weapon" then
- cItemsLoad[#cItemsLoad]["props"]["phisat"] = cItemsLoad[basID]["props"]["phisat"]
- cItemsLoad[#cItemsLoad]["props"]["magat"] = cItemsLoad[basID]["props"]["magat"]
- end
- cItemsLoad[#cItemsLoad]["stackable"] = cItemsLoad[basID]["stackable"]
- cItemsLoad[#cItemsLoad]["cost"] = cItemsLoad[basID]["cost"]
- cItemsLoad[#cItemsLoad]["icon"] = cItemsLoad[basID]["icon"]
- return #cItemsLoad
- end
- local function dPlayerInfow(buffer,x,y) -- gui
- graphics.drawBox(buffer, x, y, 10, 4, 256)
- graphics.dText(buffer,playername:sub(1,10).."["..worldCDataArray[1]["level"].."]",x,y,1)
- local percent1 = math.ceil(worldCDataArray[1]["chp"]*100/worldCDataArray[1]["mhp"])
- local percent2 = math.ceil(cmp*100/mmp)
- local percent3 = math.ceil(cxp*100/mxp)
- pbar(buffer,x,y+1,10,percent1,16384,128,math.ceil(worldCDataArray[1]["chp"]).."/"..math.ceil(worldCDataArray[1]["mhp"]).." ",1,"rev")
- pbar(buffer,x,y+2,10,percent2,2048,128,math.ceil(cmp).."/"..math.ceil(mmp).." ",1,"rev")
- pbar(buffer,x,y+3,10,percent3,16,128,math.ceil(cxp*100/mxp).."% ",1,"rev")
- for f = 1, 4 do
- if worldCDataArray[1]["effects"][f][1] ~= 0 then
- graphics.drawPixel(buffer,x+3*f-3,5,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][1][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][1][2],x+3*f-3,5,1)
- graphics.drawPixel(buffer,x+3*f-2,5,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][2][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][2][2],x+3*f-2,5,1)
- end
- end
- for f = 5, 8 do
- if worldCDataArray[1]["effects"][f][1] ~= 0 then
- graphics.drawPixel(buffer,x+3*f-3,6,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][1][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][1][2],x+3*f-3,6,1)
- graphics.drawPixel(buffer,x+3*f-2,6,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][2][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[1]["effects"][f][1]]["icon"][2][2],x+3*f-2,6,1)
- end
- end
- end
- local function dSkillw(buffer,x,y) -- gui
- graphics.drawBox(buffer, x, y, 16, 3, 256)
- local fcol = {4096,2048,8192,1024,16384}
- local fstr = {"/2","*3","@4","&5","!6"}
- for f = 1, 5 do
- graphics.drawPixel(buffer,x-1+f*3,y+1,fcol[f])
- graphics.drawPixel(buffer,x+f*3-2,y+1,fcol[f])
- graphics.dText(buffer,fstr[f],x-2+f*3,y+1,1)
- graphics.dText(buffer,cSkillsArray[f+1][2],x-2+f*3,y+2,1)
- end
- end
- local function dWCDaw(buffer,x,y) -- gui
- graphics.drawBox(buffer, x, y, 12, 3, 256)
- local nx = x + (math.max(math.floor((12 / 2) - (#worldCDataArray[cTarget]["name"] / 2)), 0))
- graphics.dText(buffer,string.sub(worldCDataArray[cTarget]["name"],1,15),nx,y,1)
- if worldCDataArray[cTarget]["roletype"] == "e" or worldCDataArray[cTarget]["roletype"] == "p" or worldCDataArray[cTarget]["roletype"] == "m" then
- pbar(buffer,x,y+1,12,math.ceil(worldCDataArray[cTarget]["chp"])*100/worldCDataArray[cTarget]["mhp"],16384,128,math.ceil(worldCDataArray[cTarget]["chp"]).."/"..worldCDataArray[cTarget]["mhp"].." ",1,"rev")
- graphics.dText(buffer,"["..worldCDataArray[cTarget]["level"].."]",x+12-2-#tostring(worldCDataArray[cTarget]["level"]),y+1,1)
- elseif worldCDataArray[cTarget]["roletype"] == "f" then
- graphics.dText(buffer,"NPC",x+4,y+1,16)
- elseif worldCDataArray[cTarget]["roletype"] == "r" then
- graphics.dText(buffer,"Press E to",x+1,y+1,16)
- graphics.dText(buffer,"pick up",x+2,y+2,16)
- end
- for f = 1, 4 do
- if worldCDataArray[cTarget]["effects"][f][1] ~= 0 then
- graphics.drawPixel(buffer,x+3*f-3,4,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][1][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][1][2],x+3*f-3,4,1)
- graphics.drawPixel(buffer,x+3*f-2,4,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][2][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][2][2],x+3*f-2,4,1)
- end
- end
- for f = 5, 8 do
- if worldCDataArray[1]["effects"][f][1] ~= 0 then
- graphics.drawPixel(buffer,x+3*f-3,5,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][1][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][1][2],x+3*f-3,5,1)
- graphics.drawPixel(buffer,x+3*f-2,5,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][2][1])
- graphics.dText(buffer,cEffectsLoad[worldCDataArray[cTarget]["effects"][f][1]]["icon"][2][2],x+3*f-2,5,1)
- end
- end
- end
- local tcolor1 = 1
- local function openDialogWindow(buffer,id,x,y)
- graphics.drawBox(buffer, x+1, y+1, 16, 10, 128)
- graphics.drawBox(buffer, x, y, 16, 10, 256)
- local nx = x + (math.max(math.floor((16 / 2) - (#worldCDataArray[id]["name"] / 2)), 0))
- graphics.dText(buffer,string.sub(worldCDataArray[id]["name"],1,15),nx,y,1)
- for f = 1, 9 - #cDialog do
- graphics.dText(buffer,string.sub(cDialog[1]["text"],1+15*f-15,1+15*f-1),x,y+f,1)
- end
- for f = 1, #cDialog-1 do
- if cDialog[#cDialog-f+1] ~= nil then
- if cDialog[#cDialog-f+1]["action"] == "getquest" then
- if CQuestsLoad[cDialog[#cDialog-f+1]["do"]]["comp"] == true then
- table.remove(cDialog,#cDialog-f+1)
- end
- end
- end
- end
- graphics.drawLine(buffer, x, y+10 - #cDialog, x+16, y+10 - #cDialog, 128)
- for n = 1, #cDialog-1 do
- tcolor1 = 1
- if cDialog[n+1]["action"] == "getquest" then
- if CQuestsLoad[cDialog[n+1]["do"]]["comp"] ~= 0 then tcolor1 = 128 end
- end
- if cDialog[n+1] ~= nil then
- if cDialog[n+1]["action"] == "getquest" then
- if CQuestsLoad[cDialog[n+1]["do"]]["minlvl"] > worldCDataArray[1]["level"] or CQuestsLoad[cDialog[n+1]["do"]]["maxlvl"] < worldCDataArray[1]["level"] or CQuestsLoad[cDialog[n+1]["do"]]["comp"] == true then
- tcolor1 = colors.red
- end
- end
- end
- graphics.dText(buffer,string.sub(cDialog[n+1]["text"],1,16),x,y+10 - #cDialog+n,tcolor1)
- end
- end
- local ctargquest = 0
- local function openQuestsWindow(buffer,x,y)
- graphics.drawBox(buffer,x+1,y+1,35,12,128)
- graphics.drawBox(buffer,x,y,35,12,256)
- graphics.drawLine(buffer, x, y, x+35, y, 128)
- graphics.drawLine(buffer, x+15, y, x+15, y+12, 128)
- graphics.dText(buffer,"X",x+35,y,1)
- graphics.dText(buffer,"Quests",x+(math.max(math.floor((35 / 2)-(6 / 2)), 0)),y,1)
- if #cQuestsArray ~= 0 then
- for f = 1, #cQuestsArray do
- graphics.dText(buffer,">"..string.sub(CQuestsLoad[cQuestsArray[f][1]]["name"],1,14),x,y+f,1)
- end
- end
- if ctargquest ~= 0 then
- graphics.dText(buffer,string.sub(CQuestsLoad[cQuestsArray[ctargquest][1]]["name"],1,19),x+16,y+1,1)
- graphics.dText(buffer,"To kill:",x+16,y+2,1)
- graphics.dText(buffer,CDataLoad[CQuestsLoad[cQuestsArray[ctargquest][1]]["targ"]]["name"].."("..cQuestsArray[ctargquest][2].."/"..CQuestsLoad[cQuestsArray[ctargquest][1]]["num"]..")",x+16,y+3,1)
- graphics.dText(buffer,"Reward",x+16,y+5,1)
- graphics.dText(buffer,"Coins: "..CQuestsLoad[cQuestsArray[ctargquest][1]]["qreward"]["coins"]..", XP: "..CQuestsLoad[cQuestsArray[ctargquest][1]]["qreward"]["xp"],x+16,y+6,1)
- if CQuestsLoad[cQuestsArray[ctargquest][1]]["qreward"]["item"][1] ~= 0 then
- graphics.dText(buffer,"item:",x+16,y+7,1)
- graphics.dText(buffer,string.sub(cItemsLoad[CQuestsLoad[cQuestsArray[ctargquest][1]]["qreward"]["item"][1]]["name"],1,15).."("..CQuestsLoad[cQuestsArray[ctargquest][1]]["qreward"]["item"][2]..")",x+16,y+8,1)
- end
- end
- end
- local ctargetitem = 0
- local function openInventoryWindow(buffer,x,y)
- graphics.drawBox(buffer,x,y,51,19,256)
- graphics.drawLine(buffer, x, y, x+51, y, 128)
- graphics.dText(buffer,"X",x+50,y,1)
- for f = 1, 5 do
- graphics.drawLine(buffer, x, y+f*6-6, x+40, y+f*6-6, 128)
- end
- for f = 1, 6 do
- graphics.drawLine(buffer, x+f*8-8, y+1, x+f*8-8, y+18, 128)
- end
- local cy = 1
- for f = 1, #inventory["bag"] do
- local h = f
- if f < 6 then cy = y+1
- elseif f > 5 and f < 11 then cy = y+7 h = f - 5
- elseif f > 10 then cy = y+13 h = f - 10 end
- if inventory["bag"][f][1] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["bag"][f][1]]["icon"]],1+x+h*8-8,cy)
- if inventory["bag"][f][2] > 1 then graphics.dText(buffer,inventory["bag"][f][2],1+x+h*8-2-6,cy+4,1) end
- end
- end
- local tinfoarray = {}
- local tcolorarray = {}
- local function atrfunc(s,c)
- table.insert(tinfoarray,s)
- table.insert(tcolorarray,c)
- end
- if ctargetitem ~= 0 then
- local vLoadnamecolor = cItemsLoad[inventory["bag"][ctargetitem][1]]["ncolor"]
- atrfunc(string.sub(cItemsLoad[inventory["bag"][ctargetitem][1]]["name"],1,10),vLoadnamecolor)
- if #cItemsLoad[inventory["bag"][ctargetitem][1]]["name"] > 10 then
- atrfunc(string.sub(cItemsLoad[inventory["bag"][ctargetitem][1]]["name"],11,20),vLoadnamecolor)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "armor" or cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "weapon" then
- local dsubtype = cItemsLoad[inventory["bag"][ctargetitem][1]]["subtype"]
- atrfunc(string.upper(string.sub(dsubtype,1,1))..string.sub(dsubtype,2,10),128)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["level"] ~= nil then
- atrfunc("Level "..cItemsLoad[inventory["bag"][ctargetitem][1]]["level"],1)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "armor" or cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "weapon" or cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "potion" then
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["reqlvl"] > worldCDataArray[1]["level"] then
- atrfunc("Level Requ",16384)
- atrfunc("ired: "..cItemsLoad[inventory["bag"][ctargetitem][1]]["reqlvl"],16384)
- end
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "item" then
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["level"] ~= nil then
- atrfunc("Level "..cItemsLoad[inventory["bag"][ctargetitem][1]]["level"],1)
- end
- elseif cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "armor" then
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["phisdef"] ~= nil and cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["phisdef"] ~= 0 then
- atrfunc("PDef: +"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["phisdef"],16)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["magdef"] ~= nil and cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["magdef"] ~= 0 then
- atrfunc("MDef: +"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["magdef"],16)
- end
- end
- -- ["sur+"] = 100, ["str+"] = 100, ["int+"] = 100, ["hp+"] = 58
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "weapon" then
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["phisat"] ~= 0 then
- atrfunc("PAttack:",16)
- atrfunc("+"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["phisat"],16)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["magat"] ~= 0 then
- atrfunc("MAttack:",16)
- atrfunc("+"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["magat"],16)
- end
- elseif cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "potion" then
- atrfunc("Restore ",1)
- atrfunc(cEffectsLoad[cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]]["value"],1)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "armor" or cItemsLoad[inventory["bag"][ctargetitem][1]]["type"] == "weapon" then
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["hp+"] ~= nil and cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["hp+"] ~= 0 then
- atrfunc("HP: +"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["hp+"],2048)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["sur+"] ~= nil and cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["sur+"] ~= 0 then
- atrfunc("Sur: +"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["sur+"],2048)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["str+"] ~= nil and cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["str+"] ~= 0 then
- atrfunc("Str: +"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["str+"],2048)
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["int+"] ~= nil and cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["int+"] ~= 0 then
- atrfunc("Int: +"..cItemsLoad[inventory["bag"][ctargetitem][1]]["props"]["int+"],2048)
- end
- end
- if cItemsLoad[inventory["bag"][ctargetitem][1]]["description"] ~= "" then
- atrfunc(string.sub(cItemsLoad[inventory["bag"][ctargetitem][1]]["description"],1,10),128)
- end
- if #cItemsLoad[inventory["bag"][ctargetitem][1]]["description"] > 10 then
- atrfunc(string.sub(cItemsLoad[inventory["bag"][ctargetitem][1]]["description"],11,20),128)
- end
- if #cItemsLoad[inventory["bag"][ctargetitem][1]]["description"] > 20 then
- atrfunc(string.sub(cItemsLoad[inventory["bag"][ctargetitem][1]]["description"],21,30),128)
- end
- atrfunc("Cost: "..cItemsLoad[inventory["bag"][ctargetitem][1]]["cost"]*inventory["bag"][ctargetitem][2],1)
- for f = 1, #tinfoarray do
- graphics.dText(buffer,tinfoarray[f],x+41,y+f,tcolorarray[f])
- end
- graphics.drawLine(buffer, x+41, y+18, x+51, y+18, 512)
- graphics.dText(buffer,"Throw away",x+41,y+18,1)
- end
- graphics.dText(buffer,"> Armor",x+1,y+18,1)
- graphics.dText(buffer,"Inventory",x+(math.max(math.floor((51 / 2)-(9 / 2)), 0)),y,1)
- graphics.dText(buffer,"Coins: "..coins,x+1,y,1)
- end
- local function openArmorInventoryWindow(buffer,x,y)
- graphics.drawBox(buffer,x,y,51,19,256)
- graphics.drawLine(buffer, x, y, x+51, y, 128)
- graphics.dText(buffer,"X",x+50,y,1)
- graphics.drawLine(buffer, x, y+1, x, y+12, 128)
- graphics.drawLine(buffer, x+8, y+1, x+8, y+12, 128)
- graphics.drawLine(buffer, x+16, y+1, x+16, y+12, 128)
- graphics.drawLine(buffer, x+24, y+1, x+24, y+12, 128)
- graphics.drawLine(buffer, x, y+6, x+24, y+6, 128)
- graphics.drawLine(buffer, x, y+12, x+24, y+12, 128)
- graphics.drawLine(buffer, x, y+18, x+24, y+18, 128)
- if inventory["weared"]["helmet"] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["weared"]["helmet"]]["icon"]],x+1,y+1)
- ctargetitem = inventory["weared"]["helmet"]
- else graphics.addImage(buffer,emptyArmorImageHelmet,x+1,y+1)
- end
- if inventory["weared"]["bodywear"] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["weared"]["bodywear"]]["icon"]],x+1,y+7)
- ctargetitem = inventory["weared"]["bodywear"]
- else graphics.addImage(buffer,emptyArmorImageBodywear,x+1,y+7)
- end
- if inventory["weared"]["pants"] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["weared"]["pants"]]["icon"]],x+9,y+1)
- ctargetitem = inventory["weared"]["pants"]
- else graphics.addImage(buffer,emptyArmorImagePants,x+9,y+1)
- end
- if inventory["weared"]["footwear"] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["weared"]["footwear"]]["icon"]],x+9,y+7)
- ctargetitem = inventory["weared"]["footwear"]
- else graphics.addImage(buffer,emptyArmorImageFootwear,x+9,y+7)
- end
- if inventory["weared"]["pendant"] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["weared"]["pendant"]]["icon"]],x+17,y+1)
- ctargetitem = inventory["weared"]["pendant"]
- else graphics.addImage(buffer,emptyArmorImagePendant,x+17,y+1)
- end
- if inventory["weared"]["weapon"] ~= 0 then
- graphics.addImage(buffer,itemimg[cItemsLoad[inventory["weared"]["weapon"]]["icon"]],x+17,y+7)
- ctargetitem = inventory["weared"]["weapon"]
- else graphics.addImage(buffer,emptyArmorImageWeapon,x+17,y+7)
- end
- graphics.dText(buffer,"< Bag",x+1,y+18,1)
- graphics.dText(buffer,"Inventory",x+(math.max(math.floor((51 / 2)-(9 / 2)), 0)),y,1)
- graphics.dText(buffer,"Coins: "..coins,x+1,y,1)
- end
- local function statsWindow(buffer,x,y)
- graphics.drawBox(buffer,x+1,y+1,35,13,128)
- graphics.drawBox(buffer,x,y,35,13,256)
- graphics.drawLine(buffer, x, y, x+35, y, 128)
- graphics.dText(buffer,"Player stats",x+(math.max(math.floor((35 / 2)-(12 / 2)), 0)),y,1)
- graphics.dText(buffer,"X",x+35,y,1)
- graphics.dText(buffer,"Player name: "..string.sub(worldCDataArray[1]["name"],1,21),x+1,y+1,1)
- graphics.dText(buffer,"Player level: "..worldCDataArray[1]["level"],x+1,y+2,1)
- graphics.dText(buffer,"Player HP: "..math.floor(worldCDataArray[1]["chp"]).."/"..math.floor(worldCDataArray[1]["mhp"]),x+1,y+3,1)
- graphics.dText(buffer,"Player MP: "..math.floor(cmp).."/"..math.floor(mmp),x+1,y+4,1)
- graphics.dText(buffer,"Player XP: "..math.floor(cxp).."/"..math.floor(mxp),x+1,y+5,1)
- graphics.dText(buffer,"Physical defence "..math.floor(worldCDataArray[1]["phisdef"]),x+1,y+6,1)
- graphics.dText(buffer,"Magical defense "..math.floor(worldCDataArray[1]["magdef"]),x+1,y+7,1)
- graphics.dText(buffer,"Physical attack "..math.floor(worldCDataArray[1]["phisatck"]),x+1,y+8,1)
- graphics.dText(buffer,"Magical attack "..math.floor(worldCDataArray[1]["magatck"]),x+1,y+9,1)
- graphics.dText(buffer,"Survivability "..survivability+vSur,x+1,y+10,1)
- graphics.dText(buffer,"Strength "..strength+vStr,x+1,y+11,1)
- graphics.dText(buffer,"Intelligence "..intelligence+vInt,x+1,y+12,1)
- end
- local ctwindowArray = {}
- local ctwindow = 0
- local ctitem = 0
- local ctwindowScroll = 1
- local function tradeWindow(buffer,x,y)
- graphics.drawBox(buffer,x,y,51,19,256)
- graphics.drawLine(buffer, x, y, x+51, y, 128)
- graphics.dText(buffer,"X",x+50,y,1)
- graphics.dText(buffer,"Trade",x+(math.max(math.floor((51 / 2)-(5 / 2)), 0)),y,1)
- for f = 1, 9 do
- graphics.drawLine(buffer, x, 1+y+f*2-2, x+49, 1+y+f*2-2, 128)
- end
- graphics.drawLine(buffer, x+49, 2, x+49, 19, 128)
- for f = 1, 8 do
- local ccolor = 1
- if f+4*ctwindowScroll-4 == ctitem then ccolor = 128 end
- if ctwindowArray[f+4*ctwindowScroll-4] ~= nil then
- graphics.dText(buffer,">"..string.sub(cItemsLoad[ctwindowArray[f+4*ctwindowScroll-4]["item"]]["name"],1,25),x+1,2+y+f*2-2,ccolor)
- graphics.dText(buffer,ctwindowArray[f+4*ctwindowScroll-4]["cost"].." coins",x+25,2+y+f*2-2,ccolor)
- end
- end
- graphics.dText(buffer,"Name",x+1,y+1,1)
- graphics.dText(buffer,"Cost",x+25,y+1,1)
- graphics.drawLine(buffer, x+50, math.ceil(y+1+(ctwindowScroll*(17/(#ctwindowArray/4))-17/(#ctwindowArray/4))), x+50, math.ceil(y+1+(ctwindowScroll*(17/(#ctwindowArray/4)))), 1)
- graphics.dText(buffer,"Coins: "..coins,x+1,y,1)
- end
- local ccwindowArray = {}
- local ccwindow = 0
- local ccwindowScroll = 1
- local cctitem = 0
- local function craftWindow(buffer,x,y)
- graphics.drawBox(buffer,x,y,51,19,256)
- graphics.drawLine(buffer, x, y, x+51, y, 128)
- graphics.dText(buffer,"X",x+50,y,1)
- graphics.dText(buffer,"Craft",x+(math.max(math.floor((51 / 2)-(5 / 2)), 0)),y,1)
- for f = 1, 9 do
- graphics.drawLine(buffer, x, 1+y+f*2-2, x+49, 1+y+f*2-2, 128)
- end
- graphics.drawLine(buffer, x+49, 2, x+49, 19, 128)
- for f = 1, 8 do
- if ccwindowArray[f+4*ccwindowScroll-4] ~= nil then
- graphics.dText(buffer,">"..string.sub(cItemsLoad[ccwindowArray[f+4*ccwindowScroll-4]["item"]]["name"],1,25),x+1,2+y+f*2-2,ccolor)
- end
- end
- if cctitem ~= 0 then
- graphics.drawBox(buffer,14,7,25,9,128)
- graphics.drawBox(buffer,13,6,25,9,256)
- graphics.dText(buffer,"X",37,6,1)
- graphics.dText(buffer,"Item: "..string.sub(cItemsLoad[ccwindowArray[cctitem]["item"]]["name"],1,22),14,7,1)
- graphics.dText(buffer,"Recipe:",14,8,1)
- for f = 1, #ccwindowArray[cctitem]["recipe"] do
- local ttytextcolor = 128
- for p = 1, #inventory["bag"] do
- if inventory["bag"][p][1] == ccwindowArray[cctitem]["recipe"][f][1] and inventory["bag"][p][2] >= ccwindowArray[cctitem]["recipe"][f][2] then
- ttytextcolor = 1
- end
- end
- graphics.dText(buffer,string.sub(cItemsLoad[ccwindowArray[cctitem]["recipe"][f][1]]["name"],1,20).." ("..ccwindowArray[cctitem]["recipe"][f][2]..")",14,8+f,ttytextcolor)
- end
- graphics.drawLine(buffer, 13, 14, 37, 14, 512)
- graphics.dText(buffer,"Create item",14,14,colors.black)
- end
- graphics.drawLine(buffer, x+50, math.ceil(y+1+(ccwindowScroll*(17/(#ccwindowArray/4))-17/(#ccwindowArray/4))), x+50, math.ceil(y+1+(ccwindowScroll*(17/(#ccwindowArray/4)))), 1)
- end
- local funcPauseTextArray = {"Continue","Inventory","Skills","Stats","Quests","Quit game"}
- local function funcPause(buffer)
- paused = true
- graphics.drawBox(buffer,1,1,16,19,128)
- graphics.drawLine(buffer,16,1,16,19,256)
- graphics.drawLine(buffer,1,19,16,19,256)
- graphics.dText(buffer,"Paused",5,1,1)
- for f = 1, #funcPauseTextArray do
- graphics.drawLine(buffer,1,1+f*2,16,1+f*2,256)
- graphics.dText(buffer,funcPauseTextArray[f],1+(math.max(math.floor((16 / 2) - (#funcPauseTextArray[f] / 2)), 0)),1+f*2,1)
- end
- end
- local function killEnemy(target)
- worldCDataArray[target]["living"] = false
- for f = 1, #cQuestsArray do
- if worldCDataArray[target]["id"] == CQuestsLoad[cQuestsArray[f][1]]["targ"] and cQuestsArray[f][3] == false and cQuestsArray[f][2] < CQuestsLoad[cQuestsArray[f][1]]["num"] then
- cQuestsArray[f][2] = cQuestsArray[f][2] + 1
- end
- end
- for f = 1, #cQuestsArray do
- if cQuestsArray[f][3] == false and cQuestsArray[f][2] == CQuestsLoad[cQuestsArray[f][1]]["num"] then
- cQuestsArray[f][3] = true
- addSMessage("Quest "..string.sub(CQuestsLoad[cQuestsArray[f][1]]["name"],1,15).." complete")
- end
- end
- worldCDataArray[target]["resptime"] = CDataLoad[worldCDataArray[target]["id"]]["vrespawn"]
- getXP(CDataLoad[worldCDataArray[target]["id"]]["loot"]["exp"])
- coins = coins + CDataLoad[worldCDataArray[target]["id"]]["loot"]["coins"]+math.ceil(math.random(-CDataLoad[worldCDataArray[target]["id"]]["loot"]["coins"]/2,CDataLoad[worldCDataArray[target]["id"]]["loot"]["coins"]/2))
- for f = 1, #CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"] do
- if 100-CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][2] < math.random(1,100) then
- local vxd1 = cItemsLoad[CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][1]]["type"]
- if vxd1 == "item" or vxd1 == "potion" then
- addItem(CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][1],1)
- addsecm("You get "..cItemsLoad[CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][1]]["name"])
- elseif vxd1 == "armor" or vxd1 == "weapon" then
- if math.random(1,2) == 1 then
- addItem(CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][1],1)
- addsecm("You get "..cItemsLoad[CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][1]]["name"])
- else
- local nitem = createNewItem(CDataLoad[worldCDataArray[target]["id"]]["loot"]["items"][f][1])
- addItem(nitem,1)
- addsecm("You get "..cItemsLoad[nitem]["name"])
- end
- end
- end
- end
- if target == cTarget then
- cTarget = 0
- end
- end
- local function getDamage(id)
- local damage = 0
- local physDefRedu = worldCDataArray[1]["phisdef"]/(worldCDataArray[1]["phisdef"]+worldCDataArray[id]["level"]*40)
- damage = worldCDataArray[id]["phisatck"]*(1-physDefRedu)
- damage = math.max(math.random(damage-(damage/3)*2,damage+(damage/3)*2),0,1)/2
- if worldCDataArray[id]["living"] and worldCDataArray[id]["chp"] > worldCDataArray[1]["chp"] then
- worldCDataArray[id]["spos"] = "r"
- elseif worldCDataArray[id]["chp"] < worldCDataArray[1]["chp"] then
- worldCDataArray[id]["spos"] = "l"
- end
- if worldCDataArray[id]["living"] and damage < worldCDataArray[1]["chp"] then
- worldCDataArray[1]["chp"] = worldCDataArray[1]["chp"] - damage
- elseif damage >= worldCDataArray[1]["chp"] then
- worldCDataArray[1]["living"] = false
- end
- end
- local function useSkill(skill)
- local cskill = cSkillsArray[skill][1]
- local damage = 0
- if cSkillsLoad[cskill]["type"] == "buff" then
- if cmp >= cSkillsLoad[cskill]["manacost"][cSkillsArray[skill][3]] and cSkillsArray[skill][2] == 0 then
- addEffect(1,cSkillsLoad[cskill]["eff"][cSkillsArray[skill][3]])
- cSkillsArray[skill][2] = cSkillsLoad[cskill]["reloading"]
- cmp = cmp - cSkillsLoad[cskill]["manacost"][cSkillsArray[skill][3]]
- end
- elseif cSkillsLoad[cskill]["type"] == "attack" and cTarget ~= 0 then
- local pdef = worldCDataArray[cTarget]["phisdef"]
- local mdef = worldCDataArray[cTarget]["magdef"]
- local physDefRedu = pdef/(pdef+worldCDataArray[1]["level"]*85)
- local magDefRedu = mdef/(mdef+worldCDataArray[1]["level"]*85)
- if cSkillsLoad[cskill]["typedm"] == "p" then
- damage = math.max((worldCDataArray[1]["phisatck"]+math.random(cSkillsLoad[cskill]["mindamage"][cSkillsArray[skill][3]],cSkillsLoad[cskill]["maxdamage"][cSkillsArray[skill][3]]))*(1-physDefRedu),0.1)
- elseif cSkillsLoad[cskill]["typedm"] == "m" then
- damage = math.max((worldCDataArray[1]["magatck"]+math.random(cSkillsLoad[cskill]["mindamage"][cSkillsArray[skill][3]],cSkillsLoad[cskill]["maxdamage"][cSkillsArray[skill][3]]))*(1-magDefRedu),0.1)
- end
- local rtype = worldCDataArray[cTarget]["roletype"]
- if damage < worldCDataArray[cTarget]["chp"] and ( rtype == "e" or rtype == "m" ) and getDistanceToId(1,cTarget) <= cSkillsLoad[cskill]["distance"] and cmp >= cSkillsLoad[cskill]["manacost"][cSkillsArray[skill][3]] and cSkillsArray[skill][2] == 0 then
- cmp = cmp - cSkillsLoad[cskill]["manacost"][cSkillsArray[skill][3]]
- worldCDataArray[cTarget]["chp"] = worldCDataArray[cTarget]["chp"] - damage
- cSkillsArray[skill][2] = cSkillsLoad[cskill]["reloading"]
- if cSkillsLoad[cskill]["eff"][cSkillsArray[skill][3]] ~= 0 then
- addEffect(cTarget,cSkillsLoad[cskill]["eff"][cSkillsArray[skill][3]])
- end
- worldCDataArray[cTarget]["attplayer"] = true
- worldCDataArray[cTarget]["agrtime"] = 16
- elseif damage >= worldCDataArray[cTarget]["chp"] and ( rtype == "e" or rtype == "m" ) and getDistanceToId(1,cTarget) <= cSkillsLoad[cskill]["distance"] and cmp >= cSkillsLoad[cskill]["manacost"][cSkillsArray[skill][3]] and cSkillsArray[skill][2] == 0 then
- cmp = cmp - cSkillsLoad[cskill]["manacost"][cSkillsArray[skill][3]]
- worldCDataArray[cTarget]["living"] = false
- for f = 1, #cQuestsArray do
- if worldCDataArray[cTarget]["id"] == CQuestsLoad[cQuestsArray[f][1]]["targ"] and cQuestsArray[f][3] == false and cQuestsArray[f][2] < CQuestsLoad[cQuestsArray[f][1]]["num"] then
- cQuestsArray[f][2] = cQuestsArray[f][2] + 1
- end
- end
- for f = 1, #cQuestsArray do
- if cQuestsArray[f][3] == false and cQuestsArray[f][2] == CQuestsLoad[cQuestsArray[f][1]]["num"] then
- cQuestsArray[f][3] = true
- addSMessage("Quest "..string.sub(CQuestsLoad[cQuestsArray[f][1]]["name"],1,15).." complete")
- end
- end
- worldCDataArray[cTarget]["resptime"] = CDataLoad[worldCDataArray[cTarget]["id"]]["vrespawn"]
- getXP(CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["exp"])
- coins = coins + CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["coins"]+math.ceil(math.random(-CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["coins"]/2,CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["coins"]/2))
- for f = 1, #CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"] do
- if 100-CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][2] < math.random(1,100) then
- local vxd1 = cItemsLoad[CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1]]["type"]
- if vxd1 == "item" or vxd1 == "potion" then
- addItem(CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1],1)
- addsecm("You get "..cItemsLoad[CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1]]["name"])
- elseif vxd1 == "armor" or vxd1 == "weapon" then
- if math.random(1,2) == 1 then
- addItem(CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1],1)
- addsecm("You get "..cItemsLoad[CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1]]["name"])
- else
- local nitem = createNewItem(CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1])
- addItem(nitem,1)
- addsecm("You get "..cItemsLoad[nitem]["name"])
- end
- end
- end
- end
- cSkillsArray[skill][2] = cSkillsLoad[cskill]["reloading"]
- worldCDataArray[cTarget]["attplayer"] = false
- worldCDataArray[cTarget]["agrtime"] = 0
- cTarget = 0
- end
- end
- end
- local function dmain()
- graphics.clearScreen(buffer1,8)
- graphics.addImage(buffer1,tbackg,backgroundcPos-51,1)
- graphics.addImage(buffer1,tbackg,backgroundcPos,1)
- graphics.addImage(buffer1,tbackg,backgroundcPos+51,1)
- drawcBIArray()
- if playerTurning == "r" then graphics.addImage(buffer1,worldCDataArray[1]["image"],20,10)
- else
- graphics.addMImage(buffer1,worldCDataArray[1]["image"],20,10)
- end
- drawCDataUnit()
- if cTarget ~= 0 and getDistance(1,worldCDataArray[cTarget]["x"]) < 40 then
- if not paused then dWCDaw(buffer1,15,1) end
- else cTarget = 0
- end
- dPlayerInfow(buffer1,1,1)
- dSkillw(buffer1,31,1)
- if cTarget ~= 0 and vOpenDialogWindow and cDialog ~= 0 then openDialogWindow(buffer1,cTarget,3,5) end
- if ftArrayms > 0 then
- graphics.dText(buffer1,drsmArray[#drsmArray],1+(math.max(math.floor((51 / 2) - (#drsmArray[#drsmArray] / 2)), 0)),5,colors.black)
- end
- if tArrayms > 0 then
- graphics.dText(buffer1,secMsgArray[#secMsgArray],1+(math.max(math.floor((51 / 2) - (#secMsgArray[#secMsgArray] / 2)), 0)),6,1)
- end
- graphics.dText(buffer1,"||",50,1,1)
- graphics.dText(buffer1,"||",50,2,1)
- if vOpenQuestsWindow then openQuestsWindow(buffer1,8,5) end
- if vOpenInventoryWindow then openInventoryWindow(buffer1,1,1) end
- if vOpenArmorInventoryWindow then openArmorInventoryWindow(buffer1,1,1) end
- if vOpenstatsWindow then statsWindow(buffer1,8,5) end
- if ctwindow ~= 0 then tradeWindow(buffer1,1,1) end
- if ccwindow ~= 0 then craftWindow(buffer1,1,1) end
- -- if cTarget ~= 0 then graphics.dText(buffer1,getDistanceToId(1,cTarget),1,18,colors.black) end -- debug1
- graphics.dText(buffer1,"",1,19,colors.black) -- debug2
- if sPouseMenu then funcPause(buffer1) end
- graphics.drawBuffer(buffer1)
- end
- local function moveplayertox(x)
- if x < worldCDataArray[1]["x"] then
- globalWXC = globalWXC - x
- backgroundcPos = backgroundcPos + 1
- worldCDataArray[1]["x"] = worldCDataArray[1]["x"] - x
- else
- globalWXC = globalWXC + x
- backgroundcPos = backgroundcPos - 1
- worldCDataArray[1]["x"] = worldCDataArray[1]["x"] + x
- end
- dmain()
- end
- dmain()
- local refMoveTm = 8
- local function funcPSecond()
- local tr2 = os.startTimer(0.1)
- while true do
- local e, t = os.pullEvent()
- if e == "timer" and t == tr2 and not paused then
- refMoveTm = refMoveTm - 1
- if tArrayms ~= 0 then tArrayms = tArrayms - 1 end
- if ftArrayms ~= 0 then ftArrayms = ftArrayms - 1 end
- for f = 1, #cSkillsArray do
- if cSkillsArray[f][1] ~= 0 and cSkillsArray[f][2] > 0 then
- cSkillsArray[f][2] = cSkillsArray[f][2] - 1
- end
- end
- for i = 1, #worldCDataArray do
- if ( worldCDataArray[i]["roletype"] == "e" or worldCDataArray[i]["roletype"] == "m" ) and worldCDataArray[i]["living"] then
- movetoward(i, worldCDataArray[i]["mx"], 15)
- end
- for f = 1, #worldCDataArray[i]["effects"] do
- if worldCDataArray[i]["effects"][f][1] ~= 0 and worldCDataArray[i]["effects"][f][2] ~= 0 then
- local value = cEffectsLoad[worldCDataArray[i]["effects"][f][1]]["value"]
- local duration = cEffectsLoad[worldCDataArray[i]["effects"][f][1]]["duration"]
- if cEffectsLoad[worldCDataArray[i]["effects"][f][1]]["type"] == "hpi" then
- if worldCDataArray[i]["chp"] + value/duration < worldCDataArray[i]["mhp"] then
- worldCDataArray[i]["chp"] = worldCDataArray[i]["chp"] + value/duration
- else worldCDataArray[i]["chp"] = worldCDataArray[i]["mhp"]
- end
- elseif cEffectsLoad[worldCDataArray[i]["effects"][f][1]]["type"] == "mpi" then
- if cmp + value/duration < mmp then
- cmp = cmp + value/duration
- else
- cmp = mmp
- end
- elseif cEffectsLoad[worldCDataArray[i]["effects"][f][1]]["type"] == "hpd" then
- if worldCDataArray[i]["chp"] > value/duration then
- worldCDataArray[i]["chp"] = worldCDataArray[i]["chp"] - value/duration
- else
- if i ~= 1 and worldCDataArray[i]["living"] == true then
- killEnemy(i)
- end
- end
- elseif cEffectsLoad[worldCDataArray[i]["effects"][f][1]]["type"] == "mpd" then
- if cmp > value/duration then
- cmp = cmp - value/duration
- else
- cmp = 0
- end
- end
- end
- if worldCDataArray[i]["effects"][f][1] ~= 0 then
- if worldCDataArray[i]["effects"][f][2] ~= 0 then
- worldCDataArray[i]["effects"][f][2] = worldCDataArray[i]["effects"][f][2] - 1
- else
- worldCDataArray[i]["effects"][f][1] = 0
- worldCDataArray[i]["effects"][f][2] = 0
- end
- end
- end
- end
- for f = 2, #worldCDataArray do
- if not worldCDataArray[f]["living"] and worldCDataArray[f]["resptime"] ~= 0 then
- worldCDataArray[f]["resptime"] = worldCDataArray[f]["resptime"] - 1
- worldCDataArray[f]["chp"] = worldCDataArray[f]["mhp"]
- end
- if not worldCDataArray[f]["living"] and worldCDataArray[f]["resptime"] == 0 then
- worldCDataArray[f]["living"] = true
- end
- if worldCDataArray[f]["attplayer"] == false and worldCDataArray[f]["living"] and worldCDataArray[f]["roletype"] ~= "f" and math.random(0,1) == 1 and refMoveTm == 0 then
- worldCDataArray[f]["mx"] = worldCDataArray[f]["sx"] + math.random(-8,8)
- end
- if worldCDataArray[f]["living"] and worldCDataArray[f]["roletype"] ~= "f" and worldCDataArray[f]["attplayer"] and worldCDataArray[f]["agrtime"] > 0 and getDistanceToId(1,f) <= worldCDataArray[f]["attackdistance"] then
- worldCDataArray[f]["agrtime"] = 16
- getDamage(f)
- worldCDataArray[f]["mx"] = worldCDataArray[f]["x"]
- if vpickwait then
- vcpcingup = 0
- vpcingupm = 0
- vpickwait = false
- cTarget = 0
- end
- if worldCDataArray[f]["living"] and cTarget == 0 then cTarget = f end
- elseif worldCDataArray[f]["living"] and worldCDataArray[f]["roletype"] ~= "f" and worldCDataArray[f]["attplayer"] and worldCDataArray[f]["agrtime"] > 0 and getDistanceToId(1,f) > worldCDataArray[f]["attackdistance"] then
- if worldCDataArray[f]["x"] > worldCDataArray[1]["x"] then
- worldCDataArray[f]["mx"] = worldCDataArray[1]["x"] + worldCDataArray[f]["attackdistance"] + 4
- elseif worldCDataArray[f]["x"] < worldCDataArray[1]["x"] then
- worldCDataArray[f]["mx"] = worldCDataArray[1]["x"] - worldCDataArray[f]["attackdistance"] - worldCDataArray[f]["width"]
- end
- if worldCDataArray[f]["living"] and cTarget == 0 then cTarget = f end
- if getDistance(f,worldCDataArray[f]["sx"]) >= 18 then
- worldCDataArray[f]["agrtime"] = worldCDataArray[f]["agrtime"] - 1
- else worldCDataArray[f]["agrtime"] = 16
- end
- end
- if worldCDataArray[f]["attplayer"] and worldCDataArray[f]["agrtime"] == 8 then
- worldCDataArray[f]["attplayer"] = false
- worldCDataArray[f]["mx"] = worldCDataArray[f]["sx"]
- end
- if getDistanceToId(1,f) >= 30 then
- if cTarget == f then cTaget = 0 end
- worldCDataArray[f]["attplayer"] = false
- worldCDataArray[f]["mx"] = worldCDataArray[f]["sx"]
- end
- if getDistanceToId(1,f) <= 10 and CDataLoad[worldCDataArray[f]["id"]]["agr"] then
- worldCDataArray[f]["attplayer"] = true
- worldCDataArray[f]["agrtime"] = 16
- end
- end
- if cmp < mmp then
- cmp = cmp + 0.5
- else cmp = mmp
- end
- local chpinc = math.min(worldCDataArray[1]["level"]*0.05,0.95)
- if worldCDataArray[1]["chp"] + chpinc < worldCDataArray[1]["mhp"] then
- worldCDataArray[1]["chp"] = worldCDataArray[1]["chp"] + chpinc
- else worldCDataArray[1]["chp"] = worldCDataArray[1]["mhp"]
- end
- if refMoveTm == 0 then refMoveTm = 8 end
- dmain()
- if vpickwait then
- vcpcingup = vcpcingup + 1
- end
- if cTarget ~= 0 and vpickwait and vcpcingup == vpcingupm then
- vcpcingup = 0
- vpcingupm = 0
- vpickwait = false
- for f = 1, #CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"] do
- if 100-CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][2] < math.random(1,100) then
- addItem(CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1],1)
- addsecm("You get "..cItemsLoad[CDataLoad[worldCDataArray[cTarget]["id"]]["loot"]["items"][f][1]]["name"])
- end
- end
- worldCDataArray[cTarget]["resptime"] = CDataLoad[worldCDataArray[cTarget]["id"]]["vrespawn"]
- worldCDataArray[cTarget]["living"] = false
- cTarget = 0
- worldCDataArray[1]["image"] = CDataLoad[1]["image"]
- end
- end
- if e == "timer" and t == tr2 then tr2 = os.startTimer(1) end
- end
- end
- cmp = mmp
- local function active()
- while true do
- e, b, p3, p4, p5 = os.pullEvent()
- if e == "key" then
- -- кнопка <- A
- if ( b == 203 or b == 30 ) and not paused and not vpickwait then
- playerTurning = "l"
- globalWXC = globalWXC - 1
- backgroundcPos = backgroundcPos + 1
- worldCDataArray[1]["x"] = worldCDataArray[1]["x"] - 1
- if backgroundcPos >= 51 then backgroundcPos = 1 end
- dmain()
- -- кнопка -> D
- elseif ( b == 205 or b == 32 ) and not paused and not vpickwait then
- playerTurning = "r"
- globalWXC = globalWXC + 1
- backgroundcPos = backgroundcPos - 1
- worldCDataArray[1]["x"] = worldCDataArray[1]["x"] + 1
- if backgroundcPos <= 0 then backgroundcPos = 51 end
- dmain()
- end
- --диалоговое окно
- -- открыть диалоговое окно 'E'
- if e == "key" and b == 18 and cTarget ~= 0 and worldCDataArray[cTarget]["roletype"] == "f" and getDistance(1,worldCDataArray[cTarget]["x"]) <= 15 and not vOpenDialogWindow then
- paused = true
- vOpenDialogWindow = true
- cDialog = worldCDataArray[cTarget]["dialog"]
- dmain()
- -- закрыть диалоговое окно 'E'
- elseif e == "key" and b == 18 and cTarget ~= 0 and worldCDataArray[cTarget]["roletype"] == "f" and getDistance(1,worldCDataArray[cTarget]["x"]) <= 15 and vOpenDialogWindow then
- paused = false
- vOpenDialogWindow = false
- cDialog = 0
- dmain()
- end
- if e == "key" and b == 27 and not paused then
- moveplayertox(3500)
- end
- -- кнопки атаки
- if b == 2 and not paused and not vpickwait then
- useSkill(1)
- dmain()
- elseif b == 3 and not paused and not vpickwait then
- useSkill(2)
- dmain()
- elseif b == 4 and not paused and not vpickwait then
- useSkill(3)
- dmain()
- elseif b == 5 and not paused and not vpickwait then
- useSkill(4)
- dmain()
- elseif b == 6 and not paused and not vpickwait then
- useSkill(5)
- dmain()
- end
- end
- if e == "mouse_click" then
- -- выбор цели лкм
- if b == 1 and not paused and not vpickwait then
- target(p3,p4)
- dmain()
- end
- -- диалоговое окно
- if b == 1 and vOpenDialogWindow and type(cDialog) == "table" and ctwindow == 0 and ccwindow == 0 then
- for f = 1, #cDialog-1 do
- if type(cDialog) == "table" and clicked(p3,p4,3,12+f+3-#cDialog,19,12+f+3-#cDialog) then
- if cDialog[f+1]["action"] == "close" then
- paused = false
- vOpenDialogWindow = false
- cDialog = 0
- dmain()
- elseif cDialog[f+1]["action"] == "dialog" then
- cDialog = cDialog[f+1]["do"]
- dmain()
- p3, p4 = 1, 1
- elseif cDialog[f+1]["action"] == "getquest" and CQuestsLoad[cDialog[f+1]["do"]]["comp"] == 0 then
- if CQuestsLoad[cDialog[f+1]["do"]]["minlvl"] <= worldCDataArray[1]["level"] then
- addQuest(cDialog[f+1]["do"])
- CQuestsLoad[cDialog[f+1]["do"]]["comp"] = false
- paused = false
- vOpenDialogWindow = false
- cDialog = 0
- dmain()
- end
- elseif cDialog[f+1]["action"] == "getquest" and CQuestsLoad[cDialog[f+1]["do"]]["comp"] == false then
- for t = 1, #cQuestsArray do
- if cQuestsArray[t][1] == cDialog[f+1]["do"] and cQuestsArray[t][3] then
- CQuestsLoad[cDialog[f+1]["do"]]["comp"] = true
- coins = coins + CQuestsLoad[cDialog[f+1]["do"]]["qreward"]["coins"]
- getXP(CQuestsLoad[cDialog[f+1]["do"]]["qreward"]["xp"])
- if CQuestsLoad[cDialog[f+1]["do"]]["qreward"]["item"][1] ~= 0 then
- addItem(CQuestsLoad[cDialog[f+1]["do"]]["qreward"]["item"][1],CQuestsLoad[cDialog[f+1]["do"]]["qreward"]["item"][2])
- end
- paused = false
- vOpenDialogWindow = false
- cDialog = 0
- table.remove(cQuestsArray,t)
- dmain()
- break end
- end
- elseif cDialog[f+1]["action"] == "trade" then
- paused = true
- ctwindow = cDialog[f+1]["do"]
- ctwindowArray = tradewindow[cDialog[f+1]["do"]]
- dmain()
- p3, p4 = 1, 1
- elseif cDialog[f+1]["action"] == "crafting" then
- paused = true
- ccwindow = cDialog[f+1]["do"]
- ccwindowArray = craftingwindow[cDialog[f+1]["do"]]
- dmain()
- p3, p4 = 1, 1
- end
- end
- end
- end
- -- открыть меню паузы
- if b == 1 and clicked(p3,p4,50,1,51,2) and not vOpenInventoryWindow and not vOpenstatsWindow and not vOpenQuestsWindow and not vOpenArmorInventoryWindow and ctwindow == 0 and ccwindow == 0 then
- sPouseMenu = true
- vOpenDialogWindow = false
- cDialog = 0
- dmain()
- end
- -- действия в меню паузы
- if sPouseMenu and not vOpenQuestsWindow and not vOpenstatsWindow and not vOpenQuestsWindow and not vOpenArmorInventoryWindow then
- if b == 1 and clicked(p3,p4,1,3,16,3) then
- sPouseMenu = false
- paused = false
- dmain()
- elseif b == 1 and clicked(p3,p4,1,5,16,5) then
- sPouseMenu = false
- vOpenInventoryWindow = true
- dmain()
- elseif b == 1 and clicked(p3,p4,1,7,16,7) then
- elseif b == 1 and clicked(p3,p4,1,9,16,9) then
- sPouseMenu = false
- vOpenstatsWindow = true
- dmain()
- elseif b == 1 and clicked(p3,p4,1,11,16,11) then
- sPouseMenu = false
- vOpenQuestsWindow = true
- dmain()
- elseif b == 1 and clicked(p3,p4,1,13,16,13) then
- end
- end
- -- закрыть окно заданий
- if vOpenQuestsWindow and clicked(p3,p4,43,5,43,5) then
- sPouseMenu = true
- vOpenQuestsWindow = false
- ctargquest = 0
- dmain()
- end
- -- закрыть окно статистики
- if vOpenstatsWindow and clicked(p3,p4,43,5,43,5) then
- sPouseMenu = true
- vOpenstatsWindow = false
- dmain()
- end
- -- закрыть окно торговли
- if ctwindow ~= 0 and clicked(p3,p4,51,1,51,1) then
- paused = false
- ctwindow = 0
- ctwindowScroll = 1
- vOpenDialogWindow = false
- cDialog = 0
- dmain()
- end
- -- закрыть окно крафта
- if ccwindow ~= 0 and clicked(p3,p4,51,1,51,1) then
- paused = false
- ccwindow = 0
- ccitem = 0
- ccwindowScroll = 1
- vOpenDialogWindow = false
- cDialog = 0
- dmain()
- end
- -- действия в окне крафта
- if ccwindow ~= 0 and cctitem == 0 then
- for f = 1, #ccwindowArray do
- if b == 1 and clicked(p3,p4,1,1+f*2,24,1+f*2) and ccwindowArray[f+4*ccwindowScroll-4] then
- cctitem = f+4*ccwindowScroll-4
- dmain()
- end
- end
- elseif ccwindow ~= 0 and cctitem ~= 0 then
- if clicked(p3,p4,37,6,37,6) then
- cctitem = 0
- dmain()
- elseif clicked(p3,p4,13,14,25,14) then
- local vcompitem = 0
- for f = 1, #ccwindowArray[cctitem]["recipe"] do
- for p = 1, #inventory["bag"] do
- if inventory["bag"][p][1] == ccwindowArray[cctitem]["recipe"][f][1] and inventory["bag"][p][2] >= ccwindowArray[cctitem]["recipe"][f][2] then
- vcompitem = vcompitem + 1
- end
- end
- end
- if vcompitem == #ccwindowArray[cctitem]["recipe"] then
- for f = 1, #ccwindowArray[cctitem]["recipe"] do
- for p = 1, #inventory["bag"] do
- if inventory["bag"][p][1] == ccwindowArray[cctitem]["recipe"][f][1] and inventory["bag"][p][2] >= ccwindowArray[cctitem]["recipe"][f][2] then
- inventory["bag"][p][2] = inventory["bag"][p][2] - ccwindowArray[cctitem]["recipe"][f][2]
- if inventory["bag"][p][2] == ccwindowArray[cctitem]["recipe"][f][2] then
- inventory["bag"][p][1] = 0
- end
- end
- end
- end
- local nitem = createNewItem(ccwindowArray[cctitem]["item"])
- addItem(nitem,1)
- cctitem = 0
- dmain()
- p3, p4 = 1, 1
- end
- end
- end
- -- действия в окне торговли
- if ctwindow ~= 0 then
- for f = 1, #ctwindowArray do
- if b == 1 and clicked(p3,p4,1,1+f*2,24,1+f*2) and ctwindowArray[f+4*ctwindowScroll-4] ~= nil and coins >= ctwindowArray[f+4*ctwindowScroll-4]["cost"] then
- ctitem = f+4*ctwindowScroll-4
- addItem(ctwindowArray[f+4*ctwindowScroll-4]["item"],1)
- coins = coins - ctwindowArray[f+4*ctwindowScroll-4]["cost"]
- dmain()
- end
- end
- end
- -- f+4*ctwindowScroll-4
- -- действия в окне заданий
- if vOpenQuestsWindow and #cQuestsArray ~= 0 then
- for f = 1, #cQuestsArray do
- if clicked(p3,p4,8,5+f,43,5+f) then
- ctargquest = f
- dmain()
- end
- end
- end
- -- закрыть окно инвентаря
- if (vOpenInventoryWindow or vOpenArmorInventoryWindow) and clicked(p3,p4,51,1,51,1) then
- sPouseMenu = true
- vOpenInventoryWindow = false
- vOpenArmorInventoryWindow = false
- ctargetitem = 0
- p3, p4 = 0, 0
- dmain()
- end
- if vOpenInventoryWindow and clicked(p3,p4,2,19,9,19) then
- ctargetitem = 0
- vOpenInventoryWindow = false
- vOpenArmorInventoryWindow = true
- dmain()
- elseif vOpenArmorInventoryWindow and clicked(p3,p4,2,19,9,19) then
- ctargetitem = 0
- vOpenInventoryWindow = true
- vOpenArmorInventoryWindow = false
- dmain()
- end
- -- действие в окне инвентаря
- if vOpenInventoryWindow then
- if ctargetitem ~= 0 and clicked(p3,p4,41,19,50,19) then
- inventory["bag"][ctargetitem][1] = 0
- inventory["bag"][ctargetitem][2] = 0
- ctargetitem = 0
- dmain()
- end
- local tbt = 0
- local cy = 1
- local x, y = 1, 1
- for f = 1, #inventory["bag"] do
- local h = f
- if f < 6 then cy = y+1
- elseif f > 5 and f < 11 then cy = y+7 h = f - 5
- elseif f > 10 then cy = y+13 h = f - 10 end
- if b == 1 and inventory["bag"][f][1] ~= 0 then
- if clicked(p3,p4,1+x+h*8-8,cy,1+x+h*8-2,cy+4) and tbt == 0 then
- ctargetitem = f
- dmain()
- tbt = 1
- break
- else
- ctargetitem = 0
- dmain()
- end
- end
- if b == 2 and inventory["bag"][f][1] ~= 0 then
- if clicked(p3,p4,1+x+h*8-8,cy,1+x+h*8-2,cy+4) and cItemsLoad[inventory["bag"][f][1]]["type"] == "armor" and cItemsLoad[inventory["bag"][f][1]]["reqlvl"] <= worldCDataArray[1]["level"] then
- if inventory["weared"][cItemsLoad[inventory["bag"][f][1]]["subtype"]] == 0 then
- inventory["weared"][cItemsLoad[inventory["bag"][f][1]]["subtype"]] = inventory["bag"][f][1]
- inventory["bag"][f][1] = 0
- inventory["bag"][f][2] = 0
- else
- local cvarwp1 = inventory["weared"][cItemsLoad[inventory["bag"][f][1]]["subtype"]]
- inventory["weared"][cItemsLoad[inventory["bag"][f][1]]["subtype"]] = inventory["bag"][f][1]
- inventory["bag"][f][1] = 0
- inventory["bag"][f][2] = 0
- addItem(cvarwp1,1)
- end
- playerVarRef()
- ctargetitem = 0
- dmain()
- break
- end
- if clicked(p3,p4,1+x+h*8-8,cy,1+x+h*8-2,cy+4) and cItemsLoad[inventory["bag"][f][1]]["type"] == "weapon" and cItemsLoad[inventory["bag"][f][1]]["reqlvl"] <= worldCDataArray[1]["level"] then
- if inventory["weared"]["weapon"] == 0 then
- inventory["weared"]["weapon"] = inventory["bag"][f][1]
- inventory["bag"][f][1] = 0
- inventory["bag"][f][2] = 0
- else
- local cvarwp2 = inventory["weared"]["weapon"]
- inventory["weared"]["weapon"] = inventory["bag"][f][1]
- inventory["bag"][f][1] = 0
- inventory["bag"][f][2] = 0
- addItem(cvarwp2,1)
- end
- ctargetitem = 0
- playerVarRef()
- dmain()
- break
- end
- if clicked(p3,p4,1+x+h*8-8,cy,1+x+h*8-2,cy+4) and cItemsLoad[inventory["bag"][f][1]]["type"] == "potion" and cItemsLoad[inventory["bag"][f][1]]["reqlvl"] <= worldCDataArray[1]["level"] then
- addEffect(1,cItemsLoad[inventory["bag"][f][1]]["props"])
- if inventory["bag"][f][2] > 1 then
- inventory["bag"][f][2] = inventory["bag"][f][2] - 1
- else
- inventory["bag"][f][1] = 0
- inventory["bag"][f][2] = 0
- ctargetitem = 0
- end
- playerVarRef()
- dmain()
- end
- end
- end
- end
- if vOpenArmorInventoryWindow and clicked(p3,p4,2,2,7,5) and b == 2 then
- takeOffItem("helmet")
- dmain()
- elseif vOpenArmorInventoryWindow and clicked(p3,p4,2,9,7,13) and b == 2 then
- takeOffItem("bodywear")
- dmain()
- elseif vOpenArmorInventoryWindow and clicked(p3,p4,10,2,16,5) and b == 2 then
- takeOffItem("pants")
- dmain()
- elseif vOpenArmorInventoryWindow and clicked(p3,p4,10,9,16,13) and b == 2 then
- takeOffItem("footwear")
- dmain()
- elseif vOpenArmorInventoryWindow and clicked(p3,p4,18,2,24,5) and b == 2 then
- takeOffItem("pendant")
- dmain()
- elseif vOpenArmorInventoryWindow and clicked(p3,p4,18,9,24,13) and b == 2 then
- takeOffItem("weapon")
- dmain()
- end
- end
- if e == "mouse_scroll" then
- if ctwindow ~= 0 and b == -1 and ctwindowScroll > 1 then -- прокрутка вверх
- ctwindowScroll = ctwindowScroll - 1
- dmain()
- elseif ctwindow ~= 0 and b == 1 and ctwindowScroll < math.ceil(#ctwindowArray/4) then -- прокрутка вниз
- ctwindowScroll = ctwindowScroll + 1
- dmain()
- end
- if ccwindow ~= 0 and b == -1 and ccwindowScroll > 1 and cctitem == 0 then -- прокрутка вверх
- ccwindowScroll = ccwindowScroll - 1
- dmain()
- elseif ccwindow ~= 0 and b == 1 and ccwindowScroll < math.ceil(#ccwindowArray/4) and cctitem == 0 then -- прокрутка вниз
- ccwindowScroll = ccwindowScroll + 1
- dmain()
- end
- end
- -- выкопать 'E'
- if e == "key_up" and b == 18 and cTarget ~= 0 and worldCDataArray[cTarget]["roletype"] == "r" and getDistance(1,worldCDataArray[cTarget]["x"]) <= 5 and not paused and not vpickwait then
- vpickwait = true
- vpcingupm = math.random(12,22)
- vcpcingup = 0
- worldCDataArray[1]["image"] = playerMdl[3]
- e = "mouse_up"
- b = 1
- end
- end -- #end of the loop
- end -- #end of the function
- --[[
- local ctwindowArray = {}
- local ctwindow = 0
- local ctitem = 0
- local ctwindowScroll = 1
- ]]--
- parallel.waitForAll(active,funcPSecond)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement