abdala ragab
Veteran OT User
Help me with this conversion I'm tired of trying a lot
This is the code that controls the spells . path He also controls the penetration of the magic wall with wave strikes
Thanks in advance
Xml Code
Tfs 1.2 Code
This is the code that controls the spells . path He also controls the penetration of the magic wall with wave strikes
Thanks in advance
Xml Code
Lua:
bool AreaCombat::getList(const Position& centerPos, const Position& targetPos, std::list<Tile*>& list) const
{
Tile* tile = g_game.getTile(targetPos.x, targetPos.y, targetPos.z);
if(!tile){
return false;
}
const MatrixArea* area = getArea(centerPos, targetPos);
if(!area){
return false;
}
Position tmpPos = targetPos;
size_t cols = area->getCols();
size_t rows = area->getRows();
uint32_t centerY, centerX;
area->getCenter(centerY, centerX);
tmpPos.x -= centerX;
tmpPos.y -= centerY;
for(size_t y = 0; y < rows; ++y){
for(size_t x = 0; x < cols; ++x){
if(area->getValue(y, x) != 0){
if(g_game.map->canThrowObjectTo(targetPos, tmpPos)){
tile = g_game.getTile(tmpPos.x, tmpPos.y, tmpPos.z);
if(tile){
list.push_back(tile);
}
}
}
tmpPos.x += 1;
}
tmpPos.x -= cols;
tmpPos.y += 1;
}
return true;
}
Code:
void AreaCombat::getList(const Position& centerPos, const Position& targetPos, std::forward_list<Tile*>& list) const
{
Tile* tile = g_game.map.getTile(targetPos);
if (tile->hasProperty(CONST_PROP_BLOCKPROJECTILE) && !tile->getFieldItem()) {
return;
}
if (tile->hasFlag(TILESTATE_FLOORCHANGE)) {
return;
}
if (tile->getTeleportItem()) {
return;
}
const MatrixArea* area = getArea(centerPos, targetPos);
if (!area) {
return;
}
uint32_t centerY, centerX;
area->getCenter(centerY, centerX);
Position tmpPos(targetPos.x - centerX, targetPos.y - centerY, targetPos.z);
uint32_t cols = area->getCols();
for (uint32_t y = 0, rows = area->getRows(); y < rows; ++y) {
for (uint32_t x = 0; x < cols; ++x) {
if (area->getValue(y, x) != 0) {
if (g_game.isSightClear(targetPos, tmpPos, true)) {
tile = g_game.map.getTile(tmpPos);
if (!tile) {
tile = new StaticTile(tmpPos.x, tmpPos.y, tmpPos.z);
g_game.map.setTile(tmpPos, tile);
}
list.push_front(tile);
}
}
tmpPos.x++;
}
tmpPos.x -= cols;
tmpPos.y++;
}
}