What's new

-Tibia 7.60 [7.6] Gem System

Status
Not open for further replies.

Thorge D

Advanced User
Joined
Jul 24, 2014
Messages
300
Reaction score
29
1. Autor: Huczu
2. Link do oryginalnego tematu:
3. Opis: Dosy? prosta sprawa. Musisz zebra? odpowiedni item i maj?c XX% szanse (kt?r? posiada item) mo?esz doda? do swojego przedmiotu jego w?a?ciwo?? po przez specjalne miejsce(d?wignia i dla sto?y).
Jakie s? w?a?ciwo?ci przedmiot?w? Dodanie akt, def i arma.

Dlaczego wersja beta?
Poniewa? by?a ma?o(prawie w og?le) nie testowana, lecz patrz?c dok?adnie w kod raczej b??d?w nie b?dzie.

Kod jest przystosowany g??wnie dla OTS'?w typu RPG o niskim exp rate.
B?dzie dzia?a? pod YurOTS 7.6 i jego potomk?w.

4. Kod:

actions.cpp pod:
[CPP]//doPlayerRemoveItem(cid,itemid,count)
lua_register(luaState, "doPlayerRemoveItem", ActionScript::luaActionDoPlayerRemoveItem);[/CPP]
dodajemy:
[CPP]#ifdef HUCZU_GEM_SYSTEM
//doSetSpecial~(itemid,amount) kazdy wyglada tak samo
lua_register(luaState, "doSetSpecialAttack", ActionScript::luaActionDoSetSpecialAttack);
lua_register(luaState, "doSetSpecialDefense", ActionScript::luaActionDoSetSpecialDefense);
lua_register(luaState, "doSetSpecialArmor", ActionScript::luaActionDoSetSpecialArmor);
//isArmor, isWeapon (itemid) do sprawdzania
lua_register(luaState, "isArmor", ActionScript::luaActionItemIsArmor);
lua_register(luaState, "isWeapon", ActionScript::luaActionItemIsWeapon);
#endif //HUCZU_GEM_SYSTEM[/CPP]
na ko?cu pliku:
[CPP]#ifdef HUCZU_GEM_SYSTEM
int ActionScript::luaActionDoSetSpecialAttack(lua_State *L){
//doSetSpecialAttack(itemid,amount) --dodawanie specialnego atk gdzie amount to ilosc tego

unsigned char amount = (unsigned char)internalGetNumber(L);
unsigned int itemid = (unsigned int)internalGetNumber(L);

ActionScript *action = getActionScript(L);

const KnownThing* tmp = action->GetItemByUID(itemid);
Item *tmpitem = NULL;
if(tmp){
tmpitem = (Item*)tmp->thing;
}
else{
lua_pushnumber(L, -1);
std::cout << "luaDoSetSpecialAttack: Item not found" << std::endl;
return 1;
}

tmpitem->setSpecialAttack(amount);

lua_pushnumber(L, 0);
return 1;
}

int ActionScript::luaActionDoSetSpecialDefense(lua_State *L){
//doSetSpecialDefense(itemid,amount) --dodawanie specialnego def gdzie amount to ilosc tego

unsigned char amount = (unsigned char)internalGetNumber(L);
unsigned int itemid = (unsigned int)internalGetNumber(L);

ActionScript *action = getActionScript(L);

const KnownThing* tmp = action->GetItemByUID(itemid);
Item *tmpitem = NULL;
if(tmp){
tmpitem = (Item*)tmp->thing;
}
else{
lua_pushnumber(L, -1);
std::cout << "luaDoSetSpecialDefense: Item not found" << std::endl;
return 1;
}

tmpitem->setSpecialDefense(amount);

lua_pushnumber(L, 0);
return 1;
}

int ActionScript::luaActionDoSetSpecialArmor(lua_State *L){
//doSetSpecialArmor(itemid,amount) --dodawanie specialnego arm gdzie amount to ilosc tego

unsigned char amount = (unsigned char)internalGetNumber(L);
unsigned int itemid = (unsigned int)internalGetNumber(L);

ActionScript *action = getActionScript(L);

const KnownThing* tmp = action->GetItemByUID(itemid);
Item *tmpitem = NULL;
if(tmp){
tmpitem = (Item*)tmp->thing;
}
else{
lua_pushnumber(L, -1);
std::cout << "luaDoSetSpecialArmor: Item not found" << std::endl;
return 1;
}

tmpitem->setSpecialArmor(amount);

lua_pushnumber(L, 0);
return 1;
}
int ActionScript::luaActionItemIsArmor(lua_State *L){
//isArmor(itemid) -- nietypowe, lecz niezwykle potrzebne

unsigned int itemid = (unsigned int)internalGetNumber(L);
ActionScript *action = getActionScript(L);

const KnownThing* tmp = action->GetItemByUID(itemid);
Item *tmpitem = NULL;
if(tmp){
tmpitem = (Item*)tmp->thing;
if(tmpitem->isArmor())
lua_pushnumber(L, 1);
else
lua_pushnumber(L,0);
}else{
lua_pushnumber(L, -1);
std::cout << "luaIsArmor: Item not found" << std::endl;
return 1;
}
}
int ActionScript::luaActionItemIsWeapon(lua_State *L){
//isWeapon(itemid) -- nietypowe, lecz niezwykle potrzebne

unsigned int itemid = (unsigned int)internalGetNumber(L);
ActionScript *action = getActionScript(L);

const KnownThing* tmp = action->GetItemByUID(itemid);
Item *tmpitem = NULL;
if(tmp){
tmpitem = (Item*)tmp->thing;
if(tmpitem->isWeapon())
lua_pushnumber(L, 1);
else
lua_pushnumber(L,0);
}else{
lua_pushnumber(L, -1);
std::cout << "luaIsWeapon: Item not found" << std::endl;
return 1;
}
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
actions.h pod:
[CPP]static int luaActionSetPlayerStorageValue(lua_State *L); [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
static int luaActionDoSetSpecialAttack(lua_State *L);
static int luaActionDoSetSpecialDefense(lua_State *L);
static int luaActionDoSetSpecialArmor(lua_State *L);
static int luaActionItemIsArmor(lua_State *L);
static int luaActionItemIsWeapon(lua_State *L);
#endif //HUCZU_GEM_SYSTEM [/CPP]
item.cpp pod:
[CPP]#ifdef YUR_READABLES
if (i.readable)
readable = new std::string(*(i.readable));
else
readable = NULL;
#endif //YUR_READABLES [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
specialAttack = i.specialAttack;
specialArmor = i.specialArmor;
specialDefense = i.specialDefense;
newAttack = i.newAttack;
newArmor = i.newArmor;
newDefense = i.newDefense;
#endif //HUCZU_GEM_SYSTEM [/CPP]
pod:
[CPP]#ifdef YUR_READABLES
readable = NULL;
#endif //YUR_READABLES [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
specialAttack = 0;
specialArmor = 0;
specialDefense = 0;
newAttack = 0;
newArmor = 0;
newDefense = 0;
#endif //HUCZU_GEM_SYSTEM [/CPP]
Ta sytuacja b?dzie wyst?powa? dwukrotnie wi?c nie krzyczcie ?e dwa takie same miejsca s?.
Kolejno pod:
[CPP]...
tmp = (char*)xmlGetProp(p, (const xmlChar *) "time");
if(tmp){
time = atoi(tmp);
xmlFreeOTSERV(tmp);
}
#endif //YUR_RINGS_AMULETS [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
tmp = (char*)xmlGetProp(p, (const xmlChar *) "specialArmor");
if(tmp){
specialArmor = atoi(tmp);
xmlFreeOTSERV(tmp);
}

tmp = (char*)xmlGetProp(p, (const xmlChar *) "specialDefense");
if(tmp){
specialDefense = atoi(tmp);
xmlFreeOTSERV(tmp);
}

tmp = (char*)xmlGetProp(p, (const xmlChar *) "specialAttack");
if(tmp){
specialAttack = atoi(tmp);
xmlFreeOTSERV(tmp);
}
tmp = (char*)xmlGetProp(p, (const xmlChar *) "armor");
if(tmp){
newArmor = atoi(tmp);
xmlFreeOTSERV(tmp);
}

tmp = (char*)xmlGetProp(p, (const xmlChar *) "defense");
if(tmp){
newDefense = atoi(tmp);
xmlFreeOTSERV(tmp);
}

tmp = (char*)xmlGetProp(p, (const xmlChar *) "attack");
if(tmp){
newAttack = atoi(tmp);
xmlFreeOTSERV(tmp);
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
pod:
[CPP]...
s.str("");
if (time != 0){
s << time;
xmlSetProp(ret, (const xmlChar*)"time", (const xmlChar*)s.str().c_str());
}
#endif //YUR_RINGS_AMULETS [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
s.str("");
if (specialArmor != 0){
s << specialArmor;
xmlSetProp(ret, (const xmlChar*)"specialArmor", (const xmlChar*)s.str().c_str());
}
s.str("");
if (specialAttack != 0){
s << specialAttack;
xmlSetProp(ret, (const xmlChar*)"specialAttack", (const xmlChar*)s.str().c_str());
}
s.str("");
if (specialDefense != 0){
s << specialDefense;
xmlSetProp(ret, (const xmlChar*)"specialDefense", (const xmlChar*)s.str().c_str());
}
s.str("");
if (newArmor != 0){
s << newArmor;
xmlSetProp(ret, (const xmlChar*)"armor", (const xmlChar*)s.str().c_str());
}
s.str("");
if (newAttack != 0){
s << newAttack;
xmlSetProp(ret, (const xmlChar*)"attack", (const xmlChar*)s.str().c_str());
}
s.str("");
if (newDefense != 0){
s << newDefense;
xmlSetProp(ret, (const xmlChar*)"defense", (const xmlChar*)s.str().c_str());
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
pod:
[CPP]bool Item::isFluidContainer() const {
return (items[id].isFluidContainer());
} [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
bool Item::isArmor() const {
return items[id].isArmor();
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
teraz zamie?:
[CPP]s << article(it.name) << " (Atak:" << (int)getAttack() << " Obrona:" << (int)getDefense() << ")"; [/CPP]
na:
[CPP]#ifdef HUCZU_GEM_SYSTEM
if(getSpecialAttack() != 0)
s << article(it.name) << " (Atk:" << (int)getAttack() << " +" << (int)getSpecialAttack();
else
s << article(it.name) << " (Atk:" << (int)getAttack();

if(getSpecialDefense() != 0)
s << " Def:" << (int)getDefense() << " +" << (int)getSpecialDefense();
else
s << " Def:" << (int)getDefense();

s << ")";
#else
s << article(it.name) << " (Atak:" << (int)getAttack() << " Obrona:" << (int)getDefense() << ")";
#endif //HUCZU_GEM_SYSTEM [/CPP]
oraz zamie?:
[CPP]s << article(it.name) << " (Armor:"<< (int)getArmor() << ")"; [/CPP]
na:
[CPP]#ifdef HUCZU_GEM_SYSTEM
if(getSpecialArmor() == 0)
s << article(it.name) << " (Arm:"<< (int)getArmor() << ")";
else
s << article(it.name) << " (Arm:"<< (int)getArmor() << " +" << (int)getSpecialArmor() << ")";
#else
s << article(it.name) << " (Armor:"<< (int)getArmor() << ")";
#endif //HUCZU_GEM_SYSTEM [/CPP]
na ko?cu pliku dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
////// Dodane juz wartosci dla przedmiotu (armor,def,atk)
int Item::getSpecialArmor() const {
return specialArmor;
}

int Item::getSpecialAttack() const {
return specialAttack;
}

int Item::getSpecialDefense() const {
return specialDefense;
}

///// Nowy arm,def,atk ktory bedzie odczytany z pliku gracza
int Item::getNewAttack() const {
return newAttack;
}

int Item::getNewArmor() const {
return newArmor;
}

int Item::getNewDefense() const {
return newDefense;
}
////// Funkcje specjalne
void Item::setSpecialArmor(unsigned char amount)
{
if(getArmor() > 0){
int newArmor = getArmor() + amount;
this->newArmor = newArmor;
this->specialArmor = amount;
}else{
return; //a co tu wiecej kombinowac?
}
}
void Item::setSpecialAttack(unsigned char amount)
{
if(getAttack() > 0){
int newAttack = getAttack() + amount;
this->newAttack = newAttack;
this->specialAttack = amount;
}else{
return; //a co tu wiecej kombinowac?
}
}
void Item::setSpecialDefense(unsigned char amount)
{
if(getDefense() > 0){
int newDefense = getDefense() + amount;
this->newDefense = newDefense;
this->specialDefense = amount;
}else{
return; //a co tu wiecej kombinowac?
}
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
item.h pod:
[CPP]#ifdef YUR_READABLES
std::string *readable;
#endif //YUR_READABLES [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
unsigned short specialArmor;
unsigned short specialDefense;
unsigned short specialAttack;
unsigned short newArmor;
unsigned short newDefense;
unsigned short newAttack;
#endif //HUCZU_GEM_SYSTEM [/CPP]
oraz pod:
[CPP]std::string Item::getText(); [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
bool isArmor() const; // Funkcja do actionsow by sprawdzal czy to armor
////// Dodane juz wartosci dla przedmiotu (armor,def,atk)
int getSpecialArmor() const;
int getSpecialAttack() const;
int getSpecialDefense() const;
////// Odczyt nowych arm,def,atk
int getNewAttack() const;
int getNewArmor() const;
int getNewDefense() const;
////// Funkcje specjalne
void setSpecialArmor(unsigned char amount);
void setSpecialAttack(unsigned char amount);
void setSpecialDefense(unsigned char amount);
#endif //HUCZU_GEM_SYSTEM [/CPP]
items.cpp pod:
[CPP]bool ItemType::isGroundTile() const
{
return group == ITEM_GROUP_GROUND;
} [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
bool ItemType::isArmor() const
{
return group == ITEM_GROUP_ARMOR;
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
items.h pod:
[CPP]bool isFluidContainer() const; [/CPP]
dodaj:
[CPP]#ifdef HUCZU_GEM_SYSTEM
bool isArmor() const;
#endif //HUCZU_GEM_SYSTEM [/CPP]
player.cpp znajdujemy i zamieniamy to:
[CPP]case SWORD:
//damagemax = 3*skills[SKILL_SWORD][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
damagemax = mul*getSkill(SKILL_SWORD,SKILL_LEVEL) *Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
case CLUB:
//damagemax = 3*skills[SKILL_CLUB][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
damagemax = mul*getSkill(SKILL_CLUB,SKILL_LEVEL)*Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
case AXE:
//damagemax = 3*skills[SKILL_AXE][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
damagemax = mul*getSkill(SKILL_AXE,SKILL_LEVEL)*Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break; [/CPP]
na:
[CPP]#ifdef HUCZU_GEM_SYSTEM
case SWORD:
//damagemax = 3*skills[SKILL_SWORD][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
if(items[slot]->getSpecialAttack() != 0)
damagemax = mul*getSkill(SKILL_SWORD,SKILL_LEVEL) *items[slot]->getNewAttack()/20 + getLevel()*1,5 + items[slot]->getNewAttack();
else
damagemax = mul*getSkill(SKILL_SWORD,SKILL_LEVEL) *Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
case CLUB:
//damagemax = 3*skills[SKILL_CLUB][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
if(items[slot]->getSpecialAttack() != 0)
damagemax = mul*getSkill(SKILL_CLUB,SKILL_LEVEL)*items[slot]->getNewAttack()/20 + getLevel()*1,5 + items[slot]->getNewAttack();
else
damagemax = mul*getSkill(SKILL_CLUB,SKILL_LEVEL)*Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
case AXE:
//damagemax = 3*skills[SKILL_AXE][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
if(items[slot]->getSpecialAttack() != 0)
damagemax = mul*getSkill(SKILL_AXE,SKILL_LEVEL)*items[slot]->getNewAttack()/20 + getLevel()*1,5 + items[slot]->getNewAttack();
else
damagemax = mul*getSkill(SKILL_AXE,SKILL_LEVEL)*Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
#else
case SWORD:
//damagemax = 3*skills[SKILL_SWORD][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
damagemax = mul*getSkill(SKILL_SWORD,SKILL_LEVEL) *Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
case CLUB:
//damagemax = 3*skills[SKILL_CLUB][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
damagemax = mul*getSkill(SKILL_CLUB,SKILL_LEVEL)*Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
case AXE:
//damagemax = 3*skills[SKILL_AXE][SKILL_LEVEL] + 2*Item::items[items[slot]->getID()].attack;
damagemax = mul*getSkill(SKILL_AXE,SKILL_LEVEL)*Item::items[items[slot]->getID()].attack/20 + getLevel()*1,5 + Item::items[items[slot]->getID()].attack;
break;
#endif //HUCZU_GEM_SYSTEM [/CPP]
oraz zamieniamy to:
[CPP]if(items[SLOT_HEAD])
armor += items[SLOT_HEAD]->getArmor();
if(items[SLOT_NECKLACE])
armor += items[SLOT_NECKLACE]->getArmor();
if(items[SLOT_ARMOR])
armor += items[SLOT_ARMOR]->getArmor();
if(items[SLOT_LEGS])
armor += items[SLOT_LEGS]->getArmor();
if(items[SLOT_FEET])
armor += items[SLOT_FEET]->getArmor();
if(items[SLOT_RING])
armor += items[SLOT_RING]->getArmor(); [/CPP]
na to:
[CPP]#ifdef HUCZU_GEM_SYSTEM
if(items[SLOT_HEAD]){
if(items[SLOT_HEAD]->getSpecialArmor() != 0)
armor += items[SLOT_HEAD]->getNewArmor();
else
armor += items[SLOT_HEAD]->getArmor();
}
if(items[SLOT_NECKLACE])
armor += items[SLOT_NECKLACE]->getArmor();

if(items[SLOT_ARMOR]){
if(items[SLOT_ARMOR]->getSpecialArmor() != 0)
armor += items[SLOT_ARMOR]->getNewArmor();
else
armor += items[SLOT_ARMOR]->getArmor();
}
if(items[SLOT_LEGS]){
if(items[SLOT_LEGS]->getSpecialArmor() != 0)
armor += items[SLOT_LEGS]->getNewArmor();
else
armor += items[SLOT_LEGS]->getArmor();
}
if(items[SLOT_FEET]){
if(items[SLOT_FEET]->getSpecialArmor() != 0)
armor += items[SLOT_FEET]->getNewArmor();
else
armor += items[SLOT_FEET]->getArmor();
}
if(items[SLOT_RING])
armor += items[SLOT_RING]->getArmor();
#else // nie chcialo mi sie robic duzo ifdefow ; o
if(items[SLOT_HEAD])
armor += items[SLOT_HEAD]->getArmor();
if(items[SLOT_NECKLACE])
armor += items[SLOT_NECKLACE]->getArmor();
if(items[SLOT_ARMOR])
armor += items[SLOT_ARMOR]->getArmor();
if(items[SLOT_LEGS])
armor += items[SLOT_LEGS]->getArmor();
if(items[SLOT_FEET])
armor += items[SLOT_FEET]->getArmor();
if(items[SLOT_RING])
armor += items[SLOT_RING]->getArmor();
#endif //HUCZU_GEM_SYSTEM [/CPP]
oraz zamie? to:
[CPP]if(items[SLOT_LEFT]){
if(items[SLOT_LEFT]->getWeaponType() == SHIELD)
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_LEFT]->getDefense();
else
defense += items[SLOT_LEFT]->getDefense();
}
if(items[SLOT_RIGHT]){
if(items[SLOT_RIGHT]->getWeaponType() == SHIELD)
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_RIGHT]->getDefense();
else
defense += items[SLOT_RIGHT]->getDefense();
} [/CPP]
na to:
[CPP]#ifdef HUCZU_GEM_SYSTEM
if(items[SLOT_LEFT]){
if(items[SLOT_LEFT]->getWeaponType() == SHIELD){
if(items[SLOT_LEFT]->getSpecialDefense() != 0){
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_LEFT]->getNewDefense();
}else{
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_LEFT]->getDefense();
}
}else{
if(items[SLOT_LEFT]->getSpecialDefense() != 0){
defense += items[SLOT_LEFT]->getNewDefense();
}else{
defense += items[SLOT_LEFT]->getDefense();
}
}
}
if(items[SLOT_RIGHT]){
if(items[SLOT_RIGHT]->getWeaponType() == SHIELD){
if(items[SLOT_RIGHT]->getSpecialDefense() != 0){
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_RIGHT]->getNewDefense();
}else{
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_RIGHT]->getDefense();
}
}else{
if(items[SLOT_RIGHT]->getSpecialDefense() != 0){
defense += items[SLOT_RIGHT]->getNewDefense();
}else{
defense += items[SLOT_RIGHT]->getDefense();
}
}
}
#else //znow oszczedzam na ifdefach
if(items[SLOT_LEFT]){
if(items[SLOT_LEFT]->getWeaponType() == SHIELD)
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_LEFT]->getDefense();
else
defense += items[SLOT_LEFT]->getDefense();
}
if(items[SLOT_RIGHT]){
if(items[SLOT_RIGHT]->getWeaponType() == SHIELD)
defense += skills[SKILL_SHIELD][SKILL_LEVEL] + items[SLOT_RIGHT]->getDefense();
else
defense += items[SLOT_RIGHT]->getDefense();
}
#endif //HUCZU_GEM_SYSTEM [/CPP]
Do projektu:
Code:
-DHUCZU_GEM_SYSTEM

LUA:

actions.xml:
[XML]<action itemid="2487" script="gemsystem.lua" /> [/XML]
itemid to ID d?wigni.

gemsystem.lua:
[LUA]function onUse(cid, item, frompos, item2, topos)
local tabela = { -- Zajebista nie?
[1] = {90, 1, 2147}, -- Arm/atk + 1, szansa 90%,ID przedmiotu
[2] = {70, 2, 2149}, -- Arm/atk +2, szansa 70%,ID przedmiotu
[3] = {50, 3, 2156}, -- Arm/atk +3, szansa 50%,ID przedmiotu
[4] = {25, 4, 2155}, -- Arm/atk +4, szansa 25%,ID przedmiotu
[5] = {15, 5, 2158}, -- Arm/atk +5, szansa 15%,ID przedmiotu
[6] = {5, 6, 2225}, -- Atk +6, szansa 5%,ID przedmiotu
[7] = {90, 1, 2145}, -- Def +1, szansa 90%,ID przedmiotu
[8] = {75, 2, 2150}, -- Def +2, szansa 75%,ID przedmiotu
[9] = {60, 3, 2153}, -- Def +3, szansa 60%,ID przedmiotu
[10] = {40, 4, 2146}, -- Def +4, szansa 40%,ID przedmiotu
[11] = {25, 5, 2154}, -- Def +5, szansa 25%,ID przedmiotu
}

local config = {-- KONFIGURACJA
check = math.random(1,100),
item1pos = {x=159, y=48, z=7, stackpos=255},
item2pos = {x=159, y=48, z=7, stackpos=255},
transform = doTransformItem(item.uid,item.itemid+1)
}
getitem1 = getThingfromPos(config.item1pos) -- Po za konfiguracja bo wygodniej
getitem2 = getThingfromPos(config.item2pos) -- Po za konfiguracja bo wygodniej

if item.uid == 5444 and item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
end

if check.config <= tabela[1][1] then
if item.uid == 5444 and item.itemid == 1945 and (getitem1.itemid == tabela[1][3] or getitem2.itemid == tabela[1][3]) then
if isArmor(getitem2.itemid) == 1 then
setSpecialArmor(getitem2.itemid, tabela[1][2])
elseif isArmor(getitem1.itemid) == 1 then
setSpecialArmor(getitem1.itemid, tabela[1][2])
elseif isWeapon(getitem2.itemid) == 1 then
setSpecialAttack(item2.itemid, tabela[1][2])
elseif isWeapon(getitem1.itemid) == 1 then
setSpecialAttack(item2.itemid, tabela[1][2])
else
doPlayerSendTextMessage(cid, 17, "Nie mozesz uzyc tego na tym przedmiocie!")
end
transform.config
end
else
if isArmor(getitem2.itemid) == 1 then
setSpecialArmor(getitem2.itemid, 0)
elseif isArmor(getitem1.itemid) == 1 then
setSpecialArmor(getitem1.itemid, 0)
elseif isWeapon(getitem1.itemid) == 1 then
setSpecialAttack(getitem1.itemid, 0)
elseif isWeapon(getitem2.itemid) == 1 then
setSpecialAttack(getitem2.itemid, 0)
end
doPlayerSendTextMessage(cid, 17, "Nie udalo sie!")
transform.config
end [/LUA]

Wa?ne by dla d?wigni nada? UID 5444. Kolejno to jest tylko kawa?ek skryptu zrobiony dla pierwszego przedmiotu. Na bazie tego trzeba dorobi? kolejne 10.
Trudne to nie b?dzie jak ma si? cho? minimaln? wiedz? na temat LUA. Prosz? pami?ta? o isArmor i isWeapon.

@down:
Poprawione.
Nie m?j b??d.
 

#NOOB

Senior User
Joined
May 25, 2014
Messages
901
Reaction score
89
Odp: [7.6] Gem System

Autorem tego kodu jest HUCZU a nie CANY... Popraw to.
 
Status
Not open for further replies.
Top