Skip to content

Commit

Permalink
Code consolidation and one bug fix in notifications. Updated the data…
Browse files Browse the repository at this point in the history
…base to YC118-3.
  • Loading branch information
Bleyddyn committed Mar 11, 2016
1 parent ca2ef16 commit a03a522
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 40 deletions.
4 changes: 2 additions & 2 deletions dbscripts/build_dbexport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
DBEXPORT=database.sql

# This should match what's in the application's user defaults under UD_DATABASE_MIN_VERSION
DBVERSION=30
DBEXPANSION="Frostline 1.0"
DBVERSION=31
DBEXPANSION="YC118-3 1.0"

VERQUERY="INSERT INTO version VALUES ($DBVERSION,'$DBEXPANSION');"

Expand Down
62 changes: 24 additions & 38 deletions src/EveNotifications/MTNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,23 @@ - (void)getCharacterPrefix:(NSString *)prefix fromLine:(NSString *)line values:(
}
}

- (void)getTypeIDPrefix:(NSString *)prefix fromLine:(NSString *)line values:(NSMutableDictionary *)values
{
CCPDatabase *db = [[GlobalData sharedInstance] database];
NSNumber *tID = [NSNumber numberWithInteger:[[line substringFromIndex:([prefix length]+2)] integerValue]];
if( tID )
{
[values setObject:tID forKey:@"typeID"];
NSString *name = [db typeName:[tID integerValue]];
if( !name )
{
name = [NSString stringWithFormat:@"typeID: %@", tID];
NSLog( @"Missing typeID: %ld", (long)[tID integerValue] );
}
[values setObject:name forKey:@"typeName"];
}
}

- (NSDictionary *)formattedBodyValues
{
NSMutableDictionary *values = [NSMutableDictionary dictionary];
Expand All @@ -451,6 +468,7 @@ - (NSDictionary *)formattedBodyValues
for( NSString *line in lines )
{
NSString *prefix = [[line componentsSeparatedByString:@":"] objectAtIndex:0];

if( [prefix isEqualToString:@"charID"] || [prefix isEqualToString:@"victimID"]
|| [prefix isEqualToString:@"bountyPlacerID"] || [prefix isEqualToString:@"podKillerID"] )
{
Expand Down Expand Up @@ -478,44 +496,12 @@ - (NSDictionary *)formattedBodyValues
if( shipID )
{
[values setObject:shipID forKey:@"itemID"];
// NSString *name = [db typeName:[shipID integerValue]];
// if( !name )
// {
// name = [NSString stringWithFormat:@"itemID: %@", shipID];
// NSLog( @"Missing typeID: %ld", (long)[shipID integerValue] );
// }
// [values setObject:name forKey:@"itemTypeName"];
// this is an actual itemID, not a typeID. Not sure how to get more info about it.
}
}
else if( [line hasPrefix:@"shipTypeID:"] )
else if( [prefix isEqualToString:@"shipTypeID"] || [prefix isEqualToString:@"victimShipTypeID"] )
{
NSNumber *shipID = [NSNumber numberWithInteger:[[line substringFromIndex:12] integerValue]];
if( shipID )
{
[values setObject:shipID forKey:@"shipTypeID"];
NSString *name = [db typeName:[shipID integerValue]];
if( !name )
{
name = [NSString stringWithFormat:@"ShipID: %@", shipID];
NSLog( @"Missing typeID: %ld", (long)[shipID integerValue] );
}
[values setObject:name forKey:@"shipTypeName"];
}
}
else if( [line hasPrefix:@"victimShipTypeID:"] )
{
NSNumber *shipID = [NSNumber numberWithInteger:[[line substringFromIndex:18] integerValue]];
if( shipID )
{
[values setObject:shipID forKey:@"shipTypeID"];
NSString *name = [db typeName:[shipID integerValue]];
if( !name )
{
name = [NSString stringWithFormat:@"ShipID: %@", shipID];
NSLog( @"Missing typeID: %ld", (long)[shipID integerValue] );
}
[values setObject:name forKey:@"shipTypeName"];
}
[self getTypeIDPrefix:prefix fromLine:line values:values];
}
else if( [line hasPrefix:@"cloneStationID:"] )
{
Expand Down Expand Up @@ -558,7 +544,7 @@ - (NSAttributedString *)formattedBody
}
case 34: // Free Rookie ship
{
NSString *shipTypeName = [values objectForKey:@"shipTypeName"];
NSString *shipTypeName = [values objectForKey:@"typeName"];
plainString = [NSString stringWithFormat:@"Free rookie ship: %@", shipTypeName];
break;
}
Expand All @@ -583,7 +569,7 @@ - (NSAttributedString *)formattedBody
}
case 140: // Killmail available
{
NSString *shipTypeName = [values objectForKey:@"shipTypeName"];
NSString *shipTypeName = [values objectForKey:@"typeName"];
plainString = [NSString stringWithFormat:@"Kill Report - Victim\nYou lost a %@", shipTypeName];
NSNumber *killID = [values objectForKey:@"killMailID"];
if( killID )
Expand All @@ -600,7 +586,7 @@ - (NSAttributedString *)formattedBody
case 141: // Killmail available
{
NSString *name = [values objectForKey:@"characterName"];
NSString *shipTypeName = [values objectForKey:@"shipTypeName"];
NSString *shipTypeName = [values objectForKey:@"typeName"];
plainString = [NSString stringWithFormat:@"Kill Report - Final Blow\n%@ in a %@", name, shipTypeName];
NSNumber *killID = [values objectForKey:@"killMailID"];
if( killID )
Expand Down

0 comments on commit a03a522

Please sign in to comment.