Skip to content

Commit

Permalink
Add plaudits to char_points and RoeSparkUpdatePacket
Browse files Browse the repository at this point in the history
  • Loading branch information
claywar committed May 13, 2024
1 parent 7e08191 commit 844a69c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/map/packets/roe_sparkupdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CRoeSparkUpdatePacket::CRoeSparkUpdatePacket(CCharEntity* PChar)
this->setType(0x110);
this->setSize(0x14);

const char* query = "SELECT spark_of_eminence, deeds FROM char_points WHERE charid = %d";
const char* query = "SELECT spark_of_eminence, deeds, plaudits FROM char_points WHERE charid = %d";

uint32 vanaTime = CVanaTime::getInstance()->getVanaTime();
uint32 daysSinceEpoch = vanaTime / (60 * 60 * 24);
Expand All @@ -44,8 +44,7 @@ CRoeSparkUpdatePacket::CRoeSparkUpdatePacket(CCharEntity* PChar)
ref<uint32>(0x04) = _sql->GetIntData(0);
ref<uint8>(0x08) = _sql->GetIntData(1);

ref<uint8>(0x0A) = 0x00;
ref<uint8>(0x0B) = 0x00;
ref<uint16>(0x0A) = _sql->GetIntData(2);

ref<uint8>(0x0C) = daysSinceEpoch % 6; // Unity Shared Daily (0-5)
ref<uint8>(0x0D) = weeksSinceEpoch % 4; // Unity Leader Weekly (0-3)
Expand Down
28 changes: 28 additions & 0 deletions tools/migrations/041_plaudits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import mariadb


def migration_name():
return "Adding plaudits column to char_points table"


def check_preconditions(cur):
return


def needs_to_run(cur):
# Ensure waypoints column exists in char_unlocks
cur.execute("SHOW COLUMNS FROM char_points LIKE 'plaudits'")
if not cur.fetchone():
return True
return False


def migrate(cur, db):
try:
cur.execute(
"ALTER TABLE char_points \
ADD COLUMN `plaudits` smallint(5) DEFAULT 0;"
)
db.commit()
except mariadb.Error as err:
print("Something went wrong: {}".format(err))

0 comments on commit 844a69c

Please sign in to comment.