Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Pet System R34083


Rekomendowane odpowiedzi

Opublikowano

constinfo.py



PetQuestIndex = 0
SlotDrop = 0
ItemPetSlot = 0
ItemPetQuest = 0
PetSend = ""
PetIndex = 0

game.py



import pet_interface

self.pet_interface = pet_interface.Interface()

"petInter_Show" : self.petInter_Show,
"petInter_Show_NOW" : self.petInter_Show_NOW,
"petInter_Hide" : self.petInter_Hide,
"petInter_SetQuest" : self.petInter_SetQuest,
"petInter_SetData" : self.petInter_SetData,
"petInter_Send" : self.petInter_Send,
"petInter_SelectBonus" : self.petInter_SelectBonus,
"petInter_SetDivision" : self.petInter_SetDivision,
"petInter_PetIsMine" : self.petInter_PetIsMine,

def petInter_Show(self):
self.pet_interface.Open()

def petInter_Show_NOW(self):
self.pet_interface.Open_NOW()

def petInter_Hide(self):
self.pet_interface.Close()

def petInter_SetData(self, data):
self.pet_interface.SetData(data)

def petInter_SetQuest(self, index):
constInfo.PetQuestIndex = int(index)

def petInter_SetDivision(self, percent):
self.pet_interface.SetDiv(percent)

def petInter_PetIsMine(self, vid):
petName = chr.GetNameByVID(int(vid))
charName = player.GetName()
if petName[0:len(charName)] == charName:
constInfo.petSend = "IS_MINE|1"
else:
constInfo.petSend = "IS_MINE|0"
event.QuestButtonClick(constInfo.PetQuestIndex)

def petInter_Send(self):
net.SendQuestInputStringPacket(str(constInfo.petSend))

def petInter_SelectBonus(self):
self.pet_interface.SelectBonus()

def panelPlayer_SetQuest(self, index):
constInfo.panelPlayerQuest = int(index)

def panelPlayer_Send(self):
net.SendQuestInputStringPacket(str(constInfo.panelPlayerSend))

def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
if constInfo.SlotDrop == 1:
constInfo.SlotDrop = 0
self.PopupMessage("Nie można wyrzucić tego przedmiotu.")
return

def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
if constInfo.SlotDrop == 1:
constInfo.SlotDrop = 0
self.PopupMessage("Nie można wyrzucić tego przedmiotu.")
return



quest



quest nixo_petsystem begin
state start begin
function get_input(function_game)
cmdchat("getinputbegin")
local input = input(cmdchat(function_game))
cmdchat("getinputend")
if input == "" or string.find(string.lower(input), "nan") then
return 0
else
return tostring(input)
end
end
when login begin
pc.setqf("nixo_my_exp", pc.get_exp())
cmdchat("petInter_SetQuest "..q.getcurrentquestindex())
end
when button or info begin
info = nixo_petsystem.get_input("petInter_Send")
splited = string.split(info, '|')
if splited[1] == "BONUS_TABLE" then
if table.getn(splited) > 4 then
chat("Możesz wybrać maksymalnie 3 bonusy.")
return
else
NIXO_SAVE(pc.getqf("nixo_pet_actual"), tonumber(splited[2]), tonumber(splited[3]), tonumber(splited[4]))
end
end
if splited[1] == "PLUS_BONUS" then
NIXO_ADD_POINTS(pc.getqf("nixo_pet_actual"), tonumber(splited[2]), 1)
end
if splited[1] == "SET_DIV" then
NIXO_SET_DIV()
end
if splited[1] == "SLOT_USE" then
NIXO_UNWEAR_ITEM(pc.getqf("nixo_pet_actual"), tonumber(splited[2]))
end
if splited[1] == "IS_MINE" and tonumber(splited[2]) == 1 then
cmdchat("petInter_Show_NOW")
end
end
when levelup begin
pc.setqf("nixo_my_exp", 0)
end
when kill with not npc.is_pc() begin
if pc.get_level()-npc.get_level() <= 30 then
local exp_full = pc.get_exp()-pc.getqf("nixo_my_exp")
local percent = PETS_CONFIG["DIVISION_OF_EXPERIENCE_TABLE"][NIXO_GET_INFO(pc.getqf("nixo_pet_actual"), "division_of_experience")]/100
pc.give_exp2(-math.ceil(exp_full*percent))
if pc.get_level() >= npc.get_level() then
pet_exp = NIXO_GET_INFO(pc.getqf("nixo_pet_actual"), "division_of_experience")
else
pet_exp = NIXO_GET_INFO(pc.getqf("nixo_pet_actual"), "division_of_experience")+1
end
if pet_exp > 0 then
local super_exp = 5
NIXO_PET_EXP(pc.getqf("nixo_pet_actual"), pet_exp*super_exp)
end
pc.setqf("nixo_my_exp", pc.get_exp())
end
end
when 53001.use begin
if pet.is_summon(PETS_TABLE[item.vnum][1]) then
NIXO_PET_UNSUMMON(item.vnum)
else
NIXO_PET_SUMMON(item.vnum)
end
end
when logout with pc.getqf("nixo_pet_actual") ~= 0 begin
NIXO_SET_TEXT(1)
pc.setqf("nixo_recall", pc.getqf("nixo_pet_actual"))
NIXO_PET_UNSUMMON(pc.getqf("nixo_pet_actual"))
NIXO_SET_TEXT(0)
end
when login with pc.getqf("nixo_recall") ~= 0 begin
for i = 0, 89 do
if item.select_cell(i) then
if item.vnum == pc.getqf("nixo_recall") then
NIXO_SET_TEXT(1)
NIXO_PET_SUMMON(pc.getqf("nixo_recall"))
NIXO_SET_TEXT(0)
break
end
end
end
pc.setqf("nixo_recall", 0)
end
when 71144.use begin
NIXO_WEAR_ITEM(pc.getqf("nixo_pet_actual"), item.vnum)
end
when 34001.click begin
cmdchat("petInter_PetIsMine "..npc.get_vid())
end
end
end

lua



-------------------------------------------
-- LUA LIB PET SYSTEM METIN2 GAME R34083 --
---- COPYRIGHT 2014 BY NIXO AKA GUMIS ----
--------- ALL RIGHTS RESERVED ------------
-------------------------------------------

PETS_CONFIG = { -- PET GLOBAL CONFIG

["POINTS_SKILL_PER_LEVEL"] = 1,
["DIVISION_OF_EXPERIENCE_TABLE"] = {10, 20, 30, 40, 50},
["MAX_BONUS"] = 3, -- CHANGE REQUIRED CHANGES IN THE GUI AND MANY CHANGES IN THE CODE
["MAX_ITEM"] = 2, -- CHANGE REQUIRED CHANGES IN THE GUI AND MANY CHANGES IN THE CODE
["MAX_SUMMONED_PETS"] = 1,
["QF_QUEST"] = "nixo_petsystem",
["QF_PREFIX"] = "nixo_pet",

}

PET_EXP_TABLE = { -- PET EXP TABLE CONFIG

[0] = 10000,
[1] = 30000,
[2] = 60000,
[3] = 90000,
[4] = 120000,
[5] = 150000,
[6] = 180000,
[7] = 210000,
[8] = 240000,
[9] = 270000,
[10] = 300000,
[11] = 330000,
[12] = 360000,
[13] = 390000,
[14] = 420000,
[15] = 450000,
[16] = 480000,
[17] = 510000,
[18] = 540000,
[19] = 570000,
[20] = 600000,
[21] = 630000,
[22] = 660000,
[23] = 690000,
[24] = 720000,
[25] = 750000,
[26] = 780000,
[27] = 810000,
[28] = 840000,
[29] = 870000,
[30] = 900000,

}

BONUSES_TABLE = { -- BONUSES CONFIG

-- [BONUS_ID] = {BONUS_NAME, VALUES_PER_LEVEL, BONUS_MAX_LEVEL}
[17] = {"Silny_przeciwko_ludziom", 2, 10},
[63] = {"Silny_przeciwko_potoworom", 2, 10},
[3] = {"Witalność_", 1, 10},
[4] = {"Inteligencja", 1, 10},
[5] = {"Siła", 1, 10},
[6] = {"Zwinność_", 1, 10},
[1] = {"Max._PŻ_", 100, 10},
[10] = {"Regeneracja_PŻ_", 5, 10},
[9] = {"Szybkość_zaklęcia", 10, 10},
[15] = {"Szansa_na_krytyka", 2, 10},
[16] = {"Szansa_na_przeszywke", 2, 10},

}

ITEM_TABLE = { -- ITEMS CONFIG (EVERY ITEM HAS OWN TABLES - ASSOCIATIVE ARRAY)

[71144] = {

["MIN_LEVEL"] = 5,

["BONUSES"] = {
[1] = {1, 1000},
},

},

}

EFFECT_TABLE = {

[0] = "d:\\\\ymir work\\\\xxx.mse",

}

PETS_TABLE = { -- PET CONFIG

-- [ITEM_VNUM] = {PET_VNUM, PET_NAME, EXP_TABLE, MAX_LEVEL, ALLOWED_BONUSES (TABLE), ALLOWED_ITEM (TABLE), NUMBER_OF_EFFECT}
[53001] = {34001, "Feniks", PET_EXP_TABLE, 30, {15, 16, 1}, {71144}, nil},

}

function NIXO_SET_TEXT(bool) -- 0/1

if (bool == 0 or bool == 1) then

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_text", bool)

end

end

function NIXO_GET_TEXT(text, variables) -- variables - table

if (pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_text") == 0) then

if (text == "PET_RECALL") then

syschat("Towarzysz został przywołany.")

elseif (text == "PET_APPEAL") then

syschat("Towarzysz został odwołany.")

elseif (text == "PET_LEVEL_UP") then

syschat("Twój towarzysz osiągnął "..variables.." poziom.")

elseif (text == "RECEIVED_THE_SKILL_POINTS") then

if (variables == 1) then

syschat("Twój towarzysz otrzymał "..variables.." punkt umiejętności.")

elseif (variables > 1 and variables < 4) then

syschat("Twój towarzysz otrzymał "..variables.." punkty umiejętności.")

elseif (variables > 4) then

syschat("Twój towarzysz otrzymał "..variables.." punktów umiejętności.")

end
elseif (text == "ADDED_SKILL_POINTS") then

syschat("Dodano punkt umiejętności w umiejętność "..variables..".")

elseif (text == "RESET_SKILLS") then

syschat("Zresetowano umiejętności.")

elseif (text == "SET_DIV_OF_EXP") then

syschat("Zmienono podział doświadczenia na "..variables..".")

elseif (text == "CHANGE_SKILLS") then

syschat("Zmienono umiejętności towarzysza.")

end

end

end

function NIXO_GET_GLOBAL_INFO(info_type) -- VNUM is ITEM_VNUM

if (info_type == "count_summoned") then

return pet.count_summoned()

elseif (info_type == "table_summoned") then

local pet_table = {}

for key in pairs(PETS_TABLE) do

if (pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_summoned_"..key) == 1) then

table.insert(pet_table, key)

end

end

return pet_table

end

end

PETS_TABLE = { -- PET CONFIG

-- [ITEM_VNUM] = {PET_VNUM, PET_NAME, MAX_LEVEL, ALLOWED_BONUSES (TABLE), ALLOWED_ITEM (TABLE), NUMBER_OF_EFFECT}
[53001] = {34001, "Feniks", 30, {15, 16, 63}, {71144}, nil},

}

function NIXO_GET_ITEM_BY_PET_VNUM(pet_vnum)

for key in pairs(PETS_TABLE) do

if (PETS_TABLE[key][1] == pet_vnum) then

return key

end

end

end

function NIXO_PET_EXP(vnum, value)

if NIXO_GET_INFO(vnum, "level") == PETS_TABLE[vnum][3] then

return

end

if NIXO_GET_INFO(vnum, "exp")+value < NIXO_GET_INFO(vnum, "exp_max") then

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_exp", NIXO_GET_INFO(vnum, "exp")+value)

else

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_exp", 0)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_level", NIXO_GET_INFO(vnum, "level")+1)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_points", NIXO_GET_INFO(vnum, "points")+PETS_CONFIG["POINTS_SKILL_PER_LEVEL"])

NIXO_SET_TEXT(1)
NIXO_PET_UNSUMMON(vnum, 1)
NIXO_PET_SUMMON(vnum)
NIXO_SET_TEXT(0)
NIXO_GET_TEXT("PET_LEVEL_UP", NIXO_GET_INFO(vnum, "level"))
NIXO_GET_TEXT("RECEIVED_THE_SKILL_POINTS", 1)

end

NIXO_RELOAD_GUI(vnum)

end

function NIXO_GET_EMPTY_AMOUNT()

if NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "item", 1) == 0 then
return 1
elseif NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "item", 2) == 0 then
return 2
elseif NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "item", 3) == 0 then
return 3
else
return 1
end

end

function NIXO_WEAR_ITEM(pet_item_vnum, item_vnum)

local amount = NIXO_GET_EMPTY_AMOUNT()

if table_is_in(PETS_TABLE[pet_item_vnum][5], item_vnum) then
if NIXO_GET_INFO(pet_item_vnum, "level") >= ITEM_TABLE[item_vnum]["MIN_LEVEL"] then
if NIXO_GET_INFO(pet_item_vnum, "item", amount) ~= 0 then
NIXO_UNWEAR_ITEM(pet_item_vnum, amount, 1)
end
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..pet_item_vnum.."_item_"..amount, item_vnum)
NIXO_RELOAD_BONUS(pet_item_vnum)
NIXO_RELOAD_GUI(pet_item_vnum)
pc.remove_item(item_vnum, 1)
else
chat("Pupil nie posiada wymaganego poziomu.")
end
else
chat("Ten przedmiot nie jest dozwolony dla twojego pupila.")
end

end

function NIXO_UNWEAR_ITEM(pet_item_vnum, amount, refresh)

if amount > 0 and amount <= 3 then

if NIXO_GET_INFO(pet_item_vnum, "item", amount) ~= 0 then
pc.give_item2(NIXO_GET_INFO(pet_item_vnum, "item", amount), 1)
NIXO_TAKE_BONUS(pet_item_vnum)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..pet_item_vnum.."_item_"..amount, 0)
NIXO_GIVE_BONUS(pet_item_vnum)
if refresh ~= 1 then
NIXO_RELOAD_GUI(pet_item_vnum)
end
end

end

end

function NIXO_GET_INFO(vnum, info_type, number_info)

if (info_type == "pet_vnum") then

return PETS_TABLE[vnum][1]

elseif (info_type == "is_summoned") then

return pet.is_summoned(PETS_TABLE[vnum][1])

elseif (info_type == "exp") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_exp")

elseif (info_type == "exp_max") then

return PET_EXP_TABLE[pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_level")]

elseif (info_type == "level") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_level")

elseif (info_type == "name") then

return " - Lv. "..pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_level").." "..PETS_TABLE[vnum][2]

elseif (info_type == "allowed_bonuses") then

return PETS_TABLE[vnum][5]

elseif (info_type == "division_of_experience") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_div_of_exp")

elseif (info_type == "bonus_type") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_type_"..number_info)

elseif (info_type == "points") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_points")

elseif (info_type == "bonus_value") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_value_"..number_info)

elseif (info_type == "item") then

return pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_item_"..number_info)

end

end

function NIXO_FIRST_SUMMON(item_vnum)

syschat("Przed pierwszym przywołaniem peta wybierz jego bonusy, które będzie rozwijał.")
syschat("Możesz ich wybrać maksymalnie 3.")

cmdchat("petInter_SetData "..PETS_TABLE[item_vnum][2].."|"..PETS_TABLE[item_vnum][1].."|1|"..PETS_TABLE[item_vnum][3].."|"..NIXO_GET_INFO(item_vnum, "exp").."|"..NIXO_GET_INFO(item_vnum, "exp_max").."|0|0|0|0|0|0|0|0|0|0")

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual", item_vnum)

cmdchat("petInter_Show_NOW")
cmdchat("petInter_SelectBonus")

end

function NIXO_RELOAD_GUI(vnum)

if pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_first_summon_"..vnum) == 1 then

cmdchat("petInter_SetData "..PETS_TABLE[vnum][2].."|"..PETS_TABLE[vnum][1].."|"..NIXO_GET_INFO(vnum, "level").."|"..PETS_TABLE[vnum][3].."|"..NIXO_GET_INFO(vnum, "exp").."|"..NIXO_GET_INFO(vnum, "exp_max").."|"..NIXO_GET_INFO(vnum, "points").."|"..BONUSES_TABLE[NIXO_GET_INFO(vnum, "bonus_type", 1)][1].."|"..NIXO_GET_INFO(vnum, "bonus_value", 1).."|"..BONUSES_TABLE[NIXO_GET_INFO(vnum, "bonus_type", 2)][1].."|"..NIXO_GET_INFO(vnum, "bonus_value", 2).."|"..BONUSES_TABLE[NIXO_GET_INFO(vnum, "bonus_type", 3)][1].."|"..NIXO_GET_INFO(vnum, "bonus_value", 3).."|"..NIXO_GET_INFO(vnum, "item", 1).."|"..NIXO_GET_INFO(vnum, "item", 2).."|"..NIXO_GET_INFO(vnum, "item", 3))
cmdchat("petInter_SetDivision "..PETS_CONFIG["DIVISION_OF_EXPERIENCE_TABLE"][NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "division_of_experience")])

end

end

function NIXO_SET_DIV()

local actual_div = NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "division_of_experience")
local max_div = table.getn(PETS_CONFIG["DIVISION_OF_EXPERIENCE_TABLE"])

if actual_div == 0 or actual_div == max_div then
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_div_of_exp", 1)
else
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_div_of_exp", actual_div+1)
end

cmdchat("petInter_SetDivision "..PETS_CONFIG["DIVISION_OF_EXPERIENCE_TABLE"][NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "division_of_experience")])

NIXO_GET_TEXT("SET_DIV_OF_EXP", PETS_CONFIG["DIVISION_OF_EXPERIENCE_TABLE"][NIXO_GET_INFO(pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual"), "division_of_experience")].."%")

end

function NIXO_SAVE(vnum, bonus1, bonus2, bonus3)

if pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_first_summon_"..vnum) == 0 then

if not table_is_in(PETS_TABLE[vnum][4], bonus1) then

chat("Bonus 1 nie może zostać wybrany w tym pupilu.")
return

end

if not table_is_in(PETS_TABLE[vnum][4], bonus2) then

chat("Bonus 2 nie może zostać wybrany w tym pupilu.")
return

end

if not table_is_in(PETS_TABLE[vnum][4], bonus3) then

chat("Bonus 3 nie może zostać wybrany w tym pupilu.")
return

end

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_type_1", bonus1)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_type_2", bonus2)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_type_3", bonus3)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_level", 1)

pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_div_of_exp", 5)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_first_summon_"..vnum, 1)

chat("Zapisano.")

cmdchat("petInter_Hide")

NIXO_PET_SUMMON(vnum)

end

end

function NIXO_PET_SUMMON(item_vnum)

if (NIXO_GET_GLOBAL_INFO("count_summoned") < PETS_CONFIG["MAX_SUMMONED_PETS"]) then

local petName = NIXO_GET_INFO(item_vnum, "name")
local petVnum = PETS_TABLE[item_vnum][1]
local petEffect = PETS_TABLE[item_vnum][7]

if (not pet.is_summon(petVnum)) then

if (pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_first_summon_"..item_vnum) == 0) then

NIXO_FIRST_SUMMON(item_vnum)

return

end

pet.summon(petVnum, petName, false)

NIXO_RELOAD_GUI(item_vnum)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual", item_vnum)

NIXO_GIVE_BONUS(item_vnum)

if petEffect ~= nil then

pet.spawn_effect(petVnum, petEffect)

end

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_summoned_"..item_vnum, 1)

NIXO_GET_TEXT("PET_RECALL")

end

end

end

function NIXO_GIVE_BONUS(item_vnum)

for i = 1, PETS_CONFIG["MAX_BONUS"] do

if (NIXO_GET_INFO(item_vnum, "bonus_value", i) >= 1) then

affect.add_collect(NIXO_GET_INFO(item_vnum, "bonus_type", i), NIXO_GET_INFO(item_vnum, "bonus_value", i), 69*69*69*69*69)

end

end

for i = 1, 3 do

if (NIXO_GET_INFO(item_vnum, "item", i) == 0) then

return

end

local table_bonuses = ITEM_TABLE[NIXO_GET_INFO(item_vnum, "item", i)]["BONUSES"]

for x = 1, table.getn(table_bonuses) do

affect.add_collect(table_bonuses[x][1], table_bonuses[x][2], 69*69*69*69*69)

end

end

end

function NIXO_ADD_POINTS(item_vnum, amount, count)

if amount > 0 and amount <= 4 then

if (count >= NIXO_GET_INFO(item_vnum, "points")) then

if (NIXO_GET_INFO(item_vnum, "bonus_value", amount)+1 <= BONUSES_TABLE[NIXO_GET_INFO(item_vnum, "bonus_type", amount)][3]) then

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..item_vnum.."_bonus_value_"..amount, NIXO_GET_INFO(item_vnum, "bonus_value", amount)+count)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..item_vnum.."_points", NIXO_GET_INFO(item_vnum, "points")-count)

local bonus_name = string.gsub(BONUSES_TABLE[NIXO_GET_INFO(item_vnum, "bonus_type", amount)][1], "_", " ")
NIXO_GET_TEXT("ADDED_SKILL_POINTS", bonus_name)

NIXO_RELOAD_GUI(item_vnum)

else

syschat("ERROR: THIS ABILITY IS NOW UP TO DEVELOPED")

end

else

syschat("ERROR: INSUFFICIENT NUMBER OF POINTS")

end

end

end

function NIXO_RESET_SKILLS(item_vnum) -- OPTIONAL FUNCTION

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_value_1", 0)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_value_2", 0)
pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_bonus_value_3", 0)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_"..vnum.."_points", NIXO_GET_INFO(item_vnum, "level")*PETS_CONFIG["POINTS_SKILL_PER_LEVEL"])

NIXO_GET_TEXT("RESET_SKILLS")

end

function NIXO_RELOAD_BONUS(item_vnum)

NIXO_TAKE_BONUS(item_vnum)
NIXO_GIVE_BONUS(item_vnum)

end

function NIXO_TAKE_BONUS(item_vnum)

for i = 1, PETS_CONFIG["MAX_BONUS"] do

if (NIXO_GET_INFO(item_vnum, "bonus_value", i) >= 1) then

affect.remove_collect(NIXO_GET_INFO(item_vnum, "bonus_type", i), NIXO_GET_INFO(item_vnum, "bonus_value", i), 69*69*69*69*69)

end

end

for i = 1, 3 do

if (NIXO_GET_INFO(item_vnum, "item", i) == 0) then

return

end

local table_bonuses = ITEM_TABLE[NIXO_GET_INFO(item_vnum, "item", i)]["BONUSES"]

for x = 1, table.getn(table_bonuses) do

affect.remove_collect(table_bonuses[x][1], table_bonuses[x][2], 69*69*69*69*69)

end

end

end

function NIXO_PET_UNSUMMON(item_vnum, close_gui)

if (pc.getf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_summoned_"..item_vnum) == 1) then

pet.unsummon(PETS_TABLE[item_vnum][1])

if close_gui ~= 1 then

cmdchat("petInter_Hide")

end

NIXO_TAKE_BONUS(item_vnum)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_summoned_"..item_vnum, 0)

pc.setf(PETS_CONFIG["QF_QUEST"], PETS_CONFIG["QF_PREFIX"].."_actual", 0)

NIXO_GET_TEXT("PET_APPEAL")

end

end

pet_interface.py



import ui
import player
import event
import chat
import app
import item
import constInfo
import locale
import uiToolTip
import mouseModule
import grp

class Interface(ui.Window):
def __init__(self):
ui.Window.__init__(self)
self.BuildWindow()

def __del__(self):
ui.Window.__del__(self)

def BuildWindow(self):
self.Board = ui.BoardWithTitleBar()
self.Board.SetSize(294, 181)
self.Board.SetPosition(100, 100)
self.Board.AddFlag('movable')
self.Board.AddFlag('float')
self.Board.SetTitleName('Informacje o twoim pupilu')
self.Board.SetCloseEvent(self.Close)

self.comp = Component()

self.Showed = 1

self.tooltipItem1 = uiToolTip.ItemToolTip()
self.tooltipItem1.Hide()
self.tooltipItem2 = uiToolTip.ItemToolTip()
self.tooltipItem2.Hide()
self.tooltipItem3 = uiToolTip.ItemToolTip()
self.tooltipItem3.Hide()

self.bonusTable = []

self.points_text = self.comp.LargeTextLine(self.Board, 'Punkty umiejętności:', 93, 175, self.comp.RGB(255, 255, 255))
self.points = self.comp.LargeTextLine(self.Board, '0', 209, 175, self.comp.RGB(255, 0, 0), 1)
self.bonus1_text = self.comp.TextLine(self.Board, 'Bonus 1:', 20, 199, self.comp.RGB(255, 255, 255))
self.bonus2_text = self.comp.TextLine(self.Board, 'Bonus 2:', 20, 219, self.comp.RGB(255, 255, 255))
self.bonus3_text = self.comp.TextLine(self.Board, 'Bonus 3:', 20, 239, self.comp.RGB(255, 255, 255))
self.bonus1_name = self.comp.TextLine(self.Board, 'Silny przeciwko potworom', 999, 199, self.comp.RGB(0, 75, 255), 155)
self.bonus2_name = self.comp.TextLine(self.Board, 'Silny przeciwko ludziom', 999, 219, self.comp.RGB(0, 75, 255), 155)
self.bonus3_name = self.comp.TextLine(self.Board, 'Inteligencja', 999, 239, self.comp.RGB(0, 75, 255), 155)
self.bonus1_value = self.comp.TextLine(self.Board, '0', 999, 199, self.comp.RGB(255, 0, 0), 253)
self.bonus2_value = self.comp.TextLine(self.Board, '10', 999, 219, self.comp.RGB(0, 255, 0), 253)
self.bonus3_value = self.comp.TextLine(self.Board, '10', 999, 239, self.comp.RGB(0, 255, 0), 253)

self.item1 = ui.SlotWindow()
self.item1.SetParent(self.Board)
self.item1.SetSize(32, 32)
self.item1.SetPosition(95, 260)
self.item1.AppendSlot(0, 0, 0, 32, 32)
self.item1.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
self.item1.SetOverInItemEvent(ui.__mem_func__(self.OverInItem1))
self.item1.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem1))
self.item1.SetUseSlotEvent(ui.__mem_func__(self.SlotItemUse1))
self.item1.SetUnselectItemSlotEvent(ui.__mem_func__(self.SlotItemUse1))
self.item1.SetSelectItemSlotEvent(ui.__mem_func__(self.SlotAttached1))
self.item1.SetSelectEmptySlotEvent(ui.__mem_func__(self.SlotTEST))
self.item1.RefreshSlot()

self.item2 = ui.SlotWindow()
self.item2.SetParent(self.Board)
self.item2.SetSize(32, 32)
self.item2.SetPosition(135, 260)
self.item2.AppendSlot(1, 0, 0, 32, 32)
self.item2.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
self.item2.SetOverInItemEvent(ui.__mem_func__(self.OverInItem2))
self.item2.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem2))
self.item2.SetUseSlotEvent(ui.__mem_func__(self.SlotItemUse2))
self.item2.SetUnselectItemSlotEvent(ui.__mem_func__(self.SlotItemUse2))
self.item2.SetSelectItemSlotEvent(ui.__mem_func__(self.SlotAttached2))
self.item2.SetSelectEmptySlotEvent(ui.__mem_func__(self.SlotTEST))
self.item2.RefreshSlot()

self.item3 = ui.SlotWindow()
self.item3.SetParent(self.Board)
self.item3.SetSize(32, 32)
self.item3.SetPosition(175, 260)
self.item3.AppendSlot(2, 0, 0, 32, 32)
self.item3.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
self.item3.SetOverInItemEvent(ui.__mem_func__(self.OverInItem3))
self.item3.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem3))
self.item3.SetUseSlotEvent(ui.__mem_func__(self.SlotItemUse3))
self.item3.SetUnselectItemSlotEvent(ui.__mem_func__(self.SlotItemUse3))
self.item3.SetSelectItemSlotEvent(ui.__mem_func__(self.SlotAttached3))
self.item3.SetSelectEmptySlotEvent(ui.__mem_func__(self.SlotTEST))
self.item3.RefreshSlot()

self.select1 = self.comp.ToggleButton(self.Board, 'Silny na potwory', '', 9, 178, (lambda id = '63': self.BonusDelete(id)), (lambda id = '63': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select2 = self.comp.ToggleButton(self.Board, 'Silny na ludzi', '', 104, 178, (lambda id = '17': self.BonusDelete(id)), (lambda id = '17': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select3 = self.comp.ToggleButton(self.Board, 'Witalność', '', 198, 178, (lambda id = '3': self.BonusDelete(id)), (lambda id = '3': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select4 = self.comp.ToggleButton(self.Board, 'Siła', '', 9, 206, (lambda id = '4': self.BonusDelete(id)), (lambda id = '4': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select5 = self.comp.ToggleButton(self.Board, 'Inteligencja', '', 104, 206, (lambda id = '5': self.BonusDelete(id)), (lambda id = '5': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select6 = self.comp.ToggleButton(self.Board, 'Zręczność', '', 198, 206, (lambda id = '6': self.BonusDelete(id)), (lambda id = '6': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select7 = self.comp.ToggleButton(self.Board, 'Max HP', '', 9, 234, (lambda id = '1': self.BonusDelete(id)), (lambda id = '1': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select8 = self.comp.ToggleButton(self.Board, 'Regeneracja pż', '', 104, 234, (lambda id = '10': self.BonusDelete(id)), (lambda id = '10': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select9 = self.comp.ToggleButton(self.Board, 'Szybkość zaklęcia', '', 198, 234, (lambda id = '9': self.BonusDelete(id)), (lambda id = '9': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select10 = self.comp.ToggleButton(self.Board, 'Krytyk', '', 50, 262, (lambda id = '15': self.BonusDelete(id)), (lambda id = '15': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.select11 = self.comp.ToggleButton(self.Board, 'Szycie', '', 152, 262, (lambda id = '16': self.BonusDelete(id)), (lambda id = '16': self.BonusAdd(id)), 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.oks = self.comp.Button(self.Board, 'Zatwierdź', '', 104, 290, self.Ok, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')

self.points_text.Hide()
self.points.Hide()
self.bonus1_text.Hide()
self.bonus2_text.Hide()
self.bonus3_text.Hide()
self.bonus1_name.Hide()
self.bonus2_name.Hide()
self.bonus3_name.Hide()
self.bonus1_value.Hide()
self.bonus2_value.Hide()
self.bonus3_value.Hide()
self.select1.Hide()
self.select2.Hide()
self.select3.Hide()
self.select4.Hide()
self.select5.Hide()
self.select6.Hide()
self.select7.Hide()
self.select8.Hide()
self.select9.Hide()
self.select10.Hide()
self.select11.Hide()
self.oks.Hide()

self.avatar_bg = self.comp.ThinBoard(self.Board, FALSE, 12, 33, 110, 103, FALSE)
self.Avatar = self.comp.ExpandedImage(self.avatar_bg, 999, 999, 'image/1.jpg')
self.show_bonus = self.comp.Button(self.Board, 'Pokaż więcej', '', 111, 146, self.ShowBonus, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
self.name = self.comp.LargeTextLine(self.Board, 'Ognisty Feniks', 999, 36, self.comp.RGB(255, 54, 0), 208)
self.level = self.comp.LargeTextLine(self.Board, 'Lv. 1/100', 999, 60, self.comp.RGB(0, 75, 255), 209, 1)
self.exp = self.comp.TextLine(self.Board, '1345/10000 (34%)', 999, 87, self.comp.RGB(0, 127, 255), 213)
self.exp_gauge = self.comp.Gauge(self.Board, 145, 'purple', 130, 114)
self.plus_bon1 = self.comp.Button(self.Board, '', '', 269, 199, (lambda bonus=1: self.Plus(bonus)), 'd:/ymir work/ui/game/windows/btn_plus_up.sub', 'd:/ymir work/ui/game/windows/btn_plus_over.sub', 'd:/ymir work/ui/game/windows/btn_plus_down.sub')
self.plus_bon2 = self.comp.Button(self.Board, '', '', 269, 219, (lambda bonus=2: self.Plus(bonus)), 'd:/ymir work/ui/game/windows/btn_plus_up.sub', 'd:/ymir work/ui/game/windows/btn_plus_over.sub', 'd:/ymir work/ui/game/windows/btn_plus_down.sub')
self.plus_bon3 = self.comp.Button(self.Board, '', '', 269, 239, (lambda bonus=3: self.Plus(bonus)), 'd:/ymir work/ui/game/windows/btn_plus_up.sub', 'd:/ymir work/ui/game/windows/btn_plus_over.sub', 'd:/ymir work/ui/game/windows/btn_plus_down.sub')
self.division_exp = self.comp.Button(self.Board, '50%', '', 230, 135, self.SetDivision, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')

self.plus_bon1.Hide()
self.plus_bon2.Hide()
self.plus_bon3.Hide()

def SetDivision(self):
constInfo.petSend = "SET_DIV|"
event.QuestButtonClick(constInfo.PetQuestIndex)

def SetDiv(self, percent):
self.division_exp.SetText(str(percent) + "%")

def Plus(self, bonus):
constInfo.petSend = "PLUS_BONUS|" + str(bonus)
event.QuestButtonClick(constInfo.PetQuestIndex)

def SetData(self, data):
data = data.replace('_', ' ')
data = data.split('|')
self.name.SetText(data[0])
constInfo.PetIndex = int(data[1])
self.RenderList = {
"34001" : "1.jpg",
"2" : "2",
"3" : "3",
"4" : "4",
}
self.Avatar.LoadImage('image/' + str(self.RenderList[data[1]]))
self.level.SetText("Lv. " + str(data[2]) + '/' + str(data[3]))
self.procent = "%.2f%%" % (float(data[4]) / max(1, float(data[5])) * 100)
self.exp.SetText(str(data[4]) + '/' + str(data[5]) + ' (' + str(self.procent) + ')')
self.exp_gauge.SetPercentage(int(data[4]), int(data[5]))
self.points.SetText(data[6])
self.bonus1_name.SetText(data[7])
self.bonus1_value.SetText(data[8])
self.bonus2_name.SetText(data[9])
self.bonus2_value.SetText(data[10])
self.bonus3_name.SetText(data[11])
self.bonus3_value.SetText(data[12])
self.item1.SetItemSlot(0, int(data[13]))
self.itemvnum1 = int(data[13])
self.item2.SetItemSlot(1, int(data[14]))
self.itemvnum2 = int(data[14])
self.item3.SetItemSlot(2, int(data[15]))
self.itemvnum3 = int(data[15])
if int(data[6]) > 0:
self.points.SetPackedFontColor(grp.GenerateColor(0.0, 1.0, 0.0, 1.0))
else:
self.points.SetPackedFontColor(grp.GenerateColor(1.0, 0.0, 0.0, 1.0))
if int(data[8]) > 0:
self.bonus1_value.SetPackedFontColor(grp.GenerateColor(0.0, 1.0, 0.0, 1.0))
else:
self.bonus1_value.SetPackedFontColor(grp.GenerateColor(1.0, 0.0, 0.0, 1.0))
if int(data[10]) > 0:
self.bonus2_value.SetPackedFontColor(grp.GenerateColor(0.0, 1.0, 0.0, 1.0))
else:
self.bonus2_value.SetPackedFontColor(grp.GenerateColor(1.0, 0.0, 0.0, 1.0))
if int(data[12]) > 0:
self.bonus3_value.SetPackedFontColor(grp.GenerateColor(0.0, 1.0, 0.0, 1.0))
else:
self.bonus3_value.SetPackedFontColor(grp.GenerateColor(1.0, 0.0, 0.0, 1.0))
if int(self.points.GetText()) > 0 and self.Showed == 2:
self.plus_bon1.Show()
self.plus_bon2.Show()
self.plus_bon3.Show()
else:
self.plus_bon1.Hide()
self.plus_bon2.Hide()
self.plus_bon3.Hide()

def ShowBonus(self):
self.Showed = 2
self.Board.SetSize(294, 310)
self.show_bonus.SetText("Pokaż mniej")
self.show_bonus.SetEvent(self.HideBonus)
self.points_text.Show()
self.points.Show()
self.bonus1_text.Show()
self.bonus2_text.Show()
self.bonus3_text.Show()
self.bonus1_name.Show()
self.bonus2_name.Show()
self.bonus3_name.Show()
self.bonus1_value.Show()
self.bonus2_value.Show()
self.bonus3_value.Show()
self.item1.Show()
self.item2.Show()
self.item3.Show()
if int(self.points.GetText()) > 0:
self.plus_bon1.Show()
self.plus_bon2.Show()
self.plus_bon3.Show()
else:
self.plus_bon1.Hide()
self.plus_bon2.Hide()
self.plus_bon3.Hide()
if self.bonus1_name.GetText() == "Brak":
self.bonus1_value.Hide()
if self.bonus2_name.GetText() == "Brak":
self.bonus2_value.Hide()
if self.bonus3_name.GetText() == "Brak":
self.bonus3_value.Hide()

def HideBonus(self):
self.Showed = 1
self.Board.SetSize(294, 181)
self.show_bonus.SetText("Pokaż więcej")
self.show_bonus.SetEvent(self.ShowBonus)
self.points_text.Hide()
self.points.Hide()
self.bonus1_text.Hide()
self.bonus2_text.Hide()
self.bonus3_text.Hide()
self.bonus1_name.Hide()
self.bonus2_name.Hide()
self.bonus3_name.Hide()
self.bonus1_value.Hide()
self.bonus2_value.Hide()
self.bonus3_value.Hide()
self.item1.Hide()
self.item2.Hide()
self.item3.Hide()
self.plus_bon1.Hide()
self.plus_bon2.Hide()
self.plus_bon3.Hide()

def SelectBonusHide(self):
self.select1.Hide()
self.select2.Hide()
self.select3.Hide()
self.select4.Hide()
self.select5.Hide()
self.select6.Hide()
self.select7.Hide()
self.select8.Hide()
self.select9.Hide()
self.select10.Hide()
self.select11.Hide()
self.oks.Hide()

def N0(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, "Musisz wybrać bonusy.")

def SelectBonus(self):
self.Showed = 3
self.Board.SetSize(294, 324)
self.show_bonus.SetText("WYBIERZ BONUSY")
self.show_bonus.SetEvent(self.N0)
self.select1.Show()
self.select2.Show()
self.select3.Show()
self.select4.Show()
self.select5.Show()
self.select6.Show()
self.select7.Show()
self.select8.Show()
self.select9.Show()
self.select10.Show()
self.select11.Show()
self.oks.Show()

def BonusAdd(self, id):
self.bonusTable.append(id)

def BonusDelete(self, id):
self.bonusTable.remove(id)

def Ok(self):
self.bonusTableString = '|'.join(self.bonusTable)
constInfo.petSend = "BONUS_TABLE|" + str(self.bonusTableString)
event.QuestButtonClick(constInfo.PetQuestIndex)

def OverInItem1(self, slot):
if self.itemvnum1:
self.tooltipItem1.SetItemToolTip(self.itemvnum1)

def OverOutItem1(self):
if self.tooltipItem1:
self.tooltipItem1.HideToolTip()

def OverInItem2(self, slot):
if self.itemvnum2:
self.tooltipItem2.SetItemToolTip(self.itemvnum2)

def OverOutItem2(self):
if self.tooltipItem2:
self.tooltipItem2.HideToolTip()

def OverInItem3(self, slot):
if self.itemvnum3:
self.tooltipItem3.SetItemToolTip(self.itemvnum3)

def OverOutItem3(self):
if self.tooltipItem3:
self.tooltipItem3.HideToolTip()

def SlotItemUse1(self):
if self.itemvnum1:
constInfo.petSend = "SLOT_USE|1"
event.QuestButtonClick(constInfo.PetQuestIndex)

def SlotItemUse2(self):
if self.itemvnum2:
constInfo.petSend = "SLOT_USE|2"
event.QuestButtonClick(constInfo.PetQuestIndex)

def SlotItemUse3(self):
if self.itemvnum3:
constInfo.petSend = "SLOT_USE|3"
event.QuestButtonClick(constInfo.PetQuestIndex)

def SlotAttached1(self):
if mouseModule.mouseController.isAttached() and mouseModule.mouseController.GetAttachedSlotNumber() == 200 and mouseModule.mouseController.GetAttachedItemIndex() == self.itemvnum1:
mouseModule.mouseController.DeattachObject()
self.SlotItemUse1()
return
mouseModule.mouseController.AttachObject(self, 1, 201, self.itemvnum1, 1)
constInfo.SlotDrop = 1

def SlotAttached2(self):
if mouseModule.mouseController.isAttached() and mouseModule.mouseController.GetAttachedSlotNumber() == 200 and mouseModule.mouseController.GetAttachedItemIndex() == self.itemvnum2:
mouseModule.mouseController.DeattachObject()
self.SlotItemUse2()
return
mouseModule.mouseController.AttachObject(self, 1, 202, self.itemvnum2, 1)
constInfo.SlotDrop = 1

def SlotAttached3(self):
if mouseModule.mouseController.isAttached() and mouseModule.mouseController.GetAttachedSlotNumber() == 200 and mouseModule.mouseController.GetAttachedItemIndex() == self.itemvnum3:
mouseModule.mouseController.DeattachObject()
self.SlotItemUse3()
return
mouseModule.mouseController.AttachObject(self, 1, 203, self.itemvnum3, 1)
constInfo.SlotDrop = 1

def SlotTEST(self):
Vnum = mouseModule.mouseController.GetAttachedItemIndex()
slotIndex = mouseModule.mouseController.GetAttachedSlotNumber()
if Vnum >= 100000 and Vnum <= 110000:
net.SendItemUsePacket(slotIndex)
mouseModule.mouseController.DeattachObject()

def Open(self):
if self.Board.IsShow():
self.Board.Hide()
else:
if not constInfo.PetIndex == 0:
if self.Showed == 3:
self.SelectBonusHide()
self.HideBonus()
self.Board.Show()

def Open_NOW(self):
if not constInfo.PetIndex == 0:
if self.Showed == 3:
self.SelectBonusHide()
self.HideBonus()
self.Board.Show()

def Close(self):
self.Board.Hide()

class Component:
def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
button = ui.Button()
if parent != None:
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(UpVisual)
button.SetOverVisual(OverVisual)
button.SetDownVisual(DownVisual)
button.SetText(buttonName)
button.SetToolTipText(tooltipText)
button.Show()
button.SetEvent(func)
return button

def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
button = ui.ToggleButton()
if parent != None:
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(UpVisual)
button.SetOverVisual(OverVisual)
button.SetDownVisual(DownVisual)
button.SetText(buttonName)
button.SetToolTipText(tooltipText)
button.Show()
button.SetToggleUpEvent(funcUp)
button.SetToggleDownEvent(funcDown)
return button

def EditLine(self, parent, editlineText, x, y, width, heigh, max):
SlotBar = ui.SlotBar()
if parent != None:
SlotBar.SetParent(parent)
SlotBar.SetSize(width, heigh)
SlotBar.SetPosition(x, y)
SlotBar.Show()
Value = ui.EditLine()
Value.SetParent(SlotBar)
Value.SetSize(width, heigh)
Value.SetPosition(1, 1)
Value.SetMax(max)
Value.SetLimitWidth(width)
Value.SetMultiLine()
Value.SetText(editlineText)
Value.Show()
return SlotBar, Value

def TextLine(self, parent, textlineText, x, y, color, x2=0):
textline = ui.TextLine()
if parent != None:
textline.SetParent(parent)
textline.SetPosition(x, y)
if x == 999:
textline.SetPosition(x2, y)
textline.SetHorizontalAlignCenter()
if color != None:
textline.SetFontColor(color[0], color[1], color[2])
textline.SetText(textlineText)
textline.Show()
return textline

def LargeTextLine(self, parent, textlineText, x, y, color, x2=0, color2=0):
textline = ui.TextLine()
if parent != None:
textline.SetParent(parent)
textline.SetPosition(x, y)
if x == 999:
textline.SetPosition(x2, y)
textline.SetHorizontalAlignCenter()
textline.SetFontName(locale.UI_DEF_FONT_LARGE)
if not x2 == 1 and not x2 == 2:
textline.SetPackedFontColor(grp.GenerateColor(1.0, 0.7843, 0.0, 1.0))
elif x2 == 1:
textline.SetPackedFontColor(grp.GenerateColor(1.0, 0.0, 0.0, 1.0))
elif x2 == 2:
textline.SetPackedFontColor(grp.GenerateColor(0.0, 1.0, 0.0, 1.0))
if color2 == 1:
textline.SetPackedFontColor(grp.GenerateColor(0.0, 0.7500, 1.0, 1.0))

textline.SetText(textlineText)
textline.Show()
return textline

def RGB(self, r, g, :
return (r*255, g*255, b*255)

def SliderBar(self, parent, sliderPos, func, x, y):
Slider = ui.SliderBar()
if parent != None:
Slider.SetParent(parent)
Slider.SetPosition(x, y)
Slider.SetSliderPos(sliderPos / 100)
Slider.Show()
Slider.SetEvent(func)
return Slider

def ExpandedImage(self, parent, x, y, img):
image = ui.ExpandedImageBox()
if parent != None:
image.SetParent(parent)
image.SetWindowHorizontalAlignCenter()
image.SetWindowVerticalAlignCenter()
image.LoadImage(img)
image.Show()
return image

def ComboBox(self, parent, text, x, y, width):
combo = ui.ComboBox()
if parent != None:
combo.SetParent(parent)
combo.SetPosition(x, y)
combo.SetSize(width, 15)
combo.SetCurrentItem(text)
combo.Show()
return combo

def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
thin = ui.ThinBoard()
if parent != None:
thin.SetParent(parent)
if moveable == TRUE:
thin.AddFlag('movable')
thin.AddFlag('float')
thin.SetSize(width, heigh)
thin.SetPosition(x, y)
if center == TRUE:
thin.SetCenterPosition()
thin.Show()
return thin

def Gauge(self, parent, width, color, x, y):
gauge = ui.Gauge()
if parent != None:
gauge.SetParent(parent)
gauge.SetPosition(x, y)
gauge.MakeGauge(width, color)
gauge.Show()
return gauge

def ListBoxEx(self, parent, x, y, width, heigh):
bar = ui.Bar()
if parent != None:
bar.SetParent(parent)
bar.SetPosition(x, y)
bar.SetSize(width, heigh)
bar.SetColor(0x77000000)
bar.Show()
ListBox=ui.ListBoxEx()
ListBox.SetParent(bar)
ListBox.SetPosition(0, 0)
ListBox.SetSize(width, heigh)
ListBox.Show()
scroll = ui.ScrollBar()
scroll.SetParent(ListBox)
scroll.SetPosition(width-15, 0)
scroll.SetScrollBarSize(heigh)
scroll.Show()
ListBox.SetScrollBar(scroll)
return bar, ListBox


Opublikowano

Jebane zbugowane g****o bez połowy funkcji xD

To system pisany 3 lata temu, Ty dalej byś takiego nie napisał.

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...